I'm using ocamlbuild
to compile an OCaml library via a mylib.mllib
file that lists the modules comprising the library. Afterwards I want to install the library files using ocamlfind
. Unlike binary files built with ocamlbuild
, all the library files are in the _build
directory. Is the correct way to install them using something like
ocamlfind install META _build/a.cma _build/a.cmxa ...
or is there some better integration between ocamlbuild
and ocamlfind
? In particular, I noticed the -install-lib-dir
flag of ocamlbuild
but can't find documentation about its purpose.
I'm aware of oasis
but right now would like to solve the problem within a Makefile and an install
target. All of this is in the context of using the opam
library manager but it should not matter for the discussion.
No, there is no specific integration. ocamlbuild
is agnostic of pre-build (configuration) and post-build (installation) tools, and ocamlfind
is similarly agnostic of build tools.
You are correct that ocamlbuild
is not very good at reliably simlinking targets from _build/
. This is a known glitch, but you should feel free to report specific cases where this is an issue to you. In any case, I think it is better to refer to the file in _build/
directly.
There is a feature request by Daniel Bünzli to have ocamlbuild help produce OPAM's .install
files rather than writing them by hand (or makefile scripting). I personally haven't had time to work on such features, but I would warmly welcome any ocamlbuild contribution along this front.