2011-02-05 16:45:02 +01:00
|
|
|
{ stdenv, fetchurl, gcc, flex, perl, libtool, groff
|
|
|
|
, buildClang ? false }:
|
2008-03-17 12:18:21 +01:00
|
|
|
|
2011-10-18 18:37:28 +02:00
|
|
|
let version = "2.9"; in
|
|
|
|
|
2010-06-12 23:52:39 +02:00
|
|
|
stdenv.mkDerivation ({
|
2011-10-18 18:37:28 +02:00
|
|
|
name = "llvm-${version}";
|
|
|
|
|
2008-03-17 12:18:21 +01:00
|
|
|
src = fetchurl {
|
2011-10-18 18:37:28 +02:00
|
|
|
url = "http://llvm.org/releases/${version}/llvm-${version}.tgz";
|
|
|
|
sha256 = "0y9pgdakn3n0vf8zs6fjxjw6972nyw4rkfwwza6b8a3ll77kc4k6";
|
2008-03-17 12:18:21 +01:00
|
|
|
};
|
|
|
|
|
2011-02-05 16:45:02 +01:00
|
|
|
buildInputs = [ gcc flex perl groff ];
|
2010-06-12 22:54:35 +02:00
|
|
|
|
2011-02-05 16:45:02 +01:00
|
|
|
configureFlags = [ "--enable-optimized" "--enable-shared" "--disable-static" ];
|
2010-06-12 23:52:39 +02:00
|
|
|
|
2010-06-12 22:54:35 +02:00
|
|
|
meta = {
|
|
|
|
homepage = http://llvm.org/;
|
|
|
|
description = "Collection of modular and reusable compiler and toolchain technologies";
|
2010-06-13 00:30:09 +02:00
|
|
|
license = "BSD";
|
2011-10-18 18:37:28 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [viric shlevy];
|
2010-06-12 22:54:35 +02:00
|
|
|
platforms = with stdenv.lib.platforms; all;
|
|
|
|
};
|
2008-03-17 12:18:21 +01:00
|
|
|
}
|
2011-02-05 16:45:02 +01:00
|
|
|
// stdenv.lib.optionalAttrs buildClang (
|
2010-06-13 00:01:41 +02:00
|
|
|
# I write the assert because 'gcc.libc' will be evaluated although 'triplet' would not
|
|
|
|
# evaluate properly (in the preConfigure below)
|
|
|
|
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
|
2010-06-12 23:52:39 +02:00
|
|
|
let
|
|
|
|
triplet = if (stdenv.system == "i686-linux") then "i686-unknown-linux-gnu"
|
|
|
|
else if (stdenv.system == "x86_64-linux") then "x86_64-unknown-linux-gnu"
|
|
|
|
else throw "System not supported";
|
|
|
|
in {
|
2011-10-18 18:37:28 +02:00
|
|
|
name = "clang-${version}";
|
2010-06-13 00:14:43 +02:00
|
|
|
|
2011-02-05 16:45:02 +01:00
|
|
|
srcClang = fetchurl {
|
2011-10-18 18:37:28 +02:00
|
|
|
url = "http://llvm.org/releases/${version}/clang-${version}.tgz";
|
|
|
|
sha256 = "1pq9g7qxw761dp6gx3amx39kl9p4zhlymmn8gfmcnw9ag0zizi3h";
|
2010-06-12 23:52:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
pushd tools
|
2011-02-05 16:45:02 +01:00
|
|
|
unpackFile $srcClang
|
2011-10-18 18:37:28 +02:00
|
|
|
mv clang-${version} clang
|
2010-06-12 23:52:39 +02:00
|
|
|
popd
|
2011-02-05 16:45:02 +01:00
|
|
|
find
|
2010-06-12 23:52:39 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
patches = [ ./clang-include-paths.patch ];
|
|
|
|
|
|
|
|
# Set up the header file paths
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i -e 's,C_INCLUDE_PATH,"${gcc.libc}/include/",' \
|
|
|
|
-e 's,CPP_HOST,"${triplet}",' \
|
|
|
|
-e 's,CPP_INCLUDE_PATH,"${gcc.gcc}/include/c++/${gcc.gcc.version}",' \
|
|
|
|
tools/clang/lib/Frontend/InitHeaderSearch.cpp
|
|
|
|
'';
|
|
|
|
|
2011-10-18 22:03:09 +02:00
|
|
|
passthru = { gcc = gcc.gcc; };
|
|
|
|
|
2010-06-12 23:52:39 +02:00
|
|
|
meta = {
|
|
|
|
homepage = http://clang.llvm.org/;
|
|
|
|
description = "A C language family frontend for LLVM";
|
2010-06-13 00:30:09 +02:00
|
|
|
license = "BSD";
|
2011-10-18 18:37:28 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [viric shlevy];
|
2010-06-12 23:52:39 +02:00
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
))
|