{bintools,cc}-wrapper: fix static builds on Darwin

Without this change, all Darwin platforms mangle to the same suffix
salt. That is normally not an issue because build = host should mean a
non-cross build, but it causes issues on Darwin with static builds
because `DEVELOPER_DIR_FOR_BUILD` and `DEVELOPER_DIR` will refer to
different SDKs but mangle to the same `DEVELOPER_DIR` with suffix salt.

The fix is to mangle static builds differently from non-static ones on
Darwin, which allows building for a static Darwin target on a
same-architecture Darwin host. This fix is applied only to Dariwn
because the issue does not appear to affect other platforms.
This commit is contained in:
Randy Eckenrode
2024-10-10 16:23:00 -04:00
parent 51755b0c00
commit 826edbf719
2 changed files with 4 additions and 2 deletions
@@ -108,7 +108,8 @@ let
coreutils_bin = optionalString (!nativeTools) (getBin coreutils);
# See description in cc-wrapper.
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config
+ lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static";
# The dynamic linker has different names on different platforms. This is a
# shell glob that ought to match it.
+2 -1
View File
@@ -115,7 +115,8 @@ let
# without interfering. For the moment, it is defined as the target triple,
# adjusted to be a valid bash identifier. This should be considered an
# unstable implementation detail, however.
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config
+ lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static";
useGccForLibs = useCcForLibs
&& libcxx == null