summary refs log tree commit diff
path: root/pkgs/stdenv/cross
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2016-12-16 05:22:02 -0800
committerJohn Ericson <Ericson2314@Yahoo.com>2017-01-13 13:23:23 -0500
commit3e197f7d81130defacfe5bdad71ca5ebe63324ff (patch)
treed06650289f9729f647814eff912e8d39bdd523a8 /pkgs/stdenv/cross
parent0ef8b69d12d1ab1574568f5660b44feba1f44179 (diff)
downloadnixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.tar
nixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.tar.gz
nixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.tar.bz2
nixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.tar.lz
nixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.tar.xz
nixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.tar.zst
nixlib-3e197f7d81130defacfe5bdad71ca5ebe63324ff.zip
top-level: Normalize stdenv booting
Introduce new abstraction, `stdenv/booter.nix` for composing bootstraping
stages, and use it everywhere for consistency. See that file for more doc.

Stdenvs besides Linux and Darwin are completely refactored to utilize this.
Those two, due to their size and complexity, are minimally edited for
easier reviewing.

No hashes should be changed.
Diffstat (limited to 'pkgs/stdenv/cross')
-rw-r--r--pkgs/stdenv/cross/default.nix55
1 files changed, 34 insertions, 21 deletions
diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix
index 10e2a7663563..728424c0a7af 100644
--- a/pkgs/stdenv/cross/default.nix
+++ b/pkgs/stdenv/cross/default.nix
@@ -1,35 +1,48 @@
-{ lib, allPackages
+{ lib
 , system, platform, crossSystem, config
 }:
 
-rec {
-  vanillaStdenv = (import ../. {
-    inherit lib allPackages system platform;
+let
+  bootStages = import ../. {
+    inherit lib system platform;
     crossSystem = null;
     # Ignore custom stdenvs when cross compiling for compatability
     config = builtins.removeAttrs config [ "replaceStdenv" ];
-  }) // {
-    # Needed elsewhere as a hacky way to pass the target
-    cross = crossSystem;
   };
 
-  # For now, this is just used to build the native stdenv. Eventually, it should
-  # be used to build compilers and other such tools targeting the cross
+in bootStages ++ [
+
+  # Build Packages.
+  #
+  # For now, this is just used to build the native stdenv. Eventually, it
+  # should be used to build compilers and other such tools targeting the cross
   # platform. Then, `forceNativeDrv` can be removed.
-  buildPackages = allPackages {
+  (vanillaPackages: {
     inherit system platform crossSystem config;
     # It's OK to change the built-time dependencies
     allowCustomOverrides = true;
-    stdenv = vanillaStdenv;
-  };
+    stdenv = vanillaPackages.stdenv // {
+      # Needed elsewhere as a hacky way to pass the target
+      cross = crossSystem;
+    };
+  })
 
-  stdenvCross = buildPackages.makeStdenvCross
-    buildPackages.stdenv crossSystem
-    buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
+  # Run packages
+  (buildPackages: {
+    inherit system platform crossSystem config;
+    stdenv = if crossSystem.useiOSCross or false
+      then let
+          inherit (buildPackages.darwin.ios-cross {
+              prefix = crossSystem.config;
+              inherit (crossSystem) arch;
+              simulator = crossSystem.isiPhoneSimulator or false; })
+            cc binutils;
+        in buildPackages.makeStdenvCross
+          buildPackages.stdenv crossSystem
+          binutils cc
+      else buildPackages.makeStdenvCross
+        buildPackages.stdenv crossSystem
+        buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
+  })
 
-  stdenvCrossiOS = let
-    inherit (buildPackages.darwin.ios-cross { prefix = crossSystem.config; inherit (crossSystem) arch; simulator = crossSystem.isiPhoneSimulator or false; }) cc binutils;
-  in buildPackages.makeStdenvCross
-    buildPackages.stdenv crossSystem
-    binutils cc;
-}
+]