Chapter 8. The build process

The basic steps for building a program are always the same. First the program's source (distfile) must be brought to the local system and then extracted. After any patches to compile properly on NetBSD are applied, the software can be configured, then built (usually by compiling), and finally the generated binaries etc. can be put into place on the system. These are exactly the steps performed by the NetBSD package system, which is implemented as a series of targets in a central Makefile, /usr/pkgsrc/mk/bsd.pkg.mk.

8.1. Program locations

Before outlining the process performed by the NetBSD package system in the next section, here's a brief discussion on where programs are installed, and which variables influence this.

The automatic variable PREFIX indicates where all files of the final program shall be installed. It is usually set to $LOCALBASE (/usr/pkg), or $CROSSBASE for pkgs in the cross category, though its value becomes that of $X11BASE if USE_IMAKE, USE_MOTIF, or USE_X11BASE is set. The value ${PREFIX} needs to be put into the various places in the program's source where paths to these files are encoded; see sections patches/* and Shared libraries - libtool for details on this.

When choosing which of these variables to use, follow the following rules: