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-19 19:03:34 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2009-11-19 19:03:34 +0000
commit7ade207f6b75da0fde94cec621ac6d8fa6c3e586 (patch)
treeb5994c723b674476a839f5ccbadb7431bce3f9b3 /pkgs/stdenv
parent56ed820f84101fc7b7cc47cbb1f57e616f35ac73 (diff)
downloadnixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar
nixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.gz
nixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.bz2
nixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.lz
nixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.xz
nixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.zst
nixlib-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.zip
- Removed all *NoCross expressions I dupilcated in nixpkgs, while maintaining
  the cross compilation functionality.
- I renamed some expected stdenv.mkDerivation parameter attributes so we can
  keep this branch properly updated from trunk. We agreed with Nicolas Pierron
  doing a massive renaming, so all current buildInputs become hostInputs (input
  as build for the host machine, in autotools terminology) , and
  then buildInputs would mean "input as for the build machine".
  By now, the specific "input as for the build machine" is specified through
  buildNativeInputs. We should fix this in the merge to trunk.
- I made the generic stdenv understand the buildNativeInputs, otherwise if
  we start changing nixpkgs expressions so they distinguish the current
  buildInputs into buildInputs and buildNativeInputs, we could break even more
  nixpkgs for other platforms.
- I changed the default result of mkDerivation so it becomes the derivation for
  to be run in the build machine. This allows, without any special rewriting,
  "fetchurl" derivations to be always results for the build machine to use
  them.
- The change above implies that, for anyone wanting to cross-compile, has to
  build the hostDrv of the wanted derivation. For example, after this commit,
  the usual test of "nix-build -A bison.hostDrv arm.nix" works. I described
  the contents of this arm.nix in r18398.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18471
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/adapters.nix24
-rw-r--r--pkgs/stdenv/generic/default.nix10
-rw-r--r--pkgs/stdenv/linux/default.nix1
3 files changed, 18 insertions, 17 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index ecbe2dbcf71d..85ff46a339df 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -110,29 +110,25 @@ rec {
   # Return a modified stdenv that adds a cross compiler to the
   # builds.
   makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv //
-    { mkDerivation = {name, buildInputs ? [], hostInputs ? [],
-            propagatedBuildInputs ? [], propagatedHostInputs ? [], ...}@args: let
+    { mkDerivation = {name, buildInputs ? [], buildNativeInputs ? [],
+            propagatedBuildInputs ? [], ...}@args: let
             # propagatedBuildInputs exists temporarily as another name for
             # propagatedHostInputs.
-            buildInputsDrvs = map (drv: drv.buildDrv) buildInputs;
-            hostInputsDrvs = map (drv: drv.hostDrv) hostInputs;
-            propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs
-                ++ propagatedHostInputs);
-            buildDrv = stdenv.mkDerivation (args // {
-                # buildInputs in the base stdenv will be named hostInputs
-                buildInputs = buildInputsDrvs ++ hostInputsDrvs;
-                # Should be propagatedHostInputs one day:
-                propagatedBuildInputs = propagatedHostInputsDrvs;
-            });
+            getBuildDrv = drv : if (drv ? buildDrv) then drv.buildDrv else drv;
+            buildInputsDrvs = map (getBuildDrv) buildNativeInputs;
+            hostInputsDrvs = map (drv: drv.hostDrv) buildInputs;
+            hostInputsDrvsAsBuildInputs = map (getBuildDrv) buildInputs;
+            propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs);
+            buildDrv = stdenv.mkDerivation args;
             hostDrv = if (cross == null) then buildDrv else
-                stdenv.mkDerivation (args // { 
+                stdenv.mkDerivation (args // {
                     name = name + "-" + cross.config;
                     buildInputs = buildInputsDrvs
                       ++ [ gccCross binutilsCross ];
 
                     crossConfig = cross.config;
                 });
-        in hostDrv // {
+        in buildDrv // {
             inherit hostDrv buildDrv;
         };
     } // { inherit cross; };
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index de525d479f95..d9ce8d6f825d 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -45,14 +45,20 @@ let
         mkDerivation = attrs:
           (derivation (
             (removeAttrs attrs ["meta" "passthru"])
-            //
+            // (let
+                buildInputs = if attrs ? buildInputs then attrs.buildInputs
+                    else [];
+                buildNativeInputs = if attrs ? buildNativeInputs then attrs.buildNativeInputs
+                    else [];
+            in
             {
               builder = if attrs ? realBuilder then attrs.realBuilder else shell;
               args = if attrs ? args then attrs.args else
                 ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
               stdenv = result;
               system = result.system;
-            })
+              buildInputs = buildInputs ++ buildNativeInputs;
+            }))
           )
           # The meta attribute is passed in the resulting attribute set,
           # but it's not part of the actual derivation, i.e., it's not
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index cf67e7071736..e04b81b152b2 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -93,7 +93,6 @@ rec {
       extraAttrs = extraAttrs // {inherit fetchurl;};
     };
 
-
   # Build a dummy stdenv with no GCC or working fetchurl.  This is
   # because we need a stdenv to build the GCC wrapper and fetchurl.
   stdenvLinuxBoot0 = stdenvBootFun {