about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2009-11-17 21:14:57 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2009-11-17 21:14:57 +0000
commit0c631f61819e680bc689d432e6c67e4e0da294fb (patch)
treec5750e2126a7d4b268f21a4d5e1873aa5a1ccaf2 /pkgs/stdenv
parent2c7fa189fb2ac1c4ef689398ab13a4465448856a (diff)
Trying to move all stdenv cross-compiling details out of the stdenv expression,
into a stdenv adapater.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18397
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/adapters.nix12
-rw-r--r--pkgs/stdenv/default.nix4
-rw-r--r--pkgs/stdenv/generic/default.nix4
-rw-r--r--pkgs/stdenv/linux/default.nix20
4 files changed, 18 insertions, 22 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index db38036615316..1191748fb5600 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -107,6 +107,18 @@ rec {
       isStatic = true;
     } // {inherit fetchurl;};
 
+  # Return a modified stdenv that adds a cross compiler to the
+  # builds.
+  makeStdenvCross = stdenv: binutilsCross : gccCross: stdenv //
+    { mkDerivation = args: stdenv.mkDerivation (args // {
+        
+        buildInputs =
+          (if args ? buildInputs then args.buildInputs else [])
+          ++ [ gccCross binutilsCross ];
+
+        crossConfig = gccCross.cross.config;
+      });
+    };
 
   /* Modify a stdenv so that the specified attributes are added to
      every derivation returned by its mkDerivation function.
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix
index 19bbb371a31c8..ed8f0e39f5f89 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 ? import ../.., cross ? null}:
+{system, stdenvType ? system, allPackages ? import ../..}:
 
 assert system != "i686-cygwin" -> system == stdenvType;
 
@@ -41,7 +41,7 @@ rec {
 
 
   # Linux standard environment.
-  stdenvLinux = (import ./linux {inherit system allPackages cross;}).stdenvLinux;
+  stdenvLinux = (import ./linux {inherit system allPackages;}).stdenvLinux;
 
     
   # MinGW/MSYS standard environment.
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index a8eab154db4e1..de525d479f956 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -1,5 +1,4 @@
 { system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
-, cross ? null
 , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
 , extraAttrs ? {}
 
@@ -53,9 +52,6 @@ let
                 ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
               stdenv = result;
               system = result.system;
-              # The env variable 'cross' is used in all the crosscompiler
-              # bootstrapping in another sense
-              crossTarget = if (cross != null) then cross.config else null;
             })
           )
           # The meta attribute is passed in the resulting attribute set,
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 9a90e4b28df8d..cf67e7071736b 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -5,8 +5,7 @@
 # ensuring purity of components produced by it.
 
 # The function defaults are for easy testing.
-{system ? "i686-linux", allPackages ? import ../../top-level/all-packages.nix,
-cross ? null}:
+{system ? "i686-linux", allPackages ? import ../../top-level/all-packages.nix}:
 
 rec {
 
@@ -205,26 +204,15 @@ rec {
   #    When updating stdenvLinux, make sure that the result has no
   #    dependency (`nix-store -qR') on bootstrapTools.
   stdenvLinux = import ../generic {
-    name = "stdenv-linux" +
-      stdenvLinuxBoot3Pkgs.lib.optionalString (cross != null) "-${cross.config}";
+    name = "stdenv-linux";
     
-    inherit system cross;
+    inherit system;
     
     preHook = builtins.toFile "prehook.sh" commonPreHook;
     
     initialPath = 
       ((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;})
-      ++ [stdenvLinuxBoot3Pkgs.patchelf]
-      ++ stdenvLinuxBoot3Pkgs.lib.optionals (cross != null)
-        [ (stdenvLinuxBoot3Pkgs.binutilsCross cross)
-           (stdenvLinuxBoot3Pkgs.gccCrossStageFinal cross) ];
-
-    postHook = if (cross != null) then
-        (builtins.toFile "cross-posthook.sh" ''
-            configureFlags="$configureFlags --build=${system} --host=${cross.config}"
-            dontStrip=1
-        '')
-        else null;
+      ++ [stdenvLinuxBoot3Pkgs.patchelf];
 
     gcc = wrapGCC rec {
       inherit (stdenvLinuxBoot2Pkgs) binutils;