From e22346c35ee8cb872d0587320083ba44230bd44b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 6 Nov 2016 21:27:38 -0800 Subject: top-level: Make stdenvCross which appears at first glance normal... ...but actually is weird just like the original --- pkgs/stdenv/cross/default.nix | 27 +++++++++++++++++++++++++++ pkgs/stdenv/default.nix | 7 +++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 pkgs/stdenv/cross/default.nix (limited to 'pkgs/stdenv') diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix new file mode 100644 index 000000000000..d78061db712e --- /dev/null +++ b/pkgs/stdenv/cross/default.nix @@ -0,0 +1,27 @@ +{ system, allPackages, platform, crossSystem, config, ... } @ args: + +rec { + vanillaStdenv = (import ../. (args // { + crossSystem = null; + allPackages = args: allPackages ({ crossSystem = null; } // args); + })).stdenv; + + # Yeah this isn't so cleanly just build-time packages yet. Notice the + # buildPackages <-> stdenvCross cycle. Yup, it's very weird. + # + # This works because the derivation used to build `stdenvCross` are in + # fact using `forceNativeDrv` to use the `nativeDrv` attribute of the resulting + # derivation built with `vanillaStdenv` (second argument of `makeStdenvCross`). + # + # Eventually, `forceNativeDrv` should be removed and the cycle broken. + buildPackages = allPackages { + # It's OK to change the built-time dependencies + allowCustomOverrides = true; + bootStdenv = stdenvCross; + inherit system platform crossSystem config; + }; + + stdenvCross = buildPackages.makeStdenvCross + vanillaStdenv crossSystem + buildPackages.binutilsCross buildPackages.gccCrossStageFinal; +} diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index 3035d87e1fc5..59088bfdf3bf 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -5,7 +5,7 @@ # Posix utilities, the GNU C compiler, and so on. On other systems, # we use the native C library. -{ system, allPackages ? import ../.., platform, config, lib }: +{ system, allPackages ? import ../.., platform, config, crossSystem, lib }: rec { @@ -36,10 +36,13 @@ rec { # Linux standard environment. inherit (import ./linux { inherit system allPackages platform config lib; }) stdenvLinux; - inherit (import ./darwin { inherit system allPackages platform config;}) stdenvDarwin; + inherit (import ./darwin { inherit system allPackages platform config; }) stdenvDarwin; + + inherit (import ./cross { inherit system allPackages platform crossSystem config lib; }) stdenvCross; # Select the appropriate stdenv for the platform `system'. stdenv = + if crossSystem != null then stdenvCross else if system == "i686-linux" then stdenvLinux else if system == "x86_64-linux" then stdenvLinux else if system == "armv5tel-linux" then stdenvLinux else -- cgit 1.4.1