2014-05-07 17:00:41 +04:00
|
|
|
# Copyright 1999-2014 Gentoo Foundation
|
2011-11-09 11:33:19 +04:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
2014-05-10 00:55:09 +04:00
|
|
|
# $Header: /var/cvsroot/gentoo-x86/eclass/emul-linux-x86.eclass,v 1.24 2014/05/09 07:13:47 mgorny Exp $
|
2011-11-09 11:33:19 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Original Author: Mike Doty <kingtaco@gentoo.org>
|
|
|
|
# Adapted from emul-libs.eclass
|
|
|
|
# Purpose: Providing a template for the app-emulation/emul-linux-* packages
|
|
|
|
#
|
|
|
|
|
2014-05-10 00:55:09 +04:00
|
|
|
inherit eutils multilib
|
2011-11-09 11:33:19 +04:00
|
|
|
|
|
|
|
case "${EAPI:-0}" in
|
2013-02-25 01:47:24 +04:00
|
|
|
3|4|5)
|
|
|
|
EXPORT_FUNCTIONS src_prepare src_install
|
2011-11-09 11:33:19 +04:00
|
|
|
;;
|
|
|
|
*) die "EAPI=${EAPI} is not supported" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
DESCRIPTION="Provides precompiled 32bit libraries"
|
|
|
|
#HOMEPAGE="http://amd64.gentoo.org/emul/content.xml"
|
|
|
|
HOMEPAGE="http://dev.gentoo.org/~pacho/emul.html"
|
2013-02-25 01:47:24 +04:00
|
|
|
SRC_URI="http://dev.gentoo.org/~pacho/emul/${P}.tar.xz"
|
|
|
|
|
|
|
|
IUSE="+development"
|
2011-11-09 11:33:19 +04:00
|
|
|
|
|
|
|
RESTRICT="strip"
|
|
|
|
S=${WORKDIR}
|
|
|
|
|
2012-10-28 22:18:29 +04:00
|
|
|
QA_PREBUILT="*"
|
|
|
|
|
2011-11-09 11:33:19 +04:00
|
|
|
SLOT="0"
|
|
|
|
|
|
|
|
DEPEND=">=sys-apps/findutils-4.2.26"
|
|
|
|
RDEPEND=""
|
|
|
|
|
|
|
|
emul-linux-x86_src_prepare() {
|
|
|
|
ALLOWED=${ALLOWED:-^${S}/etc/env.d}
|
2013-02-25 01:47:24 +04:00
|
|
|
use development && ALLOWED="${ALLOWED}|/usr/lib32/pkgconfig"
|
2013-02-25 20:14:11 +04:00
|
|
|
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*'
|
2011-11-09 11:33:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
emul-linux-x86_src_install() {
|
|
|
|
for dir in etc/env.d etc/revdep-rebuild ; do
|
|
|
|
if [[ -d "${S}"/${dir} ]] ; then
|
|
|
|
for f in "${S}"/${dir}/* ; do
|
|
|
|
mv -f "$f"{,-emul}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# remove void directories
|
|
|
|
find "${S}" -depth -type d -print0 | xargs -0 rmdir 2&>/dev/null
|
|
|
|
|
|
|
|
cp -pPR "${S}"/* "${ED}"/ || die "copying files failed!"
|
2012-10-28 22:18:29 +04:00
|
|
|
|
|
|
|
# Do not hardcode lib32, bug #429726
|
|
|
|
local x86_libdir=$(get_abi_LIBDIR x86)
|
|
|
|
if [[ ${x86_libdir} != "lib32" ]] ; then
|
|
|
|
ewarn "Moving lib32/ to ${x86_libdir}/; some libs might not work"
|
|
|
|
mv "${D}"/usr/lib32 "${D}"/usr/${x86_libdir} || die
|
2012-11-04 15:51:56 +04:00
|
|
|
if [[ -d ${D}/lib32 ]] ; then
|
|
|
|
mv "${D}"/lib32 "${D}"/${x86_libdir} || die
|
|
|
|
fi
|
2013-01-13 16:14:27 +04:00
|
|
|
|
|
|
|
pushd "${D}"/usr/${x86_libdir} >/dev/null
|
|
|
|
|
|
|
|
# Fix linker script paths.
|
2013-06-28 12:09:42 +04:00
|
|
|
local ldscripts
|
|
|
|
if ldscripts=( $(grep -ls '^GROUP.*/lib32/' *.so) ) ; then
|
|
|
|
sed -i \
|
|
|
|
-e "s:/lib32/:/${x86_libdir}/:" \
|
|
|
|
"${ldscripts[@]}" || die
|
|
|
|
fi
|
2013-01-13 16:14:27 +04:00
|
|
|
|
|
|
|
# Rewrite symlinks (if need be).
|
|
|
|
local sym tgt
|
|
|
|
while read sym ; do
|
|
|
|
tgt=$(readlink "${sym}")
|
|
|
|
ln -sf "${tgt/lib32/${x86_libdir}}" "${sym}" || die
|
|
|
|
done < <(find -xtype l)
|
|
|
|
|
|
|
|
popd >/dev/null
|
2012-10-28 22:18:29 +04:00
|
|
|
fi
|
2014-05-07 17:00:41 +04:00
|
|
|
|
2014-05-10 00:55:09 +04:00
|
|
|
# Since header wrapping is added as part of gx86-multilib support,
|
|
|
|
# all packages involved install their own copies of i686* headers
|
|
|
|
# when built with abi_x86_32.
|
|
|
|
if [[ -d "${D}"/usr/include ]] && use abi_x86_32; then
|
|
|
|
rm -r "${D}"/usr/include || die
|
|
|
|
fi
|
|
|
|
# The same goes for ${CHOST}- multilib tool prefixing.
|
|
|
|
if path_exists "${D}"/usr/bin/i686-pc-linux-gnu-* && use abi_x86_32; then
|
|
|
|
rm "${D}"/usr/bin/i686-pc-linux-gnu-* || die
|
2014-05-07 17:00:41 +04:00
|
|
|
fi
|
2011-11-09 11:33:19 +04:00
|
|
|
}
|