···10 crossOverlays = [];
1112 # Ignore custom stdenvs when cross compiling for compatibility
013 config = builtins.removeAttrs config [ "replaceStdenv" ];
14 };
15···44 inherit config;
45 overlays = overlays ++ crossOverlays;
46 selfBuild = false;
47- stdenv = adaptStdenv (buildPackages.stdenv.override (old: rec {
48- buildPlatform = localSystem;
49- hostPlatform = crossSystem;
50- targetPlatform = crossSystem;
05152- # Prior overrides are surely not valid as packages built with this run on
53- # a different platform, and so are disabled.
54- overrides = _: _: {};
55- extraBuildInputs = [ ] # Old ones run on wrong platform
56- ++ lib.optionals hostPlatform.isDarwin [ buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation ]
57- ;
58- allowedRequisites = null;
5960- hasCC = !targetPlatform.isGhcjs;
6162- cc = if crossSystem.useiOSPrebuilt or false
63- then buildPackages.darwin.iosSdkPkgs.clang
64- else if crossSystem.useAndroidPrebuilt or false
65- then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".clang
66- else if targetPlatform.isGhcjs
67- # Need to use `throw` so tryEval for splicing works, ugh. Using
68- # `null` or skipping the attribute would cause an eval failure
69- # `tryEval` wouldn't catch, wrecking accessing previous stages
70- # when there is a C compiler and everything should be fine.
71- then throw "no C compiler provided for this platform"
72- else if crossSystem.isDarwin
73- then buildPackages.llvmPackages.libcxxClang
74- else if crossSystem.useLLVM or false
75- then buildPackages.llvmPackages.clang
76- else buildPackages.gcc;
7778- extraNativeBuildInputs = old.extraNativeBuildInputs
79- ++ lib.optionals
80- (hostPlatform.isLinux && !buildPlatform.isLinux)
81- [ buildPackages.patchelf ]
82- ++ lib.optional
83- (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode;
84- in f hostPlatform && !(f buildPlatform) )
85- buildPackages.updateAutotoolsGnuConfigScriptsHook
86- ;
87- }));
088 })
8990]
···10 crossOverlays = [];
1112 # Ignore custom stdenvs when cross compiling for compatibility
13+ # Use replaceCrossStdenv instead.
14 config = builtins.removeAttrs config [ "replaceStdenv" ];
15 };
16···45 inherit config;
46 overlays = overlays ++ crossOverlays;
47 selfBuild = false;
48+ stdenv = let
49+ baseStdenv = adaptStdenv (buildPackages.stdenv.override (old: rec {
50+ buildPlatform = localSystem;
51+ hostPlatform = crossSystem;
52+ targetPlatform = crossSystem;
5354+ # Prior overrides are surely not valid as packages built with this run on
55+ # a different platform, and so are disabled.
56+ overrides = _: _: {};
57+ extraBuildInputs = [ ] # Old ones run on wrong platform
58+ ++ lib.optionals hostPlatform.isDarwin [ buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation ]
59+ ;
60+ allowedRequisites = null;
6162+ hasCC = !targetPlatform.isGhcjs;
6364+ cc = if crossSystem.useiOSPrebuilt or false
65+ then buildPackages.darwin.iosSdkPkgs.clang
66+ else if crossSystem.useAndroidPrebuilt or false
67+ then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".clang
68+ else if targetPlatform.isGhcjs
69+ # Need to use `throw` so tryEval for splicing works, ugh. Using
70+ # `null` or skipping the attribute would cause an eval failure
71+ # `tryEval` wouldn't catch, wrecking accessing previous stages
72+ # when there is a C compiler and everything should be fine.
73+ then throw "no C compiler provided for this platform"
74+ else if crossSystem.isDarwin
75+ then buildPackages.llvmPackages.libcxxClang
76+ else if crossSystem.useLLVM or false
77+ then buildPackages.llvmPackages.clang
78+ else buildPackages.gcc;
7980+ extraNativeBuildInputs = old.extraNativeBuildInputs
81+ ++ lib.optionals
82+ (hostPlatform.isLinux && !buildPlatform.isLinux)
83+ [ buildPackages.patchelf ]
84+ ++ lib.optional
85+ (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode;
86+ in f hostPlatform && !(f buildPlatform) )
87+ buildPackages.updateAutotoolsGnuConfigScriptsHook
88+ ;
89+ }));
90+ in if config ? replaceCrossStdenv then config.replaceCrossStdenv { inherit buildPackages baseStdenv; } else baseStdenv;
91 })
9293]