Why are implicit package dependencies recorded?
James E. Flemer
jflemer at uvm.edu
Sun May 8 10:04:11 PDT 2005
As the subject asks, why are implicit package dependencies (sub-deps)
recorded in a package? I ask mostly because it seems to easy to get the
sub-dependencies wrong. A simple case for incorrect sub-deps is this:
There is a package P that depends on a package D. The package D has an
optional dependency on S via the make flag WITH_S. The dependency on S
defaults to false. If package D is built with -DWITH_S, then D depends
on S. Now, when package P is built the package-depends-list target will
recurse into D, but omits S from the list (remember the flag defaults to
false).
The scenario above creates a hidden dependency in P on S (that is not
recorded in the @pkgdep list). If the case above is inverted, WITH_S
defaults to true and D is built with -DWITHOUT_S, then a bogus
dependency on S is recorded for P.
Both of these cases can be avoided by building P with the same flags
that D was built with. In the simple case, that does not seem like a
bad solution, but in practice there can be a huge number of deps and
sub-deps (mplayer has around 45).
Is there a need for sub-deps to be recorded recursively? I believe that
pkg_add will do the right thing if they are not. Are there tools that
are unable to perform the recursion themselves and need it to be part of
the package?
Outside of the ports/package world, recording of implicit dependencies
is normally avoided. Makefiles are a good example of where (typically)
only first-order dependencies are listed, and the tool (make) is
responsible for building the dep-tree of sub-deps.
-James
More information about the freebsd-ports
mailing list