-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287609 from reckenrode/darwin-stdenv-improvements
darwin.stdenv: improvements and overrideSDK rewrite
- Loading branch information
Showing
6 changed files
with
575 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
lib, | ||
runCommand, | ||
writeText, | ||
sdkVersion, | ||
}: | ||
|
||
let | ||
sdkName = "MacOSX${sdkVersion}"; | ||
toolchainName = "com.apple.dt.toolchain.XcodeDefault"; | ||
productBuildVer = null; | ||
|
||
inherit (lib.generators) toPlist toJSON; | ||
|
||
SDKSettings = { | ||
CanonicalName = "macosx${sdkVersion}"; | ||
DisplayName = "macOS ${sdkVersion}"; | ||
Toolchains = [ toolchainName ]; | ||
Version = sdkVersion; | ||
MaximumDeploymentTarget = "${sdkVersion}.99"; | ||
isBaseSDK = "YES"; | ||
}; | ||
|
||
SystemVersion = | ||
lib.optionalAttrs (productBuildVer != null) { ProductBuildVersion = productBuildVer; } | ||
// { | ||
ProductName = "macOS"; | ||
ProductVersion = sdkVersion; | ||
}; | ||
in | ||
runCommand "sdkroot-${sdkVersion}" { } '' | ||
sdk="$out/${sdkName}.sdk" | ||
install -D ${writeText "SDKSettings.plist" (toPlist { } SDKSettings)} "$sdk/SDKSettings.plist" | ||
install -D ${writeText "SDKSettings.json" (toJSON { } SDKSettings)} "$sdk/SDKSettings.json" | ||
install -D ${ | ||
writeText "SystemVersion.plist" (toPlist { } SystemVersion) | ||
} "$sdk/System/Library/CoreServices/SystemVersion.plist" | ||
ln -s "$sdk" "$sdk/usr" | ||
install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook" | ||
cat >> "$out/nix-support/setup-hook" <<-hook | ||
# | ||
# See comments in cc-wrapper's setup hook. This works exactly the same way. | ||
# | ||
[[ -z \''${strictDeps-} ]] || (( "\$hostOffset" < 0 )) || return 0 | ||
sdkRootHook() { | ||
# See ../../../build-support/setup-hooks/role.bash | ||
local role_post | ||
getHostRoleEnvHook | ||
# Only set the SDK root if one has not been set via this hook or some other means. | ||
if [[ ! \$NIX_CFLAGS_COMPILE =~ isysroot ]]; then | ||
export NIX_CFLAGS_COMPILE\''${role_post}+=' -isysroot $out/${sdkName}.sdk' | ||
fi | ||
} | ||
# See ../../../build-support/setup-hooks/role.bash | ||
getTargetRole | ||
addEnvHooks "\$targetOffset" sdkRootHook | ||
# No local scope in sourced file | ||
unset -v role_post | ||
hook | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.