nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 64 lines 2.0 kB view raw
1# Unpack the bootstrap tools tarball. 2echo Unpacking the bootstrap tools... 3$builder mkdir $out 4< $tarball $builder unxz | $builder tar x -C $out 5 6# Set the ELF interpreter / RPATH in the bootstrap binaries. 7echo Patching the bootstrap tools... 8 9if test -f $out/lib/ld.so.?; then 10 # MIPS case 11 LD_BINARY=$out/lib/ld.so.? 12else 13 # i686, x86_64 and armv5tel 14 LD_BINARY=$out/lib/ld-*so.? 15fi 16 17# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So 18# use a copy of patchelf. 19LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf . 20 21for i in $out/bin/* $out/libexec/gcc/*/*/*; do 22 if [ -L "$i" ]; then continue; fi 23 if [ -z "${i##*/liblto*}" ]; then continue; fi 24 echo patching "$i" 25 LD_LIBRARY_PATH=$out/lib $LD_BINARY \ 26 ./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i" 27done 28 29for i in $out/lib/libpcre* $out/lib/libc.so; do 30 if [ -L "$i" ]; then continue; fi 31 echo patching "$i" 32 $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i" 33done 34 35export PATH=$out/bin 36 37# Fix the libc linker script. 38#cat $out/lib/libc.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libc.so.tmp 39#mv $out/lib/libc.so.tmp $out/lib/libc.so 40#cat $out/lib/libpthread.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libpthread.so.tmp 41#mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so 42 43# Provide some additional symlinks. 44ln -s bash $out/bin/sh 45ln -s bzip2 $out/bin/bunzip2 46 47# Provide a gunzip script. 48cat > $out/bin/gunzip <<EOF 49#!$out/bin/sh 50exec $out/bin/gzip -d "\$@" 51EOF 52chmod +x $out/bin/gunzip 53 54# Provide fgrep/egrep. 55echo "#! $out/bin/sh" > $out/bin/egrep 56echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep 57echo "#! $out/bin/sh" > $out/bin/fgrep 58echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep 59 60# Provide xz (actually only xz -d will work). 61echo "#! $out/bin/sh" > $out/bin/xz 62echo "exec $builder unxz \"\$@\"" >> $out/bin/xz 63 64chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/xz