[ocaml-platform] Problem with the lib directory in opam's directory hierarchy

Kim Nguyễn kim at nguyen.vg
Wed Apr 22 18:50:34 BST 2015


On Wed, Apr 22, 2015 at 5:31 PM, Daniel Bünzli
<daniel.buenzli at erratique.ch> wrote:
> Le mercredi, 22 avril 2015 à 17:20, Kim Nguyễn a écrit :
>> Is there a better way to do this ? (I'm not asking to change the opam
>> directory structure, I just want to understand the best way to be
>> compatible with both distrib packagers and opam packagers).
>
> I think the simple answer (but other may want to confirm) is to not use `ocamlfind remove` at all. Once you removed the directory you are done. `ocamlfind remove` doesn't do anything more than removing the META file which you already destroyed.

I see. But this works for an opam setting. Imagine my program is
installed from source "a la mano". I certainly don't want to leave a
META file and the cma/cmxa lying around, furthermore, I imagine (but I
could be wrong) that e.g. Debian or Fedora packages configure findlib
to look for META files in specific directories (say /usr/lib/ocaml/
instead of the default /usr/local/lib/ocaml/x.y/) and the only way to
install/remove my META file in such a place is to use ocamlfind
install/remove.

>> Also, is it considered good practice to put in an ocamlfind package
>> directory files or subdirectory that were not installed via ocamlfind
>> install ?
>
> There should be no problem with that. You should really see ocamlfind as something that simply reads and interprets META file wherever they are. For example all my packages are usable with ocamlfind but I install them and remove them without using `ocamlfind` *at all* (I use opam's .install file, which opam handles automatically).

My question was more that my program has a ./configure script which
accepts the usual --prefix switch (plus the others, bindir, docdir
etc.) to know where to install stuff, and I also wish to publish a
META. Can I make a Makefile that is not overly convoluted (for that
part) and that will work for source install, distrib packagers and
opam ?

Best,
-- 
Kim


More information about the Platform mailing list