summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/clang.nix
blob: 48e4c4946f30c1be8ef47346f8c27f92a7c890ed (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
{ stdenv, fetchurl, perl, groff, llvm, cmake }:

let version = "3.1"; in

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

  buildInputs = [ perl llvm groff cmake ];

  patches = stdenv.lib.optionals (stdenv.gcc.libc != null) 
    [ ./clang-include-paths.patch ./clang-ld-flags.patch ];

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

  enableParallelBuilding = true;

  src = fetchurl {
      url = "http://llvm.org/releases/${version}/clang-${version}.src.tar.gz";
      sha256 = "11m7sm9f8qcrayckfg3z91zb3fimilpm0f7azn7q7qnkvhay4qzz";
  };

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