OPAM-MODULE(5)

NAME
opam-module - sysutils/opam port module

DESCRIPTION
This manual page documents the behavior of setting MODULES=sysutils/opam in the ports(7) tree.

The module provides helpers for packaging a program using opam(1) (OCaml Package Manager).

WRKSRC is expected to contains opam packages, possibly with local customization. All .opam files, at any depth, will be registered. Unmodified dependencies should be omitted, which will be managed separately.

To generate a standalone opam repository containing only the dependencies and the sources files for compiling the specified sources tree, the make(1) modopam-repository target should be used. It downloads an opam repository from MODOPAM_REPO_URL (defaults to official opam repository hosted on github), using MODOPAM_REPO_COMMIT commit (it is preferable to explicitly specify it for reproductibility, but "master" is the default value). The repository is named according to the MODOPAM_REPO_NAME variable. Next, the repository is stripped to contain only the build dependencies of MODOPAM_PACKAGES_REPOSITORY (default to MODOPAM_PACKAGES ). After that the repository is filled with a local cache of package archives. The resulting directory can be packaged and distributed. It contains source code for building the opam packages.

External dependencies can be hinted using the make(1) target modopam-external. The list of packages expected to be present at build time is shown.

The module appends to BUILD_DEPENDS unless MODOPAM_BUILDDEP is set to `No'.

It sets the MODOPAM_PACKAGES variable to PKGSTEM, as the default value for opam packages to build and install.

It sets MODOPAM_OPAMROOT, MODOPAM_ENV, MODOPAM_OPAM_BIN and MODOPAM_OPAM_RUN accordingly.

The opam options ---with-doc and ---with-test are available using MODOPAM_WITH_DOC and MODOPAM_WITH_TEST. They default to `No'.

A CONFIGURE_STYLE "opam" is provided. It is initialized to opam with the opam repository at MODOPAM_REPO_DIR (defaults to ${WRKDIR}/${MODOPAM_REPO_NAME} ). It is expected to have been generated previously by the modopam-repository target and distributed separately. It will also pin the opam packages present in WRKSRC, possibly overriding opam packages from the repository.

A default build target is used (except if MODOPAM_BUILD is set to `No'. It uses the MODOPAM_PACKAGES_BUILD variable to list the opam packages to build (default to MODOPAM_PACKAGES ).

A default install target is used (except if MODOPAM_INSTALL is set to `No'). It uses the MODOPAM_PACKAGES_INSTALL variable to list the opam packages to install (defaults to MODOPAM_PACKAGES ).

SEE ALSO
opam(1), port-modules(5)