summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/3.3/llvm.nix
blob: e40014a960c467eb2a5d6115e728c5268504a5bf (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
{ stdenv, fetchurl, perl, groff, cmake, python, libffi, binutils }:
let
  version = "3.3";
in stdenv.mkDerivation rec {
  name = "llvm-${version}";

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

  patches = [
    ./more-memory-for-bugpoint.patch # The default rlimits in 3.3 are too low for shared libraries.
    ./no-rule-aarch64.patch          # http://llvm.org/bugs/show_bug.cgi?id=16625
  ];

  buildInputs = [ perl groff cmake python libffi ];

  # hacky fix: created binaries need to be run before installation
  preBuild = let LD = if stdenv.isDarwin then "DYLD" else "LD";
    in "export ${LD}_LIBRARY_PATH='$$${LD}_LIBRARY_PATH:'`pwd`/lib";

  cmakeFlags = with stdenv; [
    "-DCMAKE_BUILD_TYPE=Release"
    "-DLLVM_ENABLE_FFI=ON"
    "-DLLVM_BINUTILS_INCDIR=${binutils}/include"
    "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=R600" # for mesa
  ] ++ stdenv.lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON";

  enableParallelBuilding = true;

  doCheck = true;

  meta = with stdenv.lib; {
    description = "Collection of modular and reusable compiler and toolchain technologies";
    homepage    = http://llvm.org/;
    license     = licenses.bsd3;
    maintainers = with maintainers; [ lovek323 raskin viric ];
    platforms   = platforms.all;
  };
}