diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2016-12-16 05:22:02 -0800 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2017-01-13 13:23:23 -0500 |
commit | 3e197f7d81130defacfe5bdad71ca5ebe63324ff (patch) | |
tree | d06650289f9729f647814eff912e8d39bdd523a8 /pkgs/stdenv/native | |
parent | 0ef8b69d12d1ab1574568f5660b44feba1f44179 (diff) |
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/native')
-rw-r--r-- | pkgs/stdenv/native/default.nix | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index 5a2d2c965599e..57182fae5236e 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -1,10 +1,10 @@ -{ lib, allPackages +{ lib , system, platform, crossSystem, config }: assert crossSystem == null; -rec { +let shell = if system == "i686-freebsd" || system == "x86_64-freebsd" then "/usr/local/bin/bash" @@ -101,50 +101,54 @@ rec { inherit system shell cc overrides config; }; +in - stdenvBoot0 = makeStdenv { - cc = null; - fetchurl = null; - }; +[ + ({}: rec { + __raw = true; - cc = import ../../build-support/cc-wrapper { - name = "cc-native"; - nativeTools = true; - nativeLibc = true; - nativePrefix = if system == "i686-solaris" then "/usr/gnu" else if system == "x86_64-solaris" then "/opt/local/gcc47" else "/usr"; - stdenv = stdenvBoot0; - }; + stdenv = makeStdenv { + cc = null; + fetchurl = null; + }; + cc = import ../../build-support/cc-wrapper { + name = "cc-native"; + nativeTools = true; + nativeLibc = true; + nativePrefix = { # switch + "i686-solaris" = "/usr/gnu"; + "x86_64-solaris" = "/opt/local/gcc47"; + }.${system} or "/usr"; + inherit stdenv; + }; - fetchurl = import ../../build-support/fetchurl { - stdenv = stdenvBoot0; - # Curl should be in /usr/bin or so. - curl = null; - }; + fetchurl = import ../../build-support/fetchurl { + inherit stdenv; + # Curl should be in /usr/bin or so. + curl = null; + }; + }) # First build a stdenv based only on tools outside the store. - stdenvBoot1 = makeStdenv { - inherit cc fetchurl; - } // {inherit fetchurl;}; - - stdenvBoot1Pkgs = allPackages { - inherit system platform crossSystem config; - allowCustomOverrides = false; - stdenv = stdenvBoot1; - }; - - - # Using that, build a stdenv that adds the ‘xz’ command (which most - # systems don't have, so we mustn't rely on the native environment - # providing it). - stdenvBoot2 = makeStdenv { - inherit cc fetchurl; - extraPath = [ stdenvBoot1Pkgs.xz ]; - overrides = self: super: { inherit (stdenvBoot1Pkgs) xz; }; - }; - + (prevStage: { + inherit system crossSystem platform config; + stdenv = makeStdenv { + inherit (prevStage) cc fetchurl; + } // { inherit (prevStage) fetchurl; }; + }) + + # Using that, build a stdenv that adds the ‘xz’ command (which most systems + # don't have, so we mustn't rely on the native environment providing it). + (prevStage: { + inherit system crossSystem platform config; + stdenv = makeStdenv { + inherit (prevStage.stdenv) cc fetchurl; + extraPath = [ prevStage.xz ]; + overrides = self: super: { inherit (prevStage) xz; }; + }; + }) - stdenvNative = stdenvBoot2; -} +] |