Skip to content

Commit acfb6aa

Browse files
committed
Document build-tool-depends in the manual, and rewrite that for build-tools
`build-tools` is described in terms of `build-tool-depends`, just as it is implemented in terms of it.
1 parent 5bd088e commit acfb6aa

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

Cabal/doc/developing-packages.rst

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,14 +1703,39 @@ system-dependent values for these fields.
17031703

17041704
Deprecated in favor of :pkg-field:`default-extensions`.
17051705

1706+
.. pkg-field:: build-tool-depends: package:executable list
1707+
1708+
A list of Haskell programs needed to build this component. Each is specified
1709+
by the package containing the executable and the name of the executable
1710+
itself, separated by a colon. It is fine for the package to be the current
1711+
one, in which case this is termed an *internal*, rather than *external*
1712+
executable dependency.
1713+
1714+
External dependencies can (and should) contain a version bound like
1715+
conventional :pkg-field:`build-depends` dependenices. Internal deps should
1716+
not contain a version bound, as they will be always resolved within the same
1717+
configuration of the package in the build plan. Specifically, version bounds
1718+
that include the package's version will be warned for being extraneous, and
1719+
version bounds that exclude the package's version will raise and error for
1720+
being impossible to follow.
1721+
1722+
Cabal can make sure that specified programs are built and on the ``PATH``
1723+
before building the component in question. It will always do so for internal
1724+
dependencies, and also do so for external dependencies when using Nix-style
1725+
local builds.
1726+
17061727
.. pkg-field:: build-tools: program list
1728+
:deprecated:
17071729

1708-
A list of programs, possibly annotated with versions, needed to
1709-
build this package, e.g. ``c2hs >= 0.15, cpphs``. If no version
1710-
constraint is specified, any version is assumed to be acceptable.
1711-
:pkg-field:`build-tools` can refer to locally defined executables, in which
1712-
case Cabal will make sure that executable is built first and add it
1713-
to the PATH upon invocations to the compiler.
1730+
Deprecated in favor of :pkg-field:`build-tool-depends`.
1731+
1732+
Confusingly, programs in the list either refer to other executables in the
1733+
same package, or one of a hard-coded set of build tools. In the case of the
1734+
former, the entry can be sugared into a :pkg-field:`build-tool-depends`
1735+
entry by prefixing with ``$pkg:``. In the case of the latter, It is
1736+
desugared by looking up the package and executable name in a hard-coded
1737+
table. Refer to the documentation for :pkg-field:`build-tool-depends` to
1738+
understand the desugared fields meaning.
17141739

17151740
.. pkg-field:: buildable: boolean
17161741

Cabal/doc/installing-packages.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ This has the following effects:
495495
(As mentioned previously, you *must* specify internal dependencies as
496496
well.)
497497

498-
- Internal ``build-tools`` dependencies are expected to be in the
499-
``PATH`` upon subsequent invocations of ``setup``.
498+
- Internal ``build-tool-depends`` and ``build-tools`` dependencies are expected
499+
to be in the ``PATH`` upon subsequent invocations of ``setup``.
500500

501501
Full details can be found in the `Componentized Cabal
502502
proposal <https://github.com/ezyang/ghc-proposals/blob/master/proposals/0000-componentized-cabal.rst>`__.

0 commit comments

Comments
 (0)