summary refs log tree commit diff
path: root/pkgs/stdenv/adapters.nix
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/adapters.nix
parent56ed820f84101fc7b7cc47cbb1f57e616f35ac73 (diff)
downloadnixpkgs-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar
nixpkgs-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.gz
nixpkgs-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.bz2
nixpkgs-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.lz
nixpkgs-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.xz
nixpkgs-7ade207f6b75da0fde94cec621ac6d8fa6c3e586.tar.zst
nixpkgs-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/adapters.nix')
-rw-r--r--pkgs/stdenv/adapters.nix24
1 files changed, 10 insertions, 14 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index ecbe2dbcf71..85ff46a339d 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; };