summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-02-02 15:03:38 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-02-02 15:03:38 +0000
commit1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6 (patch)
tree41d0cdffd3840e346797417a210aaac34ff4b04a /pkgs/stdenv
parent3e727ebe97d37394c06c0de28635535cd527e0ab (diff)
downloadnixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.tar
nixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.tar.gz
nixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.tar.bz2
nixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.tar.lz
nixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.tar.xz
nixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.tar.zst
nixpkgs-1dee2d3de0baf12ac4dd700c95c6a4da54bfaaf6.zip
* Fix stdenvNative/stdenvNix.
svn path=/nixpkgs/branches/stdenv-updates/; revision=13957
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/default.nix19
-rw-r--r--pkgs/stdenv/generic/default.nix9
-rw-r--r--pkgs/stdenv/initial/builder.sh5
-rw-r--r--pkgs/stdenv/initial/default.nix32
-rw-r--r--pkgs/stdenv/linux/default.nix9
-rw-r--r--pkgs/stdenv/native/default.nix76
-rw-r--r--pkgs/stdenv/nix/default.nix3
7 files changed, 60 insertions, 93 deletions
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix
index d8bab3c4206..4dbc3a8d176 100644
--- a/pkgs/stdenv/default.nix
+++ b/pkgs/stdenv/default.nix
@@ -10,7 +10,7 @@
 # system, e.g., cygwin and mingw builds on i686-cygwin.  Most people
 # can ignore it.
 
-{system, stdenvType ? system, allPackages}:
+{system, stdenvType ? system, allPackages ? import ../..}:
 
 assert system != "i686-cygwin" -> system == stdenvType;
 
@@ -18,21 +18,14 @@ assert system != "i686-cygwin" -> system == stdenvType;
 rec {
 
 
-  # Trivial environment used for building other environments.
-  stdenvInitial = import ./initial {
-    name = "stdenv-initial";
-    inherit system;
-  };
-
-
   # The native (i.e., impure) build environment.  This one uses the
   # tools installed on the system outside of the Nix environment,
   # i.e., the stuff in /bin, /usr/bin, etc.  This environment should
   # be used with care, since many Nix packages will not build properly
   # with it (e.g., because they require GNU Make).
-  stdenvNative = import ./native {
-    inherit stdenvInitial;
-  };
+  stdenvNative = (import ./native {
+    inherit system allPackages;
+  }).stdenv;
 
   stdenvNativePkgs = allPackages {
     bootStdenv = stdenvNative;
@@ -41,10 +34,10 @@ rec {
 
 
   # The Nix build environment.
-  stdenvNix = import ./nix (rec {
+  stdenvNix = import ./nix {
     stdenv = stdenvNative;
     pkgs = stdenvNativePkgs;
-  });
+  };
 
 
   # Linux standard environment.
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 40baec26f94..77e1c20430b 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -1,7 +1,10 @@
 { system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
 , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
 , extraAttrs ? {}
-, fetchurlBoot, forceFetchurlBoot
+
+, # The `fetchurl' to use for downloading curl and its dependencies
+  # (see all-packages.nix).
+  fetchurlBoot
 }:
 
 let {
@@ -82,9 +85,7 @@ let {
       # "lift" packages like curl from the final stdenv for Linux to
       # all-packages.nix for that platform (meaning that it has a line
       # like curl = if stdenv ? curl then stdenv.curl else ...).
-      // extraAttrs
-
-      // (if forceFetchurlBoot then {fetchurl = fetchurlBoot;} else {});
+      // extraAttrs;
 
   }.result;
 
diff --git a/pkgs/stdenv/initial/builder.sh b/pkgs/stdenv/initial/builder.sh
deleted file mode 100644
index 8d287286a9c..00000000000
--- a/pkgs/stdenv/initial/builder.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-export PATH=/usr/bin:/bin
-
-mkdir $out
-
-sed -e "s^@initialPath@^/usr /^" -e "s^@preHook@^^" -e "s^@postHook@^^" -e "s^@shell@^/bin/sh^" < $stdenvScript > $out/setup
diff --git a/pkgs/stdenv/initial/default.nix b/pkgs/stdenv/initial/default.nix
deleted file mode 100644
index 1532406ba8b..00000000000
--- a/pkgs/stdenv/initial/default.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-# Here we construct an absolutely trivial `initial' standard
-# environment.  It's not actually a functional stdenv, since there is
-# not necessarily a working C compiler.  We need this to build
-# gcc-wrapper et al. for the native stdenv.
-
-{system, name}:
-
-let {
-
-  shell = "/bin/bash";
-
-  body = 
-
-    derivation {
-      inherit system name;
-      builder = shell;
-      args = ["-e" ./builder.sh];
-      stdenvScript = ../generic/setup.sh;
-    }
-
-    // {
-      mkDerivation = attrs: derivation ((removeAttrs attrs ["meta"]) // {
-        builder = shell;
-        args = ["-e" attrs.builder];
-        stdenv = body;
-        system = body.system;
-      });
-
-      inherit shell;
-    };
-
-}
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 4504c7faec1..8fbaee6a86a 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -22,6 +22,7 @@ rec {
   # 1) Create a standard environment by downloading pre-built binaries
   # of coreutils, GCC, etc.
 
+  
   # This function downloads a file.
   download = {url, sha256}: derivation {
     name = baseNameOf (toString url);
@@ -34,6 +35,7 @@ rec {
     impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
   };
 
+  
   # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
   bootstrapTools = derivation {
     name = "bootstrap-tools";
@@ -77,8 +79,8 @@ rec {
       shell = "${bootstrapTools}/bin/sh";
       initialPath = [bootstrapTools] ++ extraPath;
       fetchurlBoot = fetchurl;
-      forceFetchurlBoot = true;
-      inherit gcc extraAttrs;
+      inherit gcc;
+      extraAttrs = extraAttrs // {inherit fetchurl;};
     };
 
 
@@ -215,8 +217,7 @@ rec {
 
     shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
     
-    fetchurlBoot = stdenvLinuxBoot3.fetchurlBoot;
-    forceFetchurlBoot = false;
+    fetchurlBoot = fetchurl;
     
     extraAttrs = {
       inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix
index ee2f9e9eb9f..248cc2a3357 100644
--- a/pkgs/stdenv/native/default.nix
+++ b/pkgs/stdenv/native/default.nix
@@ -1,11 +1,11 @@
-{stdenvInitial}:
+{system, allPackages ? import ../../..}:
 
-let
-
-  system = stdenvInitial.system;
+rec {
 
   shell = "/bin/bash";
 
+  path = ["/" "/usr" "/usr/local"];
+
 
   prehookBase = builtins.toFile "prehook-base.sh" ''
     # Disable purity tests; it's allowed (even needed) to link to
@@ -46,44 +46,53 @@ let
 
   # A function that builds a "native" stdenv (one that uses tools in
   # /usr etc.).  
-  makeStdenv = {stdenvBoot, extraPath, forceFetchurlBoot}: import ../generic {
-    name = "stdenv-native";
+  makeStdenv =
+    {gcc, fetchurl, extraPath ? []}:
+
+    import ../generic {
+      name = "stdenv-native";
 
-    preHook =
-      if system == "i686-darwin" || system == "powerpc-darwin" then prehookDarwin else
-      if system == "i686-freebsd" then prehookFreeBSD else
-      prehookBase;
+      preHook =
+        if system == "i686-darwin" || system == "powerpc-darwin" then prehookDarwin else
+        if system == "i686-freebsd" then prehookFreeBSD else
+        prehookBase;
 
-    initialPath = extraPath ++ ["/" "/usr" "/usr/local"];
+      initialPath = extraPath ++ path;
 
-    stdenv = stdenvBoot;
+      fetchurlBoot = fetchurl;
 
-    gcc = import ../../build-support/gcc-wrapper {
-      name = "gcc-native";
-      nativeTools = true;
-      nativeLibc = true;
-      nativePrefix = "/usr";
-      stdenv = stdenvBoot;
+      inherit system shell gcc;
     };
 
-    inherit shell forceFetchurlBoot;
 
-    fetchurlBoot = import ../../build-support/fetchurl {
-      stdenv = stdenvBoot;
-      # Curl should be in /usr/bin or so.
-      curl = null;
-    };
+  stdenvBoot0 = makeStdenv {
+    gcc = "/no-such-path";
+    fetchurl = null;
+  };
+  
+
+  gcc = import ../../build-support/gcc-wrapper {
+    name = "gcc-native";
+    nativeTools = true;
+    nativeLibc = true;
+    nativePrefix = "/usr";
+    stdenv = stdenvBoot0;
   };
 
-
+    
+  fetchurl = import ../../build-support/fetchurl {
+    stdenv = stdenvBoot0;
+    # Curl should be in /usr/bin or so.
+    curl = null;
+  };
+  
+    
   # First build a stdenv based only on tools outside the store.
   stdenvBoot1 = makeStdenv {
-    stdenvBoot = stdenvInitial;
-    extraPath = [];
-    forceFetchurlBoot = true;
-  };
+    inherit gcc fetchurl;
+  } // {inherit fetchurl;};
 
-  stdenvBoot1Pkgs = import ../../.. {
+  stdenvBoot1Pkgs = allPackages {
     inherit system;
     bootStdenv = stdenvBoot1;
   };
@@ -93,9 +102,10 @@ let
   # most systems don't have, so we mustn't rely on the native
   # environment providing it).
   stdenvBoot2 = makeStdenv {
-    stdenvBoot = stdenvBoot1;
+    inherit gcc fetchurl;
     extraPath = [stdenvBoot1Pkgs.replace];
-    forceFetchurlBoot = false;
   };
 
-in stdenvBoot2
+
+  stdenv = stdenvBoot2;
+}
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix
index 23471267302..521f381eed2 100644
--- a/pkgs/stdenv/nix/default.nix
+++ b/pkgs/stdenv/nix/default.nix
@@ -5,7 +5,7 @@ import ../generic {
   preHook = ./prehook.sh;
   initialPath = (import ../common-path.nix) {pkgs = pkgs;};
 
-  inherit stdenv;
+  system = stdenv.system;
 
   gcc = import ../../build-support/gcc-wrapper {
     nativeTools = false;
@@ -23,5 +23,4 @@ import ../generic {
   shell = pkgs.bash + "/bin/sh";
 
   fetchurlBoot = stdenv.fetchurlBoot;
-  forceFetchurlBoot = false;
 }