nixpkgs/pkgs/development/tools/xcbuild/sdks.nix
Matthew Bauer 35b2c0edf2 xcbuild: refactor
This reworks some of xcbuild logic to make it more compatible with
Apple’s SDK.

- Add a fake version of xcrun & xcode-select
- Cleanup platform generation. Clang does not like having 20 char
  hashes in sysroot so it is much easier to just build the parent
  directory for each runCommand. This is a little awkward but I have
  renamed everything with an added ‘s’ to make the distinction more clear.
- Cleaned up wrapper.nix in some different ways
- Reuse some versioning logic so that we don’t end up with two
  different versions of Xcode or SDK reported.
2018-07-09 17:10:20 -04:00

29 lines
746 B
Nix

{ runCommand, lib, toolchainName, sdkName, writeText, version, xcodePlatform }:
let
inherit (lib.generators) toPlist;
SDKSettings = {
CanonicalName = sdkName;
DisplayName = sdkName;
Toolchains = [ toolchainName ];
Version = version;
MaximumDeploymentTarget = version;
isBaseSDK = "YES";
};
SystemVersion = {
ProductName = "Mac OS X";
ProductVersion = version;
};
in
runCommand "SDKs" {
inherit version;
} ''
sdk=$out/${sdkName}.sdk
install -D ${writeText "SDKSettings.plist" (toPlist {} SDKSettings)} $sdk/SDKSettings.plist
install -D ${writeText "SystemVersion.plist" (toPlist {} SystemVersion)} $sdk/System/Library/CoreServices/SystemVersion.plist
ln -s $sdk $out/${xcodePlatform}.sdk
''