summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix')
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix23
1 files changed, 17 insertions, 6 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 254b4a231c22..a3d4099399b3 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,6 +1,8 @@
-{ stdenv, appleDerivation, fetchurl, xcbuild, libcxx }:
+{ stdenv, appleDerivation, fetchurl, xcbuild, ncurses, libutil-new }:
 
 appleDerivation {
+  # We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264
+  dontUseXcbuild = true;
 
   # pkill requires special private headers that are unavailable in
   # NixPkgs. These ones are needed:
@@ -14,7 +16,19 @@ appleDerivation {
   patchPhase = ''
     substituteInPlace adv_cmds.xcodeproj/project.pbxproj \
       --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \
-      --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," ""
+      --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \
+      --replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib'
+  '';
+
+  buildPhase = ''
+    targets=$(xcodebuild -list \
+                | awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \
+                | tail -n +2 | sed 's/^[ \t]*//' \
+                | grep -v -e Desktop -e Embedded -e mklocale -e colldef)
+
+    for i in $targets; do
+      xcodebuild -target $i
+    done
   '';
 
   # temporary install phase until xcodebuild has "install" support
@@ -35,10 +49,7 @@ appleDerivation {
     # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1
   '';
 
-  buildInputs = [ xcbuild libcxx ];
-
-  # temporary fix for iostream issue
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
+  buildInputs = [ xcbuild ncurses libutil-new ];
 
   meta = {
     platforms = stdenv.lib.platforms.darwin;