607063f61b
/cc @Ericson2314 PR was https://github.com/NixOS/nixpkgs/pull/46857 This line broke MacOS cross compilation. paxctl cannot be built on macOS. Maybe it can be fixed, but no reason to break things unnecessarily. Regardless, you definitely need to be more careful about backporting. I think it’s fine to move fast and break things on master but with release-18.09 we should be more careful. Something like more automated testing for cross compilation would also be helpful (hopefully even making it block). (cherry picked from commit f9c4075873cb56464126f993d22a1a72f7cfac45)
67 lines
2.2 KiB
Nix
67 lines
2.2 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 lib.init bootStages ++ [
|
|
|
|
# Regular native packages
|
|
(somePrevStage: lib.last bootStages somePrevStage // {
|
|
# It's OK to change the built-time dependencies
|
|
allowCustomOverrides = true;
|
|
})
|
|
|
|
# Build tool Packages
|
|
(vanillaPackages: {
|
|
inherit config overlays;
|
|
selfBuild = false;
|
|
stdenv =
|
|
assert vanillaPackages.stdenv.buildPlatform == localSystem;
|
|
assert vanillaPackages.stdenv.hostPlatform == localSystem;
|
|
assert vanillaPackages.stdenv.targetPlatform == localSystem;
|
|
vanillaPackages.stdenv.override { targetPlatform = crossSystem; };
|
|
# It's OK to change the built-time dependencies
|
|
allowCustomOverrides = true;
|
|
})
|
|
|
|
# Run Packages
|
|
(buildPackages: {
|
|
inherit config overlays;
|
|
selfBuild = false;
|
|
stdenv = buildPackages.stdenv.override (old: rec {
|
|
buildPlatform = localSystem;
|
|
hostPlatform = crossSystem;
|
|
targetPlatform = crossSystem;
|
|
|
|
# Prior overrides are surely not valid as packages built with this run on
|
|
# a different platform, and so are disabled.
|
|
overrides = _: _: {};
|
|
extraBuildInputs = [ ]; # Old ones run on wrong platform
|
|
allowedRequisites = null;
|
|
|
|
cc = if crossSystem.useiOSPrebuilt or false
|
|
then buildPackages.darwin.iosSdkPkgs.clang
|
|
else if crossSystem.useAndroidPrebuilt
|
|
then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc
|
|
else buildPackages.gcc;
|
|
|
|
extraNativeBuildInputs = old.extraNativeBuildInputs
|
|
++ lib.optional
|
|
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
|
|
buildPackages.updateAutotoolsGnuConfigScriptsHook
|
|
# without proper `file` command, libtool sometimes fails
|
|
# to recognize 64-bit DLLs
|
|
++ lib.optional (hostPlatform.config == "x86_64-w64-mingw32") buildPackages.file
|
|
;
|
|
});
|
|
})
|
|
|
|
]
|