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.