Building Source Packages

The first step in building a package is to locate the directory within the pkgsrc tree that contains that package, and then entering that directory. There is a provided search utility called pkglocate which can be used to do a keyword search. However, in practice pkglocate is not a very effective search tool.

A much better search tool can be found at pkgtools/pkgfind. To install it:

cd /usr/pkgsrc/pkgtools/pkgfind
bmake install clean clean-depends

Now running pkgfind <searchterm> should return a much better list of search results.

NOTE:

It is good practice to always run the clean and clean-depends targets after running bmake install, to avoid leaving old work directories all over the tree As demonstrated by our installation of pkgfind, the general procedure to build a package using pkgsrc is to:

  1. Locate the directory containing the package we wish to install.
  2. cd into that directory
  3. Run bmake install in that directory.

NOTE:

We run bmake as opposed to just make because pkgsrc uses the NetBSD version of the make utility, which supports somewhat different Makefile syntax than GNU make.