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
andclean-depends
targets after runningbmake install
, to avoid leaving old work directories all over the tree As demonstrated by our installation ofpkgfind
, the general procedure to build a package using pkgsrc is to:
- Locate the directory containing the package we wish to install.
cd
into that directory- Run
bmake install
in that directory.
NOTE:
We run
bmake
as opposed to justmake
because pkgsrc uses the NetBSD version of the make utility, which supports somewhat differentMakefile
syntax than GNU make.