xcbuild: assorted fixes and cleanups

This is in preparation for the LLVM 4 upgrade (which gets more strict
about e.g., return false in xcbuild itself) and also for using xcbuild
more extensively in the Darwin stdenv bootstrap process, which is why I
killed the unnecessary gcc dependency in the toolchain. llvm-cov pretends
to be gcov anyway, so we're fine.

+40 -9
+1
pkgs/development/compilers/llvm/3.7/clang/default.nix
··· 42 42 passthru = { 43 43 lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both 44 44 isClang = true; 45 + inherit llvm; 45 46 } // stdenv.lib.optionalAttrs stdenv.isLinux { 46 47 inherit gcc; 47 48 };
+1
pkgs/development/compilers/llvm/3.8/clang/default.nix
··· 53 53 passthru = { 54 54 lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both 55 55 isClang = true; 56 + inherit llvm; 56 57 } // stdenv.lib.optionalAttrs stdenv.isLinux { 57 58 inherit gcc; 58 59 };
+1
pkgs/development/compilers/llvm/3.9/clang/default.nix
··· 42 42 passthru = { 43 43 lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both 44 44 isClang = true; 45 + inherit llvm; 45 46 } // stdenv.lib.optionalAttrs stdenv.isLinux { 46 47 inherit gcc; 47 48 };
+1
pkgs/development/compilers/llvm/4/clang/default.nix
··· 53 53 passthru = { 54 54 lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both 55 55 isClang = true; 56 + inherit llvm; 56 57 } // stdenv.lib.optionalAttrs stdenv.isLinux { 57 58 inherit gcc; 58 59 };
+3
pkgs/development/tools/xcbuild/default.nix
··· 31 31 cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise 32 32 ''; 33 33 34 + # See https://github.com/facebook/xcbuild/issues/238 and remove once that's in 35 + patches = [ ./return-false.patch ]; 36 + 34 37 # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror. 35 38 postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) '' 36 39 sed 1i'#include <sys/sysmacros.h>' \
+13
pkgs/development/tools/xcbuild/return-false.patch
··· 1 + diff --git a/Libraries/dependency/Tools/dependency-info-tool.cpp b/Libraries/dependency/Tools/dependency-info-tool.cpp 2 + index 006f53c7..d469f068 100644 3 + --- a/Libraries/dependency/Tools/dependency-info-tool.cpp 4 + +++ b/Libraries/dependency/Tools/dependency-info-tool.cpp 5 + @@ -271,7 +271,7 @@ main(int argc, char **argv) 6 + */ 7 + std::vector<uint8_t> makefileContents = std::vector<uint8_t>(contents.begin(), contents.end()); 8 + if (!filesystem.write(makefileContents, *options.output())) { 9 + - return false; 10 + + return -1; 11 + } 12 + 13 + return 0;
+18 -7
pkgs/development/tools/xcbuild/toolchain.nix
··· 1 - {stdenv, writeText, toolchainName, xcbuild 1 + {stdenv, writeText, toolchainName, xcbuild, fetchurl 2 2 , llvm, cctools, gcc, bootstrap_cmds, binutils 3 3 , yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper}: 4 4 ··· 8 8 Identifier = toolchainName; 9 9 }; 10 10 11 + # We could pull this out of developer_cmds but it adds an annoying loop if we want to bootstrap and 12 + # this is just a tiny script so I'm not going to bother 13 + mkdep-darwin-src = fetchurl { 14 + url = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh"; 15 + sha256 = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541"; 16 + executable = true; 17 + }; 11 18 in 12 19 13 20 stdenv.mkDerivation { 14 21 name = "nixpkgs.xctoolchain"; 15 22 buildInputs = [ xcbuild makeWrapper ]; 16 23 17 - propagatedBuildInputs = [ llvm gcc yacc flex m4 unifdef gperf indent ] 18 - ++ stdenv.lib.optionals stdenv.isDarwin [ cctools bootstrap_cmds binutils ]; 19 - ## cctools should build on Linux but it doesn't currentl 24 + ## cctools should build on Linux but it doesn't currently 20 25 21 26 buildCommand = '' 22 27 mkdir -p $out ··· 58 63 ln -s ${unifdef}/bin/unifdefall 59 64 60 65 ln -s ${gperf}/bin/gperf 61 - ln -s ${gcc}/bin/gcov 62 - ln -s ${gcc}/bin/mkdep 63 66 ln -s ${indent}/bin/indent 64 67 ln -s ${ctags}/bin/ctags 65 68 '' + stdenv.lib.optionalString stdenv.isDarwin '' ··· 86 89 ln -s ${cctools}/bin/pagestuff 87 90 ln -s ${cctools}/bin/ranlib 88 91 ln -s ${cctools}/bin/redo_prebinding 89 - ''; 92 + '' + 93 + # No point including the entire gcc closure if we don't already have it 94 + (if stdenv.cc.isClang then '' 95 + ln -s ${stdenv.cc.cc.llvm}/bin/llvm-cov gcov 96 + ln -s ${mkdep-darwin-src} mkdep 97 + '' else '' 98 + ln -s ${gcc}/bin/gcov 99 + ln -s ${gcc}/bin/mkdep 100 + ''); 90 101 } 91 102 92 103 # other commands in /bin/
+2 -2
pkgs/development/tools/xcbuild/wrapper.nix
··· 50 50 ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications 51 51 52 52 mkdir -p $out/Platforms/ 53 - ln -s ${platform} $out/Platforms/ 53 + ln -s ${platform} $out/Platforms/nixpkgs.platform 54 54 55 55 mkdir -p $out/Toolchains/ 56 - ln -s ${toolchain} $out/Toolchains/ 56 + ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolahin 57 57 58 58 wrapProgram $out/bin/xcodebuild \ 59 59 --add-flags "-xcconfig ${xcconfig}" \