darwin: fix assorted xcbuild builds

This includes adding a new xcbuild-based libutil build to test the waters a bit there.
We'll need to get xcbuild into the stdenv bootstrap before we can make the main build,
but it's nice to see that it can work.

+75 -13
+18 -2
pkgs/development/tools/xcbuild/platform.nix
··· 188 Type = "ProductType"; 189 Name = "Dynamic Library"; 190 PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; 191 } 192 { 193 Identifier = "com.apple.product-type.library.static"; ··· 247 in 248 249 stdenv.mkDerivation { 250 - name = "nixpkgs.platform"; 251 buildInputs = [ xcbuild ]; 252 buildCommand = '' 253 mkdir -p $out/ ··· 264 265 mkdir -p $out/Developer/SDKs/ 266 cd $out/Developer/SDKs/ 267 - cp -r ${sdk} nix.nixpkgs.sdk 268 ''; 269 }
··· 188 Type = "ProductType"; 189 Name = "Dynamic Library"; 190 PackageTypes = [ "com.apple.package-type.mach-o-dylib" ]; 191 + DefaultBuildProperties = { 192 + FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)"; 193 + MACH_O_TYPE = "mh_dylib"; 194 + REZ_EXECUTABLE = "YES"; 195 + EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)"; 196 + EXECUTABLE_EXTENSION = "dylib"; 197 + DYLIB_COMPATIBILITY_VERSION = "1"; 198 + DYLIB_CURRENT_VERSION = "1"; 199 + FRAMEWORK_FLAG_PREFIX = "-framework"; 200 + LIBRARY_FLAG_PREFIX = "-l"; 201 + LIBRARY_FLAG_NOSPACE = "YES"; 202 + STRIP_STYLE = "debugging"; 203 + GCC_INLINES_ARE_PRIVATE_EXTERN = "YES"; 204 + CODE_SIGNING_ALLOWED = "YES"; 205 + CODE_SIGNING_REQUIRED = "NO"; 206 + }; 207 } 208 { 209 Identifier = "com.apple.product-type.library.static"; ··· 263 in 264 265 stdenv.mkDerivation { 266 + name = "MacOSX.platform"; 267 buildInputs = [ xcbuild ]; 268 buildCommand = '' 269 mkdir -p $out/ ··· 280 281 mkdir -p $out/Developer/SDKs/ 282 cd $out/Developer/SDKs/ 283 + cp -r ${sdk} ${sdk.name} 284 ''; 285 }
+1 -1
pkgs/development/tools/xcbuild/sdk.nix
··· 19 in 20 21 stdenv.mkDerivation { 22 - name = "nix.nixpkgs.sdk"; 23 buildInputs = [ xcbuild ]; 24 buildCommand = '' 25 mkdir -p $out/
··· 19 in 20 21 stdenv.mkDerivation { 22 + name = "MacOSX.sdk"; 23 buildInputs = [ xcbuild ]; 24 buildCommand = '' 25 mkdir -p $out/
+17 -6
pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix
··· 1 - { stdenv, appleDerivation, fetchurl, xcbuild, libcxx }: 2 3 appleDerivation { 4 5 # pkill requires special private headers that are unavailable in 6 # NixPkgs. These ones are needed: ··· 14 patchPhase = '' 15 substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ 16 --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \ 17 - --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" 18 ''; 19 20 # temporary install phase until xcodebuild has "install" support ··· 35 # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1 36 ''; 37 38 - buildInputs = [ xcbuild libcxx ]; 39 - 40 - # temporary fix for iostream issue 41 - NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1"; 42 43 meta = { 44 platforms = stdenv.lib.platforms.darwin;
··· 1 + { stdenv, appleDerivation, fetchurl, xcbuild, ncurses, libutil-new }: 2 3 appleDerivation { 4 + # We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264 5 + dontUseXcbuild = true; 6 7 # pkill requires special private headers that are unavailable in 8 # NixPkgs. These ones are needed: ··· 16 patchPhase = '' 17 substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ 18 --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \ 19 + --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \ 20 + --replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib' 21 + ''; 22 + 23 + buildPhase = '' 24 + targets=$(xcodebuild -list \ 25 + | awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \ 26 + | tail -n +2 | sed 's/^[ \t]*//' \ 27 + | grep -v -e Desktop -e Embedded -e mklocale -e colldef) 28 + 29 + for i in $targets; do 30 + xcodebuild -target $i 31 + done 32 ''; 33 34 # temporary install phase until xcodebuild has "install" support ··· 49 # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1 50 ''; 51 52 + buildInputs = [ xcbuild ncurses libutil-new ]; 53 54 meta = { 55 platforms = stdenv.lib.platforms.darwin;
+1
pkgs/os-specific/darwin/apple-source-releases/default.nix
··· 221 libresolv = applePackage "libresolv" "osx-10.11.6" "09flfdi3dlzq0yap32sxidacpc4nn4va7z12a6viip21ix2xb2gf" {}; 222 Libsystem = applePackage "Libsystem" "osx-10.11.6" "1nfkmbqml587v2s1d1y2s2v8nmr577jvk51y6vqrfvsrhdhc2w94" {}; 223 libutil = applePackage "libutil" "osx-10.11.6" "1gmgmcyqdyc684ih7dimdmxdljnq7mzjy5iqbf589wc0pa8h5abm" {}; 224 libunwind = applePackage "libunwind" "osx-10.11.6" "0miffaa41cv0lzf8az5k1j1ng8jvqvxcr4qrlkf3xyj479arbk1b" {}; 225 mDNSResponder = applePackage "mDNSResponder" "osx-10.11.6" "069incq28a78yh1bnr17h9cd5if5mwqpq8ahnkyxxx25fkaxgzcf" {}; 226 objc4 = applePackage "objc4" "osx-10.11.6" "00b7vbgxni8frrqyi69b4njjihlwydzjd9zj9x4z5dbx8jabkvrj" {};
··· 221 libresolv = applePackage "libresolv" "osx-10.11.6" "09flfdi3dlzq0yap32sxidacpc4nn4va7z12a6viip21ix2xb2gf" {}; 222 Libsystem = applePackage "Libsystem" "osx-10.11.6" "1nfkmbqml587v2s1d1y2s2v8nmr577jvk51y6vqrfvsrhdhc2w94" {}; 223 libutil = applePackage "libutil" "osx-10.11.6" "1gmgmcyqdyc684ih7dimdmxdljnq7mzjy5iqbf589wc0pa8h5abm" {}; 224 + libutil-new = applePackage "libutil/new.nix" "osx-10.11.6" "1gmgmcyqdyc684ih7dimdmxdljnq7mzjy5iqbf589wc0pa8h5abm" {}; 225 libunwind = applePackage "libunwind" "osx-10.11.6" "0miffaa41cv0lzf8az5k1j1ng8jvqvxcr4qrlkf3xyj479arbk1b" {}; 226 mDNSResponder = applePackage "mDNSResponder" "osx-10.11.6" "069incq28a78yh1bnr17h9cd5if5mwqpq8ahnkyxxx25fkaxgzcf" {}; 227 objc4 = applePackage "objc4" "osx-10.11.6" "00b7vbgxni8frrqyi69b4njjihlwydzjd9zj9x4z5dbx8jabkvrj" {};
+5 -4
pkgs/os-specific/darwin/apple-source-releases/file_cmds/default.nix
··· 1 - { stdenv, appleDerivation, xcbuild, zlib, bzip2, lzma }: 2 3 appleDerivation rec { 4 - buildInputs = [ xcbuild zlib bzip2 lzma ]; 5 6 # some commands not working: 7 # mtree: _simple.h not found ··· 11 substituteInPlace file_cmds.xcodeproj/project.pbxproj \ 12 --replace "FC8A8CAA14B655FD001B97AD /* PBXTargetDependency */," "" \ 13 --replace "FC8A8C9C14B655FD001B97AD /* PBXTargetDependency */," "" \ 14 - --replace "productName = file_cmds;" "" 15 sed -i -re "s/name = ([a-zA-Z]+);/name = \1; productName = \1;/" file_cmds.xcodeproj/project.pbxproj 16 ''; 17 18 # temporary install phase until xcodebuild has "install" support 19 installPhase = '' 20 mkdir -p $out/bin/ 21 - install file_cmds-*/Build/Products/Release/* $out/bin/ 22 23 for n in 1; do 24 mkdir -p $out/share/man/man$n
··· 1 + { stdenv, appleDerivation, xcbuild, zlib, bzip2, lzma, ncurses, libutil-new }: 2 3 appleDerivation rec { 4 + buildInputs = [ xcbuild zlib bzip2 lzma ncurses libutil-new ]; 5 6 # some commands not working: 7 # mtree: _simple.h not found ··· 11 substituteInPlace file_cmds.xcodeproj/project.pbxproj \ 12 --replace "FC8A8CAA14B655FD001B97AD /* PBXTargetDependency */," "" \ 13 --replace "FC8A8C9C14B655FD001B97AD /* PBXTargetDependency */," "" \ 14 + --replace "productName = file_cmds;" "" \ 15 + --replace '/usr/lib/libcurses.dylib' 'libncurses.dylib' 16 sed -i -re "s/name = ([a-zA-Z]+);/name = \1; productName = \1;/" file_cmds.xcodeproj/project.pbxproj 17 ''; 18 19 # temporary install phase until xcodebuild has "install" support 20 installPhase = '' 21 mkdir -p $out/bin/ 22 + install file_cmds-*/Build/Products/Release/* $out/bin 23 24 for n in 1; do 25 mkdir -p $out/share/man/man$n
+33
pkgs/os-specific/darwin/apple-source-releases/libutil/new.nix
···
··· 1 + { stdenv, appleDerivation, xcbuild }: 2 + 3 + # TODO: make this the official libutil expression once we've integrated xcbuild in the bootstrap 4 + appleDerivation { 5 + buildInputs = [ xcbuild ]; 6 + 7 + dontUseXcbuild = true; 8 + 9 + prePatch = '' 10 + substituteInPlace tzlink.c \ 11 + --replace '#include <xpc/xpc.h>' "" 12 + ''; 13 + 14 + buildPhase = '' 15 + xcodebuild -target util 16 + ''; 17 + 18 + installPhase = '' 19 + mkdir -p $out/lib $out/include 20 + 21 + cp libutil-*/Build/Products/Release/*.dylib $out/lib 22 + cp libutil-*/Build/Products/Release/*.h $out/include 23 + 24 + # TODO: figure out how to get this to be right the first time around 25 + install_name_tool -id $out/lib/libutil.dylib $out/lib/libutil.dylib 26 + ''; 27 + 28 + meta = with stdenv.lib; { 29 + maintainers = with maintainers; [ copumpkin ]; 30 + platforms = platforms.darwin; 31 + license = licenses.apsl20; 32 + }; 33 + }