package¶
This stanza is used to specify package metadata. In particular, this information is used when generating OPAM files (see generate_opam_files).
- (package ...)
Define package-specific metadata.
- (name <string>)
The name of the package.
This must be specified.
- (synopsis <string>)
A short package description.
- (description <string>)
A longer package description.
- (depends <dep-specification>)
Package dependencies, as
dep_specification.
- (conflicts <dep-specification>)
Package conflicts, as
dep_specification.
- (depopts <dep-specification>)
Optional package dependencies, as
dep_specification.
- (tags <tags>)
A list of tags.
- (deprecated_package_names <name list>)
A list of names that can be used with the deprecated_library_name stanza to migrate legacy libraries from other build systems that do not follow Dune’s convention of prefixing the library’s public name with the package name.
- (license ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see license).
- (authors ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see authors).
- (maintainers ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see maintainers).
- (maintenance_intent ...)
Added in version 3.18.
The same as (and takes precedences over) the corresponding global field (see maintenance_intent).
- (source ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see source).
- (bug_reports ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see bug_reports).
- (homepage ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see homepage).
- (documentation ...)
Added in version 2.0.
The same as (and takes precedences over) the corresponding global field (see documentation).
- (sites ...)
Define a site.
(sites (<section> <name>) ...)defines a site named<name>in the section<section>.
- (allow_empty)
Added in version 3.0.
Allows packages that have no user-defined stanzas attached to them.
By default, starting from Dune 3.0, packages must contain at least one user-defined stanza (such as a
library,executable, orinstallstanza). If a package is intentionally empty, add(allow_empty)to suppress the error.
Adding libraries to different packages is done via the public_name and
package fields. See library section for details.
The list of dependencies dep_specification is modelled after
opam’s own language. The syntax is a list of the following elements:
op ::= '=' | '<' | '>' | '<>' | '>=' | '<='
filter ::= :dev | :build | :with-test | :with-doc | :with-dev-setup | :post
constr ::= (<op> <version>)
logop ::= or | and
dep ::= <name>
(<name> <filter>)
(<name> <constr>)
(<name> (<logop> (<filter> | <constr>))*)
dep_specification ::= <dep>+
Filters will expand to any opam variable name if prefixed by :, not just the
ones listed in filter. This also applies to version numbers.
For example, to generate depends: [ pkg { = version } ], use (depends
(pkg (= :version))).
Note that the use of a using stanza (see using) doesn’t
automatically add the associated library or tool as a dependency. They have to
be added explicitly.