From e7c8e8da4f3f2b77c96eeebfe7e8d42a1dab85fa Mon Sep 17 00:00:00 2001 From: LluĂ­s Batlle i Rossell Date: Tue, 17 Nov 2009 22:58:48 +0000 Subject: I made the whole nixpkgs dependencies available to the cross compiler, no needing to keep a new tree of expressions apart for the expressions to get cross-compiled. I changed the whole way of using cross compilation with nixpkgs, which before was done through a simple adapter. Now the adapter became complex, and I've tried to avoid the most obvious recursivities. For example, the fetchurl expression should never be cross-compiled, as the gmp, mpfr, and some others, like some ncurses, perl, ... I made overrided copies of those necessary as perlNoCross, ncursesNoCross, as stdenvNoCross, keeping in mind that the stdenv (capable of cross compilation) is built upon stdenvNoCross using an adapter. So, to cross compile, instead of building using "nixpkgs/default.nix", you should build with your own "myarchiteture.nix", which should have contents like these, for example: import /etc/nixos/nixpkgs/default.nix { crossSystem = { config = "armv5tel-unknown-linux-gnueabi"; bigEndian = false; arch = "arm"; float = "soft"; }; } svn path=/nixpkgs/branches/stdenv-updates/; revision=18398 --- pkgs/stdenv/adapters.nix | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 1191748fb56..edf3980cd78 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -109,16 +109,38 @@ rec { # 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; - }); - }; + makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // + { mkDerivation = {name, buildInputs ? null, hostInputs ? null, + propagatedBuildInputs ? null, propagatedHostInputs ? null, ...}@args: let + buildInputsList = if (buildInputs != null) then + buildInputs else []; + hostInputsList = if (hostInputs != null) then + hostInputs else []; + propagatedBuildInputsList = if (propagatedBuildInputs != null) then + propagatedBuildInputs else []; + propagatedHostInputsList = if (propagatedHostInputs != null) then + propagatedHostInputs else []; + buildInputsDrvs = map (drv: drv.buildDrv) buildInputsList; + hostInputsDrvs = map (drv: drv.hostDrv) hostInputsList; + propagatedBuildInputsDrvs = map (drv: drv.buildDrv) propagatedBuildInputsList; + propagatedHostInputsDrvs = map (drv: drv.buildDrv) propagatedHostInputsList; + buildDrv = stdenv.mkDerivation (args // { + buildInputs = buildInputsDrvs ++ hostInputsDrvs; + propagatedBuildInputs = propagatedBuildInputsDrvs ++ + propagatedHostInputsDrvs; + }); + hostDrv = if (cross == null) then buildDrv else + stdenv.mkDerivation (args // { + name = name + "-" + cross.config; + buildInputs = buildInputsDrvs + ++ [ gccCross binutilsCross ]; + + crossConfig = cross.config; + }); + in hostDrv // { + inherit hostDrv buildDrv; + }; + } // { inherit cross; }; /* Modify a stdenv so that the specified attributes are added to every derivation returned by its mkDerivation function. -- cgit 1.4.1