xcbuild: add wrapper

Also updates xcbuild version.

This changes the raw string expressions into nix expressions that are
then converted into json by builtins.toJSON. Then, converted to Plist
XML by Apple's plutil. Sadly, xcbuild does not support using raw JSON
but Apple's plutil does so we just convert the file from JSON to XML
using Apple's plutil. The result is not ideal but it looks like all OS X
systems have working plutil's.

- set mac version to 10.10
- add setup hook.
This commit is contained in:
Matthew Bauer 2016-06-25 23:45:55 -05:00
parent d05d063572
commit de87138b9a
No known key found for this signature in database
GPG Key ID: E04D0AD9469141C3
8 changed files with 859 additions and 6 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng, CoreServices, CoreGraphics, ImageIO }:
{ stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng, CoreServices, CoreGraphics, ImageIO, ninja }:
let
googletest = fetchFromGitHub {
@ -16,13 +16,13 @@ let
};
in stdenv.mkDerivation rec {
name = "xcbuild-${stdenv.lib.substring 0 8 version}";
version = "49f8a5923f1381f87ac03ad4c1b138d1d2b74369";
version = "0ab861abcc11185a17d59608f96a015752a6fadc";
src = fetchFromGitHub {
owner = "facebook";
repo = "xcbuild";
rev = version;
sha256 = "0l107xkh7dab2xc58dqyrrhpd1gp12cpzh0wrx0i9jbh0idbwnk0";
sha256 = "12h0rn8v0js2vph2pwp5wvcrfkj12nz365i5qxw9miyfn4msnz26";
};
prePatch = ''
@ -39,5 +39,6 @@ in stdenv.mkDerivation rec {
rmdir $out/usr
'';
buildInputs = [ cmake zlib libxml2 libpng CoreServices CoreGraphics ImageIO ];
}
buildInputs = [ cmake zlib libxml2 libpng ninja ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices CoreGraphics ImageIO ];
}

View File

@ -0,0 +1,33 @@
{stdenv, platform, toolchain, xcbuild, writeText}:
let
AbstractAssetCatalog = {
Type = "FileType";
Identifier = "folder.abstractassetcatalog";
BasedOn = "wrapper";
UTI = "com.apple.dt.abstractassetcatalog";
IsTransparent = "NO";
};
in
stdenv.mkDerivation {
name = "Xcode.app";
buildInputs = [ xcbuild ];
buildCommand = ''
mkdir -p $out/Contents/Developer/Library/Xcode/Specifications/
cp ${xcbuild}/Library/Xcode/Specifications/* $out/Contents/Developer/Library/Xcode/Specifications/
plutil -convert xml1 ${writeText "folder.abstractassetcatalog" (builtins.toJSON AbstractAssetCatalog)} -o $out/Contents/Developer/Library/Xcode/Specifications/folder.abstractassetcatalog.xcspec
mkdir -p $out/Contents/Developer/Platforms/
cd $out/Contents/Developer/Platforms/
ln -s ${platform}
mkdir -p $out/Contents/Developer/Toolchains/
cd $out/Contents/Developer/Toolchains/
ln -s ${toolchain}
'';
}

View File

@ -0,0 +1,604 @@
{ stdenv, sdk, writeText, platformName, xcbuild }:
let
Info = {
CFBundleIdentifier = platformName;
Type = "Platform";
};
Version = {
ProjectName = "OSXPlatformSupport";
};
PackageTypes = [
{
Type = "PackageType";
Identifier = "com.apple.package-type.mach-o-executable";
Name = "Mach-O Executable";
Description = "Mach-O executable";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = "compiled.mach-o.executable";
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = "YES";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.mach-o-objfile";
Name = "Mach-O Object File";
Description = "Mach-O Object File";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = "compiled.mach-o.objfile";
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.mach-o-dylib";
Name = "Mach-O Dynamic Library";
Description = "Mach-O dynamic library";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = "compiled.mach-o.dylib";
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.static-library";
Name = "Mach-O Static Library";
Description = "Mach-O static library";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "lib";
EXECUTABLE_SUFFIX = ".a";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = "archive.ar";
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.mach-o-bundle";
Name = "Mach-O Loadable";
Description = "Mach-O loadable";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = ".dylib";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = "compiled.mach-o.bundle";
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper";
Name = "Wrapper";
Description = "Wrapper";
DefaultBuildSettings = {
WRAPPER_PREFIX = "";
WRAPPER_SUFFIX = ".bundle";
WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Contents";
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/MacOS";
EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)";
INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist";
INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings";
PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo";
PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist";
VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist";
PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables"; FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks";
SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks";
SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport";
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources";
LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj";
DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation";
PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns";
SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts";
JAVA_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Java";
};
ProductReference = {
FileType = "wrapper.cfbundle";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper.shallow";
BasedOn = "com.apple.package-type.wrapper";
Name = "Wrapper (Shallow)";
Description = "Shallow Wrapper";
DefaultBuildSettings = {
CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)";
EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
SHALLOW_BUNDLE = "YES";
};
ProductReference = {
FileType = "wrapper.cfbundle";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper.application";
BasedOn = "com.apple.package-type.wrapper";
Name = "Application Wrapper";
Description = "Application Wrapper";
DefaultBuildSettings = {
GENERATE_PKGINFO_FILE = "YES";
};
ProductReference = {
FileType = "wrapper.application";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "YES";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper.application.shallow";
BasedOn = "com.apple.package-type.wrapper.shallow";
Name = "Application Wrapper (Shallow)";
Description = "Shallow Application Wrapper";
DefaultBuildSettings = {
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
GENERATE_PKGINFO_FILE = "YES";
SHALLOW_BUNDLE = "YES";
};
ProductReference = {
FileType = "wrapper.application";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "YES";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper.framework";
Name = "Framework Wrapper";
Description = "Framework wrapper";
DefaultBuildSettings = {
WRAPPER_PREFIX = "";
WRAPPER_SUFFIX = ".framework";
WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
VERSIONS_FOLDER_PATH = "$(WRAPPER_NAME)/Versions";
CONTENTS_FOLDER_PATH = "$(VERSIONS_FOLDER_PATH)/$(FRAMEWORK_VERSION)";
CURRENT_VERSION = "Current";
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)";
INFOPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Info.plist";
INFOPLISTSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings";
PKGINFO_PATH = "$(WRAPPER_NAME)/PkgInfo";
PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist";
VERSIONPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/version.plist";
PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
EXECUTABLES_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)"; FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks";
SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks";
SHARED_SUPPORT_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)";
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources";
LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj";
DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation";
PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns";
SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts";
JAVA_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Java";
CODESIGNING_FOLDER_PATH = "$(TARGET_BUILD_DIR)/$(CONTENTS_FOLDER_PATH)";
};
ProductReference = {
FileType = "wrapper.framework";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper.framework.static";
Name = "Mach-O Static Framework";
Description = "Mach-O static framework";
BasedOn = "com.apple.package-type.wrapper.framework";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
};
ProductReference = {
FileType = "wrapper.framework.static";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.wrapper.framework.shallow";
Name = "Shallow Framework Wrapper";
Description = "Shallow framework wrapper";
BasedOn = "com.apple.package-type.wrapper.framework";
DefaultBuildSettings = {
CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)";
VERSIONS_FOLDER_PATH = "$(WRAPPER_NAME)";
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
SHALLOW_BUNDLE = "YES";
};
ProductReference = {
FileType = "wrapper.framework";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "NO";
};
}
{
Type = "PackageType";
Identifier = "com.apple.package-type.bundle.unit-test";
BasedOn = "com.apple.package-type.wrapper";
Name = "Unit Test Bundle";
Description = "Unit Test Bundle";
DefaultBuildSettings = {
WRAPPER_SUFFIX = "xctest";
};
ProductReference = {
FileType = "wrapper.cfbundle";
Name = "$(WRAPPER_NAME)";
IsLaunchable = "NO";
};
}
];
ProductTypes = [
{
Type = "ProductType";
Identifier = "com.apple.product-type.tool";
Class = "PBXToolProductType";
Name = "Command-line Tool";
Description = "Standalone command-line tool";
IconNamePrefix = "TargetExecutable";
DefaultTargetName = "Command-line Tool";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
REZ_EXECUTABLE = "YES";
INSTALL_PATH = "/homeless-shelter";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = "YES";
GCC_DYNAMIC_NO_PIC = "NO";
GCC_SYMBOLS_PRIVATE_EXTERN = "YES";
GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
STRIP_STYLE = "all";
CODE_SIGNING_ALLOWED = "YES";
};
PackageTypes = [
"com.apple.package-type.mach-o-executable"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.objfile";
Class = "XCStandaloneExecutableProductType";
Name = "Object File";
Description = "Object File";
IconNamePrefix = "TargetPlugin";
DefaultTargetName = "Object File";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "mh_object";
LINK_WITH_STANDARD_LIBRARIES = "NO";
REZ_EXECUTABLE = "YES";
EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
EXECUTABLE_EXTENSION = "o";
PUBLIC_HEADERS_FOLDER_PATH = "/homeless-shelter";
PRIVATE_HEADERS_FOLDER_PATH = "/homeless-shelter";
INSTALL_PATH = "/homeless-shelter";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = "YES";
SKIP_INSTALL = "YES";
STRIP_STYLE = "debugging";
GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
KEEP_PRIVATE_EXTERNS = "YES";
DEAD_CODE_STRIPPING = "NO";
};
PackageTypes = [
"com.apple.package-type.mach-o-objfile"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.library.dynamic";
Class = "PBXDynamicLibraryProductType";
Name = "Dynamic Library";
Description = "Dynamic library";
IconNamePrefix = "TargetLibrary";
DefaultTargetName = "Dynamic Library";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "mh_dylib";
REZ_EXECUTABLE = "YES";
EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
EXECUTABLE_EXTENSION = "dylib";
PUBLIC_HEADERS_FOLDER_PATH = "/homeless-shelter";
PRIVATE_HEADERS_FOLDER_PATH = "/homeless-shelter";
INSTALL_PATH = "/homeless-shelter";
DYLIB_INSTALL_NAME_BASE = "$(INSTALL_PATH)";
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
DYLIB_COMPATIBILITY_VERSION = "1";
DYLIB_CURRENT_VERSION = "1";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = "YES";
STRIP_STYLE = "debugging";
GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
CODE_SIGNING_ALLOWED = "YES";
};
PackageTypes = [
"com.apple.package-type.mach-o-dylib"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.library.static";
Class = "PBXStaticLibraryProductType";
Name = "Static Library";
Description = "Static library";
IconNamePrefix = "TargetLibrary";
DefaultTargetName = "Static Library";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "staticlib";
REZ_EXECUTABLE = "YES";
EXECUTABLE_PREFIX = "lib";
EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
EXECUTABLE_EXTENSION = "a";
PUBLIC_HEADERS_FOLDER_PATH = "/homeless-shelter";
PRIVATE_HEADERS_FOLDER_PATH = "/homeless-shelter";
INSTALL_PATH = "/homeless-shelter";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = "YES";
STRIP_STYLE = "debugging";
SEPARATE_STRIP = "YES";
};
AlwaysPerformSeparateStrip = "YES";
PackageTypes = [
"com.apple.package-type.static-library"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.bundle";
Class = "PBXBundleProductType";
Name = "Bundle";
Description = "Generic bundle";
IconNamePrefix = "TargetPlugin";
DefaultTargetName = "Bundle";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
MACH_O_TYPE = "mh_bundle";
WRAPPER_PREFIX = "";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "bundle";
WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = "YES";
STRIP_STYLE = "non-global";
GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
CODE_SIGNING_ALLOWED = "YES";
};
PackageTypes = [
"com.apple.package-type.wrapper"
"com.apple.package-type.wrapper.shallow"
];
IsWrapper = "YES";
HasInfoPlist = "YES";
HasInfoPlistStrings = "YES";
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.bundle.shallow";
BasedOn = "com.apple.product-type.bundle";
Class = "PBXBundleProductType";
Name = "Bundle (Shallow)";
Description = "Bundle (Shallow)";
PackageTypes = [
"com.apple.package-type.wrapper.shallow"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.application";
BasedOn = "com.apple.product-type.bundle";
Class = "PBXApplicationProductType";
Name = "Application";
Description = "Application";
IconNamePrefix = "TargetApp";
DefaultTargetName = "Application";
DefaultBuildProperties = {
MACH_O_TYPE = "mh_execute";
GCC_DYNAMIC_NO_PIC = "NO";
GCC_SYMBOLS_PRIVATE_EXTERN = "YES";
GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "app";
INSTALL_PATH = "$(LOCAL_APPS_DIR)";
STRIP_STYLE = "all";
CODE_SIGNING_ALLOWED = "YES";
};
PackageTypes = [
"com.apple.package-type.wrapper.application"
];
CanEmbedAddressSanitizerLibraries = "YES";
RunpathSearchPathForEmbeddedFrameworks = "@executable_path/../Frameworks";
ValidateEmbeddedBinaries = "YES";
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.application.shallow";
BasedOn = "com.apple.product-type.application";
Class = "PBXApplicationProductType";
Name = "Application (Shallow Bundle)";
Description = "Application (Shallow Bundle)";
PackageTypes = [
"com.apple.package-type.wrapper.application.shallow"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.framework";
BasedOn = "com.apple.product-type.bundle";
Class = "PBXFrameworkProductType";
Name = "Framework";
Description = "Framework";
IconNamePrefix = "TargetFramework";
DefaultTargetName = "Framework";
DefaultBuildProperties = {
MACH_O_TYPE = "mh_dylib";
FRAMEWORK_VERSION = "A";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "framework";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
DYLIB_INSTALL_NAME_BASE = "$(INSTALL_PATH)";
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
STRIP_STYLE = "debugging";
CODE_SIGNING_ALLOWED = "YES";
};
PackageTypes = [
"com.apple.package-type.wrapper.framework"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.framework.shallow";
BasedOn = "com.apple.product-type.framework";
Class = "PBXFrameworkProductType";
Name = "Framework (Shallow Bundle)";
Description = "Framework (Shallow Bundle)";
PackageTypes = [
"com.apple.package-type.wrapper.framework.shallow"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.framework.static";
BasedOn = "com.apple.product-type.framework";
Class = "XCStaticFrameworkProductType";
Name = "Static Framework";
Description = "Static Framework";
IconNamePrefix = "TargetFramework";
DefaultTargetName = "Static Framework";
DefaultBuildProperties = {
MACH_O_TYPE = "staticlib";
FRAMEWORK_VERSION = "A";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "framework";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
DYLIB_INSTALL_NAME_BASE = "";
LD_DYLIB_INSTALL_NAME = "";
SEPARATE_STRIP = "YES";
GCC_INLINES_ARE_PRIVATE_EXTERN = "NO";
CODE_SIGNING_ALLOWED = "NO";
};
AlwaysPerformSeparateStrip = "YES";
PackageTypes = [
"com.apple.package-type.wrapper.framework.static"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.bundle.unit-test";
BasedOn = "com.apple.product-type.bundle";
Class = "PBXXCTestBundleProductType";
Name = "Unit Test Bundle";
Description = "Unit Test Bundle";
DefaultBuildProperties = {
WRAPPER_EXTENSION = "xctest";
PRODUCT_SPECIFIC_LDFLAGS = "-framework XCTest";
PRODUCT_TYPE_FRAMEWORK_SEARCH_PATHS = "$(TEST_FRAMEWORK_SEARCH_PATHS)";
TEST_FRAMEWORK_SEARCH_PATHS = [
"$(inherited)"
"$(PLATFORM_DIR)/Developer/Library/Frameworks"
];
};
PackageTypes = [
"com.apple.package-type.bundle.unit-test"
];
}
{
Type = "ProductType";
Identifier = "com.apple.product-type.bundle.ui-testing";
BasedOn = "com.apple.product-type.bundle.unit-test";
Class = "PBXXCTestBundleProductType";
Name = "UI Testing Bundle";
Description = "UI Testing Bundle";
DefaultBuildProperties = {
WRAPPER_EXTENSION = "xctest";
USES_XCTRUNNER = "YES";
PRODUCT_SPECIFIC_LDFLAGS = "-framework XCTest";
PRODUCT_TYPE_FRAMEWORK_SEARCH_PATHS = "$(TEST_FRAMEWORK_SEARCH_PATHS)";
TEST_FRAMEWORK_SEARCH_PATHS = [
"$(inherited)"
"$(PLATFORM_DIR)/Developer/Library/Frameworks"
];
};
PackageTypes = [
"com.apple.package-type.bundle.unit-test"
];
}
];
in
stdenv.mkDerivation {
name = "nixpkgs.platform";
buildInputs = [ xcbuild ];
buildCommand = ''
mkdir -p $out/
cd $out/
/usr/bin/plutil -convert xml1 -o Info.plist ${writeText "Info.plist" (builtins.toJSON Info)}
/usr/bin/plutil -convert xml1 -o version.plist ${writeText "version.plist" (builtins.toJSON Version)}
mkdir -p $out/Developer/Library/Xcode/Specifications/
/usr/bin/plutil -convert xml1 -o $out/Developer/Library/Xcode/Specifications/ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)}
/usr/bin/plutil -convert xml1 -o $out/Developer/Library/Xcode/Specifications/PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)}
mkdir -p $out/Developer/SDKs/
cd $out/Developer/SDKs/
ln -s ${sdk}
'';
}

View File

@ -0,0 +1,31 @@
{ stdenv, writeText, toolchainName, sdkName, xcbuild }:
let
SDKSettings = {
CanonicalName = sdkName;
DisplayName = sdkName;
Toolchains = [ toolchainName ];
Version = "10.10";
MaximumDeploymentTarget = "10.10";
isBaseSDK = "YES";
};
SystemVersion = {
ProductName = "Mac OS X";
ProductVersion = "10.10";
};
in
stdenv.mkDerivation {
name = "nix.nixpkgs.sdk";
buildInputs = [ xcbuild ];
buildCommand = ''
mkdir -p $out/
/usr/bin/plutil -convert xml1 -o $out/SDKSettings.plist ${writeText "SDKSettings.json" (builtins.toJSON SDKSettings)}
mkdir -p $out/System/Library/CoreServices/
/usr/bin/plutil -convert xml1 -o $out/System/Library/CoreServices/SystemVersion.plist ${writeText "SystemVersion.plist" (builtins.toJSON SystemVersion)}
'';
}

View File

@ -0,0 +1,17 @@
xcbuildPhase() {
runHook preConfigure
echo "running xcodebuild"
xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE"
runHook postConfigure
}
if [ -z "$dontUseXcbuild" -a -z "$configurePhase" ]; then
configurePhase=xcbuildPhase
fi
# if [ -d "*.xcodeproj" ]; then
# buildPhase=xcbuildPhase
# fi

View File

@ -0,0 +1,100 @@
{stdenv, writeText, toolchainName, xcbuild
, cc, cctools, llvm, yacc, flex, m4, unifdef, bootstrap_cmds}:
let
ToolchainInfo = {
Identifier = toolchainName;
};
in
stdenv.mkDerivation {
name = "nixpkgs.xctoolchain";
buildInputs = [ xcbuild ];
propagatedBuildInputs = [ cc cctools llvm ];
buildCommand = ''
mkdir -p $out
/usr/bin/plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)}
mkdir -p $out/usr/include
mkdir -p $out/usr/lib
mkdir -p $out/usr/libexec
mkdir -p $out/usr/share
mkdir -p $out/usr/bin
cd $out/usr/bin
ln -s ${cc}/bin/cpp
ln -s ${cc}/bin/c++
ln -s ${cc}/bin/cc
ln -s cc clang
ln -s c++ clang++
ln -s cc c89
ln -s cc c99
ln -s ${cctools}/bin/ar
ln -s ${cctools}/bin/as
ln -s ${cctools}/bin/nm
ln -s ${cctools}/bin/nmedit
ln -s ${cctools}/bin/ld
ln -s ${cctools}/bin/libtool
ln -s ${cctools}/bin/strings
ln -s ${cctools}/bin/strip
ln -s ${cctools}/bin/install_name_tool
ln -s ${cctools}/bin/bitcode_strip
ln -s ${cctools}/bin/codesign_allocate
ln -s ${cctools}/bin/dsymutil
ln -s ${cctools}/bin/dyldinfo
ln -s ${cctools}/bin/otool
ln -s ${cctools}/bin/unwinddump
ln -s ${cctools}/bin/size
ln -s ${cctools}/bin/segedit
ln -s ${cctools}/bin/pagestuff
ln -s ${cctools}/bin/ranlib
ln -s ${cctools}/bin/redo_prebinding
ln -s ${llvm}/bin/llvm-cov
ln -s ${llvm}/bin/llvm-dsymutil
ln -s ${llvm}/bin/llvm-dwarfdump
ln -s ${llvm}/bin/llvm-nm
ln -s ${llvm}/bin/llvm-objdump
ln -s ${llvm}/bin/llvm-otool
ln -s ${llvm}/bin/llvm-profdata
ln -s ${llvm}/bin/llvm-size
ln -s ${yacc}/bin/yacc
ln -s ${yacc}/bin/bison
ln -s ${flex}/bin/flex
ln -s ${flex}/bin/flex++
ln -s flex lex
ln -s ${m4}/bin/m4
ln -s m4 gm4
ln -s ${unifdef}/bin/unifdef
ln -s ${unifdef}/bin/unifdefall
ln -s ${bootstrap_cmds}/bin/mig
'';
}
# other commands in /bin/
# asa
# cmpdylib
# ctags
# ctf_insert
# dwarfdump
# gcov
# gperf
# indent
# lipo
# lorder
# mkdep
# rebase
# rpcgen
# swift
# swift-compress
# swift-demangle
# swift-stdlib-tool
# swift-update
# swiftc
# what

View File

@ -0,0 +1,64 @@
{ stdenv, callPackage, makeWrapper, writeText, CoreServices, ImageIO, CoreGraphics
, cctools, bootstrap_cmds}:
let
toolchainName = "com.apple.dt.toolchain.XcodeDefault";
platformName = "com.apple.platform.macosx";
sdkName = "macosx10.9";
xcbuild = callPackage ./default.nix {
inherit CoreServices ImageIO CoreGraphics;
};
toolchain = callPackage ./toolchain.nix {
inherit cctools bootstrap_cmds toolchainName xcbuild;
cc = stdenv.cc;
};
sdk = callPackage ./sdk.nix {
inherit toolchainName sdkName xcbuild;
};
platform = callPackage ./platform.nix {
inherit sdk platformName xcbuild;
};
developer = callPackage ./developer.nix {
inherit platform toolchain xcbuild;
};
xcconfig = writeText "nix.xcconfig" ''
SDKROOT=${sdkName}
'';
in
stdenv.mkDerivation {
name = "xcbuild-wrapper";
buildInputs = [ xcbuild makeWrapper ];
setupHook = ./setup-hook.sh;
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/bin
cd $out/bin/
for file in ${xcbuild}/bin/*; do
ln -s $file
done
wrapProgram $out/bin/xcodebuild \
--add-flags "-xcconfig ${xcconfig}" \
--add-flags "DERIVED_DATA_DIR=." \
--set DEVELOPER_DIR "${developer}"
wrapProgram $out/bin/xcrun \
--add-flags "-sdk ${sdkName}" \
--set DEVELOPER_DIR "${developer}"
'';
preferLocalBuild = true;
}

View File

@ -6430,7 +6430,10 @@ in
xc3sprog = callPackage ../development/tools/misc/xc3sprog { };
xcbuild = callPackage ../development/tools/xcbuild { inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO; };
xcbuild = callPackage ../development/tools/xcbuild/wrapper.nix {
inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO;
inherit (darwin) cctools bootstrap_cmds;
};
xmlindent = callPackage ../development/web/xmlindent {};