add llvm-3.5

This commit is contained in:
Eric Seidel 2015-02-03 13:58:32 -08:00
parent e01997e1ef
commit 2ca30151c2
11 changed files with 338 additions and 0 deletions

View File

@ -0,0 +1,22 @@
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 198e82e..810d006 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -7355,17 +7355,6 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-shared");
}
- if (ToolChain.getArch() == llvm::Triple::arm ||
- ToolChain.getArch() == llvm::Triple::armeb ||
- ToolChain.getArch() == llvm::Triple::thumb ||
- ToolChain.getArch() == llvm::Triple::thumbeb ||
- (!Args.hasArg(options::OPT_static) &&
- !Args.hasArg(options::OPT_shared))) {
- CmdArgs.push_back("-dynamic-linker");
- CmdArgs.push_back(Args.MakeArgString(
- D.DyldPrefix + getLinuxDynamicLinker(Args, ToolChain)));
- }
-
CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());

View File

@ -0,0 +1,8 @@
diff -Naur clang-3.4-orig/tools/extra/CMakeLists.txt clang-3.4/tools/extra/CMakeLists.txt
--- clang-3.4-orig/tools/extra/CMakeLists.txt 2013-11-07 19:08:23.000000000 -0500
+++ clang-3.4/tools/extra/CMakeLists.txt 2014-01-20 11:47:22.678435223 -0500
@@ -1,3 +1,4 @@
+include(CheckLibraryExists)
check_library_exists(edit el_init "" HAVE_LIBEDIT)
add_subdirectory(clang-apply-replacements)

View File

@ -0,0 +1,41 @@
{ stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }:
stdenv.mkDerivation {
name = "clang-${version}";
unpackPhase = ''
unpackFile ${fetch "cfe" "12yv3jwdjcbkrx7zjm8wh4jrvb59v8fdw4mnmz3zc1jb00p9k07w"}
mv cfe-${version}.src clang
sourceRoot=$PWD/clang
unpackFile ${clang-tools-extra_src}
mv clang-tools-extra-* $sourceRoot/tools/extra
'';
buildInputs = [ cmake libedit libxml2 llvm ];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_FLAGS=-std=c++11"
] ++
(stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
patches = [ ./clang-purity.patch ];
# 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
'';
enableParallelBuilding = true;
meta = {
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
homepage = http://llvm.org/;
license = stdenv.lib.licenses.bsd3;
maintainers = [ stdenv.lib.maintainers.shlevy ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -0,0 +1,37 @@
{ newScope, stdenv, isl, fetchurl }:
let
callPackage = newScope (self // { inherit stdenv isl version fetch; });
version = "3.5.0";
fetch = fetch_v version;
fetch_v = ver: name: sha256: fetchurl {
url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
inherit sha256;
};
compiler-rt_src = fetch "compiler-rt" "0dl1kbrhz96djsxqr61iw5h788s7ncfpfb7aayixky1bhdaydcx4";
clang-tools-extra_src = fetch "clang-tools-extra" "0s8zjgxg8bj15nnqcw1cj1zffcralhh7f0gda1famddgg2rvx099";
self = {
llvm = callPackage ./llvm.nix rec {
version = "3.5.0";
fetch = fetch_v version;
inherit compiler-rt_src;
};
clang = callPackage ./clang.nix rec {
version = "3.5.0";
fetch = fetch_v version;
inherit clang-tools-extra_src;
};
lld = callPackage ./lld.nix {};
lldb = callPackage ./lldb.nix {};
polly = callPackage ./polly.nix {};
dragonegg = callPackage ./dragonegg.nix {};
};
in self

View File

@ -0,0 +1,34 @@
{stdenv, fetch, fetchpatch, llvm, gmp, mpfr, mpc, ncurses, zlib, version}:
stdenv.mkDerivation rec {
name = "dragonegg-${version}";
src = fetch "dragonegg" "1733czbvby1ww3xkwcwmm0km0bpwhfyxvf56wb0zv5gksp3kbgrr";
patches = [(fetchpatch {
url = "https://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/ABIHack.inc"
+ "?r1=208730&r2=208729&view=patch";
sha256 = "1al82gqz90hzjx24p0wls029lw2bgnlgd209kgvxsp82p4z1v1c1";
name = "bug-18548.patch";
})];
patchFlags = "-p2";
# The gcc the plugin will be built for (the same used building dragonegg)
GCC = "gcc";
buildInputs = [ llvm gmp mpfr mpc ncurses zlib ];
installPhase = ''
mkdir -p $out/lib $out/share/doc/${name}
cp -d dragonegg.so $out/lib
cp README COPYING $out/share/doc/${name}
'';
meta = {
homepage = http://dragonegg.llvm.org/;
description = "gcc plugin that replaces gcc's optimizers and code generators by those in LLVM";
license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric shlevy];
platforms = with stdenv.lib.platforms; linux;
};
}

View File

@ -0,0 +1,31 @@
{ stdenv, fetch, cmake, llvm, ncurses, zlib, python, version }:
stdenv.mkDerivation {
name = "lld-${version}";
src = fetch "lld" "1sd4scqynryfrmcc4h0ljgwn2dgjmbbmf38z50ya6l0janpd2nxx";
preUnpack = ''
# !!! Hopefully won't be needed for 3.5
unpackFile ${llvm.src}
export cmakeFlags="$cmakeFlags -DLLD_PATH_TO_LLVM_SOURCE="`ls -d $PWD/llvm-*`
'';
buildInputs = [ cmake ncurses zlib python ];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DLLD_PATH_TO_LLVM_BUILD=${llvm}"
];
enableParallelBuilding = true;
meta = {
description = "A set of modular code for creating linker tools";
homepage = http://llvm.org/;
license = stdenv.lib.licenses.bsd3;
maintainers = [ stdenv.lib.maintainers.shlevy ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -0,0 +1,44 @@
{ stdenv
, fetch
, cmake
, zlib
, ncurses
, swig
, which
, libedit
, llvm
, clang
, python
, version
}:
stdenv.mkDerivation {
name = "lldb-${version}";
src = fetch "lldb" "0h8cmjrhjhigk7k2qll1pcf6jfgmbdzkzfz2i048pkfg851s0x44";
patchPhase = ''
sed -i 's|/usr/bin/env||' \
scripts/Python/finish-swig-Python-LLDB.sh \
scripts/Python/build-swig-Python.sh
'';
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}"
];
enableParallelBuilding = true;
meta = {
description = "A next-generation high-performance debugger";
homepage = http://llvm.org/;
license = stdenv.lib.licenses.bsd3;
maintainers = [ stdenv.lib.maintainers.shlevy ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -0,0 +1,12 @@
diff -Naur llvm-3.4-orig/cmake/modules/TableGen.cmake llvm-3.4/cmake/modules/TableGen.cmake
--- llvm-3.4-orig/cmake/modules/TableGen.cmake 2013-10-06 21:00:07.000000000 -0400
+++ llvm-3.4/cmake/modules/TableGen.cmake 2014-01-20 13:06:55.273022149 -0500
@@ -78,8 +78,6 @@
endif()
macro(add_tablegen target project)
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
-
set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen)
add_llvm_utility(${target} ${ARGN})

View File

@ -0,0 +1,70 @@
{ stdenv
, fetch
, perl
, groff
, cmake
, python
, libffi
, binutils
, libxml2
, valgrind
, ncurses
, version
, zlib
, compiler-rt_src
}:
let
src = fetch "llvm" "00swb43mzlvda8306arlg2jw7g6k3acwfccgf1k4c2pgd3rrkq98";
in stdenv.mkDerivation rec {
name = "llvm-${version}";
unpackPhase = ''
unpackFile ${src}
mv llvm-${version}.src llvm
sourceRoot=$PWD/llvm
unpackFile ${compiler-rt_src}
mv compiler-rt-* $sourceRoot/projects/compiler-rt
'';
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
propagatedBuildInputs = [ ncurses zlib ];
# hacky fix: created binaries need to be run before installation
preBuild = ''
mkdir -p $out/
ln -sv $PWD/lib $out
'';
cmakeFlags = with stdenv; [
"-DCMAKE_BUILD_TYPE=Release"
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_BINUTILS_INCDIR=${binutils}/include"
"-DCMAKE_CXX_FLAGS=-stdlib=libc++"
] ++ stdenv.lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON"
++ stdenv.lib.optional ( isDarwin) "-DCAN_TARGET_i386=false";
postBuild = ''
rm -fR $out
paxmark m bin/{lli,llvm-rtdyld}
paxmark m unittests/ExecutionEngine/JIT/JITTests
paxmark m unittests/ExecutionEngine/MCJIT/MCJITTests
paxmark m unittests/Support/SupportTests
'';
enableParallelBuilding = true;
passthru.src = src;
meta = {
description = "Collection of modular and reusable compiler and toolchain technologies";
homepage = http://llvm.org/;
license = stdenv.lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ shlevy lovek323 raskin viric ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -0,0 +1,12 @@
diff -Naur polly-3.4-orig/CMakeLists.txt polly-3.4/CMakeLists.txt
--- polly-3.4-orig/CMakeLists.txt 2013-11-21 06:51:46.000000000 -0500
+++ polly-3.4/CMakeLists.txt 2014-01-20 18:49:34.907919933 -0500
@@ -53,7 +53,7 @@
execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --cxxflags
OUTPUT_VARIABLE LLVM_CXX_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS}")
endif(NOT DEFINED LLVM_MAIN_SRC_DIR)
set(POLLY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -0,0 +1,27 @@
{ stdenv, fetch, cmake, isl, python, gmp, llvm, version }:
stdenv.mkDerivation {
name = "polly-${version}";
src = fetch "polly" "1rqflmgzg1vzjm0r32c5ck8x3q0qm3g0hh8ggbjazh6x7nvmy6ll";
patches = [ ./polly-separate-build.patch ];
buildInputs = [ cmake isl python gmp ];
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DLLVM_INSTALL_ROOT=${llvm}"
];
enableParallelBuilding = true;
meta = {
description = "A polyhedral optimizer for llvm";
homepage = http://llvm.org/;
license = stdenv.lib.licenses.bsd3;
maintainers = [ stdenv.lib.maintainers.shlevy ];
platforms = stdenv.lib.platforms.all;
};
}