@@ -1,4 +1,4 @@
1−{ stdenv, python, llvm, ocaml, findlib, ctypes }:
1+{ stdenv, fetchpatch, python, cmake, llvm, ocaml, findlib, ctypes }:
22
33let version = stdenv.lib.getVersion llvm; in
44
@@ -7,21 +7,23 @@ stdenv.mkDerivation {
77
88 inherit (llvm) src;
99
10− buildInputs = [ python llvm ocaml findlib ctypes ];
10+ buildInputs = [ python cmake llvm ocaml findlib ctypes ];
1111
12− configurePhase = ''
13− mkdir build
14− cd build
15− ../configure --disable-compiler-version-checks --prefix=$out \
16− --disable-doxygen --disable-docs --with-ocaml-libdir=$OCAMLFIND_DESTDIR/llvm \
17− --enable-static
18− '';
12+ patches = [ (fetchpatch {
13+ url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/llvm/llvm.3.9/files/cmake.patch;
14+ sha256 = "1fcc6ylfiw1npdhx7mrsj7h0dx7cym7i9664kpr76zqazb52ikm9";
15+ })];
1916
20− enableParallelBuilding = false;
17+ cmakeFlags = [ "-DLLVM_OCAML_OUT_OF_TREE=TRUE" ];
2118
22− makeFlags = [ "-C bindings" "SYSTEM_LLVM_CONFIG=llvm-config" ];
19+ buildFlags = "ocaml_all";
20+
21+ installFlags = "-C bindings/ocaml";
2322
2423 postInstall = ''
24+ mv $out/lib/ocaml $out/ocaml
25+ mkdir -p $OCAMLFIND_DESTDIR/
26+ mv $out/ocaml $OCAMLFIND_DESTDIR/llvm
2527 mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
2628 '';
2729