2011-12-20 00:58:57 +01:00
|
|
|
{ stdenv, fetchurl, perl, groff, llvm, cmake, darwinInstallNameToolUtility }:
|
2011-10-19 22:57:18 +02:00
|
|
|
|
2011-12-19 13:48:09 +01:00
|
|
|
let version = "3.0"; in
|
2011-10-19 22:57:18 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "clang-${version}";
|
|
|
|
|
2011-12-20 00:58:57 +01:00
|
|
|
buildInputs = [ perl llvm groff cmake ] ++ stdenv.lib.optional stdenv.isDarwin darwinInstallNameToolUtility;
|
2011-10-20 01:49:22 +02:00
|
|
|
|
2011-12-19 14:40:33 +01:00
|
|
|
patches = stdenv.lib.optionals (stdenv.gcc.libc != null)
|
2011-12-19 13:48:09 +01:00
|
|
|
[ ./clang-include-paths.patch ./clang-ld-flags.patch ];
|
2011-10-19 22:57:18 +02:00
|
|
|
|
2011-12-19 14:40:33 +01:00
|
|
|
postPatch = stdenv.lib.optionalString (stdenv.gcc.libc != null) ''
|
2011-12-19 13:48:09 +01:00
|
|
|
sed -i -e 's,C_INCLUDE_PATH,"${stdenv.gcc.libc}/include/",' \
|
|
|
|
-e 's,CPP_HOST,"'$(${stdenv.gcc}/bin/cc -dumpmachine)'",' \
|
|
|
|
-e 's,CPP_INCLUDE_PATH,"${stdenv.gcc.gcc}/include/c++/${stdenv.gcc.gcc.version}",' \
|
|
|
|
lib/Driver/ToolChains.cpp
|
2011-10-19 22:57:18 +02:00
|
|
|
'';
|
|
|
|
|
2012-04-01 16:33:23 +02:00
|
|
|
cmakeFlags = [ "-DCLANG_PATH_TO_LLVM_BUILD=${llvm}" "-DCMAKE_BUILD_TYPE=Release" "-DLLVM_TARGETS_TO_BUILD=all"];
|
2011-10-19 22:57:18 +02:00
|
|
|
|
2011-12-19 13:48:09 +01:00
|
|
|
enableParallelBuilding = true;
|
2011-10-19 23:47:28 +02:00
|
|
|
|
2011-12-19 13:48:09 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://llvm.org/releases/${version}/clang-${version}.tar.gz";
|
|
|
|
sha256 = "0v8j9rgmb7w74ihc44zfxa22q17c946n5b6prwl38z3d6pd74kmn";
|
|
|
|
};
|
2011-10-19 22:57:18 +02:00
|
|
|
|
|
|
|
passthru = { gcc = stdenv.gcc.gcc; };
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = http://clang.llvm.org/;
|
|
|
|
description = "A C language family frontend for LLVM";
|
|
|
|
license = "BSD";
|
|
|
|
maintainers = with stdenv.lib.maintainers; [viric shlevy];
|
2011-12-20 00:58:57 +01:00
|
|
|
platforms = with stdenv.lib.platforms; all;
|
2011-10-19 22:57:18 +02:00
|
|
|
};
|
|
|
|
}
|
2011-12-19 13:48:09 +01:00
|
|
|
|