generate_opam_files

(generate_opam_files ...)

Use metadata specified in the dune-project file to generate .opam files.

To enable this integration, add the following field to the dune-project file:

(generate_opam_files)

Dune uses the following global fields to set the metadata for all packages defined in the project:

(license <strings>)

Specify the license of the project, ideally as an identifier from the SPDX License List.

Example:

(license MIT)

Multiple licenses may be specified.

(authors <strings>)

Specify authors.

Example:

(authors
 "Jane Doe <jane.doe@example.com>"
 "John Doe <john.doe@example.com>")
(maintainers <strings>)

Specify maintainers.

Example:

(maintainers
 "Jane Doe <jane.doe@example.com>"
 "John Doe <john.doe@example.com>")
(source ...)

Specify where the source for the package can be found.

It can be specified as (uri <uri>) or using shortcuts for some hosting services:

Service

Syntax

Github

(github user/repo)

Bitbucket

(bitbucket user/repo)

Gitlab

(gitlab user/repo)

Sourcehut

(sourcehut user/repo)

Examples:

(source
 (github ocaml/dune))
(source
 (uri https://dev.example.com/project.git))
(bug_reports <url>)

Where bugs should be reported.

If a hosting service is used in (source), a default value is provided.

Example:

(bug_reports https://dev.example.com/project/issues)
(homepage <url>)

The homepage of the project.

If a hosting service is used in (source), a default value is provided.

Example:

(bug_reports https://example.com/)
(documentation <url>)

Where the documentation is hosted.

With these fields, every time one calls Dune to execute some rules (either via dune build, dune runtest, or something else), the opam files get generated.

Some or all of these fields may be overridden for each package of the project, see package.