diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/3.9/llvm.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/3.9/llvm.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 41d655015e46..22dea611c796 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -30,16 +30,24 @@ in stdenv.mkDerivation rec { mv compiler-rt-* $sourceRoot/projects/compiler-rt ''; + outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib"; + buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isDarwin libcxxabi; propagatedBuildInputs = [ ncurses zlib ]; + postPatch = "" # 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. - patchPhase = stdenv.lib.optionalString stdenv.isDarwin '' + + stdenv.lib.optionalString stdenv.isDarwin '' sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc + '' + # Patch llvm-config to return correct library path based on --link-{shared,static}. + + stdenv.lib.optionalString (enableSharedLibraries) '' + substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib + patch -p1 < ./llvm-outputs.patch ''; # hacky fix: created binaries need to be run before installation @@ -59,7 +67,7 @@ in stdenv.mkDerivation rec { "-DLLVM_LINK_LLVM_DYLIB=ON" ] ++ stdenv.lib.optional (!isDarwin) "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include" - ++ stdenv.lib.optionals ( isDarwin) [ + ++ stdenv.lib.optionals (isDarwin) [ "-DLLVM_ENABLE_LIBCXX=ON" "-DCAN_TARGET_i386=false" ]; @@ -70,7 +78,14 @@ in stdenv.mkDerivation rec { paxmark m bin/{lli,llvm-rtdyld} ''; - postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) '' + postInstall = "" + + stdenv.lib.optionalString (enableSharedLibraries) '' + moveToOutput "lib/libLLVM-*" "$lib" + moveToOutput "lib/libLLVM.so" "$lib" + substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-" + '' + + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) '' install_name_tool -id $out/lib/libLLVM.dylib $out/lib/libLLVM.dylib ln -s $out/lib/libLLVM.dylib $out/lib/libLLVM-${version}.dylib ''; |