Some parts of the package need to know the current version of OCaml. For example, libraries should be installed /usr/lib/ocaml/3.10.2/. However, the current version of OCaml should never be hardcoded in the package (3.10.2 here). This would make a binNMU impossible when the version of OCaml changes. Instead .in files should be used where @OCamlABI@
is replaced at build-time by the current OCaml version.
For example, the package ocaml-mad would normally contain a file libmad-ocaml-dev.install for installing files with dh_install, containing:
usr/lib/ocaml/3.10.2/mad/META usr/lib/ocaml/3.10.2/mad/*.a usr/lib/ocaml/3.10.2/mad/*.cm* usr/lib/ocaml/3.10.2/mad/*.ml*In order to avoid the explicit mention of the version of OCaml (3.10.2), the package actually contains instead a file libmad-ocaml-dev.install.in which contains:
usr/lib/ocaml/@OCamlABI@/mad/META usr/lib/ocaml/@OCamlABI@/mad/*.a usr/lib/ocaml/@OCamlABI@/mad/*.cm* usr/lib/ocaml/@OCamlABI@/mad/*.ml*The string
@OCamlABI@
is substituted at build-time by the version of OCaml. Here are the relevant parts of the debian/rules file:
OCAMLABI := $(shell ocamlc -version) OFILES := $(filter-out debian/control,$(patsubst %.in,%,$(wildcard debian/*.in))) ocamlinit: for f in $(OFILES); do sed -e 's/@OCamlABI@/$(OCAMLABI)/g' $$f.in > $$f; done config.status: ocamlinit configure [...] .PHONY: build clean binary-indep binary-arch binary install ocamlinit
The only exception to this rule (properly handled by the example above) is the debian/control file, which should never be generated at build-time. As explained in Section 2.3, the dependency should nevertheless not hardcode the version of OCaml: the debian/control file should have a Depends: ocaml-base-nox-${F:OCamlABI}
which is filled by a dh_gencontrol -s -- -VF:OCamlABI="$(OCAMLABI)" in the debian/rules file.