summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDan Peebles <pumpkin@me.com>2017-03-21 23:22:15 -0400
committerDan Peebles <pumpkin@me.com>2017-03-21 23:22:15 -0400
commit3263d02626cadc95a2ddc4e949128d4925c77b02 (patch)
treeb44ca5822d2d09104664293504ee40751d39a8d6 /pkgs
parent5561abd5569e67f04479fe767bcea5038b3618ec (diff)
downloadnixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.tar
nixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.tar.gz
nixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.tar.bz2
nixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.tar.lz
nixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.tar.xz
nixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.tar.zst
nixlib-3263d02626cadc95a2ddc4e949128d4925c77b02.zip
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.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/llvm/3.7/clang/default.nix1
-rw-r--r--pkgs/development/compilers/llvm/3.8/clang/default.nix1
-rw-r--r--pkgs/development/compilers/llvm/3.9/clang/default.nix1
-rw-r--r--pkgs/development/compilers/llvm/4/clang/default.nix1
-rw-r--r--pkgs/development/tools/xcbuild/default.nix3
-rw-r--r--pkgs/development/tools/xcbuild/return-false.patch13
-rw-r--r--pkgs/development/tools/xcbuild/toolchain.nix25
-rw-r--r--pkgs/development/tools/xcbuild/wrapper.nix4
8 files changed, 40 insertions, 9 deletions
diff --git a/pkgs/development/compilers/llvm/3.7/clang/default.nix b/pkgs/development/compilers/llvm/3.7/clang/default.nix
index 535dbbc93d51..f27e3f0089e2 100644
--- a/pkgs/development/compilers/llvm/3.7/clang/default.nix
+++ b/pkgs/development/compilers/llvm/3.7/clang/default.nix
@@ -42,6 +42,7 @@ let
     passthru = {
       lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
       isClang = true;
+      inherit llvm;
     } // stdenv.lib.optionalAttrs stdenv.isLinux {
       inherit gcc;
     };
diff --git a/pkgs/development/compilers/llvm/3.8/clang/default.nix b/pkgs/development/compilers/llvm/3.8/clang/default.nix
index 41e515249eb3..90b8ea2581e8 100644
--- a/pkgs/development/compilers/llvm/3.8/clang/default.nix
+++ b/pkgs/development/compilers/llvm/3.8/clang/default.nix
@@ -53,6 +53,7 @@ let
     passthru = {
       lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
       isClang = true;
+      inherit llvm;
     } // stdenv.lib.optionalAttrs stdenv.isLinux {
       inherit gcc;
     };
diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix
index 677c4a526ea4..b3616a0e86b6 100644
--- a/pkgs/development/compilers/llvm/3.9/clang/default.nix
+++ b/pkgs/development/compilers/llvm/3.9/clang/default.nix
@@ -42,6 +42,7 @@ let
     passthru = {
       lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
       isClang = true;
+      inherit llvm;
     } // stdenv.lib.optionalAttrs stdenv.isLinux {
       inherit gcc;
     };
diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix
index 6ce63209935c..c93871592830 100644
--- a/pkgs/development/compilers/llvm/4/clang/default.nix
+++ b/pkgs/development/compilers/llvm/4/clang/default.nix
@@ -53,6 +53,7 @@ let
     passthru = {
       lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
       isClang = true;
+      inherit llvm;
     } // stdenv.lib.optionalAttrs stdenv.isLinux {
       inherit gcc;
     };
diff --git a/pkgs/development/tools/xcbuild/default.nix b/pkgs/development/tools/xcbuild/default.nix
index f2be61bd2139..649c7d14927e 100644
--- a/pkgs/development/tools/xcbuild/default.nix
+++ b/pkgs/development/tools/xcbuild/default.nix
@@ -31,6 +31,9 @@ in stdenv.mkDerivation rec {
     cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise
   '';
 
+  # See https://github.com/facebook/xcbuild/issues/238 and remove once that's in
+  patches = [ ./return-false.patch ];
+
   # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror.
   postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
     sed 1i'#include <sys/sysmacros.h>' \
diff --git a/pkgs/development/tools/xcbuild/return-false.patch b/pkgs/development/tools/xcbuild/return-false.patch
new file mode 100644
index 000000000000..8ec81b5e97ca
--- /dev/null
+++ b/pkgs/development/tools/xcbuild/return-false.patch
@@ -0,0 +1,13 @@
+diff --git a/Libraries/dependency/Tools/dependency-info-tool.cpp b/Libraries/dependency/Tools/dependency-info-tool.cpp
+index 006f53c7..d469f068 100644
+--- a/Libraries/dependency/Tools/dependency-info-tool.cpp
++++ b/Libraries/dependency/Tools/dependency-info-tool.cpp
+@@ -271,7 +271,7 @@ main(int argc, char **argv)
+      */
+     std::vector<uint8_t> makefileContents = std::vector<uint8_t>(contents.begin(), contents.end());
+     if (!filesystem.write(makefileContents, *options.output())) {
+-        return false;
++        return -1;
+     }
+ 
+     return 0;
diff --git a/pkgs/development/tools/xcbuild/toolchain.nix b/pkgs/development/tools/xcbuild/toolchain.nix
index 386f67a9d631..4313f0051473 100644
--- a/pkgs/development/tools/xcbuild/toolchain.nix
+++ b/pkgs/development/tools/xcbuild/toolchain.nix
@@ -1,4 +1,4 @@
-{stdenv, writeText, toolchainName, xcbuild
+{stdenv, writeText, toolchainName, xcbuild, fetchurl
 , llvm, cctools, gcc, bootstrap_cmds, binutils
 , yacc, flex, m4, unifdef, gperf, indent, ctags, makeWrapper}:
 
@@ -8,15 +8,20 @@ let
     Identifier = toolchainName;
   };
 
+  # We could pull this out of developer_cmds but it adds an annoying loop if we want to bootstrap and
+  # this is just a tiny script so I'm not going to bother
+  mkdep-darwin-src = fetchurl {
+    url        = "https://opensource.apple.com/source/developer_cmds/developer_cmds-63/mkdep/mkdep.sh";
+    sha256     = "0n4wpqfslfjs5zbys5yri8pfi2awyhlmknsf6laa5jzqbzq9x541";
+    executable = true;
+  };
 in
 
 stdenv.mkDerivation {
   name = "nixpkgs.xctoolchain";
   buildInputs = [ xcbuild makeWrapper ];
 
-  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
+  ## cctools should build on Linux but it doesn't currently
 
   buildCommand = ''
     mkdir -p $out
@@ -58,8 +63,6 @@ stdenv.mkDerivation {
     ln -s ${unifdef}/bin/unifdefall
 
     ln -s ${gperf}/bin/gperf
-    ln -s ${gcc}/bin/gcov
-    ln -s ${gcc}/bin/mkdep
     ln -s ${indent}/bin/indent
     ln -s ${ctags}/bin/ctags
   '' + stdenv.lib.optionalString stdenv.isDarwin ''
@@ -86,7 +89,15 @@ stdenv.mkDerivation {
     ln -s ${cctools}/bin/pagestuff
     ln -s ${cctools}/bin/ranlib
     ln -s ${cctools}/bin/redo_prebinding
-  '';
+  '' +
+    # No point including the entire gcc closure if we don't already have it
+    (if stdenv.cc.isClang then ''
+      ln -s ${stdenv.cc.cc.llvm}/bin/llvm-cov gcov
+      ln -s ${mkdep-darwin-src}               mkdep
+    '' else ''
+      ln -s ${gcc}/bin/gcov
+      ln -s ${gcc}/bin/mkdep
+    '');
 }
 
 # other commands in /bin/
diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix
index 0da733b8078e..6840694f6991 100644
--- a/pkgs/development/tools/xcbuild/wrapper.nix
+++ b/pkgs/development/tools/xcbuild/wrapper.nix
@@ -50,10 +50,10 @@ stdenv.mkDerivation {
     ln -s ${xcbuild}/Library/Xcode/Specifications $out/Library/Xcode/Specifications
 
     mkdir -p $out/Platforms/
-    ln -s ${platform} $out/Platforms/
+    ln -s ${platform} $out/Platforms/nixpkgs.platform
 
     mkdir -p $out/Toolchains/
-    ln -s ${toolchain} $out/Toolchains/
+    ln -s ${toolchain} $out/Toolchains/nixpkgs.xctoolahin
 
     wrapProgram $out/bin/xcodebuild \
       --add-flags "-xcconfig ${xcconfig}" \