nixpkgs/pkgs/development/ocaml-modules/llvm/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.2 KiB
Nix
Raw Normal View History

2022-04-22 23:05:32 +02:00
{ stdenv, lib, python3, cmake, libllvm, ocaml, findlib, ctypes }:
2015-10-16 13:22:36 +02:00
let version = lib.getVersion libllvm; in
2015-10-16 13:22:36 +02:00
stdenv.mkDerivation {
2019-08-13 23:52:01 +02:00
pname = "ocaml-llvm";
inherit version;
2015-10-16 13:22:36 +02:00
inherit (libllvm) src;
2015-10-16 13:22:36 +02:00
2022-04-22 23:05:32 +02:00
nativeBuildInputs = [ cmake python3 ocaml findlib ];
buildInputs = [ ctypes ];
propagatedBuildInputs = [ libllvm ];
2015-10-16 13:22:36 +02:00
strictDeps = true;
preConfigure = lib.optionalString (lib.versionAtLeast version "13.0.0") ''
cd llvm
'';
2019-09-03 21:25:23 +02:00
cmakeFlags = [
"-DBUILD_SHARED_LIBS=YES" # fixes bytecode builds
2019-09-03 21:25:23 +02:00
"-DLLVM_OCAML_OUT_OF_TREE=TRUE"
"-DLLVM_OCAML_INSTALL_PATH=${placeholder "out"}/ocaml"
"-DLLVM_OCAML_EXTERNAL_LLVM_LIBDIR=${lib.getLib libllvm}/lib"
2019-09-03 21:25:23 +02:00
];
2015-10-16 13:22:36 +02:00
buildFlags = [ "ocaml_all" ];
2017-03-12 19:22:01 +01:00
installFlags = [ "-C" "bindings/ocaml" ];
2015-10-16 13:22:36 +02:00
postInstall = ''
2017-03-12 19:22:01 +01:00
mkdir -p $OCAMLFIND_DESTDIR/
mv $out/ocaml $OCAMLFIND_DESTDIR/llvm
2015-10-16 13:22:36 +02:00
mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
mv $OCAMLFIND_DESTDIR/llvm/stublibs $OCAMLFIND_DESTDIR/stublibs
2015-10-16 13:22:36 +02:00
'';
passthru = {
inherit libllvm;
};
2015-10-16 13:22:36 +02:00
meta = {
inherit (libllvm.meta) license homepage;
inherit (ocaml.meta) platforms;
2015-10-16 13:22:36 +02:00
description = "OCaml bindings distributed with LLVM";
maintainers = with lib.maintainers; [ vbgl ];
2015-10-16 13:22:36 +02:00
};
}