I am writing a bson encoder/decoder library in ocaml.
I have the source file now (actually just one file).
My question is that how should I make it as a library, such as ocaml-batteries-included
, camomile
, etc?
I mean, people can use opam install
it and use ocamlfind
+ ocamlbuild
to compile with it?
Supporting ocamlfind
is really easy, and there is no excuse not to do it. Basically, pick any "similar" library, look for the META file, and adapt it to your own setting. I have given some basic instructions in this StackOverflow answer.
OCamlbuild is a build system that you are free to decide to use or not, but should not impact your users (besides the fact that they will to install it before building your programs). You may also use a Makefile or any other build system (omake, etc.). The idea of ocamlbuild is just to provide a _tags
file with sufficient information to build your library/program (and if you're doing advanced stuff a myocamlbuild.ml
file as well). Again, look at what projects that have a structure similar to yours are doing.
For Opam, there is a packaging guide to give your directions (but again, just adapt what other people are doing).