Skip to content

Instantly share code, notes, and snippets.

@IgnoredAmbience
Last active March 2, 2016 22:59
Show Gist options
  • Save IgnoredAmbience/9d77f4292def909b206b to your computer and use it in GitHub Desktop.
Save IgnoredAmbience/9d77f4292def909b206b to your computer and use it in GitHub Desktop.
OCaml Debian Packaging

OCaml Debian packaging seems to be a very complex minefield.

Useful References

Libraries

A source package XXXX may build many binary packages:

  • libXXXX-ocaml-dev for the headers/library objects (always)
  • libXXXX-ocaml for dynamically linked libraries (plugins) and native libraries (stublibs) (sometimes)

libXXXX-ocaml-dev MUST depend upon libXXXX-ocaml if it exists.

Not all architectures support native OCaml compilation or dynamic linking. Bytecode versions are required to be distributed with all platforms.

Native plugins are only suppored on platforms that ship with the OCaml standard library file dynlink.cmxa. All platforms support bytecode plugins. See the Findlib Users Manual for more involved details.

Filetype Description META file parameters In libXXXX-ocaml In libXXXX-ocaml-dev .install.in Flag
*.cma Bytecode archive/plugin package(byte), plugin(byte) If library is a plugin Otherwise
*.cmxa Native archive package(native) No Yes OPT:
*.cmxs Native plugin plugin(native) Yes, library is a plugin No DYN:
*.a No Yes
*.cmx No Yes
*.cmi Bytecode Interface No Yes
*.mli Source Inferface No Yes

dh_ocamlinit

dh_ocamlinit substitutes OCaml-specific variables in *.in files for their values.

Variable Value
@OCamlABI@ `ocamlc -version`
@OCamlStdlibDir@ `ocamlc -where`
@OCamlDllDir@ `ocamlc -where`/stublibs

Lines may be included/excluded from the output based upon the architecture's OCaml capabilities (native and plugin support). Lines are prefixed by a tag, which is removed if the tag is matched, else the entire line is deleted.

Line Prefix Line Action
OPT: Deleted if ocamlopt not available
BYTE: Deleted if ocamlopt is available
DYN: Deleted if dynlink.cmxa is available (the system supports native plugins)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment