2022-04-27 09:35:20 +00:00
|
|
|
{ stdenv, lib, python3, cmake, libllvm, ocaml, findlib, ctypes }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
let version = lib.getVersion libllvm; in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "ocaml-llvm";
|
|
|
|
inherit version;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
inherit (libllvm) src;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ocaml findlib ];
|
2022-03-05 16:20:37 +00:00
|
|
|
buildInputs = [ ctypes ];
|
2021-05-20 23:08:51 +00:00
|
|
|
propagatedBuildInputs = [ libllvm ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
2021-08-05 21:33:18 +00:00
|
|
|
"-DBUILD_SHARED_LIBS=YES" # fixes bytecode builds
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DLLVM_OCAML_OUT_OF_TREE=TRUE"
|
|
|
|
"-DLLVM_OCAML_INSTALL_PATH=${placeholder "out"}/ocaml"
|
2021-05-20 23:08:51 +00:00
|
|
|
"-DLLVM_OCAML_EXTERNAL_LLVM_LIBDIR=${lib.getLib libllvm}/lib"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [ "ocaml_all" ];
|
|
|
|
|
|
|
|
installFlags = [ "-C" "bindings/ocaml" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $OCAMLFIND_DESTDIR/
|
|
|
|
mv $out/ocaml $OCAMLFIND_DESTDIR/llvm
|
|
|
|
mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
|
2021-08-05 21:33:18 +00:00
|
|
|
mv $OCAMLFIND_DESTDIR/llvm/stublibs $OCAMLFIND_DESTDIR/stublibs
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2021-05-20 23:08:51 +00:00
|
|
|
inherit libllvm;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2021-05-20 23:08:51 +00:00
|
|
|
inherit (libllvm.meta) license homepage;
|
2022-05-18 14:49:53 +00:00
|
|
|
inherit (ocaml.meta) platforms;
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "OCaml bindings distributed with LLVM";
|
2021-01-15 22:18:51 +00:00
|
|
|
maintainers = with lib.maintainers; [ vbgl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|