diff options
Diffstat (limited to 'pkgs/stdenv/linux/default.nix')
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 8714afa0358c..c6b2bb6ef0c3 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -11,14 +11,15 @@ rec { + lib = import ../../../lib; + 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 - else if system == "armv5tel-linux" then import ./bootstrap/armv5tel - else if system == "armv6l-linux" then import ./bootstrap/armv6l - else if system == "armv7l-linux" then import ./bootstrap/armv5tel - else if system == "mips64el-linux" then import ./bootstrap/loongson2f + if system == "i686-linux" then import ./bootstrap/i686.nix + else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix + else if system == "armv5tel-linux" then import ./bootstrap/armv5tel.nix + else if system == "armv6l-linux" then import ./bootstrap/armv6l.nix + else if system == "armv7l-linux" then import ./bootstrap/armv6l.nix + else if system == "mips64el-linux" then import ./bootstrap/loongson2f.nix else abort "unsupported platform for the pure Linux stdenv"; @@ -38,19 +39,6 @@ rec { # of coreutils, GCC, etc. - # This function downloads a file. - download = {url, sha256}: derivation { - name = baseNameOf (toString url); - builder = bootstrapFiles.sh; - inherit system url; - inherit (bootstrapFiles) bzip2 mkdir curl cpio ln; - args = [ ./scripts/download.sh ]; - outputHashAlgo = "sha256"; - outputHash = sha256; - impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ]; - }; - - # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). bootstrapTools = derivation { name = "bootstrap-tools"; @@ -58,13 +46,15 @@ rec { builder = bootstrapFiles.sh; args = - if (system == "armv5tel-linux" || system == "armv6l-linux") + if system == "armv5tel-linux" || system == "armv6l-linux" + || system == "armv7l-linux" then [ ./scripts/unpack-bootstrap-tools-arm.sh ] else [ ./scripts/unpack-bootstrap-tools.sh ]; + # FIXME: get rid of curl. inherit (bootstrapFiles) bzip2 mkdir curl cpio; - tarball = download { + tarball = import <nix/fetchurl.nix> { inherit (bootstrapFiles.bootstrapTools) url sha256; }; @@ -133,9 +123,9 @@ rec { # A helper function to call gcc-wrapper. wrapGCC = - {gcc ? bootstrapTools, libc, binutils, coreutils, shell ? "", name ? "bootstrap-gcc-wrapper"}: + { gcc ? bootstrapTools, libc, binutils, coreutils, shell ? "", name ? "bootstrap-gcc-wrapper" }: - import ../../build-support/gcc-wrapper { + lib.makeOverridable (import ../../build-support/gcc-wrapper) { nativeTools = false; nativeLibc = false; inherit gcc binutils coreutils libc shell name; @@ -165,12 +155,14 @@ rec { bootStdenv = stdenvLinuxBoot1; }; + binutils1 = stdenvLinuxBoot1Pkgs.binutils.override { gold = false; }; - # 3) 2nd stdenv that we will use to build only the glibc. + + # 3) 2nd stdenv that we will use to build only Glibc. stdenvLinuxBoot2 = stdenvBootFun { gcc = wrapGCC { libc = bootstrapGlibc; - binutils = stdenvLinuxBoot1Pkgs.binutils; + binutils = binutils1; coreutils = bootstrapTools; }; overrides = pkgs: { @@ -181,7 +173,7 @@ rec { # 4) These are the packages that we can build with the 2nd - # stdenv. We only need Glibc (in step 5). + # stdenv. stdenvLinuxBoot2Pkgs = allPackages { inherit system platform; bootStdenv = stdenvLinuxBoot2; @@ -198,7 +190,7 @@ rec { # binutils and the rest of the bootstrap tools, including GCC. stdenvLinuxBoot3 = stdenvBootFun { gcc = wrapGCC { - binutils = stdenvLinuxBoot1Pkgs.binutils; + binutils = binutils1; coreutils = bootstrapTools; libc = stdenvLinuxGlibc; }; @@ -215,6 +207,10 @@ rec { cloog = pkgs.cloog.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; ppl = pkgs.ppl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; }; + extraAttrs = { + glibc = stdenvLinuxGlibc; # Required by gcc47 build + }; + extraPath = [ stdenvLinuxBoot1Pkgs.paxctl ]; inherit fetchurl; }; @@ -227,12 +223,11 @@ rec { # 8) Construct a fourth 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 from the - # bootstrap tools. + # this one uses the new GCC from step 7. The other tools + # (e.g. coreutils) are still from the bootstrap tools. stdenvLinuxBoot4 = stdenvBootFun { gcc = wrapGCC rec { - inherit (stdenvLinuxBoot3Pkgs) binutils; + binutils = binutils1; coreutils = bootstrapTools; libc = stdenvLinuxGlibc; gcc = stdenvLinuxBoot3Pkgs.gcc.gcc; @@ -254,9 +249,9 @@ rec { }; - # 10) Construct the final stdenv. It uses the Glibc, GCC and - # Binutils built above, and adds in dynamically linked versions - # of all other tools. + # 10) Construct the final stdenv. It uses the Glibc and GCC, and + # adds in a new binutils that doesn't depend on bootstrap-tools, + # as well as dynamically linked versions of all other tools. # # When updating stdenvLinux, make sure that the result has no # dependency (`nix-store -qR') on bootstrapTools or the @@ -264,15 +259,20 @@ rec { stdenvLinux = import ../generic rec { inherit system config; - preHook = commonPreHook; + preHook = + '' + # Make "strip" produce deterministic output, by setting + # timestamps etc. to a fixed value. + commonStripFlags="--enable-deterministic-archives" + ${commonPreHook} + ''; initialPath = ((import ../common-path.nix) {pkgs = stdenvLinuxBoot4Pkgs;}) - ++ [stdenvLinuxBoot4Pkgs.patchelf]; + ++ [stdenvLinuxBoot4Pkgs.patchelf stdenvLinuxBoot4Pkgs.paxctl ]; gcc = wrapGCC rec { - inherit (stdenvLinuxBoot3Pkgs) binutils; - inherit (stdenvLinuxBoot4Pkgs) coreutils; + inherit (stdenvLinuxBoot4Pkgs) binutils coreutils; libc = stdenvLinuxGlibc; gcc = stdenvLinuxBoot4.gcc.gcc; shell = stdenvLinuxBoot4Pkgs.bash + "/bin/bash"; @@ -291,11 +291,12 @@ rec { overrides = pkgs: { inherit gcc; - inherit (stdenvLinuxBoot3Pkgs) binutils glibc; + inherit (stdenvLinuxBoot3Pkgs) glibc; + inherit (stdenvLinuxBoot4Pkgs) binutils; inherit (stdenvLinuxBoot4Pkgs) gzip bzip2 xz bash coreutils diffutils findutils gawk gnumake gnused gnutar gnugrep gnupatch patchelf - attr acl pcre; + attr acl pcre paxctl; }; }; |