@@ -10,39 +10,47 @@ How Dune Knows About Packages
1010
1111Packages can be defined in two ways:
1212
13- - If a ``pkg.opam `` file is found, it signals the existence of the ``pkg ``
14- package to Dune. The contents of the opam file are not interpreted by Dune.
15- - In ``dune-project ``, a ``(package) `` stanza with ``(name pkg) `` defines the
16- ``pkg `` package.
13+ - If a ``<package-name>.opam `` file is found, it signals the existence of the
14+ ``<package-name> `` package to Dune. The contents of the opam file are not
15+ interpreted by Dune, unless :doc: `package management
16+ <../explanation/package-management>` is :doc: `enabled <config/pkg >`.
17+
18+ - In ``dune-project ``, a :doc: `(package) <dune-project/package >` stanza with
19+ ``(name <package-name>) `` defines the ``<package-name> `` package.
1720
1821.. note ::
1922
2023 If you want to define public elements but are not interested in publishing
2124 to opam, it is not necessary to write empty ``*.opam `` files. Instead,
22- prefer declaring it in ``dune-project `` as a `` (package) `` with just a
23- ``(name) ``.
25+ prefer declaring it in ``dune-project `` as a :doc: ` (package)
26+ <dune-project/package>` with just a ``(name) ``.
2427
2528Generating Opam Files
2629---------------------
2730
28- In the latter case, if ``(generate_opam_files) `` is present in
29- ``(dune-project) ``, Dune will generate ``pkg.opam `` using the metadata in found in ``(package) `` stanzas and global fields such as ``(source) ``.
31+ In the latter case, if :doc: `(generate_opam_files)
32+ <dune-project/generate_opam_files>` is present in ``(dune-project) ``, Dune will
33+ generate ``<package-name>.opam `` using the metadata in found in :doc: `(package)
34+ <dune-project/package>` stanzas and global fields such as ``(source) ``.
3035
3136.. seealso :: :doc:`../howto/opam-file-generation`
3237
33- If a ``pkg.opam.template `` file is found, the fields found in this opam file
34- are added to the generated file, overriding the generated ones in case of
35- collision. This can be used as an escape hatch to add arbitrary opam fields.
38+ If a ``<package-name>.opam.template `` file is found, the fields found in this
39+ opam file are added to the generated file, overriding the generated ones in
40+ case of collision. This can be used as an escape hatch to add arbitrary opam
41+ fields.
42+
43+ .. seealso :: :doc:`dune-project/package` for fields supported by ``dune-project``
3644
3745What Dune Installs
3846------------------
3947
4048Dune will install the following files:
4149
4250- ``(library) `` stanzas which have a ``(public_name) ``. The package name is the
43- first component of the dot-separated public name: ``(public_name pkg) `` and
44- `` (public_name pkg .sub) `` will look for a package named `` pkg `` to install
45- their contents.
51+ first component of the dot-separated public name: ``(public_name
52+ <package-name>) `` and `` (public_name <package-name> .sub) `` will look for a
53+ package named `` <package-name> `` to install their contents.
4654- ``(executable) `` and ``(test) `` stanzas with a ``(public_name) ``. The package
4755 to install the files in is determined by the ``(package) `` field, which can
4856 be omitted if there is only one package.
0 commit comments