Skip to content

Commit

Permalink
Merge pull request #24018 from copumpkin/llvm-39-improvements
Browse files Browse the repository at this point in the history
LLVM 3.9 improvements
  • Loading branch information
copumpkin authored Mar 20, 2017
2 parents 972f51a + f3aeb3b commit 5148be4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/3.9/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@ let
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
'';

outputs = [ "out" "python" ];

# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
postInstall = ''
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
ln -sv $out/bin/clang $out/bin/cpp
mkdir -p $python/bin $python/share/clang/
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
mv $out/bin/set-xcode-analyzer $python/bin
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
'';

enableParallelBuilding = true;
Expand Down
16 changes: 9 additions & 7 deletions pkgs/development/compilers/llvm/3.9/llvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ in stdenv.mkDerivation rec {
outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";

buildInputs = [ perl groff cmake libxml2 python libffi ]
++ stdenv.lib.optionals stdenv.isDarwin
[ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];

propagatedBuildInputs = [ ncurses zlib ];

Expand All @@ -53,11 +52,15 @@ in stdenv.mkDerivation rec {
sha256 = "11sq86spw41v72f676igksapdlsgh7fiqp5qkkmgfj0ndqcn9skf";
}}
''
# hacky fix: New LLVM releases require a newer OS X SDK than
# 10.9. This is a temporary measure until nixpkgs darwin support is
# updated.
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build. I realize that this LLVM isn't used in the stdenv but I want to
# keep it consistent with 4.0. We really shouldn't be copying and pasting all this code around...
+ stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ stdenv.lib.optionalString (enableSharedLibraries) ''
Expand Down Expand Up @@ -85,7 +88,6 @@ in stdenv.mkDerivation rec {
++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false"
"-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
];

postBuild = ''
Expand Down

0 comments on commit 5148be4

Please sign in to comment.