2014-01-21 01:19:53 +00:00
|
|
|
{ stdenv, fetch, cmake, libxml2, libedit, llvm, version }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "clang-${version}";
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
unpackFile ${fetch "clang" "06rb4j1ifbznl3gfhl98s7ilj0ns01p7y7zap4p7ynmqnc6pia92"}
|
|
|
|
mv clang-${version} clang
|
|
|
|
sourceRoot=$PWD/clang
|
|
|
|
unpackFile ${fetch "clang-tools-extra" "1d1822mwxxl9agmyacqjw800kzz5x8xr0sdmi8fgx5xfa5sii1ds"}
|
|
|
|
mv clang-tools-extra-${version} $sourceRoot/tools/extra
|
|
|
|
# !!! Hopefully won't be needed for 3.5
|
|
|
|
unpackFile ${llvm.src}
|
|
|
|
export cmakeFlags="$cmakeFlags -DCLANG_PATH_TO_LLVM_SOURCE=$PWD/llvm-${version}"
|
|
|
|
(cd llvm-${version} && patch -Np1 -i ${./llvm-separate-build.patch})
|
|
|
|
'';
|
|
|
|
|
2014-01-27 17:50:21 +00:00
|
|
|
patches = [ ./clang-separate-build.patch ./clang-purity.patch ];
|
2014-01-21 01:19:53 +00:00
|
|
|
|
|
|
|
buildInputs = [ cmake libedit libxml2 ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
|
|
|
"-DCLANG_PATH_TO_LLVM_BUILD=${llvm}"
|
2014-01-21 01:33:02 +00:00
|
|
|
] ++
|
|
|
|
(stdenv.lib.optional (stdenv.gcc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.gcc.libc}/include") ++
|
|
|
|
(stdenv.lib.optional (stdenv.gcc.gcc != null) "-DGCC_INSTALL_PREFIX=${stdenv.gcc.gcc}");
|
2014-01-21 01:19:53 +00:00
|
|
|
|
2014-02-03 01:39:16 +00:00
|
|
|
# Clang expects to find LLVMgold in its own prefix
|
2014-03-26 13:06:22 +00:00
|
|
|
# Clang expects to find sanitizer libraries in its own prefix
|
|
|
|
postInstall = ''
|
|
|
|
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
|
|
|
ln -sv ${llvm}/lib/clang/3.4/lib $out/lib/clang/3.4/
|
|
|
|
'';
|
2014-02-03 01:39:16 +00:00
|
|
|
|
2014-01-21 01:19:53 +00:00
|
|
|
passthru.gcc = stdenv.gcc.gcc;
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|