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