Debian OCaml Packaging Policy for OCaml 3.10.2
Prev |  | Next

# Chapter 3. Packaging OCaml libraries

# 3.1. Creating Packages for OCaml Libraries

A package which provides an OCaml library called `xxx` should be split as follows:

- For libraries which are not purely programmed in OCaml (e.g. C bindings), `libxxx-ocaml` should provide the shared library stubs (`dll*.so`), and all other stuff needed to run a bytecode executable that links into this library. It should depend on `ocaml-base-3.10.2` (or `ocaml-base-nox-3.10.2`) as well as any other library needed. The versioned dependency on `ocaml-base` is important since libraries are binary incompatible between releases of OCaml.

  `libxxx-ocaml` packages should be in Section: libs

- `libxxx-ocaml-dev` should provide the rest of the library package, in fact anything needed to develop programs using the library. If the library uses other libraries or C libraries, this package should depend on them.

  `libxxx-ocaml-dev` should depend on its companion `libxxx-ocaml` package (if any). The reason is that at compile time the OCaml compiler will try to load the shared library stubs, aborting the compilation in case of failure. Hence the development package is useless if the corresponding stub package is missing. To ensure compatibility the dependency among the two packages should be strictly versioned. In order for the resulting packages to be binNMU safe this requirement states that the dependency should make use of a ${binary:Version} substitution variable.

  Example 3-1. Dependency from a -dev package to its companion share library stub package (if any), from the pcre-ocaml package

        Package: libpcre-ocaml
        Architecture: any
        Section: libs
        Depends: ocaml-base-nox-${F:OCamlABI}, ${shlibs:Depends}, ${misc:Depends}
        ...

        Package: libpcre-ocaml-dev
        Architecture: any
        Section: libdevel
        Depends: ocaml-nox-${F:OCamlABI}, libpcre3-dev (>= 4.5), libpcre-ocaml (= ${binary:Version}), ocaml-findlib (>= 1.1), ${misc:Depends}
        ...

  `libxxx-ocaml-dev` packages should be in Section: libdevel

  All OCaml bytecode libraries (`*.cma`) and bytecode object files (`*.cmo`) should be compiled for debugging, i.e. they should be compiled passing the `-g` option to ocamlc (or ocamlc.opt).

Optionally, two other packages may be created:

- `libxxx-ocaml-bin` may include binaries provided by the library source package if they are numerous. This package should conform with the same regulations as other packages providing ocaml programs. It is only needed to split off this package if there is a significant number of programs included in the library, if not, the programs should go into `libxxx-ocaml-dev`.

- `libxxx-ocaml-doc` may include any kind of documentation provided by the library source package or as separate documentation. Again, if there is only little documentation, they should go with the `-dev` package.

It is recommended that libraries use the `-pack` option to pack all the modules provided by the library into one module. We don't think upstream libraries will be moving to this scheme anytime soon (unless we actively lobby for it) so this is just a recommendation for now.

It is recommended that each library package ships a `META` file in order to make the library usable via `ocamlfind` (see the Debian package `ocaml-findlib`). See Section 3.4 for more information on this.

Prev | Home | Next
Bytecode and native versions of programs |  | Paths for libraries