mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
{bintools,cc}-wrapper: use a fallback SDK when DEVELOPER_DIR
is not set
It is unusual to invoke a wrapped compiler without setting `DEVELOPER_DIR`, but it can happen when a user adds a compiler to their installed packages or when a package intentionally invokes the compiler without an environment (such as the GHC binary packages).
This commit is contained in:
parent
97d75cb619
commit
51755b0c00
@ -84,7 +84,7 @@ mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"}
|
||||
|
||||
# Allow wrapped bintools to do something useful when no `DEVELOPER_DIR` is set, which can happen when
|
||||
# the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set.
|
||||
DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@}
|
||||
DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@}
|
||||
|
||||
# Darwin looks for frameworks in the SDK located at `DEVELOPER_DIR`.
|
||||
extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks")
|
||||
|
@ -10,6 +10,7 @@
|
||||
, stdenvNoCC
|
||||
, runtimeShell
|
||||
, bintools ? null, libc ? null, coreutils ? null, gnugrep ? null
|
||||
, apple-sdk ? null
|
||||
, netbsd ? null
|
||||
, sharedLibraryLoader ?
|
||||
if libc == null then
|
||||
@ -412,6 +413,9 @@ stdenvNoCC.mkDerivation {
|
||||
inherit dynamicLinker targetPrefix suffixSalt coreutils_bin;
|
||||
inherit bintools_bin libc_bin libc_dev libc_lib;
|
||||
default_hardening_flags_str = builtins.toString defaultHardeningFlags;
|
||||
} // lib.optionalAttrs (apple-sdk != null && stdenvNoCC.targetPlatform.isDarwin) {
|
||||
# Wrapped compilers should do something useful even when no SDK is provided at `DEVELOPER_DIR`.
|
||||
fallback_sdk = apple-sdk.__spliced.buildTarget or apple-sdk;
|
||||
};
|
||||
|
||||
meta =
|
||||
|
@ -90,7 +90,7 @@ if [ "@darwinMinVersion@" ]; then
|
||||
|
||||
# Allow wrapped compilers to do something useful when no `DEVELOPER_DIR` is set, which can happen when
|
||||
# the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set.
|
||||
DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@}
|
||||
DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@}
|
||||
|
||||
# xcbuild needs `SDKROOT` to be the name of the SDK, which it sets in its own wrapper,
|
||||
# but compilers expect it to point to the absolute path.
|
||||
|
@ -10,6 +10,7 @@
|
||||
, stdenvNoCC
|
||||
, runtimeShell
|
||||
, cc ? null, libc ? null, bintools, coreutils ? null
|
||||
, apple-sdk ? null
|
||||
, zlib ? null
|
||||
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
|
||||
, propagateDoc ? cc != null && cc ? man
|
||||
@ -749,6 +750,9 @@ stdenvNoCC.mkDerivation {
|
||||
inherit libc_bin libc_dev libc_lib;
|
||||
inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable;
|
||||
default_hardening_flags_str = builtins.toString defaultHardeningFlags;
|
||||
} // lib.optionalAttrs (apple-sdk != null && stdenvNoCC.targetPlatform.isDarwin) {
|
||||
# Wrapped compilers should do something useful even when no SDK is provided at `DEVELOPER_DIR`.
|
||||
fallback_sdk = apple-sdk.__spliced.buildTarget or apple-sdk;
|
||||
};
|
||||
|
||||
meta =
|
||||
|
Loading…
Reference in New Issue
Block a user