diff options
Diffstat (limited to 'pkgs/development/compilers/llvm')
29 files changed, 155 insertions, 70 deletions
diff --git a/pkgs/development/compilers/llvm/3.4/clang.nix b/pkgs/development/compilers/llvm/3.4/clang.nix index 2dd3a23d7668..b05496eabf26 100644 --- a/pkgs/development/compilers/llvm/3.4/clang.nix +++ b/pkgs/development/compilers/llvm/3.4/clang.nix @@ -20,7 +20,6 @@ stdenv.mkDerivation { buildInputs = [ cmake libedit libxml2 zlib ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DCLANG_PATH_TO_LLVM_BUILD=${llvm}" ] ++ diff --git a/pkgs/development/compilers/llvm/3.4/lld.nix b/pkgs/development/compilers/llvm/3.4/lld.nix index 4360ec9ad1b2..c502b0e215e5 100644 --- a/pkgs/development/compilers/llvm/3.4/lld.nix +++ b/pkgs/development/compilers/llvm/3.4/lld.nix @@ -14,7 +14,6 @@ stdenv.mkDerivation { buildInputs = [ cmake ncurses zlib python ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLD_PATH_TO_LLVM_BUILD=${llvm}" ]; diff --git a/pkgs/development/compilers/llvm/3.4/lldb.nix b/pkgs/development/compilers/llvm/3.4/lldb.nix index 540faf01e079..cd498b5cf519 100644 --- a/pkgs/development/compilers/llvm/3.4/lldb.nix +++ b/pkgs/development/compilers/llvm/3.4/lldb.nix @@ -26,7 +26,6 @@ stdenv.mkDerivation { buildInputs = [ cmake python which swig ncurses zlib libedit ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}" "-DLLDB_PATH_TO_CLANG_BUILD=${clang}" diff --git a/pkgs/development/compilers/llvm/3.4/polly.nix b/pkgs/development/compilers/llvm/3.4/polly.nix index 2e0018c34c20..2fed0fc8abed 100644 --- a/pkgs/development/compilers/llvm/3.4/polly.nix +++ b/pkgs/development/compilers/llvm/3.4/polly.nix @@ -10,7 +10,6 @@ stdenv.mkDerivation { buildInputs = [ cmake isl python gmp ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLVM_INSTALL_ROOT=${llvm}" ]; diff --git a/pkgs/development/compilers/llvm/3.5/clang.nix b/pkgs/development/compilers/llvm/3.5/clang.nix index 42ca4ba70e4d..d11259c82f07 100644 --- a/pkgs/development/compilers/llvm/3.5/clang.nix +++ b/pkgs/development/compilers/llvm/3.5/clang.nix @@ -15,7 +15,6 @@ in stdenv.mkDerivation { buildInputs = [ cmake libedit libxml2 llvm ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ # Maybe with compiler-rt this won't be needed? diff --git a/pkgs/development/compilers/llvm/3.5/libc++/default.nix b/pkgs/development/compilers/llvm/3.5/libc++/default.nix index e7018eea3bc9..476fc7bcd43f 100644 --- a/pkgs/development/compilers/llvm/3.5/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.5/libc++/default.nix @@ -24,13 +24,12 @@ stdenv.mkDerivation rec { buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - cmakeFlags = - [ "-DCMAKE_BUILD_TYPE=Release" - "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include" - "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" - "-DLIBCXX_LIBCPPABI_VERSION=2" - "-DLIBCXX_CXX_ABI=libcxxabi" - ]; + cmakeFlags = [ + "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include" + "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" + "-DLIBCXX_LIBCPPABI_VERSION=2" + "-DLIBCXX_CXX_ABI=libcxxabi" + ]; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/llvm/3.5/lld.nix b/pkgs/development/compilers/llvm/3.5/lld.nix index b1047f8679ec..7ee90818ac99 100644 --- a/pkgs/development/compilers/llvm/3.5/lld.nix +++ b/pkgs/development/compilers/llvm/3.5/lld.nix @@ -14,7 +14,6 @@ stdenv.mkDerivation { buildInputs = [ cmake ncurses zlib python ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLD_PATH_TO_LLVM_BUILD=${llvm}" ]; diff --git a/pkgs/development/compilers/llvm/3.5/lldb.nix b/pkgs/development/compilers/llvm/3.5/lldb.nix index 1dad5227d645..8e7c8151df13 100644 --- a/pkgs/development/compilers/llvm/3.5/lldb.nix +++ b/pkgs/development/compilers/llvm/3.5/lldb.nix @@ -26,7 +26,6 @@ stdenv.mkDerivation { buildInputs = [ cmake python which swig ncurses zlib libedit ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}" "-DLLDB_PATH_TO_CLANG_BUILD=${clang}" diff --git a/pkgs/development/compilers/llvm/3.5/polly.nix b/pkgs/development/compilers/llvm/3.5/polly.nix index c943c790ea22..42b3fd74e6c8 100644 --- a/pkgs/development/compilers/llvm/3.5/polly.nix +++ b/pkgs/development/compilers/llvm/3.5/polly.nix @@ -10,7 +10,6 @@ stdenv.mkDerivation { buildInputs = [ cmake isl python gmp ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLVM_INSTALL_ROOT=${llvm}" ]; diff --git a/pkgs/development/compilers/llvm/3.6/clang/default.nix b/pkgs/development/compilers/llvm/3.6/clang/default.nix index ff0f34391af0..c1d0cf8062c8 100644 --- a/pkgs/development/compilers/llvm/3.6/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.6/clang/default.nix @@ -16,7 +16,6 @@ let buildInputs = [ cmake libedit libxml2 llvm ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ # Maybe with compiler-rt this won't be needed? diff --git a/pkgs/development/compilers/llvm/3.6/libc++/default.nix b/pkgs/development/compilers/llvm/3.6/libc++/default.nix index c02c75ac02db..b07b8eb35fa6 100644 --- a/pkgs/development/compilers/llvm/3.6/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.6/libc++/default.nix @@ -19,13 +19,12 @@ stdenv.mkDerivation rec { buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - cmakeFlags = - [ "-DCMAKE_BUILD_TYPE=Release" - "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include" - "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" - "-DLIBCXX_LIBCPPABI_VERSION=2" - "-DLIBCXX_CXX_ABI=libcxxabi" - ]; + cmakeFlags = [ + "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include" + "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" + "-DLIBCXX_LIBCPPABI_VERSION=2" + "-DLIBCXX_CXX_ABI=libcxxabi" + ]; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/llvm/3.6/lldb.nix b/pkgs/development/compilers/llvm/3.6/lldb.nix index cee99bbbdea6..207971b81727 100644 --- a/pkgs/development/compilers/llvm/3.6/lldb.nix +++ b/pkgs/development/compilers/llvm/3.6/lldb.nix @@ -26,7 +26,6 @@ stdenv.mkDerivation { buildInputs = [ cmake python which swig ncurses zlib libedit ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}" "-DLLDB_PATH_TO_CLANG_BUILD=${clang-unwrapped}" diff --git a/pkgs/development/compilers/llvm/3.7/clang/default.nix b/pkgs/development/compilers/llvm/3.7/clang/default.nix index aa71bb68553a..6c1a89cf60a9 100644 --- a/pkgs/development/compilers/llvm/3.7/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.7/clang/default.nix @@ -16,7 +16,6 @@ let buildInputs = [ cmake libedit libxml2 llvm ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ # Maybe with compiler-rt this won't be needed? diff --git a/pkgs/development/compilers/llvm/3.7/default.nix b/pkgs/development/compilers/llvm/3.7/default.nix index d7864d11d7bf..3df20086f79b 100644 --- a/pkgs/development/compilers/llvm/3.7/default.nix +++ b/pkgs/development/compilers/llvm/3.7/default.nix @@ -1,4 +1,4 @@ -{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }: +{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun }: let callPackage = newScope (self // { inherit stdenv isl version fetch; }); @@ -24,8 +24,19 @@ let clang = wrapCC self.clang-unwrapped; + libcxxClang = ccWrapperFun { + cc = self.clang-unwrapped; + isClang = true; + inherit (self) stdenv; + /* FIXME is this right? */ + inherit (stdenv.cc) libc nativeTools nativeLibc; + extraPackages = [ self.libcxx self.libcxxabi ]; + }; + stdenv = overrideCC stdenv self.clang; + libcxxStdenv = overrideCC stdenv self.libcxxClang; + lldb = callPackage ./lldb.nix {}; libcxx = callPackage ./libc++ {}; diff --git a/pkgs/development/compilers/llvm/3.7/libc++/default.nix b/pkgs/development/compilers/llvm/3.7/libc++/default.nix index 00bfb3518b10..62402142a129 100644 --- a/pkgs/development/compilers/llvm/3.7/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.7/libc++/default.nix @@ -18,12 +18,11 @@ stdenv.mkDerivation rec { buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - cmakeFlags = - [ "-DCMAKE_BUILD_TYPE=Release" - "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" - "-DLIBCXX_LIBCPPABI_VERSION=2" - "-DLIBCXX_CXX_ABI=libcxxabi" - ]; + cmakeFlags = [ + "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" + "-DLIBCXX_LIBCPPABI_VERSION=2" + "-DLIBCXX_CXX_ABI=libcxxabi" + ]; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/llvm/3.7/lldb.nix b/pkgs/development/compilers/llvm/3.7/lldb.nix index fe69130e71a7..434fdc7650ff 100644 --- a/pkgs/development/compilers/llvm/3.7/lldb.nix +++ b/pkgs/development/compilers/llvm/3.7/lldb.nix @@ -8,7 +8,7 @@ , libedit , llvm , clang-unwrapped -, python +, python2 , version }: @@ -23,7 +23,7 @@ stdenv.mkDerivation { scripts/Python/build-swig-Python.sh ''; - buildInputs = [ cmake python which swig ncurses zlib libedit ]; + buildInputs = [ cmake python2 which swig ncurses zlib libedit ]; preConfigure = '' export CXXFLAGS="-pthread" @@ -31,7 +31,6 @@ stdenv.mkDerivation { ''; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}" "-DLLDB_PATH_TO_CLANG_BUILD=${clang-unwrapped}" "-DPYTHON_VERSION_MAJOR=2" diff --git a/pkgs/development/compilers/llvm/3.7/llvm.nix b/pkgs/development/compilers/llvm/3.7/llvm.nix index cc65c69927c5..c674b959c787 100644 --- a/pkgs/development/compilers/llvm/3.7/llvm.nix +++ b/pkgs/development/compilers/llvm/3.7/llvm.nix @@ -3,7 +3,7 @@ , perl , groff , cmake -, python +, python2 , libffi , binutils , libxml2 @@ -30,11 +30,23 @@ in stdenv.mkDerivation rec { mv compiler-rt-* $sourceRoot/projects/compiler-rt ''; - buildInputs = [ perl groff cmake libxml2 python libffi ] + buildInputs = [ perl groff cmake libxml2 python2 libffi ] ++ stdenv.lib.optional stdenv.isDarwin libcxxabi; propagatedBuildInputs = [ ncurses zlib ]; + # The goal here is to disable LLVM bindings (currently go and ocaml) regardless + # of whether the impure CMake search sheananigans find the compilers in global + # paths. This mostly exists because sandbox builds don't work very well on Darwin + # and sometimes you get weird behavior if CMake finds go in your system path. + # This would be far prettier if there were a CMake option to just disable bindings + # but from what I can tell, there isn't such a thing. The file in question only + # contains `if(WIN32)` conditions to check whether to disable bindings, so making + # those always succeed has the net effect of disabling all bindings. + prePatch = '' + substituteInPlace cmake/config-ix.cmake --replace "if(WIN32)" "if(1)" + ''; + # hacky fix: created binaries need to be run before installation preBuild = '' mkdir -p $out/ diff --git a/pkgs/development/compilers/llvm/3.8/clang/default.nix b/pkgs/development/compilers/llvm/3.8/clang/default.nix index 71420d4cdccd..6052246dad07 100644 --- a/pkgs/development/compilers/llvm/3.8/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.8/clang/default.nix @@ -6,7 +6,7 @@ let name = "clang-${version}"; unpackPhase = '' - unpackFile ${fetch "cfe" "1ybcac8hlr9vl3wg8s4v6cp0c0qgqnwprsv85lihbkq3vqv94504"} + unpackFile ${fetch "cfe" "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc"} mv cfe-${version}.src clang sourceRoot=$PWD/clang unpackFile ${clang-tools-extra_src} @@ -16,7 +16,6 @@ let buildInputs = [ cmake libedit libxml2 llvm python ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ # Maybe with compiler-rt this won't be needed? @@ -30,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; diff --git a/pkgs/development/compilers/llvm/3.8/default.nix b/pkgs/development/compilers/llvm/3.8/default.nix index a2a702a617ee..04cd9f791e62 100644 --- a/pkgs/development/compilers/llvm/3.8/default.nix +++ b/pkgs/development/compilers/llvm/3.8/default.nix @@ -1,8 +1,8 @@ -{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }: +{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun }: let callPackage = newScope (self // { inherit stdenv isl version fetch; }); - version = "3.8.0"; + version = "3.8.1"; fetch = fetch_v version; fetch_v = ver: name: sha256: fetchurl { @@ -10,8 +10,8 @@ let inherit sha256; }; - compiler-rt_src = fetch "compiler-rt" "1c2nkp9563873ffz22qmhc0wakgj428pch8rmhym8agjamz3ily8"; - clang-tools-extra_src = fetch "clang-tools-extra" "1i0yrgj8qrzjjswraz0i55lg92ljpqhvjr619d268vka208aigdg"; + compiler-rt_src = fetch "compiler-rt" "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"; + clang-tools-extra_src = fetch "clang-tools-extra" "15n39r4ssphpaq4a0wzyjm7ilwxb0bch6nrapy8c5s8d49h5qjk6"; self = { llvm = callPackage ./llvm.nix { @@ -24,8 +24,19 @@ let clang = wrapCC self.clang-unwrapped; + libcxxClang = ccWrapperFun { + cc = self.clang-unwrapped; + isClang = true; + inherit (self) stdenv; + /* FIXME is this right? */ + inherit (stdenv.cc) libc nativeTools nativeLibc; + extraPackages = [ self.libcxx self.libcxxabi ]; + }; + stdenv = overrideCC stdenv self.clang; + libcxxStdenv = overrideCC stdenv self.libcxxClang; + lldb = callPackage ./lldb.nix {}; libcxx = callPackage ./libc++ {}; diff --git a/pkgs/development/compilers/llvm/3.8/libc++/default.nix b/pkgs/development/compilers/llvm/3.8/libc++/default.nix index f10dcb6784ca..15f7ee1e3e4a 100644 --- a/pkgs/development/compilers/llvm/3.8/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.8/libc++/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { name = "libc++-${version}"; - src = fetch "libcxx" "0yr3fh8vj38289b9cwk37zsy7x98dcd3kjy7xxy8mg20p48lb01n"; + src = fetch "libcxx" "1k7f9qk5bgwa02ksh6yr9hccwcbhmcdzl1fpbdw6s2c89iwg7mvp"; postUnpack = '' unpackFile ${libcxxabi.src} @@ -18,12 +18,11 @@ stdenv.mkDerivation rec { buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - cmakeFlags = - [ "-DCMAKE_BUILD_TYPE=Release" - "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" - "-DLIBCXX_LIBCPPABI_VERSION=2" - "-DLIBCXX_CXX_ABI=libcxxabi" - ]; + cmakeFlags = [ + "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" + "-DLIBCXX_LIBCPPABI_VERSION=2" + "-DLIBCXX_CXX_ABI=libcxxabi" + ]; enableParallelBuilding = true; diff --git a/pkgs/development/compilers/llvm/3.8/libc++abi.nix b/pkgs/development/compilers/llvm/3.8/libc++abi.nix index fdbc002688e9..61ff6341c30a 100644 --- a/pkgs/development/compilers/llvm/3.8/libc++abi.nix +++ b/pkgs/development/compilers/llvm/3.8/libc++abi.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation { name = "libc++abi-${version}"; - src = fetch "libcxxabi" "0175rv2ynkklbg96kpw13iwhnzyrlw3r12f4h09p9v7nmxqhivn5"; + src = fetch "libcxxabi" "1qfs2iis1i0ppv11jndc98cvd7s25pj46pq2sfyldmzswdxmzdg1"; buildInputs = [ cmake ] ++ stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; diff --git a/pkgs/development/compilers/llvm/3.8/lldb.nix b/pkgs/development/compilers/llvm/3.8/lldb.nix index ca8a74c28bb6..568476e44ac2 100644 --- a/pkgs/development/compilers/llvm/3.8/lldb.nix +++ b/pkgs/development/compilers/llvm/3.8/lldb.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation { name = "lldb-${version}"; - src = fetch "lldb" "0dasg12gf5crrd9pbi5rd1y8vwlgqp8nxgw9g4z47w3x2i28zxp3"; + src = fetch "lldb" "18z8vhfgh4m57hl66i83cp4d4mv3i86z2hjhbp5rvqs7d88li49l"; postUnpack = '' # Hack around broken standalone builf as of 3.8 @@ -25,15 +25,11 @@ stdenv.mkDerivation { cp "$(ls -d llvm-*.src)/lib/Support/regex_impl.h" "$srcDir/tools/lib/Support/" ''; - buildInputs = [ cmake python which swig ncurses zlib libedit ]; + buildInputs = [ cmake python which swig ncurses zlib libedit llvm ]; - preConfigure = '' - export CXXFLAGS="-pthread" - export LDFLAGS="-ldl" - ''; + hardeningDisable = [ "format" ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DLLDB_PATH_TO_LLVM_BUILD=${llvm}" "-DLLVM_MAIN_INCLUDE_DIR=${llvm}/include" "-DLLDB_PATH_TO_CLANG_BUILD=${clang-unwrapped}" diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix index fc29d00a5245..6112228bf4fc 100644 --- a/pkgs/development/compilers/llvm/3.8/llvm.nix +++ b/pkgs/development/compilers/llvm/3.8/llvm.nix @@ -18,7 +18,7 @@ }: let - src = fetch "llvm" "0ikfq0gxac8xpvxj23l4hk8f12ydx48fljgrz1gl9xp0ks704nsm"; + src = fetch "llvm" "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf"; in stdenv.mkDerivation rec { name = "llvm-${version}"; diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix index e75da0e9717e..6eadb91141d9 100644 --- a/pkgs/development/compilers/llvm/3.9/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.9/clang/default.nix @@ -16,7 +16,6 @@ let buildInputs = [ cmake libedit libxml2 llvm python ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_CXX_FLAGS=-std=c++11" ] ++ # Maybe with compiler-rt this won't be needed? diff --git a/pkgs/development/compilers/llvm/3.9/default.nix b/pkgs/development/compilers/llvm/3.9/default.nix index a39f013d1a9a..49fdad931b69 100644 --- a/pkgs/development/compilers/llvm/3.9/default.nix +++ b/pkgs/development/compilers/llvm/3.9/default.nix @@ -1,4 +1,4 @@ -{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }: +{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC, darwin, ccWrapperFun }: let callPackage = newScope (self // { inherit stdenv isl version fetch; }); @@ -24,8 +24,19 @@ let clang = wrapCC self.clang-unwrapped; + libcxxClang = ccWrapperFun { + cc = self.clang-unwrapped; + isClang = true; + inherit (self) stdenv; + /* FIXME is this right? */ + inherit (stdenv.cc) libc nativeTools nativeLibc; + extraPackages = [ self.libcxx self.libcxxabi ]; + }; + stdenv = overrideCC stdenv self.clang; + libcxxStdenv = overrideCC stdenv self.libcxxClang; + lldb = callPackage ./lldb.nix {}; libcxx = callPackage ./libc++ {}; diff --git a/pkgs/development/compilers/llvm/3.9/libc++/default.nix b/pkgs/development/compilers/llvm/3.9/libc++/default.nix index 97cf65ad2090..3b7caaa24bf5 100644 --- a/pkgs/development/compilers/llvm/3.9/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.9/libc++/default.nix @@ -18,8 +18,7 @@ stdenv.mkDerivation rec { buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - cmakeFlags = - [ "-DCMAKE_BUILD_TYPE=Release" + cmakeFlags = [ "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib" "-DLIBCXX_LIBCPPABI_VERSION=2" "-DLIBCXX_CXX_ABI=libcxxabi" diff --git a/pkgs/development/compilers/llvm/3.9/lldb.nix b/pkgs/development/compilers/llvm/3.9/lldb.nix index bb92a6eed6c0..0acef48f57b4 100644 --- a/pkgs/development/compilers/llvm/3.9/lldb.nix +++ b/pkgs/development/compilers/llvm/3.9/lldb.nix @@ -41,7 +41,6 @@ stdenv.mkDerivation { hardeningDisable = [ "format" ]; cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" "-DLLVM_MAIN_INCLUDE_DIR=${llvm}/include" ]; diff --git a/pkgs/development/compilers/llvm/3.9/llvm-outputs.patch b/pkgs/development/compilers/llvm/3.9/llvm-outputs.patch new file mode 100644 index 000000000000..40096fa3497f --- /dev/null +++ b/pkgs/development/compilers/llvm/3.9/llvm-outputs.patch @@ -0,0 +1,26 @@ +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 94d426b..37f7794 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -333,6 +333,21 @@ int main(int argc, char **argv) { + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + ++ /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared ++ if (!IsInDevelopmentTree) { ++ bool WantShared = true; ++ for (int i = 1; i < argc; ++i) { ++ StringRef Arg = argv[i]; ++ if (Arg == "--link-shared") ++ WantShared = true; ++ else if (Arg == "--link-static") ++ WantShared = false; // the last one wins ++ } ++ ++ if (WantShared) ++ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX; ++ } ++ + /// We only use `shared library` mode in cases where the static library form + /// of the components provided are not available; note however that this is + /// skipped if we're run from within the build dir. However, once installed, diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 41d655015e46..8086f980bcf5 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -15,10 +15,16 @@ , libcxxabi , debugVersion ? false , enableSharedLibraries ? true +, darwin }: let src = fetch "llvm" "0j49lkd5d7nnpdqzaybs2472bvcxyx0i4r3iccwf3kj2v9wk3iv6"; + shlib = if stdenv.isDarwin then "dylib" else "so"; + + # Used when creating a version-suffixed symlink of libLLVM.dylib + shortVersion = with stdenv.lib; + concatStringsSep "." (take 2 (splitString "." version)); in stdenv.mkDerivation rec { name = "llvm-${version}"; @@ -30,16 +36,25 @@ 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; + ++ stdenv.lib.optionals stdenv.isDarwin + [ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ]; 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,9 +74,10 @@ 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" + "-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool" ]; postBuild = '' @@ -70,9 +86,20 @@ in stdenv.mkDerivation rec { paxmark m bin/{lli,llvm-rtdyld} ''; - postInstall = 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 + postInstall = "" + + stdenv.lib.optionalString (enableSharedLibraries) '' + moveToOutput "lib/libLLVM-*" "$lib" + moveToOutput "lib/libLLVM.${shlib}" "$lib" + substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-" + '' + + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) '' + substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \ + --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" + install_name_tool -id $lib/lib/libLLVM.dylib $lib/lib/libLLVM.dylib + install_name_tool -change @rpath/libLLVM.dylib $lib/lib/libLLVM.dylib $out/bin/llvm-config + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib + ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${version}.dylib ''; enableParallelBuilding = true; |
