Build a library with ocamlbuild, install with ocamlfind - what's the best practice?

I am using ocamlbuild

to compile the OCaml library through a file mylib.mllib

that lists the modules containing the library. Subsequently, I want to install the library files using ocamlfind

. Unlike binaries built with ocamlbuild

, all library files are in the directory _build

. The correct way to install them is with something like

ocamlfind install META _build/a.cma _build/a.cmxa ...

      

or is there any better integration between ocamlbuild

and ocamlfind

? In particular, I noticed the flag -install-lib-dir

ocamlbuild

, but cannot find any documentation on its purpose.

I know oasis

, but right now I would like to solve the problem in the Makefile and install

. This is all in the context of using the library manager opam

, but it is irrelevant for the discussion.

+3


source to share


1 answer


No, there is no specific integration. ocamlbuild

is agnostic for pre-build (configuration) and post-build (install) ocamlfind

tools , and is incompatible with build tools.

You are correct that it ocamlbuild

does not reliably mimic targets from very well _build/

. This is a known bug, but you should report specific cases when this is a problem for you. Anyway, I think it's better to link directly to the file in _build/

.



requesting properties from Daniel BΓΌnzli so that ocamlbuild helps create OPAM files .install

rather than writing them manually (or makefile scripting). I personally haven't had time to work on such features, but I would warmly welcome any input from ocamlbuild on this front.

+1


source







All Articles