Created
December 20, 2012 23:06
-
-
Save mk270/4349438 to your computer and use it in GitHub Desktop.
Basic guide to packaging OCaml code with current tools. (current ~= December 2012)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When making and publishing an OCaml programme or library, there are several | |
tools you might use to compile and package and distribute your work. Building | |
OCaml projects is a bit different from C or similar languages, so the usual | |
"./configure && make && make test && make install" convention doesn't work. | |
As of December 2012, the recommended tools for building an OCaml package are | |
Oasis and OPAM. This document assumes you are using a UNIX-like system. | |
OPAM is responsible for installing new OCaml packages and libraries, such | |
as the dependencies of your own project. Oasis helps automate the build | |
system for your project. | |
To set up OPAM, see http://opam.ocamlpro.com/doc/Quick_Install.html | |
Oasis is documented at: http://oasis.forge.ocamlcore.org/quickstart.html | |
To install Oasis, do | |
opam install oasis | |
Oasis will generate an editable configuration file for your package, which in | |
turn is used to automate the build: | |
oasis quickstart | |
This generates an _oasis file, which you can customise. Examine similar files | |
in other projects and the documentation linked above to get a feel for how | |
it works. | |
Now run | |
oasis setup | |
ocaml setup.ml -configure | |
ocaml setup.ml -build | |
To build your project. | |
There is an example of a project set up this way here: https://github.com/mk270/ocaml_skeleton | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment