summary refs log tree commit diff
path: root/pkgs/stdenv/booter.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-10-18 14:05:39 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-11-05 17:10:53 -0500
commit4d4f94cde4d3806ca063ebf7e6ba448b0feae355 (patch)
treeab5b2aa5e33137b0832999a9a15d6740855c963f /pkgs/stdenv/booter.nix
parent70d91badf57bbe4cd884e5da22b14662dd36009c (diff)
downloadnixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.tar
nixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.tar.gz
nixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.tar.bz2
nixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.tar.lz
nixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.tar.xz
nixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.tar.zst
nixlib-4d4f94cde4d3806ca063ebf7e6ba448b0feae355.zip
treewide: Depend on targetPackages.stdenv.cc.bintools instead of binutils directly
One should do this when needed executables at run time. It is more
honest and cross-friendly than refering to binutils directly, if one
neeeds the default binary tools for the target platform, rather than
binutils in particular.
Diffstat (limited to 'pkgs/stdenv/booter.nix')
-rw-r--r--pkgs/stdenv/booter.nix23
1 files changed, 18 insertions, 5 deletions
diff --git a/pkgs/stdenv/booter.nix b/pkgs/stdenv/booter.nix
index a8f8be75545c..7364a586fc2a 100644
--- a/pkgs/stdenv/booter.nix
+++ b/pkgs/stdenv/booter.nix
@@ -47,13 +47,13 @@ stageFuns: let
      same as
 
        let
-         f_-1  = lnul;
+         f_-1  = lnul f_0;
          f_0   = op f_-1   x_0  f_1;
          f_1   = op f_0    x_1  f_2;
          f_2   = op f_1    x_2  f_3;
          ...
          f_n   = op f_n-1  x_n  f_n+1;
-         f_n+1 = rnul;
+         f_n+1 = rnul f_n;
        in
          f_0
   */
@@ -62,13 +62,15 @@ stageFuns: let
       len = builtins.length list;
       go = pred: n:
         if n == len
-        then rnul
+        then rnul pred
         else let
           # Note the cycle -- call-by-need ensures finite fold.
           cur  = op pred (builtins.elemAt list n) succ;
           succ = go cur (n + 1);
         in cur;
-    in go lnul 0;
+      lapp = lnul cur;
+      cur = go lapp 0;
+    in cur;
 
   # Take the list and disallow custom overrides in all but the final stage,
   # and allow it in the final flag. Only defaults this boolean field if it
@@ -101,4 +103,15 @@ stageFuns: let
       targetPackages = if args.selfBuild or true then null else nextStage;
     });
 
-in dfold folder {} {} withAllowCustomOverrides
+  # This is a hack for resolving cross-compiled compilers' run-time
+  # deps. (That is, compilers that are themselves cross-compiled, as
+  # opposed to used to cross-compile packages.)
+  postStage = buildPackages: {
+    __raw = true;
+    stdenv.cc =
+      if buildPackages.stdenv.cc.isClang or false
+      then buildPackages.clang
+      else buildPackages.gcc;
+  };
+
+in dfold folder postStage (_: {}) withAllowCustomOverrides