Update the stdenv-linux bootstrap tools

This commit is contained in:
Eelco Dolstra 2014-10-29 17:26:29 +01:00
parent ac8e5cd145
commit 119ce1ab03
4 changed files with 32 additions and 79 deletions

View File

@ -1,39 +1,12 @@
let
fetch = { file, sha256 }: import <nix/fetchurl.nix> {
url = "http://tarballs.nixos.org/stdenv-linux/i686/r24519/${file}";
inherit sha256;
{
busybox = import <nix/fetchurl.nix> {
url = http://tarballs.nixos.org/stdenv-linux/i686/ac8e5cd145fa5f22bab1b01d8b4db4d26d22e65c/busybox;
sha256 = "0314dskcp6gp0jpy87phpjz1r13zh0grb40yvdl9s4l2rxzgzr2v";
executable = true;
};
in {
sh = fetch {
file = "sh";
sha256 = "1l6sdhyqjlh4m5gj3pfpi8aisp1m012lpwxfcc4v1x8g429mflmy";
};
bzip2 = fetch {
file = "bzip2";
sha256 = "1p5nkrdn52jm6rsx8x3wwjpsh83f2qsjl1qckkgnkplwhj23zjp7";
};
mkdir = fetch {
file = "mkdir";
sha256 = "02ff7i9ph9ahiapsg2v9c3pwr7sl73sk4n7ic112ljkrgwkail33";
};
cpio = fetch {
file = "cpio";
sha256 = "046if3aqqramyhrn2yxrjf4bfkl8x1bcqxhvi7ml9nrv9smx8irg";
};
curl = fetch {
file = "curl.bz2";
sha256 = "1v0yfb4gcdyqpl2fxlxjh337r28c23iqm7vwck4p4643xd55di7q";
};
bootstrapTools = {
url = http://tarballs.nixos.org/stdenv-linux/i686/r24519/bootstrap-tools.cpio.bz2;
sha256 = "0imypaxy6piwbk8ff2y1nr7yk49pqmdgdbv6g8miq1zs5yfip6ij";
bootstrapTools = import <nix/fetchurl.nix> {
url = http://tarballs.nixos.org/stdenv-linux/i686/ac8e5cd145fa5f22bab1b01d8b4db4d26d22e65c/bootstrap-tools.tar.xz;
sha256 = "025r3vifkqlw0i5nvlkmfrvbn0v73r1pr6jkqckgs585y7nmsjhz";
};
}

View File

@ -1,10 +1,9 @@
# Use the static tools for i686-linux. They work on x86_64-linux
# machines as well.
# Use busybox for i686-linux since it works on x86_64-linux as well.
(import ./i686.nix) //
{
bootstrapTools = {
url = http://tarballs.nixos.org/stdenv-linux/x86_64/r23302/bootstrap-tools.cpio.bz2;
sha256 = "0w89kqhx47yl0jifp2vffp073pyrqha5f312kp971smi4h41drna";
bootstrapTools = import <nix/fetchurl.nix> {
url = http://tarballs.nixos.org/stdenv-linux/x86_64/ac8e5cd145fa5f22bab1b01d8b4db4d26d22e65c/bootstrap-tools.tar.xz;
sha256 = "01485vvwxb7fsx8c8il5hip0bhh4xy2gg76sj4zc98gl4v1jbfq9";
};
}

View File

@ -40,20 +40,15 @@ rec {
bootstrapTools = derivation {
name = "bootstrap-tools";
builder = bootstrapFiles.sh;
builder = bootstrapFiles.busybox;
args =
if system == "armv5tel-linux" || system == "armv6l-linux"
|| system == "armv7l-linux"
then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
else [ ./scripts/unpack-bootstrap-tools.sh ];
else [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];
# FIXME: get rid of curl.
inherit (bootstrapFiles) bzip2 mkdir curl cpio;
tarball = import <nix/fetchurl.nix> {
inherit (bootstrapFiles.bootstrapTools) url sha256;
};
tarball = bootstrapFiles.bootstrapTools;
inherit system;

View File

@ -1,9 +1,7 @@
set -e
# Unpack the bootstrap tools tarball.
echo Unpacking the bootstrap tools...
$mkdir $out
$bzip2 -d < $tarball | (cd $out && $cpio -i)
$builder mkdir $out
< $tarball $builder unxz | $builder tar x -C $out
# Set the ELF interpreter / RPATH in the bootstrap binaries.
echo Patching the bootstrap tools...
@ -21,32 +19,17 @@ fi
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 $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 $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
if [ -L "$i" ]; then continue; fi
if [ -z "${i##*/liblto*}" ]; then continue; fi
echo patching "$i"
LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
$out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
done
for i in $out/lib/libgmp* $out/lib/libppl* $out/lib/libcloog* $out/lib/libmpc* $out/lib/libpcre* $out/lib/libstdc++*.so.*[0-9]; do
echo trying to patch $i
if test -f $i -a ! -L $i; then
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-rpath $out/lib --force-rpath $i
LD_LIBRARY_PATH=$out/lib $LD_BINARY \
$out/bin/patchelf --set-rpath $out/lib --force-rpath $i
fi
for i in $out/lib/libpcre*; do
if [ -L "$i" ]; then continue; fi
echo patching "$i"
$out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
done
# Fix the libc linker script.
@ -60,13 +43,16 @@ mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so
ln -s bash $out/bin/sh
ln -s bzip2 $out/bin/bunzip2
# Mimic the gunzip script as in gzip installations
# Provide a gunzip script.
cat > $out/bin/gunzip <<EOF
#!$out/bin/sh
exec $out/bin/gzip -d "\$@"
EOF
chmod +x $out/bin/gunzip
# fetchurl needs curl.
bzip2 -d < $curl > $out/bin/curl
chmod +x $out/bin/curl
# Provide fgrep/egrep.
echo "#! $out/bin/sh" > $out/bin/egrep
echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
echo "#! $out/bin/sh" > $out/bin/fgrep
echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
chmod +x $out/bin/egrep $out/bin/fgrep