---
name: "bsd.port.mk"
section: "5"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/bsd.port.mk"
---

# bsd.port.mk(5)

ports tree master Makefile fragment

## NAME

**bsd.port.mk** – ports tree master Makefile fragment

## SYNOPSIS

**.include \<bsd.port.mk\>**

## DESCRIPTION

**bsd.port.mk** contains the [ports(7)](/ports/7.md) tree [make(1)](/make/1.md) framework, in the form of documented public targets, variables and paths.

The actual **bsd.port.mk** file lives under *${PORTSDIR}/infrastructure/mk*, with [make(1)](/make/1.md)'s system include file redirecting to it.

Optional parts of this framework have been moved to [port-modules(5)](/port-modules/5.md) in an effort to shrink the main file( see also MODULES).

Identifiers beginning with an underscore are internal-use only and likely to change without notice.

This documentation contains sections covering targets, variables, diagnostics, and filenames, ordered in alphabetic order, followed by a section covering the fake framework, a section covering debug packages generation, a section explaining flavors and multi-packages, and a section covering the generation of package information.

It ends with sections covering some obsolete targets, variables and files, outlining conversion methods from older incarnations of the ports tree or from other BSD variants.

**bsd.port.mk** also uses quite a few helper scripts which live under *${PORTSDIR}/infrastructure/bin*.

Binary package details are mostly covered in [pkg\_create(1)](/pkg_create/1.md) for the packing-list details, and in pkg\_add(1) for the installation semantics.

Common usage such as building every package in the system is covered by [ports(7)](/ports/7.md) and [bulk(8)](/bulk/8.md) instead, with [packages(7)](/packages/7.md) providing an overview of the result.

## TARGETS

- **{build,run,all,test}-dir-depends**

  Print all dependencies for a port in order to build it, run it, build and run it, or to run regression tests. The output is formatted as package specification pairs, in a form suitable for [tsort(1)](/tsort/1.md).

  Note that it is possible to obtain reverse dependency information by using the **show-reverse-deps** script from the *sqlports* package.

- **full-{build,run,all,test}-depends**

  Print all dependencies a package depends upon for building, running, or both, as a list of package names, sorted by dependency order with [tsort(1)](/tsort/1.md), most dependent port first.

- **{build,lib,test,run}-depends-list**

  Print a list of first level package specifications a port depends as build dependencies, library dependencies, test dependencies or run dependencies.

- **print-{build,run}-depends**

  User convenience target that displays the result of **full-{build,run}-depends** in a more readable way.

- **{pre,do,post}-\***

  Most standard targets can be specialized according to a given port's needs. If defined, the **pre-\*** hook will be invoked before running the normal action; the **do-\*** hook will be invoked instead of the normal action; the **post-\*** hook will be invoked after the normal action. Specialization hooks exist for **build**, **configure**, **distpatch**, **extract**, **fake**, **gen**, **install**, **patch**, **test**. See individual targets for exceptions.

- **all-lib-depends-args**

  Process the full LIB\_DEPENDS list into a form suitable for [pkg\_create(1)](/pkg_create/1.md), see **print-package-args**.

- **build**, **all**

  Default target. Build the port. Essentially invoke

  ```
  env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
  	-f ${MAKE_FILE} ${ALL_TARGET}
  ```

- **check-register**

  Introspection target. Verify from the ports tree, without building anything, that the current subpackage will register okay( see PLIST\_REPOSITORY).

- **check-register-all**

  Apply **check-register** to all subpackages of the current port.

- **checkpatch**

  Check that patches would apply cleanly, but do not modify anything.

- **check-shlib-syms**

  Compare exported dynamic symbols for PLIST shared libraries after **fake**, against matching installed libraries. Libraries with no installed counterpart are reported and skipped.

- **checksum**

  Compute a [sha256(1)](/sha256/1.md) digest of ${CHECKSUMFILES} (files listed in DISTFILES\* and PATCHFILES\*) and check it against ${CHECKSUM\_FILE}, normally *distinfo*. In case of a mismatch, running **checksum** with REFETCH=**true** will fetch alternative versions of files keyed on their checksum from the OpenBSD main archive site.

- **clean**

  Clean ports contents. By default, it will clean the work directory. It can be invoked as make clean='\[depends build bulk work fake flavors dist install sub package packages plist test\]'.

  - *work*

    Clean work directory.

  - *bulk*

    Clean bulk cookie.

  - *build*

    Clean the WRKBUILD directory (only useful if SEPARATE\_BUILD is set).

  - *depends*

    Recurse into dependencies.

  - *dist*

    Clean distribution files.

  - *fake*

    Clean fake installation directory.

  - *flavors*

    Clean all work directories.

  - *install*

    Uninstall package.

  - *package*

    Remove all copies of package file.

  - *plist*

    Remove registered packing-lists of all subpackages.

  - *test*

    Clean test cookie.

  - *sub*

    With *install* or *package*, clean subpackages as well.

  - *packages*

    Shorthand for ‘sub package’.

  - *all*

    Shorthand for ‘work flavors packages plist’.

- **clean-depends**

  Shorthand for ‘make clean=depends’.

- **configure**

  Configure the port. By default, **configure** creates the ${WRKBUILD} directory (see SEPARATE\_BUILD), and runs whatever configuration methods are recorded in CONFIGURE\_STYLE.

- **distclean**

  Shorthand for ‘make clean=dist’.

- **distpatch**

  Apply distribution patches only. See **patch**, PATCH\_CASES and FIX\_CRLF\_FILES for details.

- **dump-vars**

  Dump the values of all relevant variables in a port, prepended with the port's FULLPKGPATH.

  Can be limited to some specific information by setting DPB to nothing or ‘fetch’. Mostly used by [dpb(1)](/dpb/1.md) for obtaining vital information from the ports tree.

- **extract**

  Extract the distribution files under *${WRKDIR}* (but see EXTRACT\_ONLY, FIX\_EXTRACT\_PERMISSIONS and NO\_DEPENDS). Refer to EXTRACT\_CASES for a complete description. Do not use **pre-extract** and **do-extract** hooks.

- **fake**

  Do a fake port installation, that is, simulate the port installation into the staging area ${WRKINST}. There is no **do-fake** and **post-fake** hooks: instead **fake** runs **pre-fake**, **pre-install**, **do-install** and **post-install**. Override **pre-install**, **do-install**, or **post-install** to change behavior.

  There are only a handful of ports that use **pre-fake**: that hook can be used to finish setting up a *fake* directory before starting the installation proper. Stuff run during **pre-fake** will not register with **update-plist**, whereas stuff run during **pre-install** will be considered part of the installation process.

  See THE FAKE FRAMEWORK section below.

- **fake-wantlib-args**

  Check WANTLIB against the list of installed packages and libraries in the ports tree. See **print-package-args**.

- **fetch**

  Fetch the list of files in DISTFILES\* and PATCHFILES\* using ${FETCH\_CMD}. Files are normally retrieved from the list of sites in SITES\*.

  Adding a suffix to DISTFILES, PATCHFILES, SUPDISTFILES will switch the site entry to the corresponding SITES variable, e.g.,

  ```
  DISTFILES.go = ...
  SITES.go = ...
  ```

  If the rest of the entry parses as ‘*filename*{*url*}*sufx*’ ${FETCH\_CMD} will fetch *url**sufx* instead, but store the result as *filename**sufx*.

  Transfers in progress are stored as *filenamesufx.part* and moved after completion.

  The actual filesystem paths to all distfiles (resp. patchfiles) after url/filename substitution, including suffixed sources, is conveniently stored as ALL\_DISTFILES( resp. ALL\_PATCHFILES). The ports framework uses *${DISTDIR}/${DIST\_SUBDIR}* (aliased to *${FULLDISTDIR}*) to save the ports distribution files and patch files.

  If you want to fetch a significant number of distfiles quickly, say all files relevant to a port, **dpb** **-F** is more efficient.

  There are no **{pre,do,post}-fetch** hooks, as this would break [dpb(1)](/dpb/1.md).

  See ALL\_DISTFILES, ALL\_PATCHFILES, ALL\_SUPDISTFILES, CHECKSUMFILES, DISTDIR, DISTFILES\*, DIST\_SUBDIR, FETCH\_CMD, FETCH\_MANUALLY, FULLDISTDIR, MAKESUMFILES, PATCHFILES\*, SUPDISTFILES\*, REFETCH. SITES\*,

- **fetch-all**

  Like **fetch**, but also fetches SUPDISTFILES\*, for use by e.g., **makesum**.

- **fix-permissions**

  Ensure permissions are correct when using PORTS\_PRIVSEP and/or [dpb(1)](/dpb/1.md).

  If necessary, creates directory DISTDIR owned by FETCH\_USER, and creates directories LOCKDIR, PACKAGE\_REPOSITORY, PLIST\_REPOSITORY and WRKOBJDIR owned by BUILD\_USER.

  If these directories already exist, ownership of their contents is modified to conform to PORTS\_PRIVSEP and [dpb(1)](/dpb/1.md) requirements.

- **gen**

  Generate configure script when needed, either after patching input files, or from scratch for some ports, generally using automake, autoconf, autoreconf and similar GNU tools. This target only has modules (MODxxx\_gen) and a *do-gen* hooks. Then adjust timestamps to avoid regeneration during build( see REORDER\_DEPENDENCIES).

- **generate-readmes**

  Generate READMEs, rc scripts and login.conf.d files from *${PKGDIR}* into *${WRKINST}*. Run after **fake** and before **package** or **update-plist**. Always rerun, as it is cheap enough.

- **install-depends**

  Before package installation, install and verify dependencies constructed from RUN\_DEPENDS, LIB\_DEPENDS, and WANTLIB.

- **install**

  Install the package after building. See the description of THE FAKE FRAMEWORK for the non-intuitive details of the way **{pre,do,post}-install** hooks are actually used by the ports tree.

- **install-all**

  Install all packages in a multi-packages port.

- **lib-depends-args**

  Filter LIB\_DEPENDS to keep only entries required by WANTLIB, and output a list of dependencies suitable for [pkg\_create(1)](/pkg_create/1.md), see **print-package-args**.

- **lib-depends-check**

  Verify that the LIB\_DEPENDS and WANTLIB recorded in the port's packages are accurate. See **port-lib-depends-check**, which checks files under the fake staging directory instead, and thus has faster turn-around.

- **license-check**

  Check that PERMIT\_PACKAGE settings match: if any dependency has a more restrictive setting, warn about it. This warning is advisory, because automated license checking cannot know that some ports were only used for building and did not taint the current port.

- **lock**

  Manually obtain a lock on a given directory. Output must be used to update environment variables. The lock can be released with **unlock**. Seldom used, see [ports(7)](/ports/7.md) for details.

- **makesum**

  Uses **fetch-all** to fetch missing ${MAKESUMFILES} without verifying their digest, then run [sha256(1)](/sha256/1.md) on them that is, files listed in ${DISTFILES\*}, ${SUPDISTFILES\*} and ${PATCHFILES\*}. The result is stored in ${CHECKSUM\_FILE}, normally *distinfo*. Also store the lengths of all files for a quick check during **fetch**, **fetch-all**.

- **no-lib-depends-args**

  Degenerate form of **lib-depends-args** that does not do anything. See **print-package-args**.

- **no-wantlib-args**

  Degenerate form of **wantlib-args** that does not do anything. See **print-package-args**.

- **package**

  Build a port package (or packages in a MULTI\_PACKAGES case) from the fake installation. Involves creating packaging information from templates (see COMMENT, SUBST\_VARS among others) and invoking [pkg\_create(1)](/pkg_create/1.md) for each package in the MULTI\_PACKAGES list. If the repository already contains up-to-date packages, they are not rebuilt. If PLIST\_REPOSITORY is set (the default), the resulting packaging information is compared with existing stuff, and saved if new, with loud complaints if it changed without a REVISION bump.

  if DEBUG\_PACKAGES is set, some debug information may also be set aside and saved in *debug-\** packages transparently.

  Also note that *${PLIST\_REPOSITORY}/${MACHINE\_ARCH}/history* contains LRU caches for all files( see [package(5)](/package/5.md)). Arch-independent packages are created in ${PACKAGE\_REPOSITORY}/no-arch, and copied into ${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/all as needed. If ${PERMIT\_PACKAGE} is set to ‘Yes’, copies built packages into ${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/ftp, using hard links if possible.

- **patch**

  Apply distribution and OpenBSD specific patches. Because of historical accident, **patch** does not follow the exact same scheme other standard targets do. Namely, **patch** invokes **pre-patch** (if defined), **do-patch**, and **post-patch**, but the default **do-patch** target invokes **distpatch** directly. So, if the **do-patch** target is overridden, it should still begin by calling ‘make distpatch’, before applying OpenBSD specific patches. Accordingly, the exact sequence of hooks is: **pre-patch**, **do-distpatch**, **post-distpatch**, **do-patch**, **post-patch**. If *${PATCHDIR}* exists, the files described under PATCH\_LIST will be applied under WRKDIST.

- **peek-ftp**

  Connect to the first site in SITES, in the right directory, and leaves user at [ftp(1)](/ftp/1.md)'s prompt.

- **pkglocatedb**

  Top-level target, see [ports(7)](/ports/7.md).

- **port-lib-depends-check**

  Verify that the LIB\_DEPENDS and WANTLIB hold all shared libraries used for every package in the port. See [library-specs(7)](/library-specs/7.md). This makes use of **print-plist-with-depends** to avoid actually building the packages, it only needs the completion of the **fake** stage, and thus is quicker than **lib-depends-check**, unless you already have all binary packages.

- **port-wantlib-args**

  Resolve WANTLIB against the ports tree itself and system libraries, without looking at built or installed packages, and writes a list of options suitable for [pkg\_create(1)](/pkg_create/1.md). See **print-package-args**.

- **prepare**

  Before port building, install and verify dependencies constructed from BUILD\_DEPENDS, LIB\_DEPENDS and WANTLIB. In MULTI\_PACKAGES setups, see FLAVORS AND MULTI\_PACKAGES.

- **print-package-args**

  Print all dependency-related information that will be passed as parameters to [pkg\_create(1)](/pkg_create/1.md), e.g., **-W** *wantlib* and **-P** *depends* lines.

  Those parameters are generated by **run-depends-args** for RUN\_DEPENDENCIES handling, a form of **lib-depends-args** for LIB\_DEPENDS and WANTLIB interaction, and a form of **wantlib-args** for WANTLIB resolution.

  Variables lib\_depends\_args and wantlib\_args control the exact behavior: lib\_depends\_args is normally set to **lib-depends-args**, but will be set to **all-lib-depends-args** by **port-lib-depends-check**, in order to have access to the full list of LIB\_DEPENDS for figuring out missing WANTLIB. wantlib\_args is normally set to **wantlib-args** but it may be set to **port-wantlib-args** for introspection purposes, to **fake-wantlib-args** to avoid some checks, or to **no-wantlib-args** to avoid expensive WANTLIB checks entirely.

- **print-update-signature**

  Print the update signature, as computed using information from the ports tree, in the same format used for [pkg\_info(1)](/pkg_info/1.md) **-S**.

- **print-plist**

  Generate and print a package packing-list from the static information present in the port.

- **print-plist-all**

  Iterate over **print-plist** for all subpackages in a given port.

- **print-plist-all-with-depends**

  Iterate over **print-plist-with-depends** for all subpackages in a given port.

- **print-plist-contents**

  Generate and print package contents from the static information present in the port. In contrast with **print-plist**, the package contents only consists of files, all tagged with category markers such as @file. See [pkg\_create(1)](/pkg_create/1.md).

- **print-plist-libs**

  Generate and print the list of static and dynamic libraries present in the port. See [pkg\_create(1)](/pkg_create/1.md).

- **print-plist-all-libs**

  Iterate over **print-plist-libs** for all subpackages in a given port.

- **print-plist-libs-with-depends**

  Like **print-plist-libs**, but slower. It also handles LIB\_DEPENDS, RUN\_DEPENDS, and WANTLIB, so that the packing-list has complete dependency information.

- **print-plist-with-depends**

  Like **print-plist**, but slower. It also handles LIB\_DEPENDS, RUN\_DEPENDS, and WANTLIB, so that the packing-list is complete.

- **rebuild**

  Force rebuild of the port.

- **regen**

  Force rebuilding configure scripts using *gen* steps.

- **reinstall**

  Force reinstallation of a port, by first cleaning the old installation. This will obviously not work for software used as dependencies of other installed software. In that case, **update** might do the right thing.

- **repackage**

  Rebuild the packages of a port after removing existing packages.

- **run-depends-args**

  Process RUN\_DEPENDS and outputs a list of dependencies suitable for [pkg\_create(1)](/pkg_create/1.md), see **print-package-args**.

- **reprepare**

  Force running the *prepare* target again.

- **retest**

  Force running the *test* target again.

- **show**

  Invoked as make show=name, show the contents of ${name}. Invoked as make show="name1 name2 ...", show the contents of ${name1} ${name2} ..., one variable value per line. Mostly used from recursive makes, or to know the contents of another port's variables without guessing wrongly.

- **show-debug-info**

  Displays the information that was generated by [build-debug-info(1)](/build-debug-info/1.md).

- **show-fake-size**

  Print the size of ${WRKINST}, in kilobytes. Used by some options of [dpb(1)](/dpb/1.md), suitable for BULK\_TARGETS.

- **show-indexed**

  Similar to **show**. Invoked as make show-indexed=name, show the contents of ${name${SUBPACKAGE}}, or ${name} if the variable name is not SUBPACKAGE dependent.

- **show-list**

  Similar to **show**. Shows "list-like" variables, one entry per line. Mostly useful as a debugging target, since some internal variables may now exceed ARG\_MAX.

- **show-prepare-results**

  Print the list of actual installed packages found out by **prepare**.

- **show-prepare-test-results**

  Print the list of actual installed packages found out by **prepare** and **test-depends**.

- **show-required-by**

  Print the list of [pkgpath(7)](/pkgpath/7.md) for all ports that will be affected by the current port changing. Works by walking the full list of all dependencies of all ports, in reverse.

  Very slow, prefer installing the *sqlports* package and using **show-reverse-deps**.

- **show-run-depends**

  Print all running dependencies for a port, one per-line, without duplicates.

- **subpackage**

  Build a port package. Exactly like **package**, but affects only one single subpackage in multi-packages ports.

- **show-size**

  Print the size of the work directory, in kilobytes. Used by some options of [dpb(1)](/dpb/1.md), suitable for BULK\_TARGETS.

- **subupdate**

  Update an existing installation to a newer package, exactly like **update**, but affects only one single subpackage in multi-packages ports.

- **test**

  Run regression tests for the port. Essentially depend on a correct build and invoke

  ```
  env -i ${ALL_TEST_ENV} ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} \
  	-f ${MAKE_FILE} ${TEST_TARGET} ${TEST_LOG}
  ```

  If a port needs some other ports installed to run regression tests, use TEST\_DEPENDS. If a port needs special configuration or build options to enable regression testing, define a ‘test’ FLAVOR.

- **test-depends**

  Before running regression tests, Install and verify dependencies constructed from TEST\_DEPENDS.

- **unlock**

  Manually release a lock on a given directory. See **lock**.

- **update-patches**

  Create or update patches for a port, using [update-patches(1)](/update-patches/1.md). See EDIT\_PATCHES.

- **update**

  Update an existing installation to a newer package: scan the installation for a package with the same FULLPKGPATH, and update it using ‘pkg\_add -r’ if a newer package is available. In multi-packages ports, all relevant packages are updated. See UPDATE\_COOKIES\_DIR and FORCE\_UPDATE as well.

  However, see CAVEATS in [ports(7)](/ports/7.md): **update** is always ‘best-effort’ and will often not work correctly when updating to a significantly different newer version.

- **update-or-install**

  Update an installed package or perform a fresh installation, by using ‘pkg\_add -r’. Handles one single package in multi-packages ports. See UPDATE\_COOKIES\_DIR and FORCE\_UPDATE as well.

- **update-or-install-all**

  Update installed packages or perform a fresh installation, by using ‘pkg\_add -r’. Handles all packages in multi-packages ports. See UPDATE\_COOKIES\_DIR and FORCE\_UPDATE as well.

- **update-plist**

  Update the packing-lists for a port, using the fake installation and the existing packing lists, by invoking [update-plist(1)](/update-plist/1.md) with the correct parameters, along with port-specific options( UPDATE\_PLIST\_ARGS) and user settings( UPDATE\_PLIST\_OPTS). Also see SUBST\_VARS for details about the default handling of variable substitution.

- **verbose-show**

  Similar to **show**, except that it prefixes each value with the variable name, e.g., VAR=value. Also note that it does not show undefined variables, contrary to **show** which outputs blank lines for these.

- **wantlib-args**

  Call **port-wantlib-args** and **fake-wantlib-args** and compare the results, errors out in case of discrepancies. See **print-package-args**.

## VARIABLES

Note that some variables are marked as ‘User settings’, which means that individual ports should not modify them, and that some variables are marked as ‘read-only’, which means that they shouldn't ever be changed. In a MULTI\_PACKAGES setup, some variables have settings specific to a given subpackage. See FLAVORS AND MULTI\_PACKAGES.

- show

  Invoked as make show=name, show the contents of ${name}. Invoked as make show="name1 name2 ...", show the contents of ${name1} ${name2} ..., one variable value per line.

- ALL\_DISTFILES

  List of all actual files coming from every DISTFILES\* setting, after applying the ‘*filename*{*url*}*sufx*’ conversion, occasionally useful for setting EXTRACT\_ONLY manually. Read-only.

- ALL\_FAKE\_FLAGS

  Flags passed to ${MAKE} invocations during the fake process. Equals ${MAKE\_FLAGS} ${DESTDIRNAME}=${WRKINST} ${FAKE\_FLAGS}. Read-only.

- ALL\_PATCHFILES

  List of all actual files coming from every PATCHFILES\* setting, after applying the ‘*filename*{*url*}*sufx*’ conversion. Read-only.

- ALL\_SUPDISTFILES

  List of all actual files coming from every SUPDISTFILES\* setting, after applying the ‘*filename*{*url*}*sufx*’ conversion. Read-only.

- ALL\_TEST\_ENV

  Environment passed to test. Equals ${MAKE\_ENV} ${TEST\_ENV}. Read-only.

- ALL\_TEST\_FLAGS

  Flags passed to ${MAKE} invocations during test. Equals ${MAKE\_FLAGS} ${TEST\_FLAGS}. Read-only.

- ALL\_TARGET

  Target used to build software. Default is ‘all’. Can be set to empty, to yield a package's default target.

- APM\_ARCHS

  Set to the list of [apm(4)](/apm/4.md) architectures. Read-only. Use with ONLY\_FOR\_ARCHS.

- ARCH

  Current machine architecture. Read-only.

- AUTOCONF

  Location of the autoconf binary if needed. Defaults to autoconf.

- AUTOCONF\_DIR

  Where to invoke autoconf or autoreconf if ${CONFIGURE\_STYLE} includes ‘autoconf’ or ‘autoreconf’, respectively. Defaults to ${WRKSRC}.

- AUTOCONF\_ENV

  Environment values that should be passed to all runs of autoconf, automake and related tools. Specifically, version numbers and PATH. Automatically set as soon as CONFIGURE\_STYLE is gnu or higher.

- AUTOCONF\_VERSION

  Several versions of autoconf may coexist peacefully. The main autoconf script is a shell wrapper in the *devel/metaauto* package, and similarly for automake. Setting AUTOCONF\_VERSION along with CONFIGURE\_STYLE set to autoconf is the correct way to specify which one to use. AUTOCONF\_VERSION defaults to 2.13. If autoconf must be run manually, MODGNU\_AUTOCONF\_DEPENDS can be used to specify what packages to depend upon.

- AUTOHEADER

  Location of the autoheader binary. Defaults to autoheader.

- AUTOMAKE\_VERSION

  Several versions of automake may coexist peacefully. AUTOMAKE\_VERSION must be set before trying to run automake. Defaults to 1.4.

- AUTORECONF

  Location of the autoreconf binary and the arguments it is invoked with. Can be set to ‘autogen.sh’ if such a script is available. Defaults to autoreconf --force --install.

- BASE\_PKGPATH

  Full [pkgpath(7)](/pkgpath/7.md) to the current port, taking flavors into account. See also BUILD\_PKGPATH, which also includes pseudo-flavors. Read-only.

- BASELOCALSTATEDIR

  User settings. Base location for system-wide state directory. Defaults to *${VARBASE}*. See LOCALSTATEDIR.

- BASESYSCONFDIR

  User settings. Base location for system-wide configuration files. Defaults to */etc*. See SYSCONFDIR.

- BATCH

  User settings. Set to ‘Yes’ to avoid ports that require user-interaction. Use in conjunction with INTERACTIVE to simplify bulk-package builds. (See IGNORE).

- BE\_ARCHS

  Set to the list of big-endian architectures. Read-only. Use with NOT\_FOR\_ARCHS and ONLY\_FOR\_ARCHS.

- BUILD\_DEPENDS

  List of other ports the current port needs to build correctly. Each item has the form ‘\[pkgspec:\]pkgpath\[:target\]’. ‘target’ defaults to ‘install’. The package installed must conform to the ‘pkgspec’, which is by default obtained from the dependent ‘pkgpath’( see PKGSPEC). If no installation is involved, the infrastructure will still check that the directory would provide a package conforming to the ‘pkgspec’. ‘pkgpath’ is set relative to ${PORTSDIR}, see [pkgpath(7)](/pkgpath/7.md) for details. Build dependencies are checked before the **extract** stage during **prepare**.

  Build dependencies with a **patch**, **configure** or **build** target will be processed in a subdirectory of the working directory, specifically, in ${WRKDIR}/some/directory, with *some/directory* the directory part of the ‘pkgpath’.

- BUILD\_ONCE

  User settings. Defaults to ‘No’. Set to ‘Yes’ during bulk builds.

  When BUILD\_ONCE is set to ‘Yes’, all PSEUDO\_FLAVORS matching ‘no\_\*’ will be disabled, unless the special pseudo-flavor ‘bootstrap’ is also set.

  This is a bulk build optimisation, automatically set by [dpb(1)](/dpb/1.md): to avoid rebuilding the same package several times, a full bulk build will strip most ports of pseudo-packages variations that remove subpackages.

  For instance, an individual package may depend on *databases/db/v4,no\_java,no\_tcl*, to avoid bringing a jdk in during a quick build. Nevertheless, during a full bulk build, *databases/db/v4* will only be built once, as the pseudo-flavor will be automatically removed.

  However, the extra ‘bootstrap’ rule is needed to take build cycles into account. For instance, the *x11/gnome/gvfs,-goa* subpackage depends on gnome-online-accounts, which in turn requires *x11/gnome/gvfs,-main* to build (through its dependencies). So *x11/gnome/gvfs* has PSEUDO\_FLAVORS = no\_smb no\_goa bootstrap and the GNOME build first builds *x11/gnome/gvfs,no\_smb,no\_goa,bootstrap,-main* which is later used to rebuild *x11/gnome/gvfs*.

- BUILD\_PKGPATH

  Full [pkgpath(7)](/pkgpath/7.md) to the current port, taking flavors and pseudo-flavors into account. See also BASE\_PKGPATH, which doesn't include pseudo-flavors. Mostly useful to write dependencies for subpackages like this: LIB\_DEPENDS-foo=${BUILD\_PKGPATH} and avoid starting to build a package with some other flavor combination. See [pkgpath(7)](/pkgpath/7.md) on the subject of ‘pkgpath normalisation’. Read-only.

- BUILD\_PACKAGES

  The actual list of packages that will be built, once architecture problems and pseudo-flavors have been taken into account. See FLAVORS AND MULTI\_PACKAGES.

- BROKEN

  Define only for broken ports, set to reason the port is broken. See also NO\_IGNORE, TRY\_BROKEN.

- BUILD\_UNLINKED

  User settings. List of tags that shouldn't be IGNOREd even though the ports are currently UNLINKED.

- BUILD\_USER

  User to switch to when using PORTS\_PRIVSEP, defaults to ‘\_pbuild’.

- BROKEN-\<arch\>

  Define only for ports broken on a given architecture. Distinct from ONLY\_FOR\_ARCHS and NOT\_FOR\_ARCHS, which are used to mark ports for which support for some architectures does not exist at all, or is completely obsolete.

- BSD\_INSTALL\_{PROGRAM,SCRIPT,DATA,MAN}\[\_DIR\]

  Macros passed to make and configure invocations. Set based on corresponding INSTALL\_\* variables.

- BULK

  User settings. If set to ‘Yes’, all successful package builds and installations will clean their working directories, after invoking any targets mentioned in BULK\_TARGETS, and commands mentioned in BULK\_DO. Can be set on a per-${PKGPATH} basis. For instance, setting BULK\_misc/screen=No will override any BULK=Yes passed on the command line. If set to ‘Auto’, it will apply to dependencies, but not to the current port itself. See BULK\_COOKIES\_DIR. Defaults to ‘Auto’.

- BULK\_COOKIES\_DIR

  User settings. Used to store cookies for successful bulk-package builds, defaults to *${PORTSDIR}/bulk/${MACHINE\_ARCH}*.

- BULK\_DO

  Commands to run after each bulk package build before cleaning up the working directory. Empty defaults. Can be set on a per-${PKGPATH} basis, e.g., BULK\_DO\_${PKGPATH}=...

- BULK\_FLAGS

  Flags to pass to build each target in BULK\_TARGETS.

- BULK\_TARGETS

  Targets to run after each bulk package build before cleaning up the working directory. Empty defaults. Can be set on a per-${PKGPATH} basis, e.g., BULK\_TARGETS\_${PKGPATH}=...

- BZIP2

  Name of the bzip2 binary.

- CATEGORIES

  List of descriptive categories into which this port falls. Mandatory. One entry must match the current pkgpath: *devel/gmake* must belong to the ‘devel’ category.

- CCACHE\_DIR

  Sets the cache directory used when USE\_CCACHE is set to yes. Defaults to ${WRKOBJDIR}/.ccache.

- CCACHE\_ENV

  Sets additional environment variables when USE\_CCACHE is set to yes. For instance, to enable verbose logging, set CCACHE\_ENV="CCACHE\_LOGFILE=/tmp/ccache.log"

- CDIAGFLAGS

  Flags appended to CFLAGS if WARNINGS is set.

- CFLAGS

  Default flags passed to the compiler for building. Many ports ignore it. See also COPTS, CDIAGFLAGS.

- CFLAGS\_${CHOSEN\_COMPILER}

  Additional flags that will be appended to CFLAGS depending on the value of CHOSEN\_COMPILER. Common usage pattern:

  ```
  CFLAGS_base-clang =      -Wno-error=unused-but-set-variable
  ```

  See also COMPILER, COMPILER\_LANGS and CHOSEN\_COMPILER.

- CHECK\_LIB\_DEPENDS

  User settings. If set to ‘Yes’, every package build will verify that shared libraries are correctly registered. This is essentially the same as running ‘make lib-depends-check’ after each package build. Defaults to ‘No’, as this can be a big performance hit, and also because lib-depends-check doesn't know about library subdirectories or dynamic loading through [dlopen(3)](/dlopen/3.md).

- CHECK\_LIB\_DEPENDS\_ARGS

  List of extra arguments for [check-lib-depends(1)](/check-lib-depends/1.md).

- CHECKSUMFILES

  List of all files that need to be retrieved by **fetch**, with DIST\_SUBDIR prepended and with the master site selection extension removed. Read-only. See also MAKESUMFILES.

- CHECKSUM\_FILE

  Location for this port's checksums, used by **checksum**, **makesum**, and [dpb(1)](/dpb/1.md). Defaults to *distinfo*.

- CHECKSUM\_PACKAGES

  User settings. Choose whether or not to checksum packages while building. Deposits result in *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/cksums/${FULLPKGNAME}.sha256*. Can be set to ‘Yes’ to compute a checksum for all packages, or to ‘ftp’ to compute it only for PERMIT\_PACKAGE packages. Defaults to ‘no’, which does not compute a checksum at all.

- CHOSEN\_COMPILER

  Read-only. Compiler suite chosen by the COMPILER mechanism. Set to ‘irrelevant’ to disable COMPILER.

- CLEANDEPENDS

  If set to ‘Yes’, the **clean** target will also clean dependencies. Can be overridden on a per-${PKGPATH} basis, by setting CLEANDEPENDS\_${PKGPATH}.

- COMMENT

  Short (no more than 60 characters) description of the port, used for the package and the INDEX. It should not start with an uppercase letter unless semantically significant.

- COMMENT-foo

  Same as COMMENT but used for sub package -foo in a multi-package setup.

- COMMENT-vanilla

  Same as COMMENT but used for a flavored package, if the non-flavored comment is inappropriate.

- COMMENT-foo-vanilla

  Same as COMMENT but used for a sub-, flavored package.

- COMES\_WITH

  The first release where the port was made part of the standard distribution. If the current OpenBSD version is \>= this version then a notice will be displayed instead of the port being built.

- COMPILER

  Select preferred compiler. First element in the list that matches will be chosen.

  - base-gcc

    gcc 4.2 compiler from base

  - base-clang

    clang compiler from base

  - ports-gcc

    gcc compiler from ports (heeds MODGCC\_ARCHS from the module)

  - ports-clang

    clang compiler from ports (heeds MODCLANG\_ARCHS from the module)

    The first compiler that matches criteria will be chosen. On clang-based architectures ‘base-gcc’ never matches.

    Defaults to base compilers, e.g., ‘base-clang base-gcc’.

    Common reasons for explicitly setting COMPILER will most often be C++11 support, thread-local-storage support (emulated), atomic operations on some arches, sometimes assembler support, ABI compatibility with dependent/depending ports, or plain old internal compiler errors.

    With COMPILER in effect, MODGCC\_ARCHS and MODCLANG\_ARCHS default to ‘${PORTSGCC\_ARCHS}’ and ‘${LLVM\_ARCHS}’ respectively.

    ONLY\_FOR\_ARCHS will also be set if applicable.

- COMPILER\_LANGS

  The value of COMPILER\_LANGS will be added to the respective module's supported langs. Defaults to ‘c c++’. Only ‘c’ and ‘c++’ are supported by this mechanism. ‘fortran’ or ‘java’ still need old modules annotations, so that it's possible to select, e.g., ‘gfortran’ from gcc while having clang from base. See also CHOSEN\_COMPILER.

- COMPILER\_LINKS

  Used by **bsd.port.mk** and compiler MODULES to build scripts in *${WRKDIR}/bin* to force setting compiler flags( **-B** is required for clang to find *${WRKDIR}/bin/ld* as used by USE\_WXNEEDED) and call COMPILER\_WRAPPER if used.

- COMPILER\_WRAPPER

  External program used to "wrap" compilers. Populated automatically by USE\_CCACHE or can be set explicitly for other purposes (e.g. distcc).

- CONFIG\_SITE\_LIST

  Used when CONFIGURE\_STYLE=gnu, or with MODULES += gnu. List of *config.site* fragments that will speed up gnu-configure, and prevent it from preferring various gnu programs, unless BUILD\_DEPENDS explicitly ask for them. Read-only, available for debugging purposes.

- CLANG\_ARCHS, GCC4\_ARCHS

  List of architectures using Clang or GCC 4.2.1 as the base compiler. Read-only. Use with NOT\_FOR\_ARCHS or ONLY\_FOR\_ARCHS to limit ports to architectures where they compile.

- CONFIGURE\_ARGS

  Arguments to pass to configure script. Defaults are empty, except for GNU-style configure, where prefix and sysconfdir are set.

- CONFIGURE\_ENV

  Basic environment passed to configure script (path and libtool setup). GNU-style configure adds a lot more variables.

- CONFIGURE\_SCRIPT

  Set to name of script invoked by the **configure** target, if appropriate. Should be either an absolute path, or relative to ${WRKSRC}.

- CONFIGURE\_STYLE

  Set to style of configuration that needs to happen.

  If ‘perl’, assume [perl(1)](/perl/1.md)'s [ExtUtils::MakeMaker(3p)](/ExtUtils::MakeMaker/3p.md) style. Add ‘modbuild’ to enable Module::Build(3p), ‘modbuild tiny’ to enable Module::Build::Tiny(3p), or ‘modinst’ for Module::Install(3p) style.

  If ‘gnu’, ‘autoconf’, or ‘autoreconf’, assume GNU configure style. Add ‘dest’ if port does not handle DESTDIR correctly, and needs to be configured to add DESTDIR to prefixes( see also DESTDIRNAME). Add ‘old’ if port is an older autoconf port that does not recognize --sysconfdir. Use ‘autoconf’ if autoconf needs to be rerun first, but set ‘no-autoheader’ to prevent autoheader from running. Alternatively, use ‘autoreconf’ to rerun autoconf, automake, and related tools to completely regenerate the GNU build framework.

  If ‘imake’, assume port configures using X11 ports Imakefile framework. Add ‘noman’ if port has no man pages the Imakefile should try installing.

  If ‘simple’, there is a configure script, but it does not fit the normal GNU configure conventions.

  Extensions may be defined by specific MODULES. See [port-modules(5)](/port-modules/5.md) for details.

- COPTS

  User settings. Supplementary options appended to ${CFLAGS} for building. Since most ports ignore the COPTS convention, they are actually told to use ${CFLAGS} ${COPTS} as CFLAGS.

- CXXDIAGFLAGS

  Flags appended to CXXFLAGS if WARNINGS is set.

- CXXFLAGS

  Default flags passed to the C++ compiler for building. Many ports ignore it.

- CXXFLAGS\_${CHOSEN\_COMPILER}

  Additional flags that will be appended to CXXFLAGS depending on the value of CHOSEN\_COMPILER. See also COMPILER, COMPILER\_LANGS and CHOSEN\_COMPILER.

- CXXOPTS

  User settings. Supplementary options appended to ${CXXFLAGS} for building.

- DEBUG\_CONFIGURE\_ARGS

  Supplementary ${CONFIGURE\_ARGS} for enabling the generation of debugging information.

- DEBUG\_PACKAGES

  List of ${SUBPACKAGES} for which debug packages should be built "on the side". Usually set as DEBUG\_PACKAGES=${BUILD\_PACKAGES} for packages where debug information is desirable. Note the subpackages with PKG\_ARCH=\* will automatically be stripped from that list. See THE DEBUG\_PACKAGES INFRASTRUCTURE below for details.

- DEBUGINFO\_ARCHS

  List of architectures for which debug information may be provided as extra packages. Normally only amd64 and aarch64, for performance reasons.

- DESCR

  Location of description file for the package, defaults to *${PKGDIR}/DESCR* (or *${PKGDIR}/DESCR${SUBPACKAGE}* for multi-packages).

- DESTDIR

  See DESTDIRNAME.

- DESTDIRNAME

  Name of variable to set to ${WRKINST} while faking. Usually DESTDIR. To be used in the rare cases where a port heeds DESTDIR in a few directories and needs to be configured with ‘gnu dest’, so that those few directories do not get in the way.

- DIST\_TUPLE

  List of distfile templates to use, each consisting of five entries: *name* *account* *project* *tagname/commithash* *targetdir*. The template *name* should be one of ‘codeberg’, ‘fdo’, ‘github’, ‘gitlab’, ‘gnome’, ‘kde’, or ‘srht’ at the moment (see *${PORTSDIR}/infrastructure/db/dist-tuple.pattern*, additional TEMPLATE\_DISTFILES.\<name\> and TEMPLATE\_HOMEPAGE.\<name\> entries can be added as needed). The components are used to build SITES.name DISTFILES.name and (optionally) HOMEPAGE.

  At the end of **post-extract**, the files are moved to *${WRKDIST}/\<targetdir\>*. Using ‘.’ for *targetdir* will disable the move.

- DISTDIR

  User settings. Directory where all ports distribution files and patchfiles are stashed. Defaults to *${PORTSDIR}/distfiles*. Override if distribution files are stored elsewhere. Always use FULLDISTDIR to refer to ports' distribution files location, as it takes an eventual DIST\_SUBDIR into account.

- DISTFILES\*

  The main port's distribution files (the actual software source, except for binary-only ports). Will be retrieved from the corresponding SITES\* (see **fetch**), checksummed and extracted (see **checksum**, **extract**). DISTFILES normally holds a list of files.

  Preferably, adding a suffix to DISTFILES, will switch the site entry to the corresponding SITES variable, e.g.,

  ```
  DISTFILES.go = ...
  SITES.go = ...
  ```

  Each entry may optionally be of the form ‘*filename*{*url*}*sufx*’ to deal with sites that only offer archives as weird urls, doing the transfer of *url**sufx* into result file *filename**sufx*. For instance, if

  ```
  DISTFILES = minetest-{minetest/archive/}${V}${EXTRACT_SUFX}
  ```

  then **fetch** will retrieve from url ‘minetest/archive/${V}${EXTRACT\_SUFX}’ into ‘minetest-${V}${EXTRACT\_SUFX}’.

  If ${DISTFILES\*} varies depending on FLAVORS or architecture, use SUPDISTFILES\* to ensure distfiles mirroring and **makesum**'s proper operation.

  If no DISTFILES\* is set and if SITES is not null, then DISTFILES will be set to *${DISTNAME}${EXTRACT\_SUFX}*.

- DISTNAME

  Name used to identify the port. See DISTFILES\* and PKGNAME.

- DISTORIG

  Suffix used by **distpatch** to rename original files. Defaults to *.bak.orig*. Distinct from PATCHORIG to avoid confusing **update-patches**.

- DIST\_SUBDIR

  Optional subdirectory of ${DISTDIR} where the current port's distribution files and patchfiles will be located. See target **fetch**.

- DPB

  Set by the Distributed Ports Builder to only get the information it needs from **dump-vars**.

- DPB\_LOCKNAME

  If set, [dpb(1)](/dpb/1.md) will use this instead of the defaultPKGPATH- derived name. This feature comes with large restrictions and shouldn't be used unless absolutely necessary. Specifically, it can allow **dpb** to build several flavors of the same port at the same time, but beware: under MULTI\_PACKAGES and PSEUDO\_FLAVORS conditions, if some of these packages are identical across flavors, this will not work. This also makes it harder to interact with locks if the names are not obvious.

- DPB\_PROPERTIES

  Annotations for the Distributed Ports Builder. See [dpb(1)](/dpb/1.md) for semantics.

- DUMMY\_PACKAGE

  If defined, **bsd.port.mk** will provide dummy values for variables mandatory for a minimally functional port. Used by the *sqlports* package and [dpb(1)](/dpb/1.md) to perform introspection and obtain **bsd.port.mk**'s default values for variables without needing to access any specific port.

- DWZ

  Command line invocation of [dwz(1)](/dwz/1.md) to shrink debug information while building debug packages. Defaults to ‘dwz -L 100000000’ Can be set to ‘:’ to not run [dwz(1)](/dwz/1.md) at all. See THE DEBUG\_PACKAGES INFRASTRUCTURE for details.

- ECHO\_MSG

  User settings. Used to display ‘===\> Configuring for foo’ and similar informative messages. Override to turn off, for instance.

- ECHO\_REORDER

  User settings. Set it to ‘echo’ to see REORDER\_DEPENDENCIES actions. Silent by default.

- EDIT\_PATCHES

  User settings. If set to ‘No’, **update-patches** will not open changed files in an editor.

- EPOCH

  Epoch number of the current package. Used when the port version is changed but the new version is not regarded by [packages-specs(7)](/packages-specs/7.md) as being newer. Once added, it cannot be removed or go backwards. Defaults to empty (no need for numbering changes), then numbering starts at 0. Gets automatically incorporated into FULLPKGNAME as ‘v${EPOCH}’ to form a full package-name conforming to [packages-specs(7)](/packages-specs/7.md).

- ERRORS

  List of errors found while parsing the port's Makefile. Display the errors before making any target, and if any error starts with "Fatal":, do not make anything. For instance:

  ```
  .if !defined(COMMENT)
  ERRORS+="Fatal: Missing comment"
  .endif
  ```

  Porter can add to ERRORS, for instance to flag erroneous combinations of FLAVORS (but see ONLY\_FOR\_ARCHS NOT\_FOR\_ARCHS and BROKEN for other common issues).

  Note that setting fatal errors defeats all introspection mechanisms and breaks the *sqlports* package.

  Tip: if you need to debug a fatal error, you can always override ERRORS on the command line, e.g.,

  ```
  make ERRORS= show=<var>
  ```

- EXTRACT\_CASES

  The extraction stage runs a loop under *${WRKDIR}* with archive (shell variable) set to each element of EXTRACT\_ONLY in order, which is then processed by a case switch: ${EXTRACT\_CASES}.

  **bsd.port.mk** detects extensions in ${CHECKSUMFILES} and automatically adds BUILD\_DEPENDS and fragments to handle the following archives:

  - gzip

    tar.gz, tgz

  - tar

    tar

  - archivers/bzip2

    tar.bz2, tbz2, tbz

  - archivers/xz

    tar.xz, tar.lzma, tar.lz

  - archivers/unzip

    zip

  - archivers/zstd

    tar.zst, tar.zstd

  - converters/rpm2cpio

    rpm

    Other cases not supported directly in **bsd.port.mk** can be added, and existing cases can be overridden. For example the following snippet sets extra conversion flags to unzip, and adds support for rar:

    ```
    	*.zip) ${UNZIP} -Laq ${FULLDISTDIR}/$$archive -d ${WRKDIR};; \
    	*.rar) ${LOCALBASE}/bin/unrar x -idq ${DISTDIR}/$$archive;;
    ```

- EXTRACT\_ONLY

  Set to the list of distfiles to actually extract if some distfiles should not be extracted during the **do-extract** stage. Defaults to ${ALL\_DISTFILES}, can even be set to empty.

- EXTRACT\_SUFX

  Used to set DISTFILES default value to ${DISTNAME}${EXTRACT\_SUFX}. Default value is *.tar.gz*.

  Note that DISTFILES will only be set in the absence of DISTFILES.sufx as well, or if SITES is not empty.

- EXTRACT\_SUFX.\<name\>

  The EXTRACT\_SUFX value for a template defined through DIST\_TUPLE.

- EXTRACT\_FILES

  Set to the list of files to actually extract from distfiles. Its content is subject to shell evaluation as part of EXTRACT\_CASES and passed as *file* *...* argument to [tar(1)](/tar/1.md) or [unzip(1)](/unzip/1.md), e.g., [glob(7)](/glob/7.md) patterns and shell brace expansion may be used. Empty by default to extract all files.

- FAKE\_FLAGS

  Extra flags passed to ${MAKE\_PROGRAM} during the fake invocation. Empty by default. Also see ALL\_FAKE\_FLAGS.

- FAKE\_SETUP

  List of environment values normally set during fake invocations. Exposed so that modules may provide their own **do-install**. Read-only, see THE FAKE FRAMEWORK section for details.

- FAKE\_TARGET

  Target built by ${MAKE\_PROGRAM} on fake invocation. Defaults to ${INSTALL\_TARGET}.

- FAKEOBJDIR

  User settings. If non empty, used as a base for the fake staging area. The real fake directory ${WRKINST} is created there. Can be set on a per-${PKGPATH} basis. For instance, setting FAKEOBJDIR\_www/mozilla-firefox=/tmp/obj will affect only the mozilla-firefox port.

- FETCH\_CMD

  User settings. Command used to fetch distribution files for this port. Defaults to [ftp(1)](/ftp/1.md). Can be used to go through excessively paranoid firewalls. Note that FETCH\_CMD should support a few ftp options, chief among them being **-C** and **-o** *dest*, but also **-m**, **-S**, **-v**, **-V**. Most of these can be no-ops in a FETCH\_CMD script, See *${PORTSDIR}/infrastructure/template/fetch\_cmd.template* for a skeleton script.

- FETCH\_MANUALLY

  Some ports' distfiles cannot be fetched automatically for licensing reasons. In this case, set FETCH\_MANUALLY to a list of strings that will be displayed, one per line, e.g.,

  ```
  FETCH_MANUALLY= "You must fetch foo-1.0.tgz"
  FETCH_MANUALLY+="from http://www.fubar.com/ manually,"
  FETCH_MANUALLY+="after reading and agreeing to the license."
  ```

  Behaves like IS\_INTERACTIVE if some distribution files are missing.

- FETCH\_PACKAGES

  User settings, defaults to ‘No’. Set to pkg\_add(1) options. Instruct the **package** target to download packages missing from the repository from locations in ${PKG\_PATH} and place them into *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/cache/*, only building them if no suitable packages are found. For instance,

  ```
  make FETCH_PACKAGES=
  ```

  to use without any options, or

  ```
  make FETCH_PACKAGES=-Dsnap
  ```

  to use close to release.

- FILESDIR

  Location of other files related to the current port. Default: files.

- FETCH\_USER

  User to use to fetch distfiles when using PORTS\_PRIVSEP, defaults to ‘\_pfetch’.

- FIX\_CLEANUP\_PERMISSIONS

  If ‘Yes’, restore read, write and directory search permissions for the build user on *${WRKDIR}* before running **clean**. Used for build systems which set paranoid permissions at build time. Defaults to ‘No’.

- FIX\_CRLF\_FILES

  Name(s) of files with line endings to correct at the end of **distpatch**. Sometimes a port will include files with MS-DOS line endings (CR LF). To avoid problems with patches (especially when sent by email) these should be converted to LF. **bsd.port.mk** changes to WRKDIST before converting files - shell wildcards may be used.

- FIX\_EXTRACT\_PERMISSIONS

  If ‘Yes’, restore contents of *${WRKDIR}* to world-readable at the end of **extract**. Used for some distfile contents which have paranoid permissions for no reason. Defaults to ‘No’.

- FLAVOR

  The port's current options. Set by the user, and tested by the port to activate wanted functionalities.

- FLAVORS

  List of all flavors keywords a port may match. Used to sort FLAVOR into a canonical order to build the package name, or to select the packing-list, and as a quick validity check. See also PSEUDO\_FLAVORS.

- FLAVOR\_EXT

  Canonical list of flavors being set for the current build, dash-separated. See FULLPKGNAME.

- FORCE\_UPDATE

  User settings. If set to ‘Yes’, the **update** target will always update an installed package, as soon as its signature differs, and all dependencies that install packages will also force an update. If set to ‘hard’, the **update** target will also update installed packages even when the signature did not change.

- FULLDISTDIR

  Complete path to directory where ${DISTFILES\*} ${SUPDISTFILES\*} and ${PATCHFILES\*} will be located, to be used in hand-crafted extraction targets. Read-only.

- FULLPKGNAME

  Full name of the created package, taking flavors into account. Defaults to ${PKGNAME}${FLAVOR\_EXT}. See also EPOCH and REVISION.

- FULLPKGPATH

  Path to the current port's directory, relative to ${PORTSDIR}, including flavors and subpackages. See [pkgpath(7)](/pkgpath/7.md).

- GH\_\*

  Simple support for GitHub-hosted projects. Leave empty for non hosted projects. Yields a suitable default for SITES\_GITHUB and DISTNAME.

  Use DIST\_TUPLE for more complicated situations.

- GH\_ACCOUNT

  Account name of the GitHub user hosting the project.

- GH\_COMMIT

  SHA1 commit id to fetch. It is an error to specify ${GH\_COMMIT} when ${GH\_TAGNAME} is specified.

- GH\_DISTFILE

  Set by **bsd.port.mk** to the generated name of the distribution file. This can be useful for ports listing multiple DISTFILES\*.

- GH\_PROJECT

  Name of the project on GitHub.

- GH\_TAGNAME

  Name of the tag to download. Setting ${GH\_TAGNAME} to master is invalid and will throw an error. ${WRKDIST} is auto-generated based on the ${GH\_TAGNAME} if specified, otherwise ${GH\_COMMIT} will be used to generate ${WRKDIST}.

- GMAKE

  Location of the GNU make binary, if needed. Defaults to gmake.

- HOMEPAGE

  URL to the homepage of the software, if applicable.

- IGNORE

  For ignored ports, set to the reasons for which the port is ignored. If non-empty, most common targets that do something (e.g., **fetch**, **build**, **install** ...) will be ignored. See also BATCH, BUILD\_UNLINKED, BROKEN, FETCH\_MANUALLY, IGNORE\_IS\_FATAL, IGNORE\_SILENT, INTERACTIVE, IS\_INTERACTIVE, NOT\_FOR\_ARCHS, NO\_IGNORE, ONLY\_FOR\_ARCHS, UNLINKED.

- IGNORE\_IS\_FATAL

  User settings. If set to ‘Yes’, ignored ports will become fatal errors.

- IGNORE\_SILENT

  User settings. If set to ‘Yes’, do not print anything when ignoring a port.

- INSTALL\_DEBUG\_PACKAGES

  User settings. Defaults to ‘No’. If ‘Yes’, install available debug packages during all install/update targets.

- INSTALL\_{PROGRAM,SCRIPT,DATA,MAN}\[\_DIR\]

  Macros to use to install a program, a script, data, or a man page (or the corresponding directory), respectively.

- INSTALL\_TARGET

  Target invoked to install the software, during fake installation. Default is ‘install’.

- INTERACTIVE

  User settings. Set to ‘Yes’ to skip all non-interactive ports. Used in conjunction with BATCH to simplify bulk-package builds.

- IS\_INTERACTIVE

  Set to ‘Yes’ if port needs human interaction to build.

  Note that IS\_INTERACTIVE ports won't be built as official packages, so avoid at all cost.

  Human intervention should be moved to binary package installation and/or post-installation configuration instead.

  Discrete Yes/No choices are better modelled as FLAVORS.

- LE\_ARCHS

  Set to the list of little-endian architectures. Read-only. Use with NOT\_FOR\_ARCHS and ONLY\_FOR\_ARCHS.

- LIB\_DEPENDS

  List of packages used by a port for its library dependencies. Each item has the form ‘\[pkgspec:\]pkgpath’. Similar to BUILD\_DEPENDS and RUN\_DEPENDS, but with specific rules: LIB\_DEPENDS always turn into BUILD\_DEPENDS( but see FLAVORS AND MULTI PACKAGES).

  LIB\_DEPENDS is also used as a run-time dependency, and recorded in the package as such, if any of the libraries mentioned in WANTLIB is a shared library that originates within the dependent port.

  See [library-specs(7)](/library-specs/7.md) for more details.

- lib\_depends\_args

  Controls the behavior of [pkg\_create(1)](/pkg_create/1.md) related targets, see **print-package-args** for details.

- LIBCXX

  List of standard C++ libraries for the base compiler. Read-only. Use in WANTLIB.

- LIBTOOL

  Location of the libtool binary. Default: */usr/bin/libtool*.

- LIBTOOL\_FLAGS

  Arguments to pass to libtool. If USE\_LIBTOOL is set, the environment variable LIBTOOL is set to ${LIBTOOL} ${LIBTOOL\_FLAGS}.

- LLD\_EMUL

  As [ld.lld(1)](/ld.lld/1.md) does not have a default emulation mode, if it is the linker in-use, LLD\_EMUL defaults to the correct option to set the emulation mode; Otherwise, it stays empty. Read-only. Seldom used, as it is only needed to link binary data without using the compiler.

- LLVM\_ARCHS

  Set to the list of architectures where LLVM/Clang could be used, e.g., via ‘lang/clang’ port module, see [port-modules(5)](/port-modules/5.md). Read-only. Use with NOT\_FOR\_ARCHS or ONLY\_FOR\_ARCHS.

- LOCALBASE

  where other ports have already been installed. Default: */usr/local*.

- LOCALSTATEDIR

  Location for this port's state directory, should always be derived from BASELOCALSTATEDIR, which defaults to */var*. Passed to gnu configure scripts.

- LOCKDIR

  User settings. Defaults to *${WRKOBJDIR}/locks*. If set, points to a local directory common for all instances of concurrent ports builds.

- LOCK\_CMD

  User settings. Expands to a command that will acquire a lock, namely [portlock(1)](/portlock/1.md). See also [ports(7)](/ports/7.md).

- LOCK\_VERBOSE

  User settings. Defaults to ‘No’. Set to ‘Yes’ to show every acquire/release lock operation.

- LP64\_ARCHS

  Set to the list of 64-bit architectures. Read-only. Use with NOT\_FOR\_ARCHS.

- MAINTAINER

  Email address with full name of the port's maintainer. Defaults to *ports@openbsd.org*.

- MAKE\_ENV

  Environment variables passed to make invocations and tests. Sets at least PATH, PREFIX, LOCALBASE, X11BASE, CFLAGS, TRUEPREFIX, DESTDIR, and the BSD\_INSTALL\_\* macros.

- MAKE\_FLAGS

  Flags used for all make invocations, except for the **fake** stage, which adds FAKE\_FLAGS (see ALL\_FAKE\_FLAGS) and for the **test** stage, which adds TEST\_FLAGS (see ALL\_TEST\_FLAGS).

- MAKE\_FILE

  Name of the Makefile used for ports building. Defaults to Makefile. Used after changing directory to ${WRKBUILD}.

- MAKE\_JOBS

  Number of jobs to use when building the port, normally passed to MAKE\_PROGRAM through PARALLEL\_MAKE\_FLAGS. Mostly set automatically when DPB\_PROPERTIES contains ‘parallel’.

  Note that [make(1)](/make/1.md) still has bugs that may prevent parallel build from working correctly!

- MAKE\_PROGRAM

  The make program that is used for building the port. Set to ${MAKE} or ${GMAKE} depending on USE\_GMAKE. Read-only.

- MAKEFILE\_LIST

  Introspection variable, see [make(1)](/make/1.md).

- MAKESUMFILES

  List of all files that need to be retrieved by **fetch-all**, with DIST\_SUBDIR prepended and with master site selection extension removed. Read-only. See also CHECKSUMFILES.

- MESSAGE

  File recorded in the package and displayed during installation. Defaults to ${PKGDIR}/MESSAGE if this file exists. Leave empty if no message is needed.

- MISSING\_FILES

  When FETCH\_MANUALLY is set, MISSING\_FILES will contain the list of missing distfiles or patchfiles that need to be fetched manually. Read-only.

- MODGNU\_CONFIG\_GUESS\_DIRS

  If a port uses config.guess outside WRKSRC, the directories containing the other copies must be set here.

- MODPERL\_ADJ\_FILES

  If any files have a Perl shebang line, which needs to be replaced with “#!/usr/bin/perl”, list them in MODPERL\_ADJ\_FILES. File paths here should be relative to WRKSRC. These files are patched automatically at the end of **pre-configure**.

- MODPERL\_BIN\_ADJ

  Shell fragment to patch the Perl interpreter path in executable scripts. Used by MODPERL\_ADJ\_FILES.

- MODPERL\_BUILD\_TARGET

  Normal content of **do-build** when CONFIGURE\_STYLE uses perl. Provided as a separate variable if a port wants to override **do-build** for its own reasons.

- MODPERL\_INSTALL\_TARGET

  Likewise for **do-install**.

- MODPERL\_TEST\_TARGET

  Likewise for **do-test**.

- MODPERL\_REGEN\_PPPORT

  Normally, if ppport.h is present, it will be regenerated using a current version of [Devel::PPPort(3p)](/Devel::PPPort/3p.md). Set to the filename under *${WRKSRC}*, or ‘No’ to disable. Defaults to ‘ppport.h’.

- MODULES

  External modules mechanism, documented separately. Modules such as ‘imake’ and ‘gnu’ are normally included automatically with the right CONFIGURE\_STYLE. Note that it is possible to CONFIGURE\_STYLE = simple, MODULES += gnu to just get the effects of CONFIG\_SITE and MODGNU\_CONFIG\_GUESS\_DIRS along with the default TEST\_TARGET, in case the normal GNU configure script was wrapped in a separate script that takes different arguments. See [port-modules(5)](/port-modules/5.md).

- MULTI\_PACKAGES

  Set to a list of subpackage extensions for ports that create multiple packages. See FLAVORS AND MULTI\_PACKAGES below. Especially read the part about ONLY\_FOR\_ARCHS when some of the packages only exist for some architectures.

- NO\_ARCH

  Location for arch-independent packages. Defaults to ‘no-arch’. Normally, packages are generated under ${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}, except for packages where PKG\_ARCH=\*, which end up under ${PACKAGE\_REPOSITORY}/${NO\_ARCH}.

- NOT\_FOR\_ARCHS

  List of architectures on which this port does not build. See also ONLY\_FOR\_ARCHS.

- NO\_BUILD

  Set to ‘Yes’ if port does not need any build stage.

- NO\_CCACHE

  Set to ‘Yes’ to prevent ccache from being used when building a certain port, even when USE\_CCACHE is set.

- NO\_CHECKSUM

  Set to ‘Yes’ by [dpb(1)](/dpb/1.md) to avoid **checksum** entirely, as [dpb(1)](/dpb/1.md) already deals with checksums internally.

- NO\_DEPENDS

  User settings. Don't verify build of dependencies. Do not use in any ports Makefile. This is only meant as a user convenience when, e.g., you just want to browse through a given port's source and do not wish to trigger the build of dependencies.

- NO\_IGNORE

  User settings. If set to ‘Yes’, avoid ignoring a port for the usual reasons. Use, for instance, for fetching all distribution files, or for fixing a broken port. See also IGNORE and TRY\_BROKEN.

- NO\_SCCACHE

  Set to ‘Yes’ to prevent sccache from being used when building a certain port, even when USE\_SCCACHE is set.

- NO\_TEST

  Port does not have any regression tests. Only set to ‘Yes’ for ports with no regression test. It should be left alone for ports with empty regression tests, and for ports with failing tests. That way, if a subsequent update of a port acquires actual regression tests, they will be picked up automatically.

- ONLY\_FOR\_ARCHS

  List of architectures on which this port builds. Can hold both processor-specific information (e.g., powerpc), and more specific model information (e.g., macppc). This is subpackage dependent. Read the corresponding part of FLAVORS AND MULTI\_PACKAGES if some subpackages should only be built on some architectures.

- OSREV

  Revision number of OpenBSD. Read-only.

- PACKAGE\_REPOSITORY

  User settings. Location for built packages. Defaults to *${PORTSDIR}/packages*. See the **package** target for details.

- PARALLEL\_MAKE\_FLAGS

  Used when DPB\_PROPERTIES contains ‘parallel’. Flags to pass to MAKE\_PROGRAM to yield a parallel build. Defaults to -j${MAKE\_JOBS}. Mostly set to empty by ports that use other mechanisms for setting the number of jobs.

- PARALLEL\_MAKE\_JOBS

  User settings. Value of MAKE\_JOBS to use when building manually a port with DPB\_PROPERTIES containing ‘parallel’. Defaults to the number of online cpus.

- PATCH

  Command to use to apply all patches. Defaults to */usr/bin/patch*.

- PATCHORIG

  Suffix used by **patch** to rename original files, and **update-patches** to re-generate *${PATCHDIR}/${PATCH\_LIST}* by looking for files using this suffix. Defaults to *.orig.port*. In the unlikely event that one of the ${DISTFILES\*} already contains *.orig.port* files, set this to something else, such as *.orig.obsdport*. See also **distpatch**, DISTORIG.

- PATCH\_CASES

  In the normal **distpatch** stage (when PATCHFILES\* is not empty), this is the contents of a case statement, used to apply distribution patches. Fragments are automatically appended to handle gzip'ed, bzip'ed and lzip'ed patches, so that the default case is more or less equivalent to the following shell fragment:

  ```
  set -e
  cd ${FULLDISTDIR}
  for patchfile in ${ALL_PATCHFILES}
  do
      case $$patchfile in
  	*.bz2)
  	  ${BZIP2} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
  	*.zst|*.zstd)
  	  zstdcat -c <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
  	*.Z|*.gz)
  	  ${GZIP_CMD} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
  	*)
  	  ${PATCH} ${PATCH_DIST_ARGS} <$$patchfile;;
      esac
  done
  ```

- PATCHDIR

  Location for patches applied by the **patch** target. Default: *patches*.

- PATCHFILES\*

  Files to fetch from the master sites like DISTFILES\*, but serving a different purpose, as they hold distribution patches that will be applied at the **patch** stage. See also SUPDISTFILES\*.

- PATCH\_ARGS

  Full list of options used while applying port's patches.

- PATCH\_CHECK\_ONLY

  Set to ‘Yes’ by the **checkpatch** target. Don't touch unless the default **checkpatch** target needs to be redefined. Ideally, user-defined patch subtargets ought to test checkpatch. In practice, they don't.

- PATCH\_DIST\_ARGS

  Full list of options used while applying distribution patches.

- PATCH\_DIST\_STRIP

  Patch option used to strip directory levels while applying distribution patches. Defaults to -p0.

- PATCH\_LIST

  Wildcard pattern of patches to select under ${PATCHDIR}. Defaults to patch-\*. Note that filenames ending in .orig, or ~ are never applied. Note that PATCH\_LIST can hold absolute pathnames, for instance to share patches among similar ports:

  ```
  PATCH_LIST=${PORTSDIR}/x11/kde/libs2/patches/p-* patch-*
  ```

  But beware that minor variations will result in **update-patches** creating useless churn !

- PATCH\_QUIET

  User settings. If set to ‘Yes’, PATCH will work quietly.

- PATCH\_STRIP

  Patch option used to strip directory levels while applying port's patches. Defaults to -p0.

- PERMIT\_DISTFILES, PERMIT\_PACKAGE

  Set to ‘Yes’ if the distribution files or the package can be allowed on FTP sites without legal issues. Set to reason not to otherwise. PERMIT\_\* lines in the Makefile should be preceded with a comment explaining details about licensing and patents issues the port may have. Porters must be very thorough in their checks. In case of doubt, ask.

  If PERMIT\_PACKAGE is set to ‘Yes’, PERMIT\_DISTFILES will default to ‘Yes’.

- PKG\_ADD

  User settings. Path to pkg\_add(1) command, with possible options.

- PKG\_ARCH

  Comma-separated list of architectures on which this package may install. Defaults to ${MACHINE\_ARCH},${ARCH}.

  For instance: MACHINE\_ARCH=*powerpc*, ARCH=*macppc*.

  Most (if not all packages) will install correctly according to MACHINE\_ARCH.

  Use \* for arch-independent packages( see also THE DEBUG\_PACKAGES INFRASTRUCTURE).

- PKG\_ARGS

  Special arguments to pass to [pkg\_create(1)](/pkg_create/1.md), in addition to the default ones.

- PKG\_CREATE

  User settings. Path to [pkg\_create(1)](/pkg_create/1.md) command, with possible options.

- PKG\_CREATE\_NO\_CHECKS

  Porters switch. Set to ‘Yes’ to avoid checking the ports tree when solving WANTLIB( see **wantlib-args**). May result in bogus packages that mix **@depends** lines obtained from the ports tree with **@wantlib** lines that come from the installed system. Set to ‘Warn’ to have the differences printed as a warning instead of an error( the default).

- PKG\_DBDIR

  User settings. Path to package installation records. Defaults to */var/db/pkg*.

- PKG\_DELETE

  User settings. Path to [pkg\_delete(1)](/pkg_delete/1.md) command, with possible options.

- PKG\_INFO

  User settings. Path to [pkg\_info(1)](/pkg_info/1.md) command, with possible options.

- PKG\_TMPDIR

  See pkg\_add(1). Normally points to */var/tmp*, as per default.

- PORTHOME

  Setting of env variable HOME for most shell invocations. Default will trip ports that try to write into $HOME while building: non-existent */${PKGPATH}\_writes\_to\_HOME/*.

- PORTPATH

  Path used by most shell invocations. Don't override unless really needed.

- PORTSDIR

  Root of the ports tree (default: */usr/ports*).

- PORTSDIR\_PATH

  Path used by dependencies and *bsd.port.subdir.mk* to look up package specifications. Defaults to *${PORTSDIR}:${PORTSDIR}/mystuff*.

- PORTS\_PRIVSEP

  If set to ‘Yes’, will build ports as BUILD\_USER and fetch distfiles as FETCH\_USER.

  To work fully, this does require the ports tree to be world-readable, and *${WRKDIR}* to be world-readable as well( **update-patches** and friends won't work otherwise).

  Meant to use in concert with [dpb(1)](/dpb/1.md), which uses the same permissions( see ‘THE SECURITY MODEL OF DPB’ in [dpb(1)](/dpb/1.md)).

  Basically, BUILD\_USER must be able to write into *${WRKOBJDIR}*, *${PACKAGE\_REPOSITORY}*, *${PLIST\_REPOSITORY}* and FETCH\_USER must be able to write into *${DISTDIR}*. The directories and permissions can be set correctly using **fix-permissions**.

  The regular user must be allowed to execute commands as BUILD\_USER and FETCH\_USER. Running commands as another user can be achieved with [doas(1)](/doas/1.md) by setting SUDO=doas in [mk.conf(5)](/mk.conf/5.md) and using the following minimal [doas.conf(5)](/doas.conf/5.md):

  ```
  permit keepenv nopass solene as _pbuild
  permit keepenv nopass solene as _pfetch
  ```

  It is reasonably safe to allow your user id to run commands as the BUILD\_USER or FETCH\_USER and using **nopass** for these can save a lot of password entry, however it is inadvisable to allow commands like pkg\_add(1) to run as root without a password.

  Note that this also means that [doas(1)](/doas/1.md) must be configured to work within the chroot created by [proot(1)](/proot/1.md).

  As [dpb(1)](/dpb/1.md) does its own privilege dropping when run as root, it will automatically override PORTS\_PRIVSEP.

  User settings, defaults to ‘No’.

- PKGDIR

  Location for packaging information (packing-list, port description, messages). **update-plist** may create it. Must be a valid directory. Default: pkg.

- PKGFILE

  Full path to the created package for the given subpackage. Read-only.

- PKGFILES

  Full path to all created packages. Read-only.

- PKGNAME

  Name of the created package. Default is ${DISTNAME}. This does not take flavors into account. See FULLPKGNAME for that. Specific revisions and epoch changes should be handled by REVISION and EPOCH instead.

- PKGNAMES

  Read-only. List of all package names generated by the port, with FLAVORS and BUILD\_PACKAGES taken into account. Mostly used as ‘make show=PKGNAMES’ to verify that bumped package names are correct.

- PKGNAME-foo

  Package name for sub-package foo, if the default value of ${PKGNAME}${SUBPACKAGE} is not appropriate.

- PKGPATH

  Path to the current port's directory, relative to ${PORTSDIR}. Read-only.

- PKGPATHS

  Read-only. List of all package paths generated by the port, with FLAVORS and MULTI\_PACKAGES taken into account. Order matches PKGNAMES exactly.

- PKGSPEC

  Default package spec for using this port as a dependency. Defaults to ‘stem-\*’, derived from the FULLPKGNAME. Do not override without very good reasons, namely software that coexist as different incompatible versions with the same stem, e.g., already a mess. Also See the description of **-P** in [pkg\_create(1)](/pkg_create/1.md)

- PKGSTEM

  Base for the package name without any version number. Used in *READMEs* file names and actual contents, can be overridden for ports with branches, like php, e.g., PKGSTEM-main = php-5.6

- PLIST

  Location of package packing-list. Defaults to *${PKGDIR}/PLIST*, or to *${PKGDIR}/PLIST${SUBPACKAGE}* for multi-packages.

- PLIST\_DB

  Deprecated, see PLIST\_REPOSITORY.

- PLIST\_REPOSITORY

  User settings. Base directory used to save generated packing-lists, as persistent information. Packing-lists are processed by a script, [register-plist(1)](/register-plist/1.md), which complains when packing-lists change without a REVISION bump. It also knows enough about package version numbers when something in the package or its dependencies goes backward, thus catching EPOCH issues. This directory is never cleaned during normal operation. ‘make clean=plist’ should only ever be used during debugging by port maintainers. Defaults to *${PORTSDIR}/plist*( plists actually get saved into *${PLIST\_REPOSITORY}/${MACHINE\_ARCH}*). If set to empty, will not register anything: very much unsafe.

- PORTROACH

  Controls the behavior of *misc/portroach* as documented in detail at **https://jasperla.github.io/portroach/docs/portroach-portconfig.txt**

- PREFIX

  Base directory for the current port installation. Usually ${LOCALBASE}, though some ports may elect a location under *${VARBASE}*, and some multi-package ports may install under several locations. Additionally, firmware files generally install under *${BASESYSCONFDIR}*.

- PREPARE\_CHECK\_ONLY

  Build settings. Prevent the **prepare** stage from installing anything, let it just check dependencies, and handle \[:target\] dependencies. Mostly used by [dpb(1)](/dpb/1.md), which already installs everything before running **prepare**.

- PROGRESS\_METER

  User settings. Defaults to ‘Yes’. Forces commands like [ftp(1)](/ftp/1.md) and [pkg\_create(1)](/pkg_create/1.md) to use their progress-meter even in the absence of a terminal.

- PROPERTIES

  List of properties specific to a given machine architecture, obtained through the inclusion of [bsd.port.arch.mk(5)](/bsd.port.arch.mk/5.md). These can be checked like this

  ```
  .include <bsd.port.arch.mk>
  .if ${PROPERTIES:Mapm}
  # then add build options specific to apm arches
  ...
  .if !${PROPERTIES:Mlp64}
  # build options specific to lp32 arches
  ...
  ```

  For MULTI\_PACKAGES setup, use of ONLY\_FOR\_ARCHS-sub and BUILD\_PACKAGES is generally preferred (and simpler). Possible properties include

  - apm

    architecture possesses suspend (apm) support.

  - be

    architecture is big-endian.

  - gccN

    gccN architecture.

  - le

    architecture is little-endian.

  - lp64

    lp64 architecture.

  - llvm

    there is *lang/llvm* support on this architecture.

  - mono

    there is *lang/mono* support on this architecture.

- PSEUDO\_FLAVOR

  List of flavors in FLAVOR that are actually pseudo-flavors. Only for introspection purposes. Read-only.

- PSEUDO\_FLAVORS

  Extra list of flavors that do not register in package names, but are still used to control build logic, and work directory names. Its only use should be for disabling part of a multi-packages build, for instance:

  ```
  FLAVOR=no_gnome make package
  ```

  Pseudo-flavors should be named as ‘no\_something’ to disable the build of subpackage ‘-something’( and possibly some others, by restricting BUILD\_PACKAGES). Pseudo-flavors should always be handled through [bsd.port.arch.mk(5)](/bsd.port.arch.mk/5.md). A pseudo-flavor can remove several subpackages through the following construct.

  ```
  # pseudo-flavor no_gui will also remove gtk and gtk3
  MULTI_PACKAGES = -main -gtk -gtk3 -gui
  # ...
  .include <bsd.port.arch.mk>
  # remove extra build components
  .if !${BUILD_PACKAGES:M-gui}
  BUILD_PACKAGES := ${BUILD_PACKAGES:N-gtk:N-gtk3}
  .endif
  # normal configure setup, e.g.,
  .if ${BUILD_PACKAGES:M-gtk}
  # ...
  ```

  Caveat: creation of a separate working directory is mandatory for a pseudo-flavor. If, at a later time, a full build with all subpackages is required, all the work will need to be done again.

  See also BUILD\_ONCE.

- RANDOMIZE\_SUBDIRS

  Actually lives in *bsd.port.subdir.mk*. Set to ‘Yes’ to randomize tree traversal, as used by [dpb(1)](/dpb/1.md)'s **-r** option. Defaults to‘No’.

- RCDIR

  Location for daemon startup scripts. Defaults to */etc/rc.d*. Do not change.

- REFETCH

  User settings. If set to true, **checksum** will analyze ${CHECKSUM\_FILE}, and try retrieving files with the correct checksum off **https://ftp.openbsd.org**, in the directory */pub/OpenBSD/distfiles/$cipher/$value/$file*.

- REGISTER\_PLIST\_OPTS

  User settings. User options added to [register-plist(1)](/register-plist/1.md).

- REORDER\_DEPENDENCIES

  Points to a list of files that specify inter-dependencies for [make(1)](/make/1.md). If defined, each line of the file is either a comment (starting with #) or a pair of two files: most\_recent older. At the end of **post-patch**, [touch(1)](/touch/1.md) will be used to ensure those files are put in the proper order. The files are assumed to be under *${WRKSRC}*. The notation /file can be used to ask for a recursive search, e.g., to make sure that all Makefile.in are up to date. See *${PORTSDIR}/infrastructure/mk/automake.dep* for an example.

- REPORT\_PROBLEM

  See [ports(7)](/ports/7.md).

- REPORT\_PROBLEM\_LOGFILE

  See [ports(7)](/ports/7.md).

- REVISION

  Revision number of the current package. Defaults to empty (very first package), then numbering starts at 0. Gets automatically incorporated into FULLPKGNAME as ‘p${REVISION}’ to form a full package-name conforming to [packages-specs(7)](/packages-specs/7.md).

- ROACH\_SITES

  Selects the correct list of sites corresponding to ROACH\_URL, in order to help portroach.

- ROACH\_URL

  The canonical url corresponding to the current port. Gets deduced from ${DISTFILES} by default, using the first value or the first entry in ${DISTFILES.sufx} if there's only one suffix. Conversion rules for DISTFILES are applied to yield only the url part of the distfile. Set manually if the automatic rules don't find the right one.

- RUN\_DEPENDS

  Specification of ports this port needs installed to be functional. Same format as LIB\_DEPENDS. The corresponding packages will be built right before the **install** stage, and pkg\_add(1) will take care of installing them.

- SCCACHE\_DIR

  Sets the cache directory used when USE\_SCCACHE is set to yes. Defaults to ${WRKOBJDIR}/.sccache.

- SCCACHE\_ENV

  Sets additional environment variables when USE\_SCCACHE is set to yes.

- SEPARATE\_BUILD

  Many GNU configure ports can be built in a directory distinct from the place they were unpacked. For some specific ports, this is even mandatory. Set to ‘yes’ if this is the case. The ports infrastructure will generate a separate ${WRKBUILD} directory in which the port will be configured and built. Wipe ${WRKBUILD} to start anew, but skipping the extract/patch stage.

- SETENV

  Normally set to /usr/bin/env -i. Prepended to every command invocation that requires a clean environment. Do not override.

- SHARED\_LIBS

  List of shared libraries that the port may build, as a list of the form ‘libname’ ‘libversion’. Used to set variables of the form LIBlibname\_VERSION that are then used for substitution by [pkg\_create(1)](/pkg_create/1.md). The porter is responsible for making sure the port uses those version numbers when shared libraries are built.

  The intent is that the OpenBSD ports system must have control over shared library versions because of global changes that may require bumping the major version of every shared library in the system, or simply because the third party programmers do not understand the rules for shared library versions, thus breaking the update mechanism. For that reason it is advised to set libversion to 0.0 when first importing a port.

  Porters of software using libtool should make sure MAKE\_FLAGS get propagated to the libtool invocations.

  Most common build systems in the ports tree have been modified to handle this mechanism correctly.

- SITE\_BACKUP

  User settings. List of sites to try after normal master sites. Normally includes ${SITE\_OPENBSD} and ${SITE\_FREEBSD}.

- SITE\_\*

  Lists of standard sites to retrieve files from, refer to *${PORTSDIR}/infrastructure/db/network.conf* for a complete list.

  Generally used with the standard [make(1)](/make/1.md)'s ${VARIABLE:=subdir/} construct to append the relevant subdir at the end of each entry, e.g.,

  ```
  SITES = ${SITE_GNU:=cgicc/}
  ```

- SITES

  List of primary locations from which distribution files and patchfiles are retrieved. See the **fetch** target for details. Defaults to ${SITES\_GITHUB} for GitHub-hosted projects, see GH\_\*. See [ports(7)](/ports/7.md) for user configuration.

- SITES\*

  List of alternate locations from which ${DISTFILES\*}, ${PATCHFILES\*}, ${SUPDISTFILES\*} are retrieved. See **fetch** for details. Suffix should start with ‘.’ and be all lowercase for consistency.

- SKIPDIR

  See [ports(7)](/ports/7.md).

- STATIC\_PLIST

  Normally set to ‘yes’. Can be set to no for ports that do not have a static plist. Do not change without a very good reason. Note that the only good reason to not have a static plist is for ports such as *databases/ports-readmes* which actually build a bunch of files depending on the current ports tree. This breaks all introspection mechanisms within the ports tree, including *databases/pkglocatedb* which will not include that port.

- STARTAFTER

  See [ports(7)](/ports/7.md).

- STARTDIR

  See [ports(7)](/ports/7.md).

- SUBPACKAGE

  Set to the subpackage suffix when building a package in a multi-package port. Read-only. Used to test for dependencies or to adjust the package name.

- SUBST\_CMD

  A command that can be used to perform SUBST\_VARS substitution on arbitrary files. In normal mode,

  ```
  ${SUBST_CMD} file1 file2 ...
  ```

  will substitute files in place, creating backup copies of them. In copy mode,

  ```
  ${SUBST_CMD} -c src1 dest1 src2 dest2
  ```

  will copy files over while performing the substitution, as suitable for copying template files over from *${FILESDIR}* to *${PREFIX}*, for instance. This uses [pkg\_subst(1)](/pkg_subst/1.md) with suitable parameters. Read-only.

  ${SUBST\_CMD} can be used like [install(1)](/install/1.md):

  ```
  ${SUBST_CMD} [-g group] [-o owner] [-m mode] file...
  ```

  to set file *owner*, *group* and/or *mode*.

  Note that SUBST\_CMD is not really appropriate when variables have subpackage variations, like PREFIX or FULLPKGNAME. Use the appropriate SUBST\_CMD-sub instead.

- SUBST\_CMD-sub

  SUBST\_CMD with subpackage-dependent semantics, like packing-list substitution. It will substitute the right variable depending on the desired subpackage, e.g., SUBST\_CMD-foo will substitute the value of FULLPKGNAME-foo for ${FULLPKGNAME}.

- SUBST\_DATA, SUBST\_MAN, SUBST\_PROGRAM

  Specialized versions of SUBST\_CMD that use **-c** and appropriate owner/group/mode for data, manpages and programs respectively.

- SUBST\_VARS

  Make variables whose values get substituted to create the actual package information. Always holds ARCH, BASE\_PKGPATH, FLAVOR\_EXT, FULLPKGNAME, HOMEPAGE, LOCALBASE, MACHINE\_ARCH, MAINTAINER, PREFIX, PKGSTEM, RCDIR, SYSCONFDIR, TRUEPREFIX, and X11BASE. The special construct ‘${FLAVORS}’ can be used in the packing-list to specify the current list of dash separated flavors the port is compiled with (useful for cross-dependencies in MULTI\_PACKAGES). Add other variables as needed.

  TRUEPREFIX is never passed to [pkg\_create(1)](/pkg_create/1.md) as it is identical to PREFIX.

  By default, [update-plist(1)](/update-plist/1.md) is run with the following options:

  ```
  update-plist -i ARCH -i BASE_PKGPATH -i FULLPKGNAME
  -i FULLPKGPATH -i LOCALSTATEDIR -i MACHINE_ARCH
  -s BASE_PKGPATH -s LOCALBASE -s LOCALSTATEDIR -s PREFIX
  -s RCDIR -s SYSCONFDIR -s X11BASE
  ```

- SUDO

  User settings. If set to [doas(1)](/doas/1.md) in [mk.conf(5)](/mk.conf/5.md), the ports tree will only invoke root's privileges for the parts that really require it.

- SUPDISTFILES\*

  Supplementary distribution files for mirroring and creating checksums with **makesum**. For instance, a port might need architecture-specific files, or have some flavor that requires more code. SUPDISTFILES\* should hold a list of all those distribution files and patchfiles that are not always needed. Having an overlap between SUPDISTFILES\* and DISTFILES\*, PATCHFILES\* is admissible, and in fact, expected, as it is much simpler to build an error-free list of files to retrieve in that way. See the *devel/jdk/1.8* port for an example.

- SYSCONFDIR

  Location for this port's configuration files, should always be derived from BASESYSCONFDIR, which defaults to */etc*. Passed to gnu configure scripts and substituted in packing-lists.

- TAR

  Name of the tar binary.

- TARGETS

  Read-only. Set to the list of special targets for a port( **{pre,do,post}-\*** and module hooks). Used by introspection tools such as the *sqlports* package.

- TEMPLATE\_DISTFILES.\<name\>

  Template used to construct DISTFILES.name based on a DIST\_TUPLE entry by filling in placeholder strings. For instance, TEMPLATE\_DISTFILES.github defaults to

  ```
  <account>-<project>-{<account>/<project>/archive/<subdir>}<id>.tar.gz
  ```

  with DIST\_TUPLE += github foo bar baz qux. We end up with the following DISTFILES.github entry:

  ```
  foo-bar-{foo/bar/archive/ref/tags}baz.tar.gz
  ```

  Placeholders ‘account’, ‘project’, ‘id’ are self-explanatory. ‘subdir’ is set automatically by figuring out whether *id* is a *tagname* or a *hash*.

- TEMPLATE\_HOMEPAGE.\<name\>

  Template for automatically generated HOMEPAGE when using DIST\_TUPLE. Very similar to TEMPLATE\_DISTFILES.\<name\>.

- TEST\_DEPENDS

  See BUILD\_DEPENDS for specification. Test dependencies are only checked if the **test** stage is invoked.

- TEST\_ENV

  Additional environment variables passed to tests. Empty by default.

- TEST\_FLAGS

  Extra flags passed to ${MAKE\_PROGRAM} to run the regression tests. Empty by default.

- TEST\_IS\_INTERACTIVE

  Set to ‘Yes’ if port needs human interaction to run its tests, or set to ‘X11’ if the tests need an active X11 display to work.

- TEST\_LOG

  Command used to log the results of regression tests to TEST\_LOGFILE. Read-only.

- TEST\_LOGFILE

  Log file containing the results of regression tests.

- TEST\_TARGET

  Target to run regression tests. Defaults to ‘test’, except for ‘perl’ and ‘gnu’ CONFIGURE\_STYLE, which default to ‘test’ and ‘check’, respectively.

- TRUEPREFIX

  Read-only. Mostly the same as ${PREFIX}, except it never gets ${DESTDIR} prepended during **fake**. Refer to THE FAKE FRAMEWORK section for details.

- TRY\_BROKEN

  User settings. If set to ‘Yes’, don't set IGNORE for BROKEN ports, so that we will attempt to build them.

- UNLOCK\_CMD

  User settings. If set, expands to a command that will release a lock. This lock will reside in *${LOCKDIR}*.

- UNLINKED

  Some ports should not be built by default for various reasons: not fully integrated into the system yet, bootstrap-specific ports, flavors that conflict badly with the default installation, but these ports should still be indexed by tools like *sqlports* for consistency. Instead, set UNLINKED to a ‘tag’ that will make the port IGNOREd unless BUILD\_UNLINKED contains that specific tag.

- UNMESSAGE

  File recorded in the package and displayed during deinstallation. Defaults to ${PKGDIR}/UNMESSAGE if this file exists. Leave empty if no message is needed.

- UNZIP

  Name of the unzip binary.

- UPDATE\_COOKIES\_DIR

  User settings. Used to store cookies for package updates and defaults to *${PORTSDIR}/update/${MACHINE\_ARCH}*. If set to empty, will revert to a file under *${WRKDIR}*.

- UPDATE\_PLIST\_ARGS

  Tweaks to [update-plist(1)](/update-plist/1.md) behavior for some specific ports, such as variable handling.

- UPDATE\_PLIST\_OPTS

  User settings. User options added to [update-plist(1)](/update-plist/1.md), mostly **-v** for now.

- USE\_CCACHE

  User settings. Set to ‘Yes’ to use ccache when building ports. Sets up the build environment so that it is used.

- USE\_GMAKE

  Set to ‘Yes’ if GNU make (${GMAKE}) is needed for correct behavior of this port.

- USE\_GROFF

  Set to ‘Yes’ to use groff to build manpages. This sets groff as a build dependency, and also tells [pkg\_create(1)](/pkg_create/1.md) to format manpages behind the scene using groff while building packages.

- USE\_LIBTOOL

  Defaults to ‘Yes’. Set to ‘gnu’ if the base [libtool(1)](/libtool/1.md) is insufficient and GNU libtool is required. Set to ‘No’ to disable the use of [libtool(1)](/libtool/1.md) entirely; this should not be set under normal circumstances. Adds dependencies if necessary, and passes LIBTOOL environment variable to scripts invocations.

  Many ports using GNU autoconf need an m4 file from the GNU libtool package but otherwise work with base [libtool(1)](/libtool/1.md). In those cases do not set USE\_LIBTOOL, instead just set BUILD\_DEPENDS = devel/libtool.

- USE\_LLD

  Set to ‘Yes’, ‘No’ or ‘ports’ to force the use of [ld.lld(1)](/ld.lld/1.md)( as opposed to bfd's [ld(1)](/ld/1.md)). ‘ports’ forces the use of [ld.lld(1)](/ld.lld/1.md) from lang/clang module. Defaults to the appropriate value for the current architecture( see LLD\_ARCHS in [bsd.port.arch.mk(5)](/bsd.port.arch.mk/5.md)).

- USE\_MFS

  Set to ‘Yes’ to build ports under an MFS filesystem (see [mount\_mfs(8)](/mount_mfs/8.md)). Mostly for use by [dpb(1)](/dpb/1.md) and not intended to be a user setting. See WRKOBJDIR\_MFS for configuration.

- USE\_NOBTCFI

  If set to ‘Yes’, writes a wrapper script to *${WRKDIR}/bin/ld* in **patch** to request that the linker adds a PT\_OPENBSD\_NOBTCFI ELF section. Use when a port does not work with the default strict enforcement of indirect branch targets.

  Applies to all architectures; set USE\_NOBTCFI-${MACHINE\_ARCH} to apply to only a specific architecture.

- USE\_NOEXECONLY

  If set to ‘Yes’, writes a wrapper script to *${WRKDIR}/bin/ld* in **patch** adding **--no-execute-only**. Use when a port does not work with execute-only (unreadable) code sections which are used by default by the linker on some architectures.

- USE\_SCCACHE

  User settings. Set to ‘Yes’ to use sccache when building Rust ports.

- USE\_WXNEEDED

  If set to ‘Yes’, writes a wrapper script to *${WRKDIR}/bin/ld* in **patch** to request that the linker adds a PT\_OPENBSD\_WXNEEDED ELF section. Use when a port requires memory mappings that are both executable and writable and cannot be modified to avoid this.

- USE\_X11

  Normally, presence of ${X11BASE} is enforced by default for building ports. But there is an experimental way to hook the xenocara build into [dpb(1)](/dpb/1.md), which requires knowing whether a port requires X11 to already be there.

  The infrastructure mostly sets USE\_X11 automatically based on WANTLIB values, there are a few ports (about 20) that require X11 components without any library telltale.

- VARBASE

  User settings. Base location for ports that install stuff outside of *${LOCALBASE}*. Defaults to */var*.

- WANTLIB

  List of library specifications that a package will need. May include system and X11 libraries. See [library-specs(7)](/library-specs/7.md) for more details.

  As a special extension, WANTLIB may include absolute paths, e.g., *${LOCALBASE}/lib/expat=4* to distinguish between base libraries and port libraries. Use with caution, this is very seldom needed.

- wantlib\_args

  Controls the behavior of [pkg\_create(1)](/pkg_create/1.md) related targets, see **print-package-args** for details.

- WARNINGS

  User settings. If set to ‘Yes’, add CDIAGFLAGS to CFLAGS and CXXDIAGFLAGS to CXXFLAGS.

- WRKBUILD

  Subdirectory of ${WRKDIR} where the actual build occurs. Defaults to ${WRKSRC}, unless SEPARATE\_BUILD is involved, in which case it is set to an appropriate value.

- WRKCONF

  Subdirectory of ${WRKDIR} where the actual configure set occurs. Defaults to ${WRKBUILD}.

- WRKDIR

  Location where all port activity occurs. Apart from the actual port, may hold all kinds of cookies that checkpoint the port's build. Read-only. Note that WRKDIR may be a symbolic link. During ports building, *${WRKDIR}/bin* is put at the front of the PATH.

- WRKDIST

  Subdirectory of ${WRKDIR} in which the distribution files normally unpack. Base for all patches. Defaults to *${WRKDIR}/${DISTNAME}*. Note that WRKDIST may be a symbolic link, if set to ${WRKDIR}.

- WRKSRC

  Subdirectory of ${WRKDIR} where the actual source is. Base for configuration (default: ${WRKDIST}). Note that WRKSRC may be a symbolic link, if set to ${WRKDIR}.

- WRKINST

  Subdirectory of ${WRKDIR} used as a staging area for installing the port. (See **fake** target).

- WRKOBJDIR

  Used as a base for the actual port working directory. Defaults to *${PORTSDIR}/pobj*. The real working directory ${WRKDIR} is created there. Can be set on a per-${PKGPATH} basis. For instance, setting WRKOBJDIR\_www/mozilla=/tmp/obj will affect only the mozilla port. If explicitly unset (WRKOBJDIR=), the working directory is created within the port directory.

- WRKOBJDIR\_MFS

  Alternate location for the port working directory. The intent is to use an MFS based filesystem for small ports with [dpb(1)](/dpb/1.md). Active when USE\_MFS is ‘Yes’. Defaults to */tmp/pobj*.

- X11BASE

  Where X11 has been installed. Default: */usr/X11R6*.

- XAUTHORITY

  Points to a suitable authority file for X11 interactive regression tests. Defaults to *${HOME}/.Xauthority*.

- XMKMF

  Invocation of xmkmf for a CONFIGURE\_STYLE=imake port. Defaults to xmkmf -a -DPorts. The -DPorts is specific to OpenBSD and is always appended.

- YACC

  Name of yacc program to pass to GNU-configure, defaults to yacc. GNU-configure would always try to use bison otherwise, which leads to unreproducible builds. Set to bison if needed.

## THE FAKE FRAMEWORK

The **fake** target is used to install the port under a staging directory first, ready for packaging by the **package** target, so that the actual **install** target will use the binary package instead.

Essentially, **fake** invokes the install process after tweaking a few variables.

**fake** first creates a skeleton tree under ${WRKINST}, using [mkdir(1)](/mkdir/1.md) **-p**.

A **pre-fake** target may be used to complete that skeleton tree. For instance, a few ports may need supplementary stuff to be present (as it would be installed if the port's dependencies were present).

In most cases, **pre-install** is preferred.

If **{pre,do,post}-install** overrides are present, they are used with some important changes, listed in FAKE\_SETUP:

```
TRUEPREFIX=${PREFIX}
PREFIX=${WRKINST}${PREFIX}
${DESTDIRNAME}=${WRKINST}
```

Essentially, old install targets work transparently, except for a need to change PREFIX to TRUEPREFIX for symbolic links and similar path lookups. Specific traditional post install work can be simply removed, as it will be taken care of by the package itself (for instance, ldconfig, or texinfo's install-info).

If no **do-install** override is present, the port is installed using

```
env -i ${MAKE_ENV} ${FAKE_SETUP} ${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
```

Note that this does set both PREFIX and ${DESTDIRNAME}. If a port's Makefile both heeds ${DESTDIRNAME}, and references PREFIX explicitly, FAKE\_FLAGS may rectify the problem by setting PREFIX=${PREFIX} (which will do the right thing, since ${PREFIX} is a [make(1)](/make/1.md) construct which will not be seen by the shell).

${FAKE\_FLAGS} is used to set variables on [make(1)](/make/1.md) command line, which will override the port Makefile contents. Thus, a port that mentions DESTDIR= does not need any patch to work with fake.

Files such as *${PKGDIR}/README\** or *${PKGDIR}/\*.rc* get copied to *${WRKINST}* right after the end of **fake**, during **generate-readmes** (see the FILES section above for details).

## THE DEBUG\_PACKAGES INFRASTRUCTURE

If DEBUG\_PACKAGES is not empty, debug packages will be built "on the side". Since debug information is usually large, this is controlled on a per-arch basis with DEBUGINFO\_ARCHS controlling the behavior (set to amd64 by default).

During the normal **package** target , [build-debug-info(1)](/build-debug-info/1.md) will be invoked to deduce debug packing-lists from the normal packing-lists, and some extra makefile rules will be invoked to set aside the debug information, and shrink it by processing it through ${DWZ}.

Then each normal package will have a "shadow" debug-\* package built alongside it, with the exact same package signature, except it will also be tied closely with the normal package.

Figuring out what files contain debug information is entirely achieved through **@bin**, **@lib**, **@so** and **@static-lib** annotations in the base packing-lists.

Debug packages will be produced for all subpackages in DEBUG\_PACKAGES. Usually, the heuristics of trimming arch-independent packages from BUILD\_PACKAGES is enough. In case this still produces empty debug packages, the DEBUG\_PACKAGES list should be produced manually.

The actual debug packages are not registered through [register-plist(1)](/register-plist/1.md) since the information was automatically generated.

debug package names and debug package filenames are added to PKGNAMES and PKGFILES respectively for introspection purpose.

egdb(1) from ports can read debug information from a separate file, as long as the original ELF file was annotated with a debuginfo link.

That feature is used to set debug information on the side, in *.debug/* subdirectories alongside the normal binaries, shared objects and shared libraries.

For static libraries, the information can't be separated, instead the full static library with debug information is provided in the *.debug/* subdirectory, while the normal static library gets stripped.

## FLAVORS AND MULTI\_PACKAGES

Starting with OpenBSD 2.7, each port can generate distinct packages through two orthogonal mechanisms: FLAVORS and MULTI\_PACKAGES.

The current MULTI\_PACKAGES mechanism was introduced after OpenBSD 4.0.

The arch-dependent part was refined after OpenBSD 5.0.

If a port can be compiled with several options, these options should be turned into FLAVORS. The port maintainer will set FLAVORS to be the list of possible options in the Makefile. When building the port, the package builder will set FLAVOR='option1 option2...' to build a specific flavor of the port. The Makefile should test the value of FLAVOR as follows:

```
FLAVOR?=
.if ${FLAVOR:Moption1}
# what to do if option1
.endif
.if ${FLAVOR:Moption2}
# what to do if option2
.endif
```

**bsd.port.mk** takes care of a few details, such as generating a distinct work directory for each flavor, or creating a FULLPKGNAME by adding a dash separated list of flavors to the base package name. The order in which FLAVOR is specified does not matter: this dash separated list will be reordered to match the ordering of FLAVORS.

It is an error to specify an option in FLAVOR that does not appear in FLAVORS, to prevent misspellings.

In bulk package building, flavors can be specified as a comma separated list after the package directory, e.g., SUBDIR+=vim,no\_x11( see [pkgpath(7)](/pkgpath/7.md))

Finally, package information will use templates with the canonical package extension if they are available: if FLAVOR='option1 option2' and both COMMENT and COMMENT-option1-option2 are available, COMMENT-option1-option2 will be used.

If one build of a port can generate several distinct packages, set MULTI\_PACKAGES accordingly. Each extension of a MULTI\_PACKAGES name should start with a dash, so that they cannot be confused with FLAVORS. In dependency checking and bulk builds, a subpackage can be specified after a comma, e.g., SUBDIR+=quake,-server. MULTI\_PACKAGES only affects the actual package building step.

If MULTI\_PACKAGES is set, the packaging stage happens once for every subpackage, using subpackage-specific variables. For instance, if MULTI\_PACKAGES=-main -lib -server, PKG\_ARCH-main, PKG\_ARCH-lib and PKG\_ARCH-server will be used for the subpackages respectively called FULLPKGNAME-main, FULLPKGNAME-lib and FULLPKGNAME-server.

All package information is also derived from templates with SUBPACKAGE appended. In the preceding example, the packing-list template for FULLPKGNAME-lib must be in PLIST-lib.

The following variables are subpackage dependent: COMMENT, PKG\_ARCH, PERMIT\_PACKAGE, PKGFILE, PKGNAME, PKGSTEM, FULLPKGNAME, REVISION, EPOCH, FULLPKGPATH, RUN\_DEPENDS, WANTLIB, LIB\_DEPENDS, IGNORE, ONLY\_FOR\_ARCHS, NOT\_FOR\_ARCHS, PKG\_ARGS, PREFIX, CATEGORIES, MESSAGE, UNMESSAGE, DESCR, PLIST, STATIC\_PLIST, PKGSPEC.

The usual non-MULTI\_PACKAGES variables are simply used as default values for all subpackages. So, if you set PKG\_ARCH=\* PKG\_ARCH-main=i386 then PKG\_ARCH-lib and PKG\_ARCH-server will both be ‘\*’.

WANTLIB and LIB\_DEPENDS are special. At the beginning of the build, during **prepare**, all build dependencies will be checked, which includes LIB\_DEPENDS, WANTLIB for every subpackage. As an exception, any LIB\_DEPENDS-sub that references the current port will be ignored as a build dependency, in order to avoid recursion.

FULLPKGPATH and FULLPKGNAME are special as well. If PKGNAME is \<stem\>-\<version\>, then PKGNAME-sub will be set to \<stem\>-sub-\<version\> by default, except for PKGNAME-main which has PKGNAME as a default. Normally, FULLPKGPATH-sub is automatically set to the right value, but in very rare cases, one may need to override the default: for instance, if one specific subpackage is not affected by flavor settings that affect other subpackages, e.g., for include files packs, then the flavoring part of the fullpkgpath may need to be dropped.

In terms of using the port, quite a few targets will have a subpackage specific subtarget: invoking **package** is the same as invoking **subpackage** for all subpackages, invoking **install-all** is the same as invoking **install** for all subpackages, and invoking **update** is the same as invoking **subupdate** for all subpackages.

ONLY\_FOR\_ARCHS and NOT\_FOR\_ARCHS interact with MULTI\_PACKAGES and IGNORE. The infrastructure will automatically filter subpackages that are not suitable for the current architecture. Thus, MULTI\_PACKAGES should always list all subpackages, even things not buildable on the current architecture, for indexing purposes.

Starting with OpenBSD 5.1, [bsd.port.arch.mk(5)](/bsd.port.arch.mk/5.md) should be used to simplify the handling of MULTI\_PACKAGES in arch-dependent setups:

Make sure MULTI\_PACKAGES, ONLY\_FOR\_ARCHS\*, and PSEUDO\_FLAVORS are defined correctly, then

```
.include <bsd.port.arch.mk>
```

This will compute BUILD\_PACKAGES, the list of actual subpackages to build with the current setup, by taking arch constraints and pseudo-flavors into account. Then test BUILD\_PACKAGES to set up the right configuration, e.g., to check if SUBPACKAGE *-mono* should be built:

```
.if ${BUILD_PACKAGES:M-mono}
```

The *lang/gcc* or *print/poppler* ports should provide examples of proper use.

Note that [dpb(1)](/dpb/1.md) will break if all subpackages are not properly listed.

## THE GENERATION OF PACKAGE INFORMATION

Starting after OpenBSD 4.1 all package information is processed directly by [pkg\_create(1)](/pkg_create/1.md) from templates in ${PKG\_DIR}.

- If not overridden by the user, determine which set of templates to use, depending on the current SUBPACKAGE and FLAVOR information. Set PLIST${SUBPACKAGE}, DESCR${SUBPACKAGE}, COMMENT${SUBPACKAGE}, MESSAGE${SUBPACKAGE}, UNMESSAGE${SUBPACKAGE} accordingly.

- Generate the actual DESCR, and if needed, MESSAGE, UNMESSAGE, from the templates in ${DESCR}, ${MESSAGE}, ${UNMESSAGE}, by substituting the variables in ${SUBST\_VARS}, and by substituting ${FLAVORS} with the canonical flavor extension for this port, e.g., if FLAVORS=no\_map gfx qt2, if FLAVOR=gfx no\_map, this is ‘-no\_map-gfx’.

- Generate the actual packing-list from the template ${PLIST}, by inserting fragments and applying the same variable substitutions as other package information.

Note that ${COMMENT} is currently not substituted.

To avoid substitution, variables can be escaped as follows: $\\{PREFIX}

If FLAVORS lists flv, then constructs such as the line %%flv%% or !%%flv%% in the packing-list template trigger the inclusion of *${PKGDIR}/PFRAG.flv${SUBPACKAGE}* or *${PKGDIR}/PFRAG.no-flv${SUBPACKAGE}*. Other fragments can be defined by simply adding -Dfrag=1 or -Dfrag=0 to PKG\_ARGS.

pkg\_add(1) now calls [ldconfig(8)](/ldconfig/8.md) directly, provided dynamic libraries have been annotated with @lib libthingy.so.5.0. Adding new directories to the dynamic loader cache has been deprecated. It is often better to let libraries be visible as a link under ${LOCALBASE}. Having a separate directory is enough to trick [ld(1)](/ld/1.md) into grabbing the right version. Libraries used only for [dlopen(3)](/dlopen/3.md) do not need to be visible. Some programs will prefer to use rpath to find their own libraries.

The special **update-plist** target does a fairly good job of automatically generating the packing-list information.

If PLIST\_REPOSITORY points to a directory, all packing-lists from packages generated by [pkg\_create(1)](/pkg_create/1.md) during the **package** stage are saved in *${PLIST\_REPOSITORY}/${MACHINE\_ARCH}* by a script: *${PORTSDIR}/infrastructure/bin/register-plist*. This script strips some irrelevant information and normalizes the packing-list somehow, and compares it to existing information, looking for relevant changes. Since a package name must always be changed when the packing-list changes, any attempt to replace a packing-list of a given name with a different packing-list will be flagged as an error.

In MULTI\_PACKAGES mode, there must be separate COMMENT, DESCR, and PLIST templates for each SUBPACKAGE (and optional distinct MESSAGE, UNMESSAGE files in a similar way). This contrasts with the FLAVORS situation, where all these files will automatically default to the non-flavor version if there is no flavor-specific file around.

## OBSOLETE TARGETS

- **{build,run,lib}-depends**

  The dependency mechanism now meshes BUILD\_DEPENDS, LIB\_DEPENDS, RUN\_DEPENDS, WANTLIB and MULTI\_PACKAGES. Refer to **prepare**, **install-depends**, **test-depends**.

## OBSOLETE VARIABLES

- FETCH\_BEFORE\_ARGS, FETCH\_AFTER\_ARGS

  Set FETCH\_CMD to point to a script that does any required special treatment instead.

- FETCH\_DEPENDS

  Used to specify dependencies that were needed to fetch files. It is much easier to mirror locally weird distribution files.

- NO\_EXTRACT

  Set EXTRACT\_ONLY= instead.

- NO\_WRKDIR

  All ports should have a working directory, as this is necessary to store cookies and keep state.

- NO\_WRKSUBDIR

  The same functionality is obtained by setting WRKDIST=${WRKDIR}.

- OPSYS\_VER

  Use OSREV instead.

- PKGNAME

  Used to refer to the full package name, has been superseded by FULLPKGNAME-foo, for SUBPACKAGE -foo. PKGNAME now holds the package name, not taking multi-packages or flavors into account. Most ports are not concerned by this change.

- PLIST\_SUBST

  From NetBSD and FreeBSD. Use SUBST\_VARS instead. OpenBSD does not allow general substitutions of the form VAR=value, but uses only a list of variables instead. Most package files gets transformed, instead of only the packing-list.

- SCRIPTDIR

  Old location for scripts related to the current port. There is no reason for the semantic distinction, use FILESDIR for those.

- SITES0, ..., SITES9

  Supplementary locations from which distribution files and patchfiles were retrieved, superseded by the more generic SITES.sufx matching DISTFILES.sufx construct.

- USE\_BZIP2

  The framework will automatically detect the presence of *.tar.bz2* files to extract. See also BZIP2, EXTRACT\_CASES, and EXTRACT\_SUFX.

- USE\_ZIP

  The framework will automatically detect the presence of *.zip* files to extract. See also ZIP, EXTRACT\_CASES, and EXTRACT\_SUFX.

## FILES

- *../Makefile.inc*

  Common Makefile fragment for a set of ports, included automatically.

- *${PORTSDIR}/distfiles*

  Default setup of ${DISTDIR}.

- *${DISTDIR}*

  Cache of all distribution files.

- *distinfo*

  Checksum file. Holds the output of [cksum(1)](/cksum/1.md), using [sha256(1)](/sha256/1.md) for the port's ${DISTFILES\*}, ${SUPDISTFILES\*} and ${PATCHFILES\*}, as well as the sizes of these files.

- *${DISTDIR}/${CHECKSUMFILES}*

  Cache of normal distribution files for a given port.

- *${DISTDIR}/${MAKESUMFILES}*

  Cache of all distribution files for a given port.

- *${PORTSDIR}/infrastructure/mk/\*.mk*

  Actual location of the [make(1)](/make/1.md) glue for the ports tree. [make(1)](/make/1.md) looks for *bsd.port.mk*( and *bsd.port.subdir.mk*) under */usr/share/mk/bsd.port.mk*, but that file is just a stub that redirects to the real location.

- *${PKGDIR}/DESCR*

  Description for the port. Variables such as ${HOMEPAGE} and ${MAINTAINER} will be expanded (see SUBST\_VARS). Multi-package ports will use DESCR${SUBPACKAGE}.

- *${PKGDIR}/README*

  OpenBSD specific documentation for a port, that will be installed as *${LOCALBASE}/share/doc/pkg-readmes/${PKGSTEM}* at the end of **fake**. Variables from SUBST\_VARS will be expanded. Multi-package ports will use *README${SUBPACKAGE}*.

- *${PKGDIR}/\<foo\>.login*

  login.conf.d file for class \<foo\>. Will be installed as *${PREFIX}/share/examples/login.conf.d/foo* at the end of **fake**. When a port provides a daemon started by [rc.d(8)](/rc.d/8.md) requiring non-default [login.conf(5)](/login.conf/5.md) attributes, a sample file should be provided and used as a template by adding **@sample** **/etc/login.conf.d/${***class*} to the packing list.

- *${PKGDIR}/\<foo\>.rc*

  Startup script for \<foo\>. Will be installed as *${RCDIR}/\<foo\>* at the end of **fake**. Variables from SUBST\_VARS will be expanded.

- *${PORTSDIR}/plist*

  Default setup of ${PLIST\_REPOSITORY}.

- *${PORTSDIR}/packages*

  Default setup of ${PACKAGE\_REPOSITORY}.

- *${PACKAGE\_REPOSITORY}/no-arch*

  Location of arch-independent packages.

- *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/all*

  Location of all built packages.

- *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/cache*

  Location of packages retrieved through the network.

- *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/cksums*

  Location of checksums, see CHECKSUM\_PACKAGES.

- *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/cdrom*

  Location of packages suitable for the CD.

- *${PACKAGE\_REPOSITORY}/${MACHINE\_ARCH}/ftp*

  Location of packages suitable for FTP.

- *${PORTSDIR}/bulk/${MACHINE\_ARCH}*

  Default setup of ${BULK\_COOKIES\_DIR}.

- *${PORTSDIR}/update/${MACHINE\_ARCH}*

  Default setup of ${UPDATE\_COOKIES\_DIR}.

- *${PORTSDIR}/mystuff*

  Extra directory used to store local ports before committing them. All depend targets will normally look there after the normal lookup fails. See PORTSDIR\_PATH.

## DIAGNOSTICS

Note that some of these messages are actually emitted by some other external commands, but grouped here for convenience: easier to look for in [dpb(1)](/dpb/1.md)'s logs.

See ERRORS for more details about internal diagnostics.

- /bin/sh: cd .../pkg - No such file or directory

  Emitted during **generate-readmes**. *${PKGDIR}* must point to an existing directory, so that **bsd.port.mk** can be certain there are no *MESSAGEs* or other files pertinent to the package.

- \===\> Building from scratch in ...

  Emitted when a build creates the *${WRKDIR}* for a port. Used by [dpb(1)](/dpb/1.md) to separate clean builds from builds restarted after a crash for statistics collection.

- Discovered old directory in ...

  This message comes from [update-plist(1)](/update-plist/1.md). A directory was found in the packing-list file mentioned in the diagnostic. That directory line used to be needed but is no longer, because it's now accounted for through dependencies. Indicates the old directory has been removed.

- Error: change in plist between ...

  Error message comes from [register-plist(1)](/register-plist/1.md).

- Error: duplicate item in packing-list

  Error message comes from [pkg\_create(1)](/pkg_create/1.md), and will result from incorrect packing-lists, such as including several fragments with the same file, or having incorrect PKG\_ARGS-sub.

- Error: Libraries in packing-lists...and libraries from installed packages don't match

  The ports tree and the installed packages are out-of-sync. Mixing library information from both sources might produce packages that can't be installed elsewhere. Cleanest fix is to update the out-of-date source (e.g., update the ports tree, or build and install new packages). Developers may use PKG\_CREATE\_NO\_CHECKS instead, assuming they understand the implications. See **print-package-args** (**wantlib-args**) for details.

- Fatal: can't flavor a SUBDIR

  A dependency mentions top\_subdir,flavor. Flavor would then be ignored, as it is only applied to individual ports.

- Fatal: can't subpackage a SUBDIR

  A dependency mentions top\_subdir,-sub. Subpackage would then be ignored, as it is only applied to individual ports.

- Fatal: flavor should never start with a digit

  This would utterly confuse pkg\_add(1). See [packages-specs(7)](/packages-specs/7.md).

- Fatal: inclusion of \<file\> from \<file\>

  *bsd.port.mk* or *bsd.port.subdir.mk* has been included from a MODULE or from *Makefile.inc*, resulting in a double inclusion. This would lead to weird results, such as PKG\_ARGS being defined twice.

- Fatal: SITES\* is not defined but referenced by \<file\> in \<DISTFILES\*/PATCHFILES\*/SUPDISTFILES\*\>

  Pretty much self-explanatory.

- Fatal: SUBPACKAGES should always begin with -: \<offending list\>

  That is the only way to differentiate between FLAVOR and SUBPACKAGE in [pkgpath(7)](/pkgpath/7.md) specifications.

- Fatal: building ports requires correctly installed X11

  All file sets of the base OS, including xenocara, must be installed before building ports.

- Fatal: /usr/local/lib/X11/app-defaults should exist and be a symlink

  */usr/local/lib/X11/app-defaults* is distributed as a symlink in the *xshare\*.tgz* file set. If xenocara was not fully installed before packages were added, it may have been created as a directory instead.

- Fatal: the licensing info for \<pkgname\> is incomplete...

  Every port must have explicit defines of all PERMIT\_\* values.

- Fatal: Use 'env FLAVOR=flavor make' instead

  Arguments specified after [make(1)](/make/1.md) are hardcoded for all recursive sub-makes, and very difficult to override. Thus, FLAVOR must be specified in the environment instead.

- Fatal: Use 'env SUBPACKAGE=-sub make' instead

  Arguments specified after [make(1)](/make/1.md) are hardcoded for all recursive sub-makes, and very difficult to override. Thus, SUBPACKAGE must be specified in the environment instead.

- ldconfig: \<dir\>: No such file or directory

  Usually produced by pkg\_add(1) running [ldconfig(8)](/ldconfig/8.md). Some tools such as GNU libtool will add directories living under *${WRKINST}* to the shared library path during the **fake** stage. Of course, [ldconfig(8)](/ldconfig/8.md) will later complain after the directory no longer exists. The bogus tool should be fixed to conform to OpenBSD usage.

- LIB\_DEPENDS \<spec\> not needed for \<FULLPKGPATH\>

  There doesn't seem to be any WANTLIB to match the given LIB\_DEPENDS. Thus, the LIB\_DEPENDS won't turn into a @depends line in the created package. This is often because of confusion between LIB\_DEPENDS and RUN\_DEPENDS: RUN\_DEPENDS is needed for dlopen'd libraries.

  Might be intentional sometimes, if some compile flavors create static binaries, for instance. Also, will happen for multi-packages, where one sets LIB\_DEPENDS to have a given build dependency (and corresponding WANTLIB for a given SUBPACKAGE).

  See **print-package-args** (**lib-depends-args**) for details.

- Not built because unlinked (\<tag\>)

  See UNLINKED.

- Warning: FULLPKGNAME-sub defined but not FULLPKGPATH-sub

  FULLPKGNAME-sub has been explicitly defined by the port, instead of relying on the default, but no value of FULLPKGPATH-sub has been given. This is often an error.

- Warning: no debug-info in ...

  Port uses DEBUG\_PACKAGES so the [build-debug-info(1)](/build-debug-info/1.md) script expects debug information on all binaries and libraries. Most probably, the build machinery for that specific port omitted -g somewhere, or it runs strips during fake anyway. It can also occur if DEBUG\_PACKAGES includes subpackages with no files holding debug info.

- Warning: old style distfiles \<files\>... found

  See **fetch** for the newer way.

- Warning: symlink(s) point to non existent file.

  Warning message comes from [pkg\_create(1)](/pkg_create/1.md). The symlink resides in the fake area, under *${WRKINST}*. This is only a warning because the symlink may point to a run-time dependency, which obviously won't exist under *${WRKINST}* at the time ‘make package’ is run.

- Warning: @option no-default-conflict with no @conflict

  Warning message comes from [pkg\_create(1)](/pkg_create/1.md). Most packages that waive "default-conflict" will have explicit conflict markers instead. Otherwise, the package will only conflict with the exact same version, with some possible REVISION bumps. Any other version or FLAVOR won't conflict. This is generally an error, apart from very few ports like *devel/autoconf/\**.

- groff produced empty result for \<manpage\>...

  Warning message comes from [pkg\_create(1)](/pkg_create/1.md). Manpages are automatically formatted with [groff(1)](/groff/1.md) if USE\_GROFF is set. The above message denotes an actual problem while formatting the page, which should be addressed. In the meantime, [pkg\_create(1)](/pkg_create/1.md) still produces a package, but leaves the manpage unformatted, in the hope that something will be able to make sense of it.

## SEE ALSO

[clean-old-distfiles(1)](/clean-old-distfiles/1.md), [ftp(1)](/ftp/1.md), pkg\_add(1), [pkg\_create(1)](/pkg_create/1.md), [OpenBSD::Intro(3p)](/OpenBSD::Intro/3p.md), [bsd.port.arch.mk(5)](/bsd.port.arch.mk/5.md), [mk.conf(5)](/mk.conf/5.md), [port-modules(5)](/port-modules/5.md), [library-specs(7)](/library-specs/7.md), [mirroring-ports(7)](/mirroring-ports/7.md), [packages-specs(7)](/packages-specs/7.md), [pkgpath(7)](/pkgpath/7.md), [ports(7)](/ports/7.md)

## HISTORY

The ports mechanism originally came from FreeBSD. A lot of additions were taken from NetBSD over the seminal years.

Since 1998, the framework has been systematically cleaned-up and reorganized to remove bugs. New features have been carefully introduced, trying hard to avoid inconsistencies.

FLAVORS, MULTI\_PACKAGES, SEPARATE\_BUILD and FAKE are OpenBSD improvements. Most recent additions do not come from another BSD.

## BUGS

LOCALBASE, X11BASE, BASESYSCONFDIR, VARBASE and PREFIX are not heeded consistently. Using anything but the default values has not been heavily tested. Some ports may not build if you change them.
