From 7ade207f6b75da0fde94cec621ac6d8fa6c3e586 Mon Sep 17 00:00:00 2001 From: LluĂ­s Batlle i Rossell Date: Thu, 19 Nov 2009 19:03:34 +0000 Subject: - 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 --- pkgs/stdenv/adapters.nix | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'pkgs/stdenv/adapters.nix') 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; }; -- cgit 1.4.1