1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
8 # Original Author: Mike Doty <kingtaco@gentoo.org>
9 # Adapted from emul-libs.eclass
10 # Purpose: Providing a template for the app-emulation/emul-linux-* packages
13 inherit eutils multilib
17 EXPORT_FUNCTIONS src_prepare src_install
19 *) die "EAPI=${EAPI} is not supported" ;;
22 eqawarn "emul-linux-x86.eclass is last rited and will be removed on 2015-11-24."
23 eqawarn "Please remove your copies of emul-linux-x86 ebuilds as they are"
24 eqawarn "no longer supported."
26 DESCRIPTION="Provides precompiled 32bit libraries"
27 #HOMEPAGE="https://amd64.gentoo.org/emul/content.xml"
28 HOMEPAGE="https://dev.gentoo.org/~pacho/emul.html"
29 SRC_URI="https://dev.gentoo.org/~pacho/emul/${P}.tar.xz"
40 DEPEND=">=sys-apps/findutils-4.2.26"
43 emul-linux-x86_src_prepare() {
44 ALLOWED=${ALLOWED:-^${S}/etc/env.d}
45 use development && ALLOWED="${ALLOWED}|/usr/lib32/pkgconfig"
46 find "${S}" ! -type d ! '(' -name '*.so' -o -name '*.so.[0-9]*' -o -name '*.h' ')' | egrep -v "${ALLOWED}" | xargs -d $'\n' rm -f || die 'failed to remove everything but *.so*'
49 emul-linux-x86_src_install() {
50 for dir in etc/env.d etc/revdep-rebuild ; do
51 if [[ -d "${S}"/${dir} ]] ; then
52 for f in "${S}"/${dir}/* ; do
58 # remove void directories
59 find "${S}" -depth -type d -print0 | xargs -0 rmdir 2&>/dev/null
61 cp -pPR "${S}"/* "${ED}"/ || die "copying files failed!"
63 # Do not hardcode lib32, bug #429726
64 local x86_libdir=$(get_abi_LIBDIR x86)
65 if [[ ${x86_libdir} != "lib32" ]] ; then
66 ewarn "Moving lib32/ to ${x86_libdir}/; some libs might not work"
67 mv "${D}"/usr/lib32 "${D}"/usr/${x86_libdir} || die
68 if [[ -d ${D}/lib32 ]] ; then
69 mv "${D}"/lib32 "${D}"/${x86_libdir} || die
72 pushd "${D}"/usr/${x86_libdir} >/dev/null
74 # Fix linker script paths.
76 if ldscripts=( $(grep -ls '^GROUP.*/lib32/' *.so) ) ; then
78 -e "s:/lib32/:/${x86_libdir}/:" \
79 "${ldscripts[@]}" || die
82 # Rewrite symlinks (if need be).
85 tgt=$(readlink "${sym}")
86 ln -sf "${tgt/lib32/${x86_libdir}}" "${sym}" || die
87 done < <(find -xtype l)
92 # Since header wrapping is added as part of gx86-multilib support,
93 # all packages involved install their own copies of i686* headers
94 # when built with abi_x86_32.
95 if [[ -d "${D}"/usr/include ]] && use abi_x86_32; then
96 rm -r "${D}"/usr/include || die
98 # The same goes for ${CHOST}- multilib tool prefixing.
99 if path_exists "${D}"/usr/bin/i686-pc-linux-gnu-* && use abi_x86_32; then
100 rm "${D}"/usr/bin/i686-pc-linux-gnu-* || die