Documentation on the NetBSD Packages System | ||
---|---|---|
Prev | Chapter 10. FAQs & features of the package system | Next |
Your package may depend on some other package being present - and there are various ways of expressing this dependency. NetBSD supports the BUILD_DEPENDS and DEPENDS definitions (beware: the DEPENDS definition is not the same as FreeBSD's deprecated one, and NetBSD does not use the FreeBSD LIB_DEPENDS definition any more - it proved problematic on ELF NetBSD platforms).
In the following examples, the BUILD_DEPENDS dependencies have the format: file:directory[:stage]. If the stage isn't specified, it defaults to "install". If the file contains a '/', it is interpreted as a regular file - otherwise, the name is taken to be an executable file, and the shell's search PATH is searched for file. If the regular file is not found, or the executable file is not in the path, then the pre-requisite package will be built from the sources in directory, which is usually relative to the current package's directory. The DEPENDS definition specifies a package name (which contains its version number), and the directory containing the package to build if this version of the package is not installed.
If your package needs files from another package to build, see the print/ghostscript5 package (it relies on the jpeg sources being present in source form during the build):
BUILD_DEPENDS+= ../../graphics/jpeg/${WRKDIR:T}/jpeg-6a:../../graphics/jpeg:extract
If your package needs to have another package installed to build itself, this is specified using the BUILD_DEPENDS definition, but without specifying the stage ":extract" as above. An example is the print/lyx package, which uses the ``latex'' binary during its build process:
BUILD_DEPENDS+= latex:../../print/teTeX
If your package needs a library with which to link, this is specified using the DEPENDS definition. An example of this is the print/lyx package, which uses the xpm library, version 3.4j to build.
DEPENDS+= xpm-3.4j:../../graphics/xpm
You can also use wildcards in package dependences:
DEPENDS+= xpm-*:../../graphics/xpm
Note that such wildcard dependencies are retained when creating binary package. The dependency is checked when installing the binary package and any package which matches the pattern would be used. Beware that wildard dependencies should be used with a bit of care. Simple example for package which needs some version of Tk installed, but doesn't care which exactly - dependency
DEPENDS+= tk-*:../../x11/tk80would also match e.g. tk-postgresql-6.5.3, which is not what was needed. ALWAYS ensure that the wildcard doesn't match more than it should. For this example, use:
DEPENDS+= tk-[0-9]*:../../x11/tk80This is safe because package names don't include digits.
If your package needs some executable to be able to run correctly, this is specified using the DEPENDS definition. The print/lyx package needs to be able to execute the latex binary from the teTex package when it runs, and that is specified:
DEPENDS+= teTex-*:../../print/teTeX
The comment about wildcard dependencies from previous paragraph applies here, too.