Chapter 5. Configuring pkgsrc

Table of Contents

5.1. General configuration
5.2. Variables affecting the build process
5.3. Developer/advanced settings
5.4. Selecting Build Options

5.1. General configuration

In this section, you can find some variables that apply to all pkgsrc packages. The preferred method of setting these variables is by setting them in /etc/mk.conf.

  • LOCALBASE: Where packages will be installed. The default is /usr/pkg. Do not mix binary packages with different LOCALBASEs!

  • CROSSBASE: Where “cross” category packages will be installed. The default is ${LOCALBASE}/cross.

  • X11BASE: Where X11 is installed on the system. The default is /usr/X11R6.

  • DISTDIR: Where to store the downloaded copies of the original source distributions used for building pkgsrc packages. The default is ${PKGSRCDIR}/distfiles.

  • MASTER_SITE_OVERRIDE: If set, override the packages' MASTER_SITES with this value.

  • MASTER_SITE_BACKUP: Backup location(s) for distribution files and patch files if not found locally or in ${MASTER_SITES} or ${PATCH_SITES} respectively. The defaults are ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}/ and ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/.

  • BINPKG_SITES: List of sites carrying binary pkgs.

5.2. Variables affecting the build process

XXX

  • PACKAGES: The top level directory for the binary packages. The default is ${PKGSRCDIR}/packages.

  • WRKOBJDIR: The top level directory where, if defined, the separate working directories will get created, and symbolically linked to from ${WRKDIR} (see below). This is useful for building packages on several architectures, then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every architecture. (It should be noted that PKGSRCDIR should not be set by the user — it is an internal definition which refers to the root of the pkgsrc tree. It is possible to have many pkgsrc tree instances.)

  • LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See Section 8.3, “patches/*” for more information. rel and arch are replaced with OS release (“2.0”, etc.) and architecture (“mipsel”, etc.).

  • PKGMAKECONF: Location of the mk.conf file used by a package's BSD-style Makefile. If this is not set, MAKECONF is set to /dev/null to avoid picking up settings used by builds in /usr/src.

5.3. Developer/advanced settings

XXX

  • PKG_DEVELOPER: Run some sanity checks that package developers want:

    • make sure patches apply with zero fuzz

    • run check-shlibs to see that all binaries will find their shared libs.

  • PKG_DEBUG_LEVEL: The level of debugging output which is displayed whilst making and installing the package. The default value for this is 0, which will not display the commands as they are executed (normal, default, quiet operation); the value 1 will display all shell commands before their invocation, and the value 2 will display both the shell commands before their invocation, and their actual execution progress with set -x will be displayed.

  • ALLOW_VULNERABILITIES.pkgbase: A space separated list of vulnerability IDs that may be ignored when performing the automated security checks. These IDs are listed in the pkg-vulnerabilities file and are displayed by audit-packages when it finds a vulnerable package.

  • SKIP_AUDIT_PACKAGES: If this is set to “yes”, the automated security checks (which use the security/audit-packages package) will be entirely skipped for all packages built. Normally you'll want to use ALLOW_VULNERABILITIES instead of this.

5.4. Selecting Build Options

Some packages have build time options, usually to select between different dependencies, enable optional support for big dependencies or enable experimental features.

To see which options, if any, a package supports, and which options are mutually exclusive, run make show-options, for example:

    The following options are supported by this package:
        ssl      Enable SSL support.
    Exactly one of the following gecko options is required:
        firefox  Use firefox as gecko rendering engine.
        mozilla  Use mozilla as gecko rendering engine.
    At most one of the following database options may be selected:
        mysql    Enable support for MySQL database.
        pgsql    Enable support for PostgreSQL database.

    These options are enabled by default: firefox
    These options are currently enabled: mozilla ssl

The following variables can be defined in /etc/mk.conf to select which options to enable for a package: PKG_DEFAULT_OPTIONS, which can be used to select or disable options for all packages that support them, and PKG_OPTIONS.pkgbase, which can be used to select or disable options specifically for package pkgbase. Options listed in these variables are selected, options preceded by “-” are disabled. A few examples:

$ grep "PKG.*OPTION" /etc/mk.conf
PKG_DEFAULT_OPTIONS=    -arts -dvdread -esound
PKG_OPTIONS.kdebase=    debug -sasl
PKG_OPTIONS.apache=     suexec 

The following settings are consulted in the order given, and the last setting that selects or disables an option is used:

  1. the default options as suggested by the package maintainer

  2. the options implied by the settings of legacy variables (see below)

  3. PKG_DEFAULT_OPTIONS

  4. PKG_OPTIONS.pkgbase

For groups of mutually exclusive options, the last option selected is used, all others are automatically disabled. If an option of the group is explicitly disabled, the previously selected option, if any, is used. It is an error if no option from a required group of options is selected, and building the package will fail.

Before the options framework was introduced, build options were selected by setting a variable (often named USE_FOO) in /etc/mk.conf for each option. To ease transition to the options framework for the user, these legacy variables are converted to the appropriate options setting (PKG_OPTIONS.pkgbase) automatically. A warning is issued to prompt the user to update /etc/mk.conf to use the options framework directly. Support for the legacy variables will be removed eventually.