stdenv: implement crossOverlays

crossOverlays only apply to the packages being built, not the build
packages. It is useful when you don’t care what is used to build your
packages, just what is being built. The idea relies heavily on the
cross compiling infrastructure. Using this implies that we need to
create a cross stdenv.
This commit is contained in:
Matthew Bauer
2018-12-04 21:06:46 -06:00
parent 9d8de9ffaa
commit a3a6ad7a01
9 changed files with 28 additions and 20 deletions
+9 -4
View File
@@ -1,11 +1,14 @@
{ lib
, localSystem, crossSystem, config, overlays
, localSystem, crossSystem, config, overlays, crossOverlays ? []
}:
let
bootStages = import ../. {
inherit lib localSystem overlays;
crossSystem = null;
crossSystem = localSystem;
crossOverlays = [];
# Ignore custom stdenvs when cross compiling for compatability
config = builtins.removeAttrs config [ "replaceStdenv" ];
};
@@ -33,7 +36,8 @@ in lib.init bootStages ++ [
# Run Packages
(buildPackages: {
inherit config overlays;
inherit config;
overlays = overlays ++ crossOverlays;
selfBuild = false;
stdenv = buildPackages.stdenv.override (old: rec {
buildPlatform = localSystem;
@@ -48,7 +52,7 @@ in lib.init bootStages ++ [
cc = if crossSystem.useiOSPrebuilt or false
then buildPackages.darwin.iosSdkPkgs.clang
else if crossSystem.useAndroidPrebuilt
else if crossSystem.useAndroidPrebuilt or false
then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc
else buildPackages.gcc;
@@ -56,6 +60,7 @@ in lib.init bootStages ++ [
++ lib.optionals
(hostPlatform.isLinux && !buildPlatform.isLinux)
[ buildPackages.patchelf buildPackages.paxctl ]
++ lib.optional hostPlatform.isDarwin buildPackages.clang
++ lib.optional
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
buildPackages.updateAutotoolsGnuConfigScriptsHook
+1 -1
View File
@@ -2,7 +2,7 @@
, localSystem, crossSystem, config, overlays
}:
assert crossSystem == null;
assert crossSystem == localSystem;
let
bootStages = import ../. {
+2 -2
View File
@@ -1,5 +1,5 @@
{ lib
, localSystem, crossSystem, config, overlays
, localSystem, crossSystem, config, overlays, crossOverlays ? []
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
, bootstrapFiles ? let
@@ -16,7 +16,7 @@
}
}:
assert crossSystem == null;
assert crossSystem == localSystem;
let
inherit (localSystem) system platform;
+2 -2
View File
@@ -7,7 +7,7 @@
{ # Args just for stdenvs' usage
lib
# Args to pass on to the pkgset builder, too
, localSystem, crossSystem, config, overlays
, localSystem, crossSystem, config, overlays, crossOverlays ? []
} @ args:
let
@@ -36,7 +36,7 @@ let
# Select the appropriate stages for the platform `system'.
in
if crossSystem != null then stagesCross
if crossSystem != localSystem || crossOverlays != [] then stagesCross
else if config ? replaceStdenv then stagesCustom
else { # switch
"i686-linux" = stagesLinux;
+1 -1
View File
@@ -2,7 +2,7 @@
, localSystem, crossSystem, config, overlays
}:
assert crossSystem == null;
assert crossSystem == localSystem;
let inherit (localSystem) system; in
+2 -2
View File
@@ -4,7 +4,7 @@
# compiler and linker that do not search in default locations,
# ensuring purity of components produced by it.
{ lib
, localSystem, crossSystem, config, overlays
, localSystem, crossSystem, config, overlays, crossOverlays ? []
, bootstrapFiles ?
let table = {
@@ -32,7 +32,7 @@
in files
}:
assert crossSystem == null;
assert crossSystem == localSystem;
let
inherit (localSystem) system platform;
+1 -1
View File
@@ -2,7 +2,7 @@
, localSystem, crossSystem, config, overlays
}:
assert crossSystem == null;
assert crossSystem == localSystem;
let
inherit (localSystem) system;
+2 -2
View File
@@ -1,10 +1,10 @@
{ lib
, crossSystem, config, overlays
, crossSystem, localSystem, config, overlays
, bootStages
, ...
}:
assert crossSystem == null;
assert crossSystem == localSystem;
bootStages ++ [
(prevStage: {