{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.

+4 -2
+2 -1
pkgs/build-support/bintools-wrapper/default.nix
··· 108 108 coreutils_bin = optionalString (!nativeTools) (getBin coreutils); 109 109 110 110 # See description in cc-wrapper. 111 - suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; 111 + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config 112 + + lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static"; 112 113 113 114 # The dynamic linker has different names on different platforms. This is a 114 115 # shell glob that ought to match it.
+2 -1
pkgs/build-support/cc-wrapper/default.nix
··· 115 115 # without interfering. For the moment, it is defined as the target triple, 116 116 # adjusted to be a valid bash identifier. This should be considered an 117 117 # unstable implementation detail, however. 118 - suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; 118 + suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config 119 + + lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static"; 119 120 120 121 useGccForLibs = useCcForLibs 121 122 && libcxx == null