Fixing the unpack bootstrap tools script so it works not only for mips.

svn path=/nixpkgs/branches/stdenv-updates/; revision=22855
This commit is contained in:
Lluís Batlle i Rossell 2010-08-01 22:00:14 +00:00
parent 0f4673788e
commit 9724fb271b

View File

@ -8,35 +8,43 @@ $bzip2 -d < $tarball | (cd $out && $cpio -i)
# Set the ELF interpreter / RPATH in the bootstrap binaries.
echo Patching the bootstrap tools...
if test -f $out/lib/ld.so.?; then
# MIPS case
LD_BINARY=$out/lib/ld.so.?
else
# i686, x86_64 and armv5tel
LD_BINARY=$out/lib/ld-*so.?
fi
# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
# use a copy of patchelf.
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? $out/bin/cp $out/bin/patchelf .
LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
echo patching $i
if ! test -L $i; then
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? \
$out/bin/patchelf --set-interpreter $out/lib/ld.so.? --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? \
$out/bin/patchelf --set-interpreter $out/lib/ld.so.? --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
fi
done
for i in $out/lib/librt* ; do
echo patching $i
if ! test -L $i; then
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? \
$out/bin/patchelf --set-interpreter $out/lib/ld.so.? --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? \
$out/bin/patchelf --set-interpreter $out/lib/ld.so.? --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
fi
done
for i in $out/lib/libgmp* $out/lib/libppl* $out/lib/libcloog* $out/lib/libmpc*; do
echo patching $i
echo trying to patch $i
if test -f $i -a ! -L $i; then
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? \
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $out/lib/ld.so.? \
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-rpath $out/lib --force-rpath $i
fi
done