···1010 crossOverlays = [];
11111212 # Ignore custom stdenvs when cross compiling for compatibility
1313+ # Use replaceCrossStdenv instead.
1314 config = builtins.removeAttrs config [ "replaceStdenv" ];
1415 };
1516···4445 inherit config;
4546 overlays = overlays ++ crossOverlays;
4647 selfBuild = false;
4747- stdenv = adaptStdenv (buildPackages.stdenv.override (old: rec {
4848- buildPlatform = localSystem;
4949- hostPlatform = crossSystem;
5050- targetPlatform = crossSystem;
4848+ stdenv = let
4949+ baseStdenv = adaptStdenv (buildPackages.stdenv.override (old: rec {
5050+ buildPlatform = localSystem;
5151+ hostPlatform = crossSystem;
5252+ targetPlatform = crossSystem;
51535252- # Prior overrides are surely not valid as packages built with this run on
5353- # a different platform, and so are disabled.
5454- overrides = _: _: {};
5555- extraBuildInputs = [ ] # Old ones run on wrong platform
5656- ++ lib.optionals hostPlatform.isDarwin [ buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation ]
5757- ;
5858- allowedRequisites = null;
5454+ # Prior overrides are surely not valid as packages built with this run on
5555+ # a different platform, and so are disabled.
5656+ overrides = _: _: {};
5757+ extraBuildInputs = [ ] # Old ones run on wrong platform
5858+ ++ lib.optionals hostPlatform.isDarwin [ buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation ]
5959+ ;
6060+ allowedRequisites = null;
59616060- hasCC = !targetPlatform.isGhcjs;
6262+ hasCC = !targetPlatform.isGhcjs;
61636262- cc = if crossSystem.useiOSPrebuilt or false
6363- then buildPackages.darwin.iosSdkPkgs.clang
6464- else if crossSystem.useAndroidPrebuilt or false
6565- then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".clang
6666- else if targetPlatform.isGhcjs
6767- # Need to use `throw` so tryEval for splicing works, ugh. Using
6868- # `null` or skipping the attribute would cause an eval failure
6969- # `tryEval` wouldn't catch, wrecking accessing previous stages
7070- # when there is a C compiler and everything should be fine.
7171- then throw "no C compiler provided for this platform"
7272- else if crossSystem.isDarwin
7373- then buildPackages.llvmPackages.libcxxClang
7474- else if crossSystem.useLLVM or false
7575- then buildPackages.llvmPackages.clang
7676- else buildPackages.gcc;
6464+ cc = if crossSystem.useiOSPrebuilt or false
6565+ then buildPackages.darwin.iosSdkPkgs.clang
6666+ else if crossSystem.useAndroidPrebuilt or false
6767+ then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".clang
6868+ else if targetPlatform.isGhcjs
6969+ # Need to use `throw` so tryEval for splicing works, ugh. Using
7070+ # `null` or skipping the attribute would cause an eval failure
7171+ # `tryEval` wouldn't catch, wrecking accessing previous stages
7272+ # when there is a C compiler and everything should be fine.
7373+ then throw "no C compiler provided for this platform"
7474+ else if crossSystem.isDarwin
7575+ then buildPackages.llvmPackages.libcxxClang
7676+ else if crossSystem.useLLVM or false
7777+ then buildPackages.llvmPackages.clang
7878+ else buildPackages.gcc;
77797878- extraNativeBuildInputs = old.extraNativeBuildInputs
7979- ++ lib.optionals
8080- (hostPlatform.isLinux && !buildPlatform.isLinux)
8181- [ buildPackages.patchelf ]
8282- ++ lib.optional
8383- (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode;
8484- in f hostPlatform && !(f buildPlatform) )
8585- buildPackages.updateAutotoolsGnuConfigScriptsHook
8686- ;
8787- }));
8080+ extraNativeBuildInputs = old.extraNativeBuildInputs
8181+ ++ lib.optionals
8282+ (hostPlatform.isLinux && !buildPlatform.isLinux)
8383+ [ buildPackages.patchelf ]
8484+ ++ lib.optional
8585+ (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode;
8686+ in f hostPlatform && !(f buildPlatform) )
8787+ buildPackages.updateAutotoolsGnuConfigScriptsHook
8888+ ;
8989+ }));
9090+ in if config ? replaceCrossStdenv then config.replaceCrossStdenv { inherit buildPackages baseStdenv; } else baseStdenv;
8891 })
89929093]