summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-09-20 11:07:52 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-09-26 14:08:21 -0400
commitd349f9a34006cc484b5e7509a3f227d52d6e2a5d (patch)
tree69d187767ba311e275115b767680081c2b9b5f96
parent0d3d2a01d20d88dde3696ead43c557c1f3043ee7 (diff)
downloadnixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.tar
nixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.tar.gz
nixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.tar.bz2
nixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.tar.lz
nixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.tar.xz
nixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.tar.zst
nixpkgs-d349f9a34006cc484b5e7509a3f227d52d6e2a5d.zip
cc-wrapper: Use stdenvNoCC to build
cc-wrapper may wrap a cc-compiler, but it doesn't need one to build
itself. (c.f. expand-response-params is a separate derivation.) This
helps avoid cycles on the cross stuff, in addition to removing a
useless dependency edge.

I could have been super careful with overrides in the stdenv to avoid
the mass rebuild, but I don't think it's worth it.
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix7
-rw-r--r--pkgs/stdenv/darwin/default.nix4
-rw-r--r--pkgs/stdenv/freebsd/default.nix2
-rw-r--r--pkgs/stdenv/linux/default.nix4
-rw-r--r--pkgs/stdenv/native/default.nix3
-rw-r--r--pkgs/stdenv/nix/default.nix13
-rw-r--r--pkgs/top-level/all-packages.nix4
7 files changed, 18 insertions, 19 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 866be9cded9..489fb02dcb5 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -5,15 +5,15 @@
 # script that sets up the right environment variables so that the
 # compiler and the linker just "work".
 
-{ name ? "", stdenv, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
-, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
+{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
+, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenvNoCC.shell
 , zlib ? null, extraPackages ? [], extraBuildCommands ? ""
 , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
 , buildPackages ? {}
 , useMacosReexportHack ? false
 }:
 
-with stdenv.lib;
+with stdenvNoCC.lib;
 
 assert nativeTools -> nativePrefix != "";
 assert !nativeTools ->
@@ -25,6 +25,7 @@ assert (noLibc || nativeLibc) == (libc == null);
 assert cc.langVhdl or false -> zlib != null;
 
 let
+  stdenv = stdenvNoCC;
   inherit (stdenv) hostPlatform targetPlatform;
 
   # Prefix for binaries. Customarily ends with a dash separator.
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index b7f750508e8..a67ca53e1c5 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -77,7 +77,7 @@ in rec {
 
         cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
           inherit shell;
-          inherit (last) stdenv;
+          inherit (last) stdenvNoCC;
 
           nativeTools  = false;
           nativeLibc   = false;
@@ -324,7 +324,7 @@ in rec {
     shell       = "${pkgs.bash}/bin/bash";
 
     cc = lib.callPackageWith {} ../../build-support/cc-wrapper {
-      inherit (pkgs) stdenv;
+      inherit (pkgs) stdenvNoCC;
       inherit shell;
       nativeTools = false;
       nativeLibc  = false;
diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix
index c10d1515a3d..6ab8bf21726 100644
--- a/pkgs/stdenv/freebsd/default.nix
+++ b/pkgs/stdenv/freebsd/default.nix
@@ -77,7 +77,7 @@ let inherit (localSystem) system; in
         nativeTools  = true;
         nativePrefix = "/usr";
         nativeLibc   = true;
-        inherit (prevStage) stdenv;
+        stdenvNoCC = prevStage.stdenv;
         cc           = {
           name    = "clang-9.9.9";
           cc      = "/usr";
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index e79ec48e9f4..a114ab609e6 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -84,7 +84,7 @@ let
           libc = prevStage.glibc;
           inherit (prevStage) binutils coreutils gnugrep;
           name = name;
-          stdenv = prevStage.ccWrapperStdenv;
+          stdenvNoCC = prevStage.ccWrapperStdenv;
         };
 
         extraAttrs = {
@@ -244,7 +244,7 @@ in
         };
         cc = prevStage.gcc-unwrapped;
         libc = self.glibc;
-        inherit (self) stdenv binutils coreutils gnugrep;
+        inherit (self) stdenvNoCC binutils coreutils gnugrep;
         name = "";
         shell = self.bash + "/bin/bash";
       };
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix
index 9ecb56028bc..558a77281ed 100644
--- a/pkgs/stdenv/native/default.nix
+++ b/pkgs/stdenv/native/default.nix
@@ -117,6 +117,7 @@ in
       cc = null;
       fetchurl = null;
     };
+    stdenvNoCC = stdenv;
 
     cc = import ../../build-support/cc-wrapper {
       name = "cc-native";
@@ -126,7 +127,7 @@ in
         "i686-solaris" = "/usr/gnu";
         "x86_64-solaris" = "/opt/local/gcc47";
       }.${system} or "/usr";
-      inherit stdenv;
+      inherit stdenvNoCC;
     };
 
     fetchurl = import ../../build-support/fetchurl {
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix
index c736442dc0a..ffff8bdf51d 100644
--- a/pkgs/stdenv/nix/default.nix
+++ b/pkgs/stdenv/nix/default.nix
@@ -1,5 +1,5 @@
 { lib
-, crossSystem, config
+, crossSystem, config, overlays
 , bootStages
 , ...
 }:
@@ -7,9 +7,7 @@
 assert crossSystem == null;
 
 bootStages ++ [
-  (prevStage: let
-    inherit (prevStage) stdenv;
-  in {
+  (prevStage: {
     inherit config overlays;
 
     stdenv = import ../generic rec {
@@ -27,10 +25,9 @@ bootStages ++ [
 
       cc = import ../../build-support/cc-wrapper {
         nativeTools = false;
-        nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
+        nativePrefix = lib.optionalString hostPlatform.isSunOS "/usr";
         nativeLibc = true;
-        inherit stdenv;
-        inherit (prevStage) binutils coreutils gnugrep;
+        inherit (prevStage) stdenvNoCC binutils coreutils gnugrep;
         cc = prevStage.gcc.cc;
         isGNU = true;
         shell = prevStage.bash + "/bin/sh";
@@ -38,7 +35,7 @@ bootStages ++ [
 
       shell = prevStage.bash + "/bin/sh";
 
-      fetchurlBoot = stdenv.fetchurlBoot;
+      fetchurlBoot = prevStage.stdenv.fetchurlBoot;
 
       overrides = self: super: {
         inherit cc;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 860567283b8..94aebfe7fb7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6207,11 +6207,11 @@ with pkgs;
 
   wla-dx = callPackage ../development/compilers/wla-dx { };
 
-  wrapCCWith = { name ? "", cc, libc, extraBuildCommands ? "" }: ccWrapperFun {
+  wrapCCWith = { name ? "", cc, libc, extraBuildCommands ? "" }: ccWrapperFun rec {
     nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
     nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
     nativePrefix = stdenv.cc.nativePrefix or "";
-    noLibc = (libc == null);
+    noLibc = !nativeLibc && (libc == null);
 
     isGNU = cc.isGNU or false;
     isClang = cc.isClang or false;