git.iko.soy/typeable/nixpkgs
on master help sign in
llvm-4: small improvements on Darwin and elsewhere

Split outputs because there's no point in keeping a reference to Python and it causes trouble during the Darwin stdenv bootstrap. There's also an unnecessary dependency on LLVM in libc++ which causes us to rebuild LLVM several more times than necessary during bootstrap, and an awkward dependency on XPC in the TSAN that we turn off. This is in preparation for using LLVM 4 in the Darwin stdenv and by default across nixpkgs.

commit2cb440df726bb0995c5c5640353b7a7311bceb6c authorDan Peebles <pumpkin@me.com> dateSat 18 Mar 2017, 13:07 (10 years ago) parent645c218
3 files changed+20−8
pkgs/development/compilers/llvm/4/clang/default.nix+11 pkgs/development/compilers/llvm/4/libc++/default.nix+1−1 pkgs/development/compilers/llvm/4/llvm.nix+8−7
pkgs/development/compilers/llvm/4/clang/default.nix+11
@@ -29,12 +29,23 @@ let
2929 sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
3030 '';
3131
32+ outputs = [ "out" "python" ];
33+
3234 # Clang expects to find LLVMgold in its own prefix
3335 # Clang expects to find sanitizer libraries in its own prefix
3436 postInstall = ''
3537 ln -sv ${llvm}/lib/LLVMgold.so $out/lib
3638 ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/
3739 ln -sv $out/bin/clang $out/bin/cpp
40+
41+ mkdir -p $python/bin $python/share/clang/
42+ mv $out/bin/{git-clang-format,scan-view} $python/bin
43+ if [ -e $out/bin/set-xcode-analyzer ]; then
44+ mv $out/bin/set-xcode-analyzer $python/bin
45+ fi
46+ mv $out/share/clang/*.py $python/share/clang
47+
48+ rm $out/bin/c-index-test
3849 '';
3950
4051 enableParallelBuilding = true;
pkgs/development/compilers/llvm/4/libc++/default.nix+1−1
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
1919 substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
2020 '';
2121
22− buildInputs = [ cmake llvm libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
22+ buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
2323
2424 cmakeFlags = [
2525 "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
pkgs/development/compilers/llvm/4/llvm.nix+8−7
@@ -41,16 +41,18 @@ in stdenv.mkDerivation rec {
4141 outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
4242
4343 buildInputs = [ perl groff cmake libxml2 python libffi ]
44− ++ stdenv.lib.optionals stdenv.isDarwin
45− [ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
44+ ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
4645
4746 propagatedBuildInputs = [ ncurses zlib ];
4847
49− # hacky fix: New LLVM releases require a newer OS X SDK than
50− # 10.9. This is a temporary measure until nixpkgs darwin support is
51− # updated.
48+ # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
49+ # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
50+ # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
51+ # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
52+ # a flag and turn the flag off during the stdenv build.
5253 postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
53− sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
54+ substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
55+ --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
5456 ''
5557 # Patch llvm-config to return correct library path based on --link-{shared,static}.
5658 + stdenv.lib.optionalString (enableSharedLibraries) ''
@@ -85,7 +87,6 @@ in stdenv.mkDerivation rec {
8587 ++ stdenv.lib.optionals (isDarwin) [
8688 "-DLLVM_ENABLE_LIBCXX=ON"
8789 "-DCAN_TARGET_i386=false"
88− "-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
8990 ];
9091
9192 postBuild = ''