about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-07 12:22:33 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-07 12:51:21 +0200
commitec8d41f08c95cff79ccb28132146226f4f75c6fe (patch)
treec371a0c81a6f2e9a6a06489daf4a4e4cff393081 /pkgs/stdenv
parentd38ee5b46c5ca7d479786a4fa40efd53dcd748ec (diff)
Revert "Merge pull request #28557 from obsidiansystems/binutils-wrapper"
This reverts commit 0a944b345e89ca0096974d168f49e1c6830c3fc2, reversing
changes made to 61733ed6ccde3427016720f2e0cd191d3d95152c.

I dislike these massive stdenv changes with unclear motivation,
especially when they involve gratuitous mass renames like NIX_CC ->
NIX_BINUTILS. The previous such rename (NIX_GCC -> NIX_CC) caused
months of pain, so let's not do that again.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/darwin/default.nix55
-rw-r--r--pkgs/stdenv/linux/default.nix35
2 files changed, 26 insertions, 64 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index d71cda7f8a964..f4801d674e8ae 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -63,40 +63,10 @@ in rec {
                           extraBuildInputs,
                           allowedRequisites ? null}:
     let
-      buildPackages = lib.optionalAttrs (last ? stdenv) {
-        inherit (last) stdenv;
-      };
-
-      coreutils = { name = "coreutils-9.9.9"; outPath = bootstrapTools; };
-      gnugrep   = { name = "gnugrep-9.9.9";   outPath = bootstrapTools; };
-
-      binutils = import ../../build-support/binutils-wrapper {
-        inherit shell;
-        inherit (last) stdenv;
-
-        nativeTools  = false;
-        nativeLibc   = false;
-        inherit buildPackages coreutils gnugrep;
-        libc         = last.pkgs.darwin.Libsystem;
-        binutils     = { name = "binutils-9.9.9";  outPath = bootstrapTools; };
-      };
-
-      cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
-        inherit shell;
-        inherit (last) stdenv;
-
-        nativeTools  = false;
-        nativeLibc   = false;
-        inherit buildPackages coreutils gnugrep binutils;
-        libc         = last.pkgs.darwin.Libsystem;
-        isClang      = true;
-        cc           = { name = "clang-9.9.9";     outPath = bootstrapTools; };
-      };
-
       thisStdenv = import ../generic {
         inherit config shell extraNativeBuildInputs extraBuildInputs;
         allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [
-          cc.expand-response-params cc.binutils
+          thisStdenv.cc.expand-response-params
         ];
 
         name = "stdenv-darwin-boot-${toString step}";
@@ -105,9 +75,24 @@ in rec {
         hostPlatform = localSystem;
         targetPlatform = localSystem;
 
-        inherit cc;
+        cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
+          inherit shell;
+          inherit (last) stdenv;
+
+          nativeTools  = false;
+          nativeLibc   = false;
+          buildPackages = lib.optionalAttrs (last ? stdenv) {
+            inherit (last) stdenv;
+          };
+          libc         = last.pkgs.darwin.Libsystem;
+          isClang      = true;
+          cc           = { name = "clang-9.9.9";     outPath = bootstrapTools; };
+          binutils     = { name = "binutils-9.9.9";  outPath = bootstrapTools; };
+          coreutils    = { name = "coreutils-9.9.9"; outPath = bootstrapTools; };
+          gnugrep      = { name = "gnugrep-9.9.9";   outPath = bootstrapTools; };
+        };
 
-        preHook = lib.optionalString (shell == "${bootstrapTools}/bin/bash") ''
+        preHook = stage0.stdenv.lib.optionalString (shell == "${bootstrapTools}/bin/bash") ''
           # Don't patch #!/interpreter because it leads to retained
           # dependencies on the bootstrapTools in the final stdenv.
           dontPatchShebangs=1
@@ -365,8 +350,8 @@ in rec {
       xz.out xz.bin libcxx libcxxabi gmp.out gnumake findutils bzip2.out
       bzip2.bin llvmPackages.llvm llvmPackages.llvm.lib zlib.out zlib.dev libffi.out coreutils ed diffutils gnutar
       gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk
-      gnugrep llvmPackages.clang-unwrapped patch pcre.out gettext
-      binutils-raw.binutils.out binutils-raw.binutils.dev binutils binutils.binutils
+      gnugrep llvmPackages.clang-unwrapped patch pcre.out binutils-raw.out
+      binutils-raw.dev binutils gettext
       cc.expand-response-params
     ]) ++ (with pkgs.darwin; [
       dyld Libsystem CF cctools ICU libiconv locale
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 08166c55a5a97..fab1985b9765c 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -143,16 +143,7 @@ in
         '';
       };
       gcc-unwrapped = bootstrapTools;
-      binutils = import ../../build-support/binutils-wrapper {
-        nativeTools = false;
-        nativeLibc = false;
-        buildPackages = { };
-        libc = self.glibc;
-        inherit (self) coreutils gnugrep;
-        binutils = bootstrapTools;
-        name = "bootstrap-binutils-wrapper";
-        stdenv = self.stdenv;
-      };
+      binutils = bootstrapTools;
       coreutils = bootstrapTools;
       gnugrep = bootstrapTools;
     };
@@ -174,7 +165,7 @@ in
 
     # Rebuild binutils to use from stage2 onwards.
     overrides = self: super: {
-      binutils = super.binutils_nogold;
+      binutils = super.binutils.override { gold = false; };
       inherit (prevStage)
         ccWrapperStdenv
         glibc gcc-unwrapped coreutils gnugrep;
@@ -197,14 +188,9 @@ in
     overrides = self: super: {
       inherit (prevStage)
         ccWrapperStdenv
-        gcc-unwrapped coreutils gnugrep
+        binutils gcc-unwrapped coreutils gnugrep
         perl paxctl gnum4 bison;
       # This also contains the full, dynamically linked, final Glibc.
-      binutils = prevStage.binutils.override {
-        # Rewrap the binutils with the new glibc, so both the next
-        # stage's wrappers use it.
-        libc = self.glibc;
-      };
     };
   })
 
@@ -249,15 +235,6 @@ in
       # other purposes (binutils and top-level pkgs) too.
       inherit (prevStage) gettext gnum4 bison gmp perl glibc zlib linuxHeaders;
 
-      binutils = super.binutils.override {
-        # Don't use stdenv's shell but our own
-        shell = self.bash + "/bin/bash";
-        # Build expand-response-params with last stage like below
-        buildPackages = {
-          inherit (prevStage) stdenv;
-        };
-      };
-
       gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
         nativeTools = false;
         nativeLibc = false;
@@ -322,8 +299,8 @@ in
       allowedRequisites = with prevStage; with lib;
         # Simple executable tools
         concatMap (p: [ (getBin p) (getLib p) ])
-          [ gzip bzip2 xz bash binutils.binutils coreutils diffutils findutils
-            gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl
+          [ gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
+            gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl
           ]
         # Library dependencies
         ++ map getLib (
@@ -333,7 +310,7 @@ in
         # More complicated cases
         ++ [
             glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders
-            binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params
+            gcc gcc.cc gcc.cc.lib gcc.expand-response-params
           ]
           ++ lib.optionals (system == "aarch64-linux")
             [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];