summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/3.3/clang.nix
blob: 72287560b245216d518da81b0df83f6c17569d8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ stdenv, fetchurl, perl, groff, llvm, cmake, libxml2, python }:

# be sure not to rebuild clang on darwin; some packages request it specifically
# we need to fix those
assert stdenv.isDarwin -> stdenv.gcc.nativeTools;

let
  version = "3.3";
  gccReal = if (stdenv.gcc.gcc or null) == null then stdenv.gcc else stdenv.gcc.gcc;
in

stdenv.mkDerivation {
  name = "clang-${version}";

  buildInputs = [ perl llvm groff cmake libxml2 python ];

  patches = [ ./clang-tablegen-dir.patch ] ++
            stdenv.lib.optional (stdenv.gcc.libc != null) ./clang-purity.patch;

  cmakeFlags = [
    "-DCLANG_PATH_TO_LLVM_BUILD=${llvm}"
    "-DCMAKE_BUILD_TYPE=Release"
    "-DLLVM_TARGETS_TO_BUILD=all"
    "-DGCC_INSTALL_PREFIX=${gccReal}"
  ] ++ stdenv.lib.optionals (stdenv.gcc.libc != null) [
    "-DC_INCLUDE_DIRS=${stdenv.gcc.libc}/include/"
  ];

  enableParallelBuilding = true;

  src = fetchurl {
      url = "http://llvm.org/releases/${version}/cfe-${version}.src.tar.gz";
      sha256 = "15mrvw43s4frk1j49qr4v5viq68h8qlf10qs6ghd6mrsmgj5vddi";
  };

  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];
    platforms = with stdenv.lib.platforms; all;
  };
}