git.iko.soy/typeable/nixpkgs
on master help sign in
Merge #18007: add llvmPackages_39

Direct merge to master, too, without switching any package.

commit4e5ba34d81b21757e18f5ea09d1754aff98ee311 authorVladimír Čunát <vcunat@gmail.com> dateSun 4 Sep 2016, 12:38 (10 years ago) parent0edc7eef5c3115
10 files changed+386
pkgs/development/compilers/llvm/3.9/clang/default.nix+57 pkgs/development/compilers/llvm/3.9/clang/purity.patch+16 pkgs/development/compilers/llvm/3.9/default.nix+35 pkgs/development/compilers/llvm/3.9/libc++/darwin.patch+39 pkgs/development/compilers/llvm/3.9/libc++/default.nix+40 pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh+3 pkgs/development/compilers/llvm/3.9/libc++abi.nix+47 pkgs/development/compilers/llvm/3.9/lldb.nix+56 pkgs/development/compilers/llvm/3.9/llvm.nix+89 pkgs/top-level/all-packages.nix+4
pkgs/development/compilers/llvm/3.9/clang/default.nixnew file+57
@@ -0,0 +1,57 @@
1+{ stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src, python }:
2+
3+let
4+ gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
5+ self = stdenv.mkDerivation {
6+ name = "clang-${version}";
7+
8+ unpackPhase = ''
9+ unpackFile ${fetch "cfe" "0a1x32rxrq4ln079xf58irg56gjdxcfgwa00ws4hqv9pv73sg5km"}
10+ mv cfe-${version}.src clang
11+ sourceRoot=$PWD/clang
12+ unpackFile ${clang-tools-extra_src}
13+ mv clang-tools-extra-* $sourceRoot/tools/extra
14+ '';
15+
16+ buildInputs = [ cmake libedit libxml2 llvm python ];
17+
18+ cmakeFlags = [
19+ "-DCMAKE_BUILD_TYPE=Release"
20+ "-DCMAKE_CXX_FLAGS=-std=c++11"
21+ ] ++
22+ # Maybe with compiler-rt this won't be needed?
23+ (stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}") ++
24+ (stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
25+
26+ patches = [ ./purity.patch ];
27+
28+ postPatch = ''
29+ sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
30+ sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
31+ '';
32+
33+ # Clang expects to find LLVMgold in its own prefix
34+ # Clang expects to find sanitizer libraries in its own prefix
35+ postInstall = ''
36+ ln -sv ${llvm}/lib/LLVMgold.so $out/lib
37+ ln -sv ${llvm}/lib/clang/3.9.0/lib $out/lib/clang/3.9.0/
38+ ln -sv $out/bin/clang $out/bin/cpp
39+ '';
40+
41+ enableParallelBuilding = true;
42+
43+ passthru = {
44+ lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
45+ isClang = true;
46+ } // stdenv.lib.optionalAttrs stdenv.isLinux {
47+ inherit gcc;
48+ };
49+
50+ meta = {
51+ description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
52+ homepage = http://llvm.org/;
53+ license = stdenv.lib.licenses.bsd3;
54+ platforms = stdenv.lib.platforms.all;
55+ };
56+ };
57+in self
pkgs/development/compilers/llvm/3.9/clang/purity.patchnew file+16
@@ -0,0 +1,16 @@
1+--- a/lib/Driver/Tools.cpp 2016-08-25 15:48:05.187553443 +0200
2++++ b/lib/Driver/Tools.cpp 2016-08-25 15:48:47.534468882 +0200
3+@@ -9420,13 +9420,6 @@
4+ if (!Args.hasArg(options::OPT_static)) {
5+ if (Args.hasArg(options::OPT_rdynamic))
6+ CmdArgs.push_back("-export-dynamic");
7+-
8+- if (!Args.hasArg(options::OPT_shared)) {
9+- const std::string Loader =
10+- D.DyldPrefix + ToolChain.getDynamicLinker(Args);
11+- CmdArgs.push_back("-dynamic-linker");
12+- CmdArgs.push_back(Args.MakeArgString(Loader));
13+- }
14+ }
15+
16+ CmdArgs.push_back("-o");
pkgs/development/compilers/llvm/3.9/default.nixnew file+35
@@ -0,0 +1,35 @@
1+{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }:
2+let
3+ callPackage = newScope (self // { inherit stdenv isl version fetch; });
4+
5+ version = "3.9.0";
6+
7+ fetch = fetch_v version;
8+ fetch_v = ver: name: sha256: fetchurl {
9+ url = "http://llvm.org/releases/3.9.0/${name}-${ver}.src.tar.xz";
10+ inherit sha256;
11+ };
12+
13+ compiler-rt_src = fetch "compiler-rt" "16m5g0hf8yg9npnw25j2a86g34nsvk9rsm3c84gbch2prm7j5rg0";
14+ clang-tools-extra_src = fetch "clang-tools-extra" "052zg0h5vbmxnh2ikc743rw3649f112dfyn8hg39x6cfxi3fqyjv";
15+
16+ self = {
17+ llvm = callPackage ./llvm.nix {
18+ inherit compiler-rt_src stdenv;
19+ };
20+
21+ clang-unwrapped = callPackage ./clang {
22+ inherit clang-tools-extra_src stdenv;
23+ };
24+
25+ clang = wrapCC self.clang-unwrapped;
26+
27+ stdenv = overrideCC stdenv self.clang;
28+
29+ lldb = callPackage ./lldb.nix {};
30+
31+ libcxx = callPackage ./libc++ {};
32+
33+ libcxxabi = callPackage ./libc++abi.nix {};
34+ };
35+in self
pkgs/development/compilers/llvm/3.9/libc++/darwin.patchnew file+39
@@ -0,0 +1,39 @@
1+--- libcxx-3.8.0.src.org/lib/CMakeLists.txt 2015-12-16 15:41:05.000000000 -0800
2++++ libcxx-3.8.0.src/lib/CMakeLists.txt 2016-06-17 19:40:00.293394500 -0700
3+@@ -94,30 +94,30 @@
4+ add_definitions(-D__STRICT_ANSI__)
5+ add_link_flags(
6+ "-compatibility_version 1"
7+ "-current_version 1"
8+- "-install_name /usr/lib/libc++.1.dylib"
9+- "-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
10++ "-install_name ${LIBCXX_LIBCXXABI_LIB_PATH}/libc++.1.dylib"
11++ "-Wl,-reexport_library,${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
12+ "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
13+ "/usr/lib/libSystem.B.dylib")
14+ else()
15+ if ( ${CMAKE_OSX_SYSROOT} )
16+ list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
17+ if (OSX_HAS_ARMV7)
18+ set(OSX_RE_EXPORT_LINE
19+- "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
20++ "${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
21+ "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
22+ else()
23+ set(OSX_RE_EXPORT_LINE
24+- "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
25++ "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib")
26+ endif()
27+ else()
28+- set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
29++ set(OSX_RE_EXPORT_LINE "${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
30+ endif()
31+
32+ add_link_flags(
33+ "-compatibility_version 1"
34+- "-install_name /usr/lib/libc++.1.dylib"
35++ "-install_name ${LIBCXX_LIBCXXABI_LIB_PATH}/libc++.1.dylib"
36+ "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
37+ "${OSX_RE_EXPORT_LINE}"
38+ "-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp"
39+ "-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp")
pkgs/development/compilers/llvm/3.9/libc++/default.nixnew file+40
@@ -0,0 +1,40 @@
1+{ lib, stdenv, fetch, cmake, libcxxabi, fixDarwinDylibNames, version }:
2+
3+stdenv.mkDerivation rec {
4+ name = "libc++-${version}";
5+
6+ src = fetch "libcxx" "01jvgwi9zd46bb1f93c561212bjzg02q2akacvsj4qsw6r8qvcyh";
7+
8+ postUnpack = ''
9+ unpackFile ${libcxxabi.src}
10+ '';
11+
12+ preConfigure = ''
13+ # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
14+ cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
15+ '';
16+
17+ patches = lib.optional stdenv.isDarwin ./darwin.patch;
18+
19+ buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
20+
21+ cmakeFlags =
22+ [ "-DCMAKE_BUILD_TYPE=Release"
23+ "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
24+ "-DLIBCXX_LIBCPPABI_VERSION=2"
25+ "-DLIBCXX_CXX_ABI=libcxxabi"
26+ ];
27+
28+ enableParallelBuilding = true;
29+
30+ linkCxxAbi = stdenv.isLinux;
31+
32+ setupHook = ./setup-hook.sh;
33+
34+ meta = {
35+ homepage = http://libcxx.llvm.org/;
36+ description = "A new implementation of the C++ standard library, targeting C++11";
37+ license = "BSD";
38+ platforms = stdenv.lib.platforms.unix;
39+ };
40+}
pkgs/development/compilers/llvm/3.9/libc++/setup-hook.shnew file+3
@@ -0,0 +1,3 @@
1+linkCxxAbi="@linkCxxAbi@"
2+export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
3+export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
pkgs/development/compilers/llvm/3.9/libc++abi.nixnew file+47
@@ -0,0 +1,47 @@
1+{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
2+
3+stdenv.mkDerivation {
4+ name = "libc++abi-${version}";
5+
6+ src = fetch "libcxxabi" "06c05jlwfgm2q5xhy5wzmsi9bmfphzh22wpmbph84s452wksjdxh";
7+
8+ buildInputs = [ cmake ] ++ stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
9+
10+ postUnpack = ''
11+ unpackFile ${libcxx.src}
12+ unpackFile ${llvm.src}
13+ export NIX_CFLAGS_COMPILE+=" -I$PWD/include"
14+ export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
15+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
16+ export TRIPLE=x86_64-apple-darwin
17+ '';
18+
19+ installPhase = if stdenv.isDarwin
20+ then ''
21+ for file in lib/*.dylib; do
22+ # this should be done in CMake, but having trouble figuring out
23+ # the magic combination of necessary CMake variables
24+ # if you fancy a try, take a look at
25+ # http://www.cmake.org/Wiki/CMake_RPATH_handling
26+ install_name_tool -id $out/$file $file
27+ done
28+ make install
29+ install -d 755 $out/include
30+ install -m 644 ../include/*.h $out/include
31+ ''
32+ else ''
33+ install -d -m 755 $out/include $out/lib
34+ install -m 644 lib/libc++abi.so.1.0 $out/lib
35+ install -m 644 ../include/cxxabi.h $out/include
36+ ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
37+ ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
38+ '';
39+
40+ meta = {
41+ homepage = http://libcxxabi.llvm.org/;
42+ description = "A new implementation of low level support for a standard C++ library";
43+ license = "BSD";
44+ maintainers = with stdenv.lib.maintainers; [ vlstill ];
45+ platforms = stdenv.lib.platforms.unix;
46+ };
47+}
pkgs/development/compilers/llvm/3.9/lldb.nixnew file+56
@@ -0,0 +1,56 @@
1+{ stdenv
2+, fetch
3+, cmake
4+, zlib
5+, ncurses
6+, swig
7+, which
8+, libedit
9+, llvm
10+, clang-unwrapped
11+, python
12+, version
13+}:
14+
15+stdenv.mkDerivation {
16+ name = "lldb-${version}";
17+
18+ src = fetch "lldb" "1113s6crh94hzk9h9lqrvng0lsy174ml2rq0r962ngqy843hwa31";
19+
20+ postUnpack = ''
21+ # Hack around broken standalone build as of 3.8
22+ unpackFile ${llvm.src}
23+ srcDir="$(ls -d lldb-*.src)"
24+ mkdir -p "$srcDir/tools/lib/Support"
25+ cp "$(ls -d llvm-*.src)/lib/Support/regex_impl.h" "$srcDir/tools/lib/Support/"
26+
27+ # Fix up various paths that assume llvm and clang are installed in the same place
28+ substituteInPlace $srcDir/cmake/modules/LLDBStandalone.cmake \
29+ --replace CheckAtomic $(readlink -f llvm-*.src)/cmake/modules/CheckAtomic.cmake
30+ sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
31+ $srcDir/cmake/modules/LLDBStandalone.cmake
32+ sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
33+ $srcDir/cmake/modules/LLDBStandalone.cmake
34+ sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
35+ $srcDir/cmake/modules/LLDBStandalone.cmake
36+ '';
37+
38+ buildInputs = [ cmake python which swig ncurses zlib libedit llvm ];
39+
40+ CXXFLAGS = "-fno-rtti";
41+ hardeningDisable = [ "format" ];
42+
43+ cmakeFlags = [
44+ "-DCMAKE_BUILD_TYPE=Release"
45+ "-DLLVM_MAIN_INCLUDE_DIR=${llvm}/include"
46+ ];
47+
48+ enableParallelBuilding = true;
49+
50+ meta = {
51+ description = "A next-generation high-performance debugger";
52+ homepage = http://llvm.org/;
53+ license = stdenv.lib.licenses.bsd3;
54+ platforms = stdenv.lib.platforms.all;
55+ };
56+}
pkgs/development/compilers/llvm/3.9/llvm.nixnew file+89
@@ -0,0 +1,89 @@
1+{ stdenv
2+, fetch
3+, perl
4+, groff
5+, cmake
6+, python
7+, libffi
8+, binutils
9+, libxml2
10+, valgrind
11+, ncurses
12+, version
13+, zlib
14+, compiler-rt_src
15+, libcxxabi
16+, debugVersion ? false
17+, enableSharedLibraries ? true
18+}:
19+
20+let
21+ src = fetch "llvm" "0j49lkd5d7nnpdqzaybs2472bvcxyx0i4r3iccwf3kj2v9wk3iv6";
22+in stdenv.mkDerivation rec {
23+ name = "llvm-${version}";
24+
25+ unpackPhase = ''
26+ unpackFile ${src}
27+ mv llvm-${version}.src llvm
28+ sourceRoot=$PWD/llvm
29+ unpackFile ${compiler-rt_src}
30+ mv compiler-rt-* $sourceRoot/projects/compiler-rt
31+ '';
32+
33+ buildInputs = [ perl groff cmake libxml2 python libffi ]
34+ ++ stdenv.lib.optional stdenv.isDarwin libcxxabi;
35+
36+ propagatedBuildInputs = [ ncurses zlib ];
37+
38+ # hacky fix: New LLVM releases require a newer OS X SDK than
39+ # 10.9. This is a temporary measure until nixpkgs darwin support is
40+ # updated.
41+ patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
42+ sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
43+ '';
44+
45+ # hacky fix: created binaries need to be run before installation
46+ preBuild = ''
47+ mkdir -p $out/
48+ ln -sv $PWD/lib $out
49+ '';
50+
51+ cmakeFlags = with stdenv; [
52+ "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
53+ "-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
54+ "-DLLVM_BUILD_TESTS=ON"
55+ "-DLLVM_ENABLE_FFI=ON"
56+ "-DLLVM_ENABLE_RTTI=ON"
57+ "-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
58+ ] ++ stdenv.lib.optional enableSharedLibraries [
59+ "-DLLVM_LINK_LLVM_DYLIB=ON"
60+ ] ++ stdenv.lib.optional (!isDarwin)
61+ "-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include"
62+ ++ stdenv.lib.optionals ( isDarwin) [
63+ "-DLLVM_ENABLE_LIBCXX=ON"
64+ "-DCAN_TARGET_i386=false"
65+ ];
66+
67+ postBuild = ''
68+ rm -fR $out
69+
70+ paxmark m bin/{lli,llvm-rtdyld}
71+ '';
72+
73+ postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
74+ install_name_tool -id $out/lib/libLLVM.dylib $out/lib/libLLVM.dylib
75+ ln -s $out/lib/libLLVM.dylib $out/lib/libLLVM-${version}.dylib
76+ '';
77+
78+ enableParallelBuilding = true;
79+
80+ passthru.src = src;
81+
82+ meta = {
83+ description = "Collection of modular and reusable compiler and toolchain technologies";
84+ homepage = http://llvm.org/;
85+ license = stdenv.lib.licenses.bsd3;
86+ maintainers = with stdenv.lib.maintainers; [ lovek323 raskin viric ];
87+ platforms = stdenv.lib.platforms.all;
88+ };
89+}
pkgs/top-level/all-packages.nix+4
@@ -4941,6 +4941,10 @@ in
49414941 inherit (stdenvAdapters) overrideCC;
49424942 };
49434943
4944+ llvmPackages_39 = callPackage ../development/compilers/llvm/3.9 {
4945+ inherit (stdenvAdapters) overrideCC;
4946+ };
4947+
49444948 manticore = callPackage ../development/compilers/manticore { };
49454949
49464950 mentorToolchains = recurseIntoAttrs (