diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-02-01 21:44:56 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-02-01 21:44:56 +0000 |
commit | 779b4b2448b173d55e04f3f7f380b439dd928d92 (patch) | |
tree | c76a7386d2ef48dad2f7ae23cd987eaa7296ee59 /pkgs/stdenv | |
parent | 9f3a83f2478c9fa42efa51c63f170e82d1707d74 (diff) |
* Use GCC 4.3 by default.
* Updated stdenv-linux: - The bootstrap tools are no longer statically linked (except for binaries in the Nixpkgs tree used to download and unpack the bootstrap tools). - x86_64 uses the same static binaries as i686. This makes the Nixpkgs tree a bit smaller. - Use the Linux 2.6.28 headers. svn path=/nixpkgs/branches/stdenv-updates/; revision=13946
Diffstat (limited to 'pkgs/stdenv')
23 files changed, 168 insertions, 186 deletions
diff --git a/pkgs/stdenv/linux/bootstrap/i686/bash b/pkgs/stdenv/linux/bootstrap/i686/bash deleted file mode 100755 index a41afe58ac9b4..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/i686/bash +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/bzip2 b/pkgs/stdenv/linux/bootstrap/i686/bzip2 index ea45149fa4d34..c4a9e6cb872f8 100755 --- a/pkgs/stdenv/linux/bootstrap/i686/bzip2 +++ b/pkgs/stdenv/linux/bootstrap/i686/bzip2 Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/cp b/pkgs/stdenv/linux/bootstrap/i686/cp deleted file mode 100755 index 55142a9e0b899..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/i686/cp +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/cpio b/pkgs/stdenv/linux/bootstrap/i686/cpio new file mode 100755 index 0000000000000..03f053ce65ee4 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap/i686/cpio Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 b/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 index b7434ff5b9ed9..394b0fb2b4614 100755 --- a/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 +++ b/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/default.nix b/pkgs/stdenv/linux/bootstrap/i686/default.nix index e065931e5ebf4..4200bcb7ea6d3 100644 --- a/pkgs/stdenv/linux/bootstrap/i686/default.nix +++ b/pkgs/stdenv/linux/bootstrap/i686/default.nix @@ -1,27 +1,13 @@ { - bash = ./bash; + sh = ./sh; bzip2 = ./bzip2; - cp = ./cp; + mkdir = ./mkdir; + cpio = ./cpio; + ln = ./ln; curl = ./curl.bz2; - tar = ./tar.bz2; - binutilsURL = { - url = http://nixos.org/tarballs/stdenv-linux/i686/r9803/binutils.tar.bz2; - sha1 = "73532561c2f98d0df641fbd778bc92cea298762a"; - }; - - gccURL = { - url = http://nixos.org/tarballs/stdenv-linux/i686/r9803/gcc.tar.bz2; - sha1 = "522dc2e22dc42f640b0290638382d45bd43a7d55"; - }; - - glibcURL = { - url = http://nixos.org/tarballs/stdenv-linux/i686/r9803/glibc.tar.bz2; - sha1 = "b9ae1e43e9977476ef53f8c1c9cd1cff5526ff40"; - }; - - staticToolsURL = { - url = http://nixos.org/tarballs/stdenv-linux/i686/r9803/static-tools.tar.bz2; - sha1 = "ebe826e848736a82bcdd9a195dd510b533ecc997"; + bootstrapTools = { + url = http://nixos.org/tarballs/stdenv-linux/i686/r13932/bootstrap-tools.cpio.bz2; + sha256 = "12z35wnpcbjwczsr9fldp6bjpz7wh5qwylw6xfrr9l4s7gmk3m8a"; }; } diff --git a/pkgs/stdenv/linux/bootstrap/i686/ln b/pkgs/stdenv/linux/bootstrap/i686/ln new file mode 100755 index 0000000000000..dda29b4ea2b0b --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap/i686/ln Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/mkdir b/pkgs/stdenv/linux/bootstrap/i686/mkdir new file mode 100755 index 0000000000000..b3682da3cd232 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap/i686/mkdir Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/sh b/pkgs/stdenv/linux/bootstrap/i686/sh new file mode 100755 index 0000000000000..b03bbf0cfcd7d --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap/i686/sh Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/i686/tar.bz2 b/pkgs/stdenv/linux/bootstrap/i686/tar.bz2 deleted file mode 100755 index b6241bf3d2314..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/i686/tar.bz2 +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/x86_64/bash b/pkgs/stdenv/linux/bootstrap/x86_64/bash deleted file mode 100755 index 68200f238e9db..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/x86_64/bash +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/x86_64/bzip2 b/pkgs/stdenv/linux/bootstrap/x86_64/bzip2 deleted file mode 100755 index dd2cce8952c9e..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/x86_64/bzip2 +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/x86_64/cp b/pkgs/stdenv/linux/bootstrap/x86_64/cp deleted file mode 100755 index 397b1e898097c..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/x86_64/cp +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/x86_64/curl.bz2 b/pkgs/stdenv/linux/bootstrap/x86_64/curl.bz2 deleted file mode 100755 index 8e40942bcfe18..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/x86_64/curl.bz2 +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/bootstrap/x86_64/default.nix b/pkgs/stdenv/linux/bootstrap/x86_64/default.nix index 1b265bd66a5fd..30b30d9c498a6 100644 --- a/pkgs/stdenv/linux/bootstrap/x86_64/default.nix +++ b/pkgs/stdenv/linux/bootstrap/x86_64/default.nix @@ -1,27 +1,10 @@ -{ - bash = ./bash; - bzip2 = ./bzip2; - cp = ./cp; - curl = ./curl.bz2; - tar = ./tar.bz2; - - binutilsURL = { - url = http://nixos.org/tarballs/stdenv-linux/x86_64/r9803/binutils.tar.bz2; - sha1 = "9ac95e34c96c19cd0b925af46c97c9979becaaca"; - }; - - gccURL = { - url = http://nixos.org/tarballs/stdenv-linux/x86_64/r9803/gcc.tar.bz2; - sha1 = "e8cb32425c8f55833ca081bd74668a029bdf1755"; - }; - - glibcURL = { - url = http://nixos.org/tarballs/stdenv-linux/x86_64/r9803/glibc.tar.bz2; - sha1 = "74b1698a4595ce4b4f43a33b3ceca1e4459e494e"; - }; +# Use the static tools for i686-linux. They work on x86_64-linux +# machines as well. +(import ../i686) // - staticToolsURL = { - url = http://nixos.org/tarballs/stdenv-linux/x86_64/r9803/static-tools.tar.bz2; - sha1 = "4da3af92c9bcd8fc43b31934d8429412e209741b"; +{ + bootstrapTools = { + url = http://nixos.org/tarballs/stdenv-linux/x86_64/r13932/bootstrap-tools.cpio.bz2; + sha256 = "135lx2945cxf43g9n39dxcamw6f6n8qp5iqbh4xma575rf2bx5js"; }; -} +} \ No newline at end of file diff --git a/pkgs/stdenv/linux/bootstrap/x86_64/tar.bz2 b/pkgs/stdenv/linux/bootstrap/x86_64/tar.bz2 deleted file mode 100755 index 94b2bacdb9d80..0000000000000 --- a/pkgs/stdenv/linux/bootstrap/x86_64/tar.bz2 +++ /dev/null Binary files differdiff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 21594bad5a9fe..4504c7faec1ac 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -9,7 +9,7 @@ rec { - bootstrapTools = + bootstrapFiles = if system == "i686-linux" then import ./bootstrap/i686 else if system == "x86_64-linux" then import ./bootstrap/x86_64 else if system == "powerpc-linux" then import ./bootstrap/powerpc @@ -19,114 +19,115 @@ rec { # The bootstrap process proceeds in several steps. - # 1) Create a standard environment by downloading pre-built - # statically linked binaries of coreutils, gcc, etc. - - # To fetch the pre-built binaries, we use a statically linked `curl' - # binary which is unpacked here. - curl = derivation { - inherit system; - name = "curl"; - builder = bootstrapTools.bash; - inherit (bootstrapTools) bzip2 cp curl; - args = [ ./scripts/unpack-curl.sh ]; - }; + # 1) Create a standard environment by downloading pre-built binaries + # of coreutils, GCC, etc. # This function downloads a file. - download = {url, sha1, pkgname}: derivation { + download = {url, sha256}: derivation { name = baseNameOf (toString url); - builder = bootstrapTools.bash; - inherit system curl url; + builder = bootstrapFiles.sh; + inherit system url; + inherit (bootstrapFiles) bzip2 mkdir curl cpio ln; args = [ ./scripts/download.sh ]; - outputHashAlgo = "sha1"; - outputHash = sha1; + outputHashAlgo = "sha256"; + outputHash = sha256; impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ]; }; - # This function downloads and unpacks a file. - downloadAndUnpack = pkgname: {url, sha1}: derivation { - name = pkgname; - builder = bootstrapTools.bash; - inherit (bootstrapTools) bzip2 tar cp; - args = [ ./scripts/unpack.sh ]; - tarball = download {inherit url sha1 pkgname;}; + # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). + bootstrapTools = derivation { + name = "bootstrap-tools"; + + builder = bootstrapFiles.sh; + + args = [ ./scripts/unpack-bootstrap-tools.sh ]; + + inherit (bootstrapFiles) bzip2 mkdir curl cpio; + + tarball = download { + inherit (bootstrapFiles.bootstrapTools) url sha256; + }; + inherit system; - allowedReferences = []; + + # Needed by the GCC wrapper. + langC = true; + langCC = true; }; + - # The various statically linked components that make up the standard - # environment. - staticTools = downloadAndUnpack "static-tools" bootstrapTools.staticToolsURL; - staticBinutils = downloadAndUnpack "static-binutils" bootstrapTools.binutilsURL; - staticGCC = (downloadAndUnpack "static-gcc" bootstrapTools.gccURL) - // { langC = true; langCC = false; langF77 = false; }; - staticGlibc = downloadAndUnpack "static-glibc" bootstrapTools.glibcURL; - + # This function builds the various standard environments used during + # the bootstrap. + stdenvBootFun = + {gcc, extraAttrs ? {}, extraPath ? [], fetchurl}: - # A helper function to call gcc-wrapper. - wrapGCC = - {gcc ? staticGCC, libc, binutils, shell ? ""}: - (import ../../build-support/gcc-wrapper) { - nativeTools = false; - nativeLibc = false; - inherit gcc binutils libc shell; - stdenv = stdenvInitial; + import ../generic { + inherit system; + name = "stdenv-linux-boot"; + param1 = bootstrapTools; + preHook = builtins.toFile "prehook.sh" + '' + export LD_LIBRARY_PATH=$param1/lib + export NIX_ENFORCE_PURITY=1 + havePatchELF=1 + # Don't patch #!/interpreter because it leads to retained + # dependencies on the bootstrapTools in the final stdenv. + dontPatchShebangs=1 + ''; + shell = "${bootstrapTools}/bin/sh"; + initialPath = [bootstrapTools] ++ extraPath; + fetchurlBoot = fetchurl; + forceFetchurlBoot = true; + inherit gcc extraAttrs; }; - # The "fake" standard environment used to build "real" standard - # environments. It consists of just the basic statically linked - # tools. - stdenvInitial = let { - body = derivation { - name = "stdenv-linux-initial"; - builder = bootstrapTools.bash; - args = [ ./scripts/builder-stdenv-initial.sh ]; - stdenvScript = ../generic/setup.sh; - inherit system staticTools curl; - } // { - # !!! too much duplication with stdenv/generic/default.nix - mkDerivation = attrs: (derivation ((removeAttrs attrs ["meta"]) // { - builder = bootstrapTools.bash; - args = ["-e" attrs.builder]; - stdenv = body; - system = body.system; - })) // { meta = if attrs ? meta then attrs.meta else {}; }; - shell = bootstrapTools.bash; - }; + # Build a dummy stdenv with no GCC or working fetchurl. This is + # because we need a stdenv to build the GCC wrapper and fetchurl. + stdenvLinuxBoot0 = stdenvBootFun { + gcc = "/no-such-path"; + fetchurl = null; }; + + fetchurl = import ../../build-support/fetchurl { + stdenv = stdenvLinuxBoot0; + curl = bootstrapTools; + }; - # This function builds the various standard environments used during - # the bootstrap. - stdenvBootFun = - {gcc, staticGlibc, extraAttrs ? {}, extraPath ? []}: - - let - fetchurlBoot = import ../../build-support/fetchurl { - stdenv = stdenvInitial; - inherit curl; - }; - in import ../generic { - name = "stdenv-linux-boot"; - param1 = if staticGlibc then "static" else "dynamic"; - preHook = ./scripts/prehook.sh; - stdenv = stdenvInitial; - shell = bootstrapTools.bash; - initialPath = [staticTools] ++ extraPath; - inherit fetchurlBoot; - forceFetchurlBoot = true; - inherit gcc extraAttrs; + + # The Glibc include directory cannot have the same prefix as the GCC + # include directory, since GCC gets confused otherwise (it will + # search the Glibc headers before the GCC headers). So create a + # dummy Glibc. + bootstrapGlibc = stdenvLinuxBoot0.mkDerivation { + name = "bootstrap-glibc"; + buildCommand = '' + ensureDir $out + ln -s ${bootstrapTools}/lib $out/lib + ln -s ${bootstrapTools}/include-glibc $out/include + ''; + }; + + + # A helper function to call gcc-wrapper. + wrapGCC = + {gcc ? bootstrapTools, libc, binutils, shell ? "", name ? "bootstrap-gcc"}: + + import ../../build-support/gcc-wrapper { + nativeTools = false; + nativeLibc = false; + inherit gcc binutils libc shell name; + stdenv = stdenvLinuxBoot0; }; # Create the first "real" standard environment. This one consists - # of statically linked components only, and a minimal glibc to keep - # the gcc configure script happy. + # of bootstrap tools only, and a minimal Glibc to keep the GCC + # configure script happy. stdenvLinuxBoot1 = stdenvBootFun { - # Use the statically linked, downloaded glibc/gcc/binutils. - gcc = wrapGCC {libc = staticGlibc; binutils = staticBinutils;}; - staticGlibc = true; + gcc = wrapGCC {libc = bootstrapGlibc; binutils = bootstrapTools;}; + inherit fetchurl; }; @@ -138,18 +139,18 @@ rec { }; - # 3) Build Glibc with the statically linked tools. The result is the - # full, dynamically linked, final Glibc. + # 3) Build Glibc with the bootstrap tools. The result is the full, + # dynamically linked, final Glibc. stdenvLinuxGlibc = stdenvLinuxBoot1Pkgs.glibc; # 4) Construct a second stdenv identical to the first, except that # this one uses the Glibc built in step 3. It still uses - # statically linked tools. + # the rest of the bootstrap tools, including GCC. stdenvLinuxBoot2 = removeAttrs (stdenvBootFun { - staticGlibc = false; - gcc = wrapGCC {binutils = staticBinutils; libc = stdenvLinuxGlibc;}; + gcc = wrapGCC {binutils = bootstrapTools; libc = stdenvLinuxGlibc;}; extraAttrs = {glibc = stdenvLinuxGlibc;}; + inherit fetchurl; }) ["gcc" "binutils"]; @@ -160,25 +161,18 @@ rec { }; - # Ugh, some packages in stdenvLinuxBoot3Pkgs need "sh", so create a - # package that contains just a symlink to bash. - shSymlink = stdenvLinuxBoot2Pkgs.runCommand "sh-symlink" {} '' - ensureDir $out/bin - ln -s $shell $out/bin/sh - ''; - - # 6) Construct a third stdenv identical to the second, except that # this one uses the dynamically linked GCC and Binutils from step - # 5. The other tools (e.g. coreutils) are still static. + # 5. The other tools (e.g. coreutils) are still from the + # bootstrap tools. stdenvLinuxBoot3 = stdenvBootFun { - staticGlibc = false; - gcc = wrapGCC { + gcc = wrapGCC rec { inherit (stdenvLinuxBoot2Pkgs) binutils; libc = stdenvLinuxGlibc; gcc = stdenvLinuxBoot2Pkgs.gcc.gcc; + name = gcc.name; }; - extraPath = [stdenvLinuxBoot2Pkgs.replace shSymlink]; + inherit fetchurl; }; @@ -192,21 +186,31 @@ rec { # 8) Construct the final stdenv. It uses the Glibc, GCC and # Binutils built above, and adds in dynamically linked versions # of all other tools. + # + # When updating stdenvLinux, make sure that the result has no + # dependency (`nix-store -qR') on bootstrapTools. stdenvLinux = import ../generic { name = "stdenv-linux"; - preHook = ./scripts/prehook.sh; + + inherit system; + + preHook = builtins.toFile "prehook.sh" + '' + export NIX_ENFORCE_PURITY=1 + havePatchELF=1 + ''; + initialPath = [ ((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;}) stdenvLinuxBoot3Pkgs.patchelf ]; - stdenv = stdenvInitial; - - gcc = wrapGCC { + gcc = wrapGCC rec { inherit (stdenvLinuxBoot2Pkgs) binutils; libc = stdenvLinuxGlibc; gcc = stdenvLinuxBoot2Pkgs.gcc.gcc; shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh"; + name = gcc.name; }; shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh"; diff --git a/pkgs/stdenv/linux/scripts/builder-stdenv-initial.sh b/pkgs/stdenv/linux/scripts/builder-stdenv-initial.sh deleted file mode 100644 index 6bd2f3084bfe9..0000000000000 --- a/pkgs/stdenv/linux/scripts/builder-stdenv-initial.sh +++ /dev/null @@ -1,7 +0,0 @@ -set -e - -PATH=$staticTools/bin - -mkdir $out - -sed -e "s^@initialPath@^$staticTools^" -e "s^@preHook@^^" -e "s^@postHook@^^" -e "s^@shell@^$SHELL^" < $stdenvScript > $out/setup diff --git a/pkgs/stdenv/linux/scripts/download.sh b/pkgs/stdenv/linux/scripts/download.sh index 1d010f88d1e4e..e7594f208ea13 100644 --- a/pkgs/stdenv/linux/scripts/download.sh +++ b/pkgs/stdenv/linux/scripts/download.sh @@ -1,3 +1,8 @@ set -e + +$ln -s $curl curl.bz2 +$bzip2 -d -f curl.bz2 +./curl --version + echo "downloading $out from $url" -$curl/bin/curl --fail --location --max-redirs 20 "$url" > "$out" +./curl --fail --location --max-redirs 20 "$url" > "$out" diff --git a/pkgs/stdenv/linux/scripts/prehook.sh b/pkgs/stdenv/linux/scripts/prehook.sh index 4ba81f1eef74c..29c02e2eaf2e4 100644 --- a/pkgs/stdenv/linux/scripts/prehook.sh +++ b/pkgs/stdenv/linux/scripts/prehook.sh @@ -1,8 +1,3 @@ export NIX_ENFORCE_PURITY=1 -if test "$param1" = "static"; then - export NIX_CFLAGS_LINK="-static" - export NIX_LDFLAGS_BEFORE="-static" -fi - havePatchELF=1 diff --git a/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh new file mode 100644 index 0000000000000..bb9c7071f3de6 --- /dev/null +++ b/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh @@ -0,0 +1,35 @@ +set -e + +# Unpack the bootstrap tools tarball. +echo Unpacking the bootstrap tools... +$mkdir $out +$bzip2 -d < $tarball | (cd $out && $cpio -V -i) + +# Set the ELF interpreter / RPATH in the bootstrap binaries. +echo Patching the bootstrap tools... + +# 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-linux*.so.2 $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-linux*.so.2 \ + ./patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib $i + fi +done + +# Fix the libc linker script. +export PATH=$out/bin +cat $out/lib/libc.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libc.so.tmp +mv $out/lib/libc.so.tmp $out/lib/libc.so + +# Provide some additional symlinks. +ln -s bash $out/bin/sh + +ln -s bzip2 $out/bin/bunzip2 + +# fetchurl needs curl. +bzip2 -d < $curl > $out/bin/curl +chmod +x $out/bin/curl diff --git a/pkgs/stdenv/linux/scripts/unpack-curl.sh b/pkgs/stdenv/linux/scripts/unpack-curl.sh deleted file mode 100644 index 3023f865c946b..0000000000000 --- a/pkgs/stdenv/linux/scripts/unpack-curl.sh +++ /dev/null @@ -1,11 +0,0 @@ -set -x -set -e - -# Tricky: need to make $out/bin without mkdir ;-). So use cp to copy -# the current (empty) directory. -$cp -prvd . $out -$cp -prvd . $out/bin - -$cp $curl curl.bz2 -$bzip2 -d curl.bz2 -$cp curl $out/bin diff --git a/pkgs/stdenv/linux/scripts/unpack.sh b/pkgs/stdenv/linux/scripts/unpack.sh deleted file mode 100644 index eb916cbc48d57..0000000000000 --- a/pkgs/stdenv/linux/scripts/unpack.sh +++ /dev/null @@ -1,8 +0,0 @@ -set -e - -$cp $tar .tar.bz2 -$bzip2 -d .tar.bz2 - -$bzip2 -d < $tarball | ./.tar xvf - - -$cp -prd * $out |