@@ -0,0 +1,35 @@
1+{ stdenv, python, llvm, ocaml, findlib, ctypes }:
2+
3+let version = stdenv.lib.getVersion llvm; in
4+
5+stdenv.mkDerivation {
6+ name = "ocaml-llvm-${version}";
7+
8+ inherit (llvm) src;
9+
10+ buildInputs = [ python llvm ocaml findlib ctypes ];
11+
12+ configurePhase = ''
13+ mkdir build
14+ cd build
15+ ../configure CC=gcc CXX=g++ --disable-compiler-version-checks --prefix=$out \
16+ --disable-doxygen --disable-docs --with-ocaml-libdir=$OCAMLFIND_DESTDIR/llvm \
17+ --enable-static
18+ '';
19+
20+ enableParallelBuilding = false;
21+
22+ makeFlags = [ "-C bindings" "SYSTEM_LLVM_CONFIG=llvm-config" ];
23+
24+ postInstall = ''
25+ mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
26+ '';
27+
28+ meta = {
29+ inherit (llvm.meta) license homepage;
30+ inherit (ocaml.meta) platforms;
31+ description = "OCaml bindings distributed with LLVM";
32+ maintainers = with stdenv.lib.maintainers; [ vbgl ];
33+ };
34+
35+}