| 1 |
# Copyright 1999-2005 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header$ |
| 4 |
|
| 5 |
# |
| 6 |
# don't monkey with this ebuild unless contacting portage devs. |
| 7 |
# period. |
| 8 |
# |
| 9 |
|
| 10 |
inherit eutils flag-o-matic eutils toolchain-funcs multilib autotools |
| 11 |
|
| 12 |
DESCRIPTION="sandbox'd LD_PRELOAD hack" |
| 13 |
HOMEPAGE="http://www.gentoo.org/" |
| 14 |
SRC_URI="mirror://gentoo/${P}.tar.bz2 |
| 15 |
http://dev.gentoo.org/~azarah/sandbox/${P}.tar.bz2" |
| 16 |
|
| 17 |
LICENSE="GPL-2" |
| 18 |
SLOT="0" |
| 19 |
#KEYWORDS=" alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86" |
| 20 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
| 21 |
IUSE="" |
| 22 |
RESTRICT="multilib-pkg-force" |
| 23 |
|
| 24 |
RDEPEND="" |
| 25 |
DEPEND="sys-devel/libtool" |
| 26 |
|
| 27 |
setup_multilib() { |
| 28 |
if use amd64 && has_m32 && [[ ${CONF_MULTILIBDIR} == "lib32" ]]; then |
| 29 |
export DEFAULT_ABI="amd64" |
| 30 |
export MULTILIB_ABIS="x86 amd64" |
| 31 |
export CFLAGS_amd64=${CFLAGS_amd64:-"-m64"} |
| 32 |
export CFLAGS_x86=${CFLAGS_x86-"-m32 -L/emul/linux/x86/lib -L/emul/linux/x86/usr/lib"} |
| 33 |
export LIBDIR_amd64=${LIBDIR_amd64-${CONF_LIBDIR}} |
| 34 |
export LIBDIR_x86=${LIBDIR_x86-${CONF_MULTILIBDIR}} |
| 35 |
fi |
| 36 |
} |
| 37 |
|
| 38 |
src_unpack() { |
| 39 |
setup_multilib |
| 40 |
for ABI in $(get_install_abis) ; do |
| 41 |
cd ${WORKDIR} |
| 42 |
unpack ${A} |
| 43 |
einfo "Unpacking sandbox for ABI=${ABI}..." |
| 44 |
mv ${S} ${S%/}-${ABI} || die "failed moving \$S to ${ABI}" |
| 45 |
|
| 46 |
cd ${S%/}-${ABI} |
| 47 |
epatch ${FILESDIR}/${P}-fbsd.patch |
| 48 |
# These are needed because they are called by internal checks :/ |
| 49 |
touch lstat.c stat.c malloc.c realloc.c |
| 50 |
|
| 51 |
eautoreconf |
| 52 |
done |
| 53 |
} |
| 54 |
|
| 55 |
abi_fail_check() { |
| 56 |
local ABI=$1 |
| 57 |
if [[ ${ABI} == "x86" ]] ; then |
| 58 |
echo |
| 59 |
eerror "Building failed for ABI=x86!. This usually means a broken" |
| 60 |
eerror "multilib setup. Please fix that before filling a bugreport" |
| 61 |
eerror "against sandbox." |
| 62 |
echo |
| 63 |
fi |
| 64 |
} |
| 65 |
|
| 66 |
src_compile() { |
| 67 |
setup_multilib |
| 68 |
|
| 69 |
filter-lfs-flags #90228 |
| 70 |
|
| 71 |
has_multilib_profile && append-flags -DSB_HAVE_64BIT_ARCH |
| 72 |
|
| 73 |
ewarn "If configure fails with a 'cannot run C compiled programs' error, try this:" |
| 74 |
ewarn "FEATURES=-sandbox emerge sandbox" |
| 75 |
|
| 76 |
OABI="${ABI}" |
| 77 |
for ABI in $(get_install_abis); do |
| 78 |
export ABI |
| 79 |
cd ${S}-${ABI} |
| 80 |
|
| 81 |
einfo "Configuring sandbox for ABI=${ABI}..." |
| 82 |
econf --libdir="/usr/$(get_libdir)" |
| 83 |
einfo "Building sandbox for ABI=${ABI}..." |
| 84 |
emake || { |
| 85 |
abi_fail_check "${ABI}" |
| 86 |
die "emake failed for ${ABI}" |
| 87 |
} |
| 88 |
done |
| 89 |
ABI="${OABI}" |
| 90 |
} |
| 91 |
|
| 92 |
src_install() { |
| 93 |
setup_multilib |
| 94 |
|
| 95 |
OABI="${ABI}" |
| 96 |
for ABI in $(get_install_abis); do |
| 97 |
export ABI |
| 98 |
cd ${S}-${ABI} |
| 99 |
einfo "Installing sandbox for ABI=${ABI}..." |
| 100 |
make DESTDIR="${D}" install || die "make install failed for ${ABI}" |
| 101 |
done |
| 102 |
ABI="${OABI}" |
| 103 |
|
| 104 |
keepdir /var/log/sandbox |
| 105 |
fowners root:portage /var/log/sandbox |
| 106 |
fperms 0770 /var/log/sandbox |
| 107 |
|
| 108 |
for x in "${S}-${ABI}"/{AUTHORS,COPYING,ChangeLog,NEWS,README} ; do |
| 109 |
dodoc "${x}" |
| 110 |
done |
| 111 |
} |
| 112 |
|
| 113 |
pkg_preinst() { |
| 114 |
chown root:portage ${IMAGE}/var/log/sandbox |
| 115 |
chmod 0770 ${IMAGE}/var/log/sandbox |
| 116 |
} |