mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
5eaea6cee0
This fixes the "sliding window" principle: 0. Run packages: build = native; host = foreign; target = foreign; 1. Build packages: build = native; host = native; target = foreign; 2. Vanilla packages: build = native; host = native; target = native; 3. Vanilla packages: build = native; host = native; target = native; n+3. ... Each stage's build dependencies are resolved against the previous stage, and the "foreigns" are shifted accordingly. Vanilla packages alone are built against themsevles, since there are no more "foreign"s to shift away. Before, build packages' build dependencies were resolved against themselves: 0. Run packages: build = native; host = foreign; target = foreign; 1. Build packages: build = native; host = native; target = foreign; 2. Build packages: build = native; host = native; target = foreign; n+2. ... This is wrong because that principle is violated by the target platform staying foreign. This will change the hashes of many build packages and run packages, but that is OK. This is an unavoidable cost of fixing cross compiling. The cross compilation docs have been updated to reflect this fix.
52 lines
1.4 KiB
Nix
52 lines
1.4 KiB
Nix
{ lib
|
|
, localSystem, crossSystem, config, overlays
|
|
}:
|
|
|
|
let
|
|
bootStages = import ../. {
|
|
inherit lib localSystem overlays;
|
|
crossSystem = null;
|
|
# Ignore custom stdenvs when cross compiling for compatability
|
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
|
};
|
|
|
|
in bootStages ++ [
|
|
|
|
# Build Packages
|
|
(vanillaPackages: {
|
|
buildPlatform = localSystem;
|
|
hostPlatform = localSystem;
|
|
targetPlatform = crossSystem;
|
|
inherit config overlays;
|
|
selfBuild = false;
|
|
# It's OK to change the built-time dependencies
|
|
allowCustomOverrides = true;
|
|
stdenv = vanillaPackages.stdenv // {
|
|
overrides = _: _: {};
|
|
};
|
|
})
|
|
|
|
# Run Packages
|
|
(buildPackages: {
|
|
buildPlatform = localSystem;
|
|
hostPlatform = crossSystem;
|
|
targetPlatform = crossSystem;
|
|
inherit config overlays;
|
|
selfBuild = false;
|
|
stdenv = if crossSystem.useiOSCross or false
|
|
then let
|
|
inherit (buildPackages.darwin.ios-cross {
|
|
prefix = crossSystem.config;
|
|
inherit (crossSystem) arch;
|
|
simulator = crossSystem.isiPhoneSimulator or false; })
|
|
cc binutils;
|
|
in buildPackages.makeStdenvCross
|
|
buildPackages.stdenv crossSystem
|
|
binutils cc
|
|
else buildPackages.makeStdenvCross
|
|
buildPackages.stdenv crossSystem
|
|
buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
|
|
})
|
|
|
|
]
|