From de87138b9ac14a466fe5f0b43462542308913cb0 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sat, 25 Jun 2016 23:45:55 -0500 Subject: [PATCH 01/19] 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. --- pkgs/development/tools/xcbuild/default.nix | 11 +- pkgs/development/tools/xcbuild/developer.nix | 33 + pkgs/development/tools/xcbuild/platform.nix | 604 +++++++++++++++++++ pkgs/development/tools/xcbuild/sdk.nix | 31 + pkgs/development/tools/xcbuild/setup-hook.sh | 17 + pkgs/development/tools/xcbuild/toolchain.nix | 100 +++ pkgs/development/tools/xcbuild/wrapper.nix | 64 ++ pkgs/top-level/all-packages.nix | 5 +- 8 files changed, 859 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/tools/xcbuild/developer.nix create mode 100644 pkgs/development/tools/xcbuild/platform.nix create mode 100644 pkgs/development/tools/xcbuild/sdk.nix create mode 100644 pkgs/development/tools/xcbuild/setup-hook.sh create mode 100644 pkgs/development/tools/xcbuild/toolchain.nix create mode 100644 pkgs/development/tools/xcbuild/wrapper.nix diff --git a/pkgs/development/tools/xcbuild/default.nix b/pkgs/development/tools/xcbuild/default.nix index e313672aea3f..1393034ff205 100644 --- a/pkgs/development/tools/xcbuild/default.nix +++ b/pkgs/development/tools/xcbuild/default.nix @@ -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 ]; -} \ No newline at end of file + buildInputs = [ cmake zlib libxml2 libpng ninja ] + ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices CoreGraphics ImageIO ]; +} diff --git a/pkgs/development/tools/xcbuild/developer.nix b/pkgs/development/tools/xcbuild/developer.nix new file mode 100644 index 000000000000..993a5fb861a2 --- /dev/null +++ b/pkgs/development/tools/xcbuild/developer.nix @@ -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} + ''; +} diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix new file mode 100644 index 000000000000..692a673e5c9d --- /dev/null +++ b/pkgs/development/tools/xcbuild/platform.nix @@ -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} + ''; +} diff --git a/pkgs/development/tools/xcbuild/sdk.nix b/pkgs/development/tools/xcbuild/sdk.nix new file mode 100644 index 000000000000..11131fcd9cfa --- /dev/null +++ b/pkgs/development/tools/xcbuild/sdk.nix @@ -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)} + ''; +} diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh new file mode 100644 index 000000000000..4a0f74b0e6df --- /dev/null +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -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 diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix new file mode 100644 index 000000000000..05fcd60c5873 --- /dev/null +++ b/pkgs/development/tools/xcbuild/toolchain.nix @@ -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 diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix new file mode 100644 index 000000000000..1b38c85ceb95 --- /dev/null +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -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; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9bbf962a45fd..11153d889d7e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {}; From 8e301fab5021a0b9d93934ea36183fd249b21f76 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 20 Oct 2016 03:17:24 -0500 Subject: [PATCH 02/19] adv_cmds: add xcode derivation --- .../apple-source-releases/adv_cmds/xcode.nix | 22 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix new file mode 100644 index 000000000000..ca041dfa4003 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl, xcbuild, xpc }: + +stdenv.mkDerivation { + name = "adv_cmds"; + + src = fetchurl { + url = "https://opensource.apple.com/tarballs/adv_cmds/adv_cmds-163.tar.gz"; + sha256 = "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q"; + }; + + patchPhase = '' + substituteInPlace pkill/pkill.c \ + --replace '#include ' "" + ''; + + buildInputs = [ xcbuild xpc ]; + + meta = { + platforms = stdenv.lib.platforms.darwin; + maintainers = with stdenv.lib.maintainers; [ matthewbauer ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11153d889d7e..5775d9c33b30 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17377,4 +17377,6 @@ in xulrunner = firefox-unwrapped; nitrokey-app = callPackage ../tools/security/nitrokey-app { }; + + adv_cmds = callPackage ../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix {}; } From 44ad052c4329a6404ad7622b32797059d1db2819 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 2 Nov 2016 00:17:58 -0500 Subject: [PATCH 03/19] xcbuild: Make "xcbuild.raw" for original unwrapped --- pkgs/development/tools/xcbuild/wrapper.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index 1b38c85ceb95..b8e270ea1fff 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -60,5 +60,9 @@ stdenv.mkDerivation { --set DEVELOPER_DIR "${developer}" ''; + passthru = { + raw = xcbuild; + }; + preferLocalBuild = true; } From ebf963ac6cf7b5661cbca21631787211f2bc828f Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sat, 5 Nov 2016 19:51:15 -0500 Subject: [PATCH 04/19] xcbuild: Update toolchain - Rework spec files. - Add more tool specs. - Add ctags. --- pkgs/development/tools/xcbuild/developer.nix | 145 ++++- pkgs/development/tools/xcbuild/platform.nix | 578 +------------------ pkgs/development/tools/xcbuild/sdk.nix | 4 +- pkgs/development/tools/xcbuild/toolchain.nix | 39 +- pkgs/development/tools/xcbuild/wrapper.nix | 9 +- pkgs/top-level/all-packages.nix | 6 +- 6 files changed, 170 insertions(+), 611 deletions(-) diff --git a/pkgs/development/tools/xcbuild/developer.nix b/pkgs/development/tools/xcbuild/developer.nix index 993a5fb861a2..05e05def2ac2 100644 --- a/pkgs/development/tools/xcbuild/developer.nix +++ b/pkgs/development/tools/xcbuild/developer.nix @@ -1,15 +1,138 @@ -{stdenv, platform, toolchain, xcbuild, writeText}: +{ stdenv, platform, toolchain, xcbuild, writeText }: let -AbstractAssetCatalog = { - Type = "FileType"; - Identifier = "folder.abstractassetcatalog"; - BasedOn = "wrapper"; + Tools = [ + { + Identifier = "com.apple.build-tools.nmedit"; + Type = "Tool"; + Name = "Nmedit"; + } + { + Identifier = "com.apple.compilers.resource-copier"; + Type = "Tool"; + Name = "Resource Copier"; + } + { + Identifier = "com.apple.compilers.yacc"; + Type = "Tool"; + Name = "Yacc"; + InputFileTypes = [ "sourcecode.yacc" ]; + ExecDescription = "Yacc $(InputFile)"; + } + { + Identifier = "com.apple.compilers.lex"; + Type = "Tool"; + Name = "Lex"; + ExecDescription = "Lex $(InputFile)"; + InputFileTypes = [ "sourcecode.lex" ]; + } + ]; - UTI = "com.apple.dt.abstractassetcatalog"; - IsTransparent = "NO"; -}; + Architectures = [ + { + Identifier = "Standard"; + Type = "Architecture"; + Name = "Standard Architectures (64-bit Intel)"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD"; + } + { + Identifier = "Universal"; + Type = "Architecture"; + Name = "Universal (64-bit Intel)"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; + } + { + Identifier = "Native"; + Type = "Architecture"; + Name = "Native Architecture of Build Machine"; + ArchitectureSetting = "NATIVE_ARCH_ACTUAL"; + } + { + Identifier = "Standard64bit"; + Type = "Architecture"; + Name = "64-bit Intel"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; + } + { + Identifier = "x86_64"; + Type = "Architecture"; + Name = "Intel 64-bit"; + } + { + Identifier = "Standard_Including_64_bit"; + Type = "Architecture"; + Name = "Standard Architectures (including 64-bit)"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; + } + ]; + + PackageTypes = [ + { + Identifier = "com.apple.package-type.mach-o-executable"; + Type = "PackageType"; + Name = "Mach-O Executable"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.executable"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.mach-o-objfile"; + Type = "PackageType"; + Name = "Mach-O Object File"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.objfile"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.mach-o-dylib"; + Type = "PackageType"; + Name = "Mach-O Dynamic Library"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.dylib"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + ]; + + ProductTypes = [ + { + Identifier = "com.apple.product-type.tool"; + Type = "ProductType"; + Name = "Command-line Tool"; + PackageTypes = [ "com.apple.package-type.mach-o-executable" ]; + } + { + Identifier = "com.apple.product-type.objfile"; + Type = "ProductType"; + Name = "Object File"; + PackageTypes = [ "com.apple.package-type.mach-o-objfile" ]; + } + { + Identifier = "com.apple.product-type.library.dynamic"; + Type = "ProductType"; + Name = "Dynamic Library"; + PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; + } + ]; in @@ -20,7 +143,11 @@ stdenv.mkDerivation { 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 + cd $out/Contents/Developer/Library/Xcode/Specifications/ + plutil -convert xml1 -o Tools.xcspec ${writeText "Tools.xcspec" (builtins.toJSON Tools)} + plutil -convert xml1 -o Architectures.xcspec ${writeText "Architectures.xcspec" (builtins.toJSON Architectures)} + plutil -convert xml1 -o PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)} + plutil -convert xml1 -o ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)} mkdir -p $out/Contents/Developer/Platforms/ cd $out/Contents/Developer/Platforms/ diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix index 692a673e5c9d..491f1d6309f8 100644 --- a/pkgs/development/tools/xcbuild/platform.nix +++ b/pkgs/development/tools/xcbuild/platform.nix @@ -11,576 +11,6 @@ let 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 { @@ -590,12 +20,8 @@ stdenv.mkDerivation { 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)} + plutil -convert xml1 -o Info.plist ${writeText "Info.plist" (builtins.toJSON Info)} + plutil -convert xml1 -o version.plist ${writeText "version.plist" (builtins.toJSON Version)} mkdir -p $out/Developer/SDKs/ cd $out/Developer/SDKs/ diff --git a/pkgs/development/tools/xcbuild/sdk.nix b/pkgs/development/tools/xcbuild/sdk.nix index 11131fcd9cfa..7d587249bf8e 100644 --- a/pkgs/development/tools/xcbuild/sdk.nix +++ b/pkgs/development/tools/xcbuild/sdk.nix @@ -23,9 +23,9 @@ stdenv.mkDerivation { buildInputs = [ xcbuild ]; buildCommand = '' mkdir -p $out/ - /usr/bin/plutil -convert xml1 -o $out/SDKSettings.plist ${writeText "SDKSettings.json" (builtins.toJSON SDKSettings)} + 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)} + plutil -convert xml1 -o $out/System/Library/CoreServices/SystemVersion.plist ${writeText "SystemVersion.plist" (builtins.toJSON SystemVersion)} ''; } diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix index 05fcd60c5873..e86536c45983 100644 --- a/pkgs/development/tools/xcbuild/toolchain.nix +++ b/pkgs/development/tools/xcbuild/toolchain.nix @@ -1,5 +1,6 @@ {stdenv, writeText, toolchainName, xcbuild -, cc, cctools, llvm, yacc, flex, m4, unifdef, bootstrap_cmds}: +, cc, llvm, cctools, gcc, bootstrap_cmds, binutils +, yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper}: let @@ -11,11 +12,11 @@ in stdenv.mkDerivation { name = "nixpkgs.xctoolchain"; - buildInputs = [ xcbuild ]; - propagatedBuildInputs = [ cc cctools llvm ]; + buildInputs = [ xcbuild makeWrapper ]; + propagatedBuildInputs = [ cc cctools llvm gcc bootstrap_cmds binutils yacc flex m4 unifdef gperf indent ]; buildCommand = '' mkdir -p $out - /usr/bin/plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)} + plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)} mkdir -p $out/usr/include mkdir -p $out/usr/lib @@ -27,10 +28,8 @@ stdenv.mkDerivation { 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 cc clang ln -s ${cctools}/bin/ar ln -s ${cctools}/bin/as @@ -66,7 +65,9 @@ stdenv.mkDerivation { 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 @@ -74,27 +75,31 @@ stdenv.mkDerivation { ln -s ${unifdef}/bin/unifdefall ln -s ${bootstrap_cmds}/bin/mig + + ln -s ${gperf}/bin/gperf + ln -s ${gcc}/bin/gcov + ln -s ${gcc}/bin/mkdep + ln -s ${indent}/bin/indent + ln -s ${binutils}/bin/lipo + ln -s ${ctags}/bin/ctags ''; } # other commands in /bin/ # asa -# cmpdylib -# ctags -# ctf_insert +# cmpdylib (in cctools) +# ctf_insert (in cctools) # dwarfdump -# gcov -# gperf -# indent -# lipo # lorder -# mkdep # rebase -# rpcgen +# rpcgen (in developer_cmds) +# what + + +# swift: see #11463 # swift # swift-compress # swift-demangle # swift-stdlib-tool # swift-update # swiftc -# what diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index b8e270ea1fff..ef4ab245ec0c 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -1,19 +1,18 @@ { stdenv, callPackage, makeWrapper, writeText, CoreServices, ImageIO, CoreGraphics -, cctools, bootstrap_cmds}: +, cctools, bootstrap_cmds, binutils}: let toolchainName = "com.apple.dt.toolchain.XcodeDefault"; platformName = "com.apple.platform.macosx"; - sdkName = "macosx10.9"; + sdkName = "macosx10.10"; xcbuild = callPackage ./default.nix { inherit CoreServices ImageIO CoreGraphics; }; toolchain = callPackage ./toolchain.nix { - inherit cctools bootstrap_cmds toolchainName xcbuild; - cc = stdenv.cc; + inherit cctools bootstrap_cmds toolchainName xcbuild binutils; }; sdk = callPackage ./sdk.nix { @@ -29,7 +28,7 @@ let }; xcconfig = writeText "nix.xcconfig" '' -SDKROOT=${sdkName} + SDKROOT=${sdkName} ''; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5775d9c33b30..bf91489c8927 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6432,7 +6432,7 @@ in xcbuild = callPackage ../development/tools/xcbuild/wrapper.nix { inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO; - inherit (darwin) cctools bootstrap_cmds; + inherit (darwin) cctools bootstrap_cmds binutils; }; xmlindent = callPackage ../development/web/xmlindent {}; @@ -17378,5 +17378,7 @@ in nitrokey-app = callPackage ../tools/security/nitrokey-app { }; - adv_cmds = callPackage ../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix {}; + adv_cmds = callPackage ../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix { + inherit (darwin.apple_sdk.libs) xpc; + }; } From 6c1858a93dee8c28f5f7f804f4153d8f9c6c7bb8 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 7 Nov 2016 16:09:10 -0600 Subject: [PATCH 05/19] adv_cmds: Disable pkill. pkill isn't building because of some missing headers: - xpc/xpc.h - os/base_private.h - _simple.h They are all available somewhere but not set up correctly in the Darwin stdenv. TODO: add pkill back in! --- .../darwin/apple-source-releases/adv_cmds/xcode.nix | 9 +++++---- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index ca041dfa4003..f9e8207d8bfa 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, xcbuild, xpc }: +{ stdenv, fetchurl, xcbuild, libcxx }: stdenv.mkDerivation { name = "adv_cmds"; @@ -9,11 +9,12 @@ stdenv.mkDerivation { }; patchPhase = '' - substituteInPlace pkill/pkill.c \ - --replace '#include ' "" + substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ + --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" ''; - buildInputs = [ xcbuild xpc ]; + buildInputs = [ xcbuild libcxx ]; + #NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1"; meta = { platforms = stdenv.lib.platforms.darwin; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bf91489c8927..ddee4d24e2b9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17378,7 +17378,5 @@ in nitrokey-app = callPackage ../tools/security/nitrokey-app { }; - adv_cmds = callPackage ../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix { - inherit (darwin.apple_sdk.libs) xpc; - }; + adv_cmds = callPackage ../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix {}; } From f1897116d04d99a4491ef3a8db6acf54dd0035c6 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 7 Nov 2016 17:43:20 -0600 Subject: [PATCH 06/19] xcbuild: temporarily fix cflags/ldflags This gets everything to build. adv_cmds: remove NIX_LDFLAGS - unneeded --- pkgs/development/tools/xcbuild/setup-hook.sh | 2 +- .../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh index 4a0f74b0e6df..72ffb7b128c5 100644 --- a/pkgs/development/tools/xcbuild/setup-hook.sh +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -3,7 +3,7 @@ xcbuildPhase() { echo "running xcodebuild" - xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" + xcodebuild runHook postConfigure } diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index f9e8207d8bfa..e5600f3962da 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation { ''; buildInputs = [ xcbuild libcxx ]; - #NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1"; + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1"; meta = { platforms = stdenv.lib.platforms.darwin; From 78c3acc2eee5510dfdebcab4e62b32a7f43930c4 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 7 Nov 2016 19:57:42 -0600 Subject: [PATCH 07/19] xcbuild: Add install phase This phase is disabled for now but we can use it later. --- pkgs/development/tools/xcbuild/setup-hook.sh | 24 +++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh index 72ffb7b128c5..0d38e2466b0d 100644 --- a/pkgs/development/tools/xcbuild/setup-hook.sh +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -1,15 +1,27 @@ -xcbuildPhase() { - runHook preConfigure +xcbuildBuildPhase() { + export DSTROOT=$out + + runHook preBuild echo "running xcodebuild" - xcodebuild + xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build - runHook postConfigure + runHook postBuild } -if [ -z "$dontUseXcbuild" -a -z "$configurePhase" ]; then - configurePhase=xcbuildPhase +xcbuildInstallPhase () { + runHook preInstall + + # not implemented + # xcodebuild install + + runHook postInstall +} + +if [ -z "$dontUseXcbuild" ]; then + buildPhase=xcbuildBuildPhase + installPhase=xcbuildInstallPhase fi # if [ -d "*.xcodeproj" ]; then From 1ee8685ee73b8867810e9a309d106019f11be0f7 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 7 Nov 2016 21:55:31 -0600 Subject: [PATCH 08/19] adv_cmds: add custom install phase --- pkgs/development/tools/xcbuild/setup-hook.sh | 4 +++- .../darwin/apple-source-releases/adv_cmds/xcode.nix | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh index 0d38e2466b0d..b0ae8dd6e8e2 100644 --- a/pkgs/development/tools/xcbuild/setup-hook.sh +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -21,7 +21,9 @@ xcbuildInstallPhase () { if [ -z "$dontUseXcbuild" ]; then buildPhase=xcbuildBuildPhase - installPhase=xcbuildInstallPhase + if [ -z "$installPhase" ]; then + installPhase=xcbuildInstallPhase + fi fi # if [ -d "*.xcodeproj" ]; then diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index e5600f3962da..7857a59161c0 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -8,12 +8,25 @@ stdenv.mkDerivation { sha256 = "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q"; }; + # remove pkill from build patchPhase = '' substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" ''; + # temporary install phase until xcodebuild has "install" support + installPhase = '' + mkdir -p $out/bin/ + + for cmd in cap_mkdb finger fingerd gencat last locale lsvfs ps stty tabs tty whois + do + install adv_cmds-*/Build/Products/Release-*/$cmd $out/bin/$cmd + done + ''; + buildInputs = [ xcbuild libcxx ]; + + # temporary fix for iostream issue NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1"; meta = { From a35b330f30d0138ff5e4a86c7afdcc7c7e311fea Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 22:24:59 -0600 Subject: [PATCH 09/19] adv_cmds: move from all-packages Use the old way with pkgs/os-specific/darwin/apple-source-releases/defuault.nix. --- .../apple-source-releases/adv_cmds/xcode.nix | 27 ++++++++++--------- .../darwin/apple-source-releases/default.nix | 2 ++ pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index 7857a59161c0..15160e02e149 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -1,14 +1,7 @@ -{ stdenv, fetchurl, xcbuild, libcxx }: +{ stdenv, appleDerivation, fetchurl, xcbuild, libcxx }: -stdenv.mkDerivation { - name = "adv_cmds"; - - src = fetchurl { - url = "https://opensource.apple.com/tarballs/adv_cmds/adv_cmds-163.tar.gz"; - sha256 = "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q"; - }; - - # remove pkill from build +appleDerivation { + # disable pkill from build patchPhase = '' substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" @@ -17,11 +10,19 @@ stdenv.mkDerivation { # temporary install phase until xcodebuild has "install" support installPhase = '' mkdir -p $out/bin/ + install adv_cmds-*/Build/Products/Release-*/* $out/bin/ - for cmd in cap_mkdb finger fingerd gencat last locale lsvfs ps stty tabs tty whois - do - install adv_cmds-*/Build/Products/Release-*/$cmd $out/bin/$cmd + for n in 1 8; do + mkdir -p $out/share/man/man$n + install */*.$n $out/share/man/man$n done + + mkdir -p $out/System/Library/LaunchDaemons + install fingerd/finger.plist $out/System/Library/LaunchDaemons + + # from variant_links.sh + # ln -s $out/bin/pkill $out/bin/pgrep + # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1 ''; buildInputs = [ xcbuild libcxx ]; diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 2ebb8868a2ea..2f49330ed595 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -33,6 +33,7 @@ let libutil = "43"; libunwind = "35.3"; + adv_cmds = "163"; }; "osx-10.11.5" = { Libc = "1082.50.1"; # 10.11.6 still unreleased :/ @@ -213,6 +214,7 @@ let removefile = applePackage "removefile" "osx-10.11.6" "1b6r74ry3k01kypvlaclf33fha15pcm0kzx9zrymlg66wg0s0i3r" {}; Security = applePackage "Security" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; xnu = applePackage "xnu" "osx-10.11.6" "0yhziq4dqqcbjpf6vyqn8xhwva2zb525gndkx8cp8alzwp76jnr9" {}; + adv_cmds = applePackage "adv_cmds/xcode.nix" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {}; libsecurity_apple_csp = libsecPackage "libsecurity_apple_csp" "osx-10.7.5" "1ngyn1ik27n4x981px3kfd1z1n8zx7r5w812b6qfjpy5nw4h746w" {}; libsecurity_apple_cspdl = libsecPackage "libsecurity_apple_cspdl" "osx-10.7.5" "1svqa5fhw7p7njzf8bzg7zgc5776aqjhdbnlhpwmr5hmz5i0x8r7" {}; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ddee4d24e2b9..b1273fc469b6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17377,6 +17377,4 @@ in xulrunner = firefox-unwrapped; nitrokey-app = callPackage ../tools/security/nitrokey-app { }; - - adv_cmds = callPackage ../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix {}; } From ec409c8e9698e5be7c1d3635bc0a547e6564bc36 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 12:01:49 -0600 Subject: [PATCH 10/19] contacts: use xcbuild instead of xcodebuild --- pkgs/tools/misc/contacts/default.nix | 10 +++++----- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/contacts/default.nix b/pkgs/tools/misc/contacts/default.nix index 2bfe0eb42665..bd52f1bc0a49 100644 --- a/pkgs/tools/misc/contacts/default.nix +++ b/pkgs/tools/misc/contacts/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, xcbuild, Foundation, AddressBook }: stdenv.mkDerivation rec { version = "1.1a-3"; @@ -9,15 +9,15 @@ stdenv.mkDerivation rec { sha256 = "0wdqc1ndgrdhqapvvgx5xihc750szv08lp91x4l6n0gh59cpxpg3"; }; - preBuild = '' - substituteInPlace Makefile --replace "xcodebuild" "/usr/bin/xcodebuild" - ''; + buildInputs = [ xcbuild Foundation AddressBook ]; installPhase = '' mkdir -p $out/bin - cp ./build/Deployment/contacts $out/bin + cp ./contacts-*/Build/Products/Default-*/contacts $out/bin ''; + NIX_LDFLAGS = " -F${Foundation}/Library/Frameworks/ -F${AddressBook}/Library/Frameworks/"; + meta = with stdenv.lib; { description = "Access contacts from the Mac address book from command-line"; homepage = http://www.gnufoo.org/contacts/contacts.html; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b1273fc469b6..4f2a1d837952 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -760,7 +760,9 @@ in cpulimit = callPackage ../tools/misc/cpulimit { }; - contacts = callPackage ../tools/misc/contacts { }; + contacts = callPackage ../tools/misc/contacts { + inherit (darwin.apple_sdk.frameworks) Foundation AddressBook; + }; coturn = callPackage ../servers/coturn { }; From 4a01a370514796936929d65f6497fdc0326de496 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 13:08:09 -0600 Subject: [PATCH 11/19] basic_cmds: init at 55 --- .../basic_cmds/default.nix | 22 +++++++++++++++++++ .../darwin/apple-source-releases/default.nix | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix diff --git a/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix new file mode 100644 index 000000000000..6f0ea955cf0a --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix @@ -0,0 +1,22 @@ +{ stdenv, appleDerivation, fetchurl, xcbuild }: + +appleDerivation rec { + buildInputs = [ xcbuild ]; + + # temporary install phase until xcodebuild has "install" support + installPhase = '' + mkdir -p $out/bin/ + install basic_cmds-*/Build/Products/Release-*/* $out/bin/ + + for n in 1; do + mkdir -p $out/share/man/man$n + install */*.$n $out/share/man/man$n + done + + ''; + + meta = { + platforms = stdenv.lib.platforms.darwin; + maintainers = with stdenv.lib.maintainers; [ matthewbauer ]; + }; +} diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 2f49330ed595..8aa0a6d675f7 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -33,6 +33,7 @@ let libutil = "43"; libunwind = "35.3"; + basic_cmds = "55"; adv_cmds = "163"; }; "osx-10.11.5" = { @@ -215,6 +216,7 @@ let Security = applePackage "Security" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; xnu = applePackage "xnu" "osx-10.11.6" "0yhziq4dqqcbjpf6vyqn8xhwva2zb525gndkx8cp8alzwp76jnr9" {}; adv_cmds = applePackage "adv_cmds/xcode.nix" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {}; + basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {}; libsecurity_apple_csp = libsecPackage "libsecurity_apple_csp" "osx-10.7.5" "1ngyn1ik27n4x981px3kfd1z1n8zx7r5w812b6qfjpy5nw4h746w" {}; libsecurity_apple_cspdl = libsecPackage "libsecurity_apple_cspdl" "osx-10.7.5" "1svqa5fhw7p7njzf8bzg7zgc5776aqjhdbnlhpwmr5hmz5i0x8r7" {}; From 823772b0569681284957177f4a442aef5f7e737a Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 22:28:37 -0600 Subject: [PATCH 12/19] Librpcsvc: init at 26 --- .../Librpcsvc/default.nix | 25 +++++++++++++++++++ .../darwin/apple-source-releases/default.nix | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix diff --git a/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix new file mode 100644 index 000000000000..b20687b41593 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix @@ -0,0 +1,25 @@ +{ stdenv, appleDerivation, developer_cmds }: + +appleDerivation rec { + phases = [ "unpackPhase" "installPhase" ]; + + buildInputs = [ developer_cmds ]; + + installPhase = '' + export DSTROOT=$out + export SRCROOT=$PWD + export OBJROOT=$PWD + + . ./xcodescripts/install_rpcsvc.sh + + mv $out/usr/* $out + rmdir $out/usr/ + ''; + + meta = with stdenv.lib; { + description = ""; + maintainers = with maintainers; [ matthewbauer ]; + platforms = platforms.darwin; + license = licenses.apsl20; + }; +} diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 8aa0a6d675f7..180a6f90283e 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -33,6 +33,7 @@ let libutil = "43"; libunwind = "35.3"; + Librpcsvc = "26"; basic_cmds = "55"; adv_cmds = "163"; }; @@ -215,6 +216,7 @@ let removefile = applePackage "removefile" "osx-10.11.6" "1b6r74ry3k01kypvlaclf33fha15pcm0kzx9zrymlg66wg0s0i3r" {}; Security = applePackage "Security" "osx-10.9.5" "1nv0dczf67dhk17hscx52izgdcyacgyy12ag0jh6nl5hmfzsn8yy" {}; xnu = applePackage "xnu" "osx-10.11.6" "0yhziq4dqqcbjpf6vyqn8xhwva2zb525gndkx8cp8alzwp76jnr9" {}; + Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "1zwfwcl9irxl1dlnf2b4v30vdybp0p0r6n6g1pd14zbdci1jcg2k" {}; adv_cmds = applePackage "adv_cmds/xcode.nix" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {}; basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {}; From 3b17d9e35e04885859d27024c75954d212a40b8a Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 22:29:57 -0600 Subject: [PATCH 13/19] developer_cmds: init at 62 --- .../darwin/apple-source-releases/default.nix | 2 ++ .../developer_cmds/default.nix | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 180a6f90283e..232c473ecb07 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -34,6 +34,7 @@ let libutil = "43"; libunwind = "35.3"; Librpcsvc = "26"; + developer_cmds= "62"; basic_cmds = "55"; adv_cmds = "163"; }; @@ -219,6 +220,7 @@ let Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "1zwfwcl9irxl1dlnf2b4v30vdybp0p0r6n6g1pd14zbdci1jcg2k" {}; adv_cmds = applePackage "adv_cmds/xcode.nix" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {}; basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {}; + developer_cmds = applePackage "developer_cmds" "osx-10.11.6" "1r9c2b6dcl22diqf90x58psvz797d3lxh4r2wppr7lldgbgn24di" {}; libsecurity_apple_csp = libsecPackage "libsecurity_apple_csp" "osx-10.7.5" "1ngyn1ik27n4x981px3kfd1z1n8zx7r5w812b6qfjpy5nw4h746w" {}; libsecurity_apple_cspdl = libsecPackage "libsecurity_apple_cspdl" "osx-10.7.5" "1svqa5fhw7p7njzf8bzg7zgc5776aqjhdbnlhpwmr5hmz5i0x8r7" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix new file mode 100644 index 000000000000..b58951423fec --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchurl, appleDerivation, xcbuild }: + +appleDerivation rec { + buildInputs = [ xcbuild ]; + + patchPhase = '' + substituteInPlace rpcgen/rpc_main.c \ + --replace "/usr/bin/cpp" "${stdenv.cc}/bin/cpp" + ''; + + # temporary install phase until xcodebuild has "install" support + installPhase = '' + mkdir -p $out/bin/ + install developer_cmds-*/Build/Products/Release-*/* $out/bin/ + + for n in 1; do + mkdir -p $out/share/man/man$n + install */*.$n $out/share/man/man$n + done + ''; + + meta = { + platforms = stdenv.lib.platforms.darwin; + maintainers = with stdenv.lib.maintainers; [ matthewbauer ]; + }; +} From 9f46587841448decbb1ec8e46076e36838f82c93 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 22:30:32 -0600 Subject: [PATCH 14/19] network_cmds: init at 481.20.1 Fixes #16764 --- .../darwin/apple-source-releases/default.nix | 2 + .../network_cmds/default.nix | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index 232c473ecb07..af17babac56a 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -35,6 +35,7 @@ let libunwind = "35.3"; Librpcsvc = "26"; developer_cmds= "62"; + network_cmds = "481.20.1"; basic_cmds = "55"; adv_cmds = "163"; }; @@ -221,6 +222,7 @@ let adv_cmds = applePackage "adv_cmds/xcode.nix" "osx-10.11.6" "12gbv35i09aij9g90p6b3x2f3ramw43qcb2gjrg8lzkzmwvcyw9q" {}; basic_cmds = applePackage "basic_cmds" "osx-10.11.6" "0hvab4b1v5q2x134hdkal0rmz5gsdqyki1vb0dbw4py1bqf0yaw9" {}; developer_cmds = applePackage "developer_cmds" "osx-10.11.6" "1r9c2b6dcl22diqf90x58psvz797d3lxh4r2wppr7lldgbgn24di" {}; + network_cmds = applePackage "network_cmds" "osx-10.11.6" "0lhi9wz84qr1r2ab3fb4nvmdg9gxn817n5ldg7zw9gnf3wwn42kw" {}; libsecurity_apple_csp = libsecPackage "libsecurity_apple_csp" "osx-10.7.5" "1ngyn1ik27n4x981px3kfd1z1n8zx7r5w812b6qfjpy5nw4h746w" {}; libsecurity_apple_cspdl = libsecPackage "libsecurity_apple_cspdl" "osx-10.7.5" "1svqa5fhw7p7njzf8bzg7zgc5776aqjhdbnlhpwmr5hmz5i0x8r7" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix new file mode 100644 index 000000000000..fe4d60e7ebe9 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix @@ -0,0 +1,39 @@ +{ stdenv, appleDerivation, xcbuild, openssl, Librpcsvc, xnu, libpcap, developer_cmds }: + +appleDerivation rec { + buildInputs = [ xcbuild openssl xnu Librpcsvc libpcap developer_cmds ]; + + NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/ -D__APPLE_USE_RFC_2292 -DIPV6_DONTFRAG=14 -DINET6"; + + patchPhase = '' + # disable spray, rtadvd + substituteInPlace network_cmds.xcodeproj/project.pbxproj \ + --replace "7294F0EA0EE8BAC80052EC88 /* PBXTargetDependency */," "" \ + --replace "7216D34D0EE89FEC00AE70E4 /* PBXTargetDependency */," "" + ''; + + # temporary install phase until xcodebuild has "install" support + installPhase = '' + mkdir -p $out/bin/ + install network_cmds-*/Build/Products/Release-*/* $out/bin/ + + for n in 1 5; do + mkdir -p $out/share/man/man$n + install */*.$n $out/share/man/man$n + done + + mkdir -p $out/etc/ + install rtadvd.tproj/rtadvd.conf ip6addrctl.tproj/ip6addrctl.conf $out/etc/ + + mkdir -p $out/local/OpenSourceVersions/ + install network_cmds.plist $out/local/OpenSourceVersions/ + + mkdir -p $out/System/Library/LaunchDaemons + install kdumpd.tproj/com.apple.kdumpd.plist $out/System/Library/LaunchDaemons + ''; + + meta = { + platforms = stdenv.lib.platforms.darwin; + maintainers = with stdenv.lib.maintainers; [ matthewbauer ]; + }; +} From 25485ece2a3568fd84291ce4d600199c53754619 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 9 Nov 2016 23:07:24 -0600 Subject: [PATCH 15/19] xcbuild: add name to platform.nix --- pkgs/development/tools/xcbuild/platform.nix | 1 + .../os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix | 2 +- .../darwin/apple-source-releases/basic_cmds/default.nix | 2 +- .../darwin/apple-source-releases/developer_cmds/default.nix | 2 +- .../darwin/apple-source-releases/network_cmds/default.nix | 2 +- pkgs/tools/misc/contacts/default.nix | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix index 491f1d6309f8..eea8ea5f9ebd 100644 --- a/pkgs/development/tools/xcbuild/platform.nix +++ b/pkgs/development/tools/xcbuild/platform.nix @@ -5,6 +5,7 @@ let Info = { CFBundleIdentifier = platformName; Type = "Platform"; + Name = "macosx"; }; Version = { diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index 15160e02e149..7a8fdde69feb 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -10,7 +10,7 @@ appleDerivation { # temporary install phase until xcodebuild has "install" support installPhase = '' mkdir -p $out/bin/ - install adv_cmds-*/Build/Products/Release-*/* $out/bin/ + install adv_cmds-*/Build/Products/Release/* $out/bin/ for n in 1 8; do mkdir -p $out/share/man/man$n diff --git a/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix index 6f0ea955cf0a..07a13966efe6 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix @@ -6,7 +6,7 @@ appleDerivation rec { # temporary install phase until xcodebuild has "install" support installPhase = '' mkdir -p $out/bin/ - install basic_cmds-*/Build/Products/Release-*/* $out/bin/ + install basic_cmds-*/Build/Products/Release/* $out/bin/ for n in 1; do mkdir -p $out/share/man/man$n diff --git a/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix index b58951423fec..67fbf83496ed 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/developer_cmds/default.nix @@ -11,7 +11,7 @@ appleDerivation rec { # temporary install phase until xcodebuild has "install" support installPhase = '' mkdir -p $out/bin/ - install developer_cmds-*/Build/Products/Release-*/* $out/bin/ + install developer_cmds-*/Build/Products/Release/* $out/bin/ for n in 1; do mkdir -p $out/share/man/man$n diff --git a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix index fe4d60e7ebe9..090a9d05fb87 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix @@ -15,7 +15,7 @@ appleDerivation rec { # temporary install phase until xcodebuild has "install" support installPhase = '' mkdir -p $out/bin/ - install network_cmds-*/Build/Products/Release-*/* $out/bin/ + install network_cmds-*/Build/Products/Release/* $out/bin/ for n in 1 5; do mkdir -p $out/share/man/man$n diff --git a/pkgs/tools/misc/contacts/default.nix b/pkgs/tools/misc/contacts/default.nix index bd52f1bc0a49..5c91332463f0 100644 --- a/pkgs/tools/misc/contacts/default.nix +++ b/pkgs/tools/misc/contacts/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { installPhase = '' mkdir -p $out/bin - cp ./contacts-*/Build/Products/Default-*/contacts $out/bin + cp ./contacts-*/Build/Products/Default/contacts $out/bin ''; NIX_LDFLAGS = " -F${Foundation}/Library/Frameworks/ -F${AddressBook}/Library/Frameworks/"; From 0b6bfa49d5b6c70ee2844c292044c35a39fabf96 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 10 Nov 2016 02:20:12 -0600 Subject: [PATCH 16/19] xcbuild: Move extra specs to platform --- pkgs/development/tools/xcbuild/developer.nix | 142 ------------------- pkgs/development/tools/xcbuild/platform.nix | 139 ++++++++++++++++++ 2 files changed, 139 insertions(+), 142 deletions(-) diff --git a/pkgs/development/tools/xcbuild/developer.nix b/pkgs/development/tools/xcbuild/developer.nix index 05e05def2ac2..826571238de4 100644 --- a/pkgs/development/tools/xcbuild/developer.nix +++ b/pkgs/development/tools/xcbuild/developer.nix @@ -1,141 +1,5 @@ { stdenv, platform, toolchain, xcbuild, writeText }: -let - - Tools = [ - { - Identifier = "com.apple.build-tools.nmedit"; - Type = "Tool"; - Name = "Nmedit"; - } - { - Identifier = "com.apple.compilers.resource-copier"; - Type = "Tool"; - Name = "Resource Copier"; - } - { - Identifier = "com.apple.compilers.yacc"; - Type = "Tool"; - Name = "Yacc"; - InputFileTypes = [ "sourcecode.yacc" ]; - ExecDescription = "Yacc $(InputFile)"; - } - { - Identifier = "com.apple.compilers.lex"; - Type = "Tool"; - Name = "Lex"; - ExecDescription = "Lex $(InputFile)"; - InputFileTypes = [ "sourcecode.lex" ]; - } - ]; - - Architectures = [ - { - Identifier = "Standard"; - Type = "Architecture"; - Name = "Standard Architectures (64-bit Intel)"; - RealArchitectures = [ "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD"; - } - { - Identifier = "Universal"; - Type = "Architecture"; - Name = "Universal (64-bit Intel)"; - RealArchitectures = [ "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; - } - { - Identifier = "Native"; - Type = "Architecture"; - Name = "Native Architecture of Build Machine"; - ArchitectureSetting = "NATIVE_ARCH_ACTUAL"; - } - { - Identifier = "Standard64bit"; - Type = "Architecture"; - Name = "64-bit Intel"; - RealArchitectures = [ "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; - } - { - Identifier = "x86_64"; - Type = "Architecture"; - Name = "Intel 64-bit"; - } - { - Identifier = "Standard_Including_64_bit"; - Type = "Architecture"; - Name = "Standard Architectures (including 64-bit)"; - RealArchitectures = [ "x86_64" ]; - ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; - } - ]; - - PackageTypes = [ - { - Identifier = "com.apple.package-type.mach-o-executable"; - Type = "PackageType"; - Name = "Mach-O Executable"; - DefaultBuildSettings = { - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "compiled.mach-o.executable"; - Name = "$(EXECUTABLE_NAME)"; - }; - } - { - Identifier = "com.apple.package-type.mach-o-objfile"; - Type = "PackageType"; - Name = "Mach-O Object File"; - DefaultBuildSettings = { - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "compiled.mach-o.objfile"; - Name = "$(EXECUTABLE_NAME)"; - }; - } - { - Identifier = "com.apple.package-type.mach-o-dylib"; - Type = "PackageType"; - Name = "Mach-O Dynamic Library"; - DefaultBuildSettings = { - EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; - EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; - }; - ProductReference = { - FileType = "compiled.mach-o.dylib"; - Name = "$(EXECUTABLE_NAME)"; - }; - } - ]; - - ProductTypes = [ - { - Identifier = "com.apple.product-type.tool"; - Type = "ProductType"; - Name = "Command-line Tool"; - PackageTypes = [ "com.apple.package-type.mach-o-executable" ]; - } - { - Identifier = "com.apple.product-type.objfile"; - Type = "ProductType"; - Name = "Object File"; - PackageTypes = [ "com.apple.package-type.mach-o-objfile" ]; - } - { - Identifier = "com.apple.product-type.library.dynamic"; - Type = "ProductType"; - Name = "Dynamic Library"; - PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; - } - ]; - -in - stdenv.mkDerivation { name = "Xcode.app"; buildInputs = [ xcbuild ]; @@ -143,12 +7,6 @@ stdenv.mkDerivation { mkdir -p $out/Contents/Developer/Library/Xcode/Specifications/ cp ${xcbuild}/Library/Xcode/Specifications/* $out/Contents/Developer/Library/Xcode/Specifications/ - cd $out/Contents/Developer/Library/Xcode/Specifications/ - plutil -convert xml1 -o Tools.xcspec ${writeText "Tools.xcspec" (builtins.toJSON Tools)} - plutil -convert xml1 -o Architectures.xcspec ${writeText "Architectures.xcspec" (builtins.toJSON Architectures)} - plutil -convert xml1 -o PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)} - plutil -convert xml1 -o ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)} - mkdir -p $out/Contents/Developer/Platforms/ cd $out/Contents/Developer/Platforms/ ln -s ${platform} diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix index eea8ea5f9ebd..c54f7f83e0ee 100644 --- a/pkgs/development/tools/xcbuild/platform.nix +++ b/pkgs/development/tools/xcbuild/platform.nix @@ -12,6 +12,138 @@ let ProjectName = "OSXPlatformSupport"; }; + Tools = [ + { + Identifier = "com.apple.build-tools.nmedit"; + Type = "Tool"; + Name = "Nmedit"; + } + { + Identifier = "com.apple.compilers.resource-copier"; + Type = "Tool"; + Name = "Resource Copier"; + } + { + Identifier = "com.apple.compilers.yacc"; + Type = "Tool"; + Name = "Yacc"; + InputFileTypes = [ "sourcecode.yacc" ]; + ExecDescription = "Yacc $(InputFile)"; + } + { + Identifier = "com.apple.compilers.lex"; + Type = "Tool"; + Name = "Lex"; + ExecDescription = "Lex $(InputFile)"; + InputFileTypes = [ "sourcecode.lex" ]; + } + ]; + + Architectures = [ + { + Identifier = "Standard"; + Type = "Architecture"; + Name = "Standard Architectures (64-bit Intel)"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD"; + } + { + Identifier = "Universal"; + Type = "Architecture"; + Name = "Universal (64-bit Intel)"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT"; + } + { + Identifier = "Native"; + Type = "Architecture"; + Name = "Native Architecture of Build Machine"; + ArchitectureSetting = "NATIVE_ARCH_ACTUAL"; + } + { + Identifier = "Standard64bit"; + Type = "Architecture"; + Name = "64-bit Intel"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD_64_BIT"; + } + { + Identifier = "x86_64"; + Type = "Architecture"; + Name = "Intel 64-bit"; + } + { + Identifier = "Standard_Including_64_bit"; + Type = "Architecture"; + Name = "Standard Architectures (including 64-bit)"; + RealArchitectures = [ "x86_64" ]; + ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT"; + } + ]; + + PackageTypes = [ + { + Identifier = "com.apple.package-type.mach-o-executable"; + Type = "PackageType"; + Name = "Mach-O Executable"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.executable"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.mach-o-objfile"; + Type = "PackageType"; + Name = "Mach-O Object File"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.objfile"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + { + Identifier = "com.apple.package-type.mach-o-dylib"; + Type = "PackageType"; + Name = "Mach-O Dynamic Library"; + DefaultBuildSettings = { + EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)"; + EXECUTABLE_PATH = "$(EXECUTABLE_NAME)"; + }; + ProductReference = { + FileType = "compiled.mach-o.dylib"; + Name = "$(EXECUTABLE_NAME)"; + }; + } + ]; + + ProductTypes = [ + { + Identifier = "com.apple.product-type.tool"; + Type = "ProductType"; + Name = "Command-line Tool"; + PackageTypes = [ "com.apple.package-type.mach-o-executable" ]; + } + { + Identifier = "com.apple.product-type.objfile"; + Type = "ProductType"; + Name = "Object File"; + PackageTypes = [ "com.apple.package-type.mach-o-objfile" ]; + } + { + Identifier = "com.apple.product-type.library.dynamic"; + Type = "ProductType"; + Name = "Dynamic Library"; + PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; + } + ]; + in stdenv.mkDerivation { @@ -24,6 +156,13 @@ stdenv.mkDerivation { plutil -convert xml1 -o Info.plist ${writeText "Info.plist" (builtins.toJSON Info)} plutil -convert xml1 -o version.plist ${writeText "version.plist" (builtins.toJSON Version)} + mkdir -p $out/Developer/Library/Xcode/Specifications/ + cd $out/Developer/Library/Xcode/Specifications/ + plutil -convert xml1 -o Tools.xcspec ${writeText "Tools.xcspec" (builtins.toJSON Tools)} + plutil -convert xml1 -o Architectures.xcspec ${writeText "Architectures.xcspec" (builtins.toJSON Architectures)} + plutil -convert xml1 -o PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)} + plutil -convert xml1 -o ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)} + mkdir -p $out/Developer/SDKs/ cd $out/Developer/SDKs/ ln -s ${sdk} From 437bdc5e4bc29baaaa3991e260e5ee40de8f3fa0 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 10 Nov 2016 14:53:28 -0600 Subject: [PATCH 17/19] xcbuild: fix toolchain on Linux --- pkgs/development/tools/xcbuild/toolchain.nix | 62 +++++++++++--------- pkgs/development/tools/xcbuild/wrapper.nix | 2 +- pkgs/top-level/all-packages.nix | 1 + 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix index e86536c45983..386f67a9d631 100644 --- a/pkgs/development/tools/xcbuild/toolchain.nix +++ b/pkgs/development/tools/xcbuild/toolchain.nix @@ -1,5 +1,5 @@ {stdenv, writeText, toolchainName, xcbuild -, cc, llvm, cctools, gcc, bootstrap_cmds, binutils +, llvm, cctools, gcc, bootstrap_cmds, binutils , yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper}: let @@ -13,7 +13,11 @@ in stdenv.mkDerivation { name = "nixpkgs.xctoolchain"; buildInputs = [ xcbuild makeWrapper ]; - propagatedBuildInputs = [ cc cctools llvm gcc bootstrap_cmds binutils yacc flex m4 unifdef gperf indent ]; + + propagatedBuildInputs = [ llvm gcc yacc flex m4 unifdef gperf indent ] + ++ stdenv.lib.optionals stdenv.isDarwin [ cctools bootstrap_cmds binutils ]; + ## cctools should build on Linux but it doesn't currentl + buildCommand = '' mkdir -p $out plutil -convert xml1 -o $out/ToolchainInfo.plist ${writeText "ToolchainInfo.plist" (builtins.toJSON ToolchainInfo)} @@ -25,33 +29,12 @@ stdenv.mkDerivation { 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 ${stdenv.cc}/bin/cpp + ln -s ${stdenv.cc}/bin/c++ + ln -s ${stdenv.cc}/bin/cc ln -s c++ clang++ ln -s cc clang - 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 @@ -74,14 +57,35 @@ stdenv.mkDerivation { ln -s ${unifdef}/bin/unifdef ln -s ${unifdef}/bin/unifdefall - ln -s ${bootstrap_cmds}/bin/mig - ln -s ${gperf}/bin/gperf ln -s ${gcc}/bin/gcov ln -s ${gcc}/bin/mkdep ln -s ${indent}/bin/indent - ln -s ${binutils}/bin/lipo ln -s ${ctags}/bin/ctags + '' + stdenv.lib.optionalString stdenv.isDarwin '' + ln -s ${bootstrap_cmds}/bin/mig + ln -s ${binutils}/bin/lipo + + 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 ''; } diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index ef4ab245ec0c..2b01bdbb52b2 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -12,7 +12,7 @@ let }; toolchain = callPackage ./toolchain.nix { - inherit cctools bootstrap_cmds toolchainName xcbuild binutils; + inherit cctools bootstrap_cmds toolchainName xcbuild binutils stdenv; }; sdk = callPackage ./sdk.nix { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4f2a1d837952..2def672e6ad3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6435,6 +6435,7 @@ in xcbuild = callPackage ../development/tools/xcbuild/wrapper.nix { inherit (darwin.apple_sdk.frameworks) CoreServices CoreGraphics ImageIO; inherit (darwin) cctools bootstrap_cmds binutils; + stdenv = clangStdenv; }; xmlindent = callPackage ../development/web/xmlindent {}; From 4685bd7853c40ec970eaf722fcae993c10bb1b5d Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 10 Nov 2016 14:56:58 -0600 Subject: [PATCH 18/19] xcbuild: update meta and comments --- .../Librpcsvc/default.nix | 1 - .../apple-source-releases/adv_cmds/xcode.nix | 8 +++++++- .../network_cmds/default.nix | 18 +++++++++++------- pkgs/tools/misc/contacts/default.nix | 1 + 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix index b20687b41593..512ec6253c78 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Librpcsvc/default.nix @@ -17,7 +17,6 @@ appleDerivation rec { ''; meta = with stdenv.lib; { - description = ""; maintainers = with maintainers; [ matthewbauer ]; platforms = platforms.darwin; license = licenses.apsl20; diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index 7a8fdde69feb..fedd49022380 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -1,7 +1,13 @@ { stdenv, appleDerivation, fetchurl, xcbuild, libcxx }: appleDerivation { - # disable pkill from build + + # pkill requires special private headers that are unavailable in + # NixPkgs. These ones are needed: + # - xpc/xpxc.h + # - os/base_private.h + # - _simple.h + # We disable it here for now. TODO: build pkill inside adv_cmds patchPhase = '' substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" diff --git a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix index 090a9d05fb87..71acb833cc3f 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix @@ -5,8 +5,10 @@ appleDerivation rec { NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/ -D__APPLE_USE_RFC_2292 -DIPV6_DONTFRAG=14 -DINET6"; + # "spray" requires some files that aren't compiling correctly in xcbuild. + # "rtadvd" seems to fail with some missing constants. + # We disable spray and rtadvd here for now. patchPhase = '' - # disable spray, rtadvd substituteInPlace network_cmds.xcodeproj/project.pbxproj \ --replace "7294F0EA0EE8BAC80052EC88 /* PBXTargetDependency */," "" \ --replace "7216D34D0EE89FEC00AE70E4 /* PBXTargetDependency */," "" @@ -22,14 +24,16 @@ appleDerivation rec { install */*.$n $out/share/man/man$n done - mkdir -p $out/etc/ - install rtadvd.tproj/rtadvd.conf ip6addrctl.tproj/ip6addrctl.conf $out/etc/ + # TODO: patch files to load from $out/ instead of /usr/ - mkdir -p $out/local/OpenSourceVersions/ - install network_cmds.plist $out/local/OpenSourceVersions/ + # mkdir -p $out/etc/ + # install rtadvd.tproj/rtadvd.conf ip6addrctl.tproj/ip6addrctl.conf $out/etc/ - mkdir -p $out/System/Library/LaunchDaemons - install kdumpd.tproj/com.apple.kdumpd.plist $out/System/Library/LaunchDaemons + # mkdir -p $out/local/OpenSourceVersions/ + # install network_cmds.plist $out/local/OpenSourceVersions/ + + # mkdir -p $out/System/Library/LaunchDaemons + # install kdumpd.tproj/com.apple.kdumpd.plist $out/System/Library/LaunchDaemons ''; meta = { diff --git a/pkgs/tools/misc/contacts/default.nix b/pkgs/tools/misc/contacts/default.nix index 5c91332463f0..d146cd93343e 100644 --- a/pkgs/tools/misc/contacts/default.nix +++ b/pkgs/tools/misc/contacts/default.nix @@ -16,6 +16,7 @@ stdenv.mkDerivation rec { cp ./contacts-*/Build/Products/Default/contacts $out/bin ''; + ## FIXME: the framework setup hook isn't adding these correctly NIX_LDFLAGS = " -F${Foundation}/Library/Frameworks/ -F${AddressBook}/Library/Frameworks/"; meta = with stdenv.lib; { From fc1f6f55ea6c7eb1f98027db532683755fb7d4b9 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sat, 12 Nov 2016 15:51:25 -0600 Subject: [PATCH 19/19] xcbuild: Get rid of developer.nix, move to wrapper also: - add custom outputs "specs" for xcbuild - get rid of unneeded tools - update xcbuild - add more comments - fixup xcbuild derivations Affected xcbuild derivations include: - adv_cmds - network_cmds - basic_cmds --- pkgs/development/tools/xcbuild/developer.nix | 18 ---------- pkgs/development/tools/xcbuild/platform.nix | 36 +++++-------------- pkgs/development/tools/xcbuild/setup-hook.sh | 2 +- pkgs/development/tools/xcbuild/wrapper.nix | 17 +++++---- .../apple-source-releases/adv_cmds/xcode.nix | 6 +++- .../basic_cmds/default.nix | 9 ++++- .../network_cmds/default.nix | 2 +- 7 files changed, 35 insertions(+), 55 deletions(-) delete mode 100644 pkgs/development/tools/xcbuild/developer.nix diff --git a/pkgs/development/tools/xcbuild/developer.nix b/pkgs/development/tools/xcbuild/developer.nix deleted file mode 100644 index 826571238de4..000000000000 --- a/pkgs/development/tools/xcbuild/developer.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ stdenv, platform, toolchain, xcbuild, writeText }: - -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/ - - 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} - ''; -} diff --git a/pkgs/development/tools/xcbuild/platform.nix b/pkgs/development/tools/xcbuild/platform.nix index c54f7f83e0ee..0b03d4120e85 100644 --- a/pkgs/development/tools/xcbuild/platform.nix +++ b/pkgs/development/tools/xcbuild/platform.nix @@ -12,33 +12,11 @@ let ProjectName = "OSXPlatformSupport"; }; - Tools = [ - { - Identifier = "com.apple.build-tools.nmedit"; - Type = "Tool"; - Name = "Nmedit"; - } - { - Identifier = "com.apple.compilers.resource-copier"; - Type = "Tool"; - Name = "Resource Copier"; - } - { - Identifier = "com.apple.compilers.yacc"; - Type = "Tool"; - Name = "Yacc"; - InputFileTypes = [ "sourcecode.yacc" ]; - ExecDescription = "Yacc $(InputFile)"; - } - { - Identifier = "com.apple.compilers.lex"; - Type = "Tool"; - Name = "Lex"; - ExecDescription = "Lex $(InputFile)"; - InputFileTypes = [ "sourcecode.lex" ]; - } - ]; + # These files are all based off of Xcode spec fies found in + # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Speciications/. + # Based off of the MacOSX Architectures.xcpsec file. All i386 stuff + # is removed because NixPkgs only supports darwin-x86_64. Architectures = [ { Identifier = "Standard"; @@ -81,6 +59,8 @@ let } ]; + # Based off of the MacOSX Package Types.xcpsec file. Only keep the + # bare minimum needed. PackageTypes = [ { Identifier = "com.apple.package-type.mach-o-executable"; @@ -123,6 +103,9 @@ let } ]; + # Based off of the MacOSX Product Types.xcpsec file. All + # bundles/wrapper are removed, because we prefer dynamic products in + # NixPkgs. ProductTypes = [ { Identifier = "com.apple.product-type.tool"; @@ -158,7 +141,6 @@ stdenv.mkDerivation { mkdir -p $out/Developer/Library/Xcode/Specifications/ cd $out/Developer/Library/Xcode/Specifications/ - plutil -convert xml1 -o Tools.xcspec ${writeText "Tools.xcspec" (builtins.toJSON Tools)} plutil -convert xml1 -o Architectures.xcspec ${writeText "Architectures.xcspec" (builtins.toJSON Architectures)} plutil -convert xml1 -o PackageTypes.xcspec ${writeText "PackageTypes.xcspec" (builtins.toJSON PackageTypes)} plutil -convert xml1 -o ProductTypes.xcspec ${writeText "ProductTypes.xcspec" (builtins.toJSON ProductTypes)} diff --git a/pkgs/development/tools/xcbuild/setup-hook.sh b/pkgs/development/tools/xcbuild/setup-hook.sh index b0ae8dd6e8e2..c3b26a6ac796 100644 --- a/pkgs/development/tools/xcbuild/setup-hook.sh +++ b/pkgs/development/tools/xcbuild/setup-hook.sh @@ -5,7 +5,7 @@ xcbuildBuildPhase() { echo "running xcodebuild" - xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build + xcodebuild OTHER_CFLAGS="$NIX_CFLAGS_COMPILE" OTHER_CPLUSPLUSFLAGS="$NIX_CFLAGS_COMPILE" OTHER_LDFLAGS="$NIX_LDFLAGS" build runHook postBuild } diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index 2b01bdbb52b2..fc03c273fc58 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -23,10 +23,6 @@ let inherit sdk platformName xcbuild; }; - developer = callPackage ./developer.nix { - inherit platform toolchain xcbuild; - }; - xcconfig = writeText "nix.xcconfig" '' SDKROOT=${sdkName} ''; @@ -50,13 +46,22 @@ stdenv.mkDerivation { ln -s $file done + mkdir -p $out/Library/Xcode/ + ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications + + mkdir -p $out/Platforms/ + ln -s ${platform} $out/Platforms/ + + mkdir -p $out/Toolchains/ + ln -s ${toolchain} $out/Toolchains/ + wrapProgram $out/bin/xcodebuild \ --add-flags "-xcconfig ${xcconfig}" \ --add-flags "DERIVED_DATA_DIR=." \ - --set DEVELOPER_DIR "${developer}" + --set DEVELOPER_DIR "$out" wrapProgram $out/bin/xcrun \ --add-flags "-sdk ${sdkName}" \ - --set DEVELOPER_DIR "${developer}" + --set DEVELOPER_DIR "$out" ''; passthru = { diff --git a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix index fedd49022380..254b4a231c22 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix @@ -8,9 +8,13 @@ appleDerivation { # - os/base_private.h # - _simple.h # We disable it here for now. TODO: build pkill inside adv_cmds + + # We also disable locale here because of some issues with a missing + # "lstdc++". patchPhase = '' substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ - --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" + --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \ + --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" ''; # temporary install phase until xcodebuild has "install" support diff --git a/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix index 07a13966efe6..9e8b78e57d6c 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/basic_cmds/default.nix @@ -3,6 +3,14 @@ appleDerivation rec { buildInputs = [ xcbuild ]; + # These PBXcp calls should be patched in xcbuild to allow them to + # automatically be prefixed. + patchPhase = '' + substituteInPlace basic_cmds.xcodeproj/project.pbxproj \ + --replace "dstPath = /usr/share/man/man1;" "dstPath = $out/share/man/man1;" \ + --replace "dstPath = /usr/share/man/man5;" "dstPath = $out/share/man/man5;" + ''; + # temporary install phase until xcodebuild has "install" support installPhase = '' mkdir -p $out/bin/ @@ -12,7 +20,6 @@ appleDerivation rec { mkdir -p $out/share/man/man$n install */*.$n $out/share/man/man$n done - ''; meta = { diff --git a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix index 71acb833cc3f..357a87689a03 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/network_cmds/default.nix @@ -3,7 +3,7 @@ appleDerivation rec { buildInputs = [ xcbuild openssl xnu Librpcsvc libpcap developer_cmds ]; - NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/ -D__APPLE_USE_RFC_2292 -DIPV6_DONTFRAG=14 -DINET6"; + NIX_CFLAGS_COMPILE = " -I./unbound -I${xnu}/Library/Frameworks/System.framework/Headers/"; # "spray" requires some files that aren't compiling correctly in xcbuild. # "rtadvd" seems to fail with some missing constants.