about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/llvm/default.nix
blob: c91a5712137921f84843828bb95487df7910243b (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, fetchpatch, python, cmake, llvm, ocaml, findlib, ctypes }:

let version = stdenv.lib.getVersion llvm; in

stdenv.mkDerivation {
  pname = "ocaml-llvm";
  inherit version;

  inherit (llvm) src;

  buildInputs = [ python cmake llvm ocaml findlib ctypes ];

  patches = [ (fetchpatch {
    url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/llvm/llvm.3.9/files/cmake.patch;
    sha256 = "1fcc6ylfiw1npdhx7mrsj7h0dx7cym7i9664kpr76zqazb52ikm9";
  })];

  cmakeFlags = [ "-DLLVM_OCAML_OUT_OF_TREE=TRUE" ];

  buildFlags = "ocaml_all";

  installFlags = "-C bindings/ocaml";

  postInstall = ''
    mv $out/lib/ocaml $out/ocaml
    mkdir -p $OCAMLFIND_DESTDIR/
    mv $out/ocaml $OCAMLFIND_DESTDIR/llvm
    mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
  '';

  meta = {
    inherit (llvm.meta) license homepage;
    platforms = ocaml.meta.platforms or [];
    description = "OCaml bindings distributed with LLVM";
    maintainers = with stdenv.lib.maintainers; [ vbgl ];
  };

}