9 sdkName = "MacOSX${sdkVersion}";
10 toolchainName = "com.apple.dt.toolchain.XcodeDefault";
11 productBuildVer = null;
13 inherit (lib.generators) toPlist toJSON;
16 CanonicalName = "macosx${sdkVersion}";
17 DisplayName = "macOS ${sdkVersion}";
18 Toolchains = [ toolchainName ];
20 MaximumDeploymentTarget = "${sdkVersion}.99";
25 lib.optionalAttrs (productBuildVer != null) { ProductBuildVersion = productBuildVer; }
27 ProductName = "macOS";
28 ProductVersion = sdkVersion;
31 runCommand "sdkroot-${sdkVersion}" { } ''
32 sdk="$out/${sdkName}.sdk"
34 install -D ${writeText "SDKSettings.plist" (toPlist { } SDKSettings)} "$sdk/SDKSettings.plist"
35 install -D ${writeText "SDKSettings.json" (toJSON { } SDKSettings)} "$sdk/SDKSettings.json"
37 writeText "SystemVersion.plist" (toPlist { } SystemVersion)
38 } "$sdk/System/Library/CoreServices/SystemVersion.plist"
40 ln -s "$sdk" "$sdk/usr"
42 install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook"
43 cat >> "$out/nix-support/setup-hook" <<-hook
45 # See comments in cc-wrapper's setup hook. This works exactly the same way.
47 [[ -z \''${strictDeps-} ]] || (( "\$hostOffset" < 0 )) || return 0
50 # See ../../../build-support/setup-hooks/role.bash
54 # Only set the SDK root if one has not been set via this hook or some other means.
55 if [[ ! \$NIX_CFLAGS_COMPILE =~ isysroot ]]; then
56 export NIX_CFLAGS_COMPILE\''${role_post}+=' -isysroot $out/${sdkName}.sdk'
60 # See ../../../build-support/setup-hooks/role.bash
63 addEnvHooks "\$targetOffset" sdkRootHook
65 # No local scope in sourced file