mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
bintools-wrapper, cc-wrapper: parameterize darwin min version variable
These variables are the ones that the standard toolchain uses, so we
should use those and not always use MACOSX_DEPLOYMENT_TARGET.
See 236a426c12/cctools/ld64/src/ld/PlatformSupport.cpp (L54-L55)
This commit is contained in:
parent
2a9b3b4943
commit
6c4ce7960e
@ -120,6 +120,10 @@ rec {
|
||||
# platforms define the old name "sdkVer".
|
||||
darwinSdkVersion = final.sdkVer or "10.12";
|
||||
darwinMinVersion = final.darwinSdkVersion;
|
||||
darwinMinVersionVariable =
|
||||
if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET"
|
||||
else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET"
|
||||
else null;
|
||||
|
||||
emulator = pkgs: let
|
||||
qemu-user = pkgs.qemu.override {
|
||||
|
@ -21,7 +21,7 @@ havePlatformVersionFlag=
|
||||
haveDarwinSDKVersion=
|
||||
haveDarwinPlatformVersion=
|
||||
|
||||
mangleVarSingle MACOSX_DEPLOYMENT_TARGET ${role_suffixes[@]+"${role_suffixes[@]}"}
|
||||
mangleVarSingle @darwinMinVersionVariable@ ${role_suffixes[@]+"${role_suffixes[@]}"}
|
||||
|
||||
n=0
|
||||
nParams=${#params[@]}
|
||||
@ -61,12 +61,12 @@ done
|
||||
if [ ! "$havePlatformVersionFlag" ]; then
|
||||
if [ ! "$haveDarwinSDKVersion" ] && [ ! "$haveDarwinPlatformVersion" ]; then
|
||||
# Nothing provided. Use the modern "-platform_version" to set both.
|
||||
extraBefore+=(-platform_version @darwinPlatform@ "${MACOSX_DEPLOYMENT_TARGET_@suffixSalt@:-@darwinMinVersion@}" @darwinSdkVersion@)
|
||||
extraBefore+=(-platform_version @darwinPlatform@ "${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@}" @darwinSdkVersion@)
|
||||
elif [ ! "$haveDarwinSDKVersion" ]; then
|
||||
# Add missing sdk version
|
||||
extraBefore+=(-sdk_version @darwinSdkVersion@)
|
||||
elif [ ! "$haveDarwinPlatformVersion" ]; then
|
||||
# Add missing platform version
|
||||
extraBefore+=(-@darwinPlatform@_version_min "${MACOSX_DEPLOYMENT_TARGET_@suffixSalt@:-@darwinMinVersion@}")
|
||||
extraBefore+=(-@darwinPlatform@_version_min "${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@}")
|
||||
fi
|
||||
fi
|
||||
|
@ -327,11 +327,14 @@ stdenv.mkDerivation {
|
||||
###
|
||||
+ optionalString stdenv.targetPlatform.isDarwin (
|
||||
let
|
||||
inherit (stdenv.targetPlatform) darwinMinVersion darwinPlatform darwinSdkVersion;
|
||||
inherit (stdenv.targetPlatform)
|
||||
darwinPlatform darwinSdkVersion
|
||||
darwinMinVersion darwinMinVersionVariable;
|
||||
in ''
|
||||
export darwinPlatform=${darwinPlatform}
|
||||
export darwinMinVersion=${darwinMinVersion}
|
||||
export darwinSdkVersion=${darwinSdkVersion}
|
||||
export darwinMinVersionVariable=${darwinMinVersionVariable}
|
||||
substituteAll ${./add-darwin-ldflags-before.sh} $out/nix-support/add-local-ldflags-before.sh
|
||||
''
|
||||
)
|
||||
|
@ -68,9 +68,9 @@ fi
|
||||
# Only add darwin min version flag if a default darwin min version is set,
|
||||
# which is a signal that we're targetting darwin.
|
||||
if [ "@darwinMinVersion@" ]; then
|
||||
mangleVarSingle MACOSX_DEPLOYMENT_TARGET ${role_suffixes[@]+"${role_suffixes[@]}"}
|
||||
mangleVarSingle @darwinMinVersionVariable@ ${role_suffixes[@]+"${role_suffixes[@]}"}
|
||||
|
||||
NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="-m@darwinPlatformForCC@-version-min=${MACOSX_DEPLOYMENT_TARGET_@suffixSalt@:-@darwinMinVersion@} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@"
|
||||
NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="-m@darwinPlatformForCC@-version-min=${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@"
|
||||
fi
|
||||
|
||||
# That way forked processes will not extend these environment variables again.
|
||||
|
@ -109,6 +109,9 @@ let
|
||||
darwinMinVersion = optionalString stdenv.targetPlatform.isDarwin (
|
||||
stdenv.targetPlatform.darwinMinVersion
|
||||
);
|
||||
|
||||
darwinMinVersionVariable = optionalString stdenv.targetPlatform.isDarwin
|
||||
stdenv.targetPlatform.darwinMinVersionVariable;
|
||||
in
|
||||
|
||||
# Ensure bintools matches
|
||||
@ -131,7 +134,7 @@ stdenv.mkDerivation {
|
||||
gnugrep_bin = if nativeTools then "" else gnugrep;
|
||||
|
||||
inherit targetPrefix suffixSalt;
|
||||
inherit darwinPlatformForCC darwinMinVersion;
|
||||
inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable;
|
||||
|
||||
outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user