BSD.PORT.MK(5)

πŸ“¦ in nixpkgs unstable

πŸ’… bsd.port.mk(5) β€” ports tree master Makefile fragment πŸ’…

File Formats Manual

✨ NAME ✨

bsd.port.mk β€” ports tree master Makefile fragment

πŸ¦‹ SYNOPSIS πŸ¦‹

.include <bsd.port.mk>

🌸 DESCRIPTION 🌸

Okay bestie, so bsd.port.mk is literally the whole ports(7) tree make(1) framework β€” it’s the documented public targets, variables and paths, all in one place. Slay.

The actual bsd.port.mk file lives under ${PORTSDIR}/infrastructure/mk, with make(1)’s system include file redirecting to it. Lowkey iconic.

Optional parts of this framework have been moved to port-modules(5) in an effort to shrink the main file β€” see also MODULES.

⚠️ heads up bestie: identifiers beginning with an underscore are internal-use only and are likely to change without notice. Do not get attached. πŸ’€

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. Periodt.

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) 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) and bulk(8) instead, with packages(7) 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). Ngl, this is the β€œwho comes first” tea. πŸ«–

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

  • 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), most dependent port first. Main character dependency gets the crown 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. Just the first layer, bestie β€” not the whole group chat. πŸ’¬
  • print-{build,run}-depends β€” User convenience target that displays the result of full-{build,run}-depends in a more readable way. It’s giving β€œsame facts, cuter outfit.” πŸ’–
  • {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. Bestie, this is the plug-in system for build steps. πŸ”Œ
  • all-lib-depends-args β€” Process the full LIB_DEPENDS list into a form suitable for pkg_create(1), 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}

That’s the whole vibe: clean environment, make program, make flags, make file, all target. No cap. πŸ”₯

  • check-register β€” Introspection target. Verify from the ports tree, without building anything, that the current subpackage will register okay (see PLIST_REPOSITORY). It’s a vibe check for registration, basically. βœ…
  • check-register-all β€” Apply check-register to all subpackages of the current port. All of them, bestie. Every single one. 🫢
  • checkpatch β€” Check that patches would apply cleanly, but do not modify anything. It’s a rehearsal, not the actual performance. 🎭
  • checksum β€” Compute a sha256(1) 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. That’s the β€œoops, wrong file, try the checksum keyed one” emergency button. 😭
  • 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. Easy. πŸ’…
  • configure β€” Configure the port. By default, configure creates the ${WRKBUILD} directory (see SEPARATE_BUILD), and runs whatever configuration methods are recorded in CONFIGURE_STYLE. It’s the β€œset up the vibe before the real work” target. πŸ› οΈ
  • distclean β€” Shorthand for make clean=dist. 🧹
  • distpatch β€” Apply distribution patches only. See patch, PATCH_CASES and FIX_CRLF_FILES for details. Patches only, bestie β€” not the whole patch moment. 🩹
  • dump-vars β€” Dump the values of all relevant variables in a port, prepended with the port’s FULLPKGPATH. It can be limited to some specific information by setting DPB to nothing or fetch. Mostly used by dpb(1) for obtaining vital information from the ports tree. It’s literally the port’s info dump. πŸ“‹
  • 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. Like, do not. πŸ™…β€β™€οΈ
  • 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. Big difference, bestie. 🚨

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. It’s the β€œdo these libraries actually exist” check. πŸ”
  • 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 urlsufx instead, but store the result as filenamesufx.

Transfers in progress are stored as filenamesufx.part and moved after completion. Cute little .part era. 🫢

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. Lowkey the group-fetch shortcut. ⚑

There are no {pre,do,post}-fetch hooks, as this would break dpb(1). So do not ask for them. πŸ’€

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. It’s fetch’s overachieving sibling. 🌟
  • fix-permissions β€” Ensure permissions are correct when using PORTS_PRIVSEP and/or dpb(1).

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) requirements. Permissions slay, but only when they’re correct. πŸ’…

  • 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). Autotools era, but make it timestamp-safe. πŸ•°οΈ
  • 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. It’s cheap, bestie β€” just run it. πŸŽ€
  • install-depends β€” Before package installation, install and verify dependencies constructed from RUN_DEPENDS, LIB_DEPENDS, and WANTLIB. Gotta make sure the friends are actually there before the main event. πŸ«‚
  • 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. This is the part where the hooks are not giving what you think they’re giving. πŸ‘€
  • install-all β€” Install all packages in a multi-packages port. All of them, periodt. πŸ“¦
  • lib-depends-args β€” Filter LIB_DEPENDS to keep only entries required by WANTLIB, and output a list of dependencies suitable for pkg_create(1), see print-package-args. Only the needed library friends make the list. βœ‚οΈ
  • 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. Faster turn-around, bestie β€” that’s the whole point. πŸƒβ€β™€οΈπŸ’¨

license-check πŸ’…

Okay so this one checks that your PERMIT_PACKAGE settings actually match up β€” if any dependency has a more restrictive setting, it warns you 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. It's giving β€œheads up bestie, but not a whole verdict” ✨

lock πŸ”’

Manually obtain a lock on a given directory. The output must be used to update environment variables β€” like, fr fr, don't ignore it. The lock can be released with unlock. Seldom used, see ports(7) for details.

makesum 🧚

Uses fetch-all to fetch missing ${MAKESUMFILES} without verifying their digest, then runs sha256(1) on them β€” that is, files listed in ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*}. The result is stored in ${CHECKSUM_FILE}, normally distinfo. Also stores the lengths of all files for a quick check during fetch, fetch-all. Checksums girlies stay winning πŸ’–

no-lib-depends-args 🌸

Degenerate form of lib-depends-args that does not do anything. See print-package-args. Literally the β€œdo nothing” button of dependency args πŸ’€

no-wantlib-args πŸ¦‹

Degenerate form of wantlib-args that does not do anything. See print-package-args. Same energy: iconically empty ✨

package πŸ‘‘

Build a port package (or packages in a MULTI_PACKAGES case) from the fake installation. This involves creating packaging information from templates (see COMMENT, SUBST_VARS among others) and invoking pkg_create(1) 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. Not me getting scolded by the ports tree 😭

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)). 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. Packaging slay πŸ’…

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. Historical accident but make it fashion ✨

peek-ftp πŸ™ˆ

Connect to the first site in SITES, in the right directory, and leaves user at ftp(1)'s prompt. Just a lil peek, no cap πŸ‘€

pkglocatedb πŸ—‚οΈ

Top-level target, see ports(7). Short and iconic.

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). 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. Efficient queen behaviour 🫢

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). See print-package-args. Introspection vibes ✨

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”. Prep era πŸ’–

Print all dependency-related information that will be passed as parameters to pkg_create(1), 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. So many args, so little time 😭

Print the update signature, as computed using information from the ports tree, in the same format used for pkg_info(1) -S. Signature reveals are a vibe πŸ’…

Generate and print a package packing-list from the static information present in the port. Static info only, bestie ✨

Iterate over print-plist for all subpackages in a given port. All of them, no skipping πŸ‘‘

Iterate over print-plist-with-depends for all subpackages in a given port. Same all-subpackages energy, but with depends πŸ’–

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). Files only, tagged and cute πŸŽ€

Generate and print the list of static and dynamic libraries present in the port. See pkg_create(1). Library inventory bestie ✨

Iterate over print-plist-libs for all subpackages in a given port. All the libs, all the subpackages πŸ’…

Like print-plist-libs, but slower. It also handles LIB_DEPENDS, RUN_DEPENDS, and WANTLIB, so that the packing-list has complete dependency information. Slower but thorough β€” highkey worth it 🫢

Like print-plist, but slower. It also handles LIB_DEPENDS, RUN_DEPENDS, and WANTLIB, so that the packing-list is complete. Complete packing-list, complete vibe ⭐

rebuild πŸ’€

Force rebuild of the port. No thoughts, just rebuild 😭

regen 🧚

Force rebuilding configure scripts using gen steps. Regenerate era ✨

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. Reinstall girlies be careful πŸ’–

repackage πŸ“¦

Rebuild the packages of a port after removing existing packages. Out with the old packages, in with the new πŸ’…

run-depends-args πŸƒ

Process RUN_DEPENDS and outputs a list of dependencies suitable for pkg_create(1), see print-package-args. Run depends, run ✨

reprepare 🫢

Force running the prepare target again. Prep again, bestie πŸ’–

retest πŸ§ͺ

Force running the test target again. Test again, no cap πŸ”₯

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. The β€œjust tell me the variable” target πŸ’…

show-debug-info πŸ›

Displays the information that was generated by build-debug-info(1). Debug tea β˜•βœ¨

show-fake-size πŸ“

Print the size of ${WRKINST}, in kilobytes. Used by some options of dpb(1), suitable for BULK_TARGETS. Size check, but make it fake πŸ’–

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. Indexed and iconic ✨

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. Debugging realness 😭

show-prepare-results 🧚

Print the list of actual installed packages found out by prepare. Receipts from prep πŸ’…

show-prepare-test-results πŸ§ͺ

Print the list of actual installed packages found out by prepare and test-depends. Even more receipts ✨

show-required-by πŸ•ΈοΈ

Print the list of pkgpath(7) 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. Slow walk energy, bestie 😭

show-run-depends πŸƒβ€β™€οΈ

Print all running dependencies for a port, one per-line, without duplicates. Run deps, no dupes πŸ’–

subpackage 🎁

Build a port package. Exactly like package, but affects only one single subpackage in multi-packages ports. One subpackage at a time, main character energy πŸ‘‘

show-size πŸ“

Print the size of the work directory, in kilobytes. Used by some options of dpb(1), suitable for BULK_TARGETS. Work directory measurements, slay ✨

subupdate πŸ”„

Update an existing installation to a newer package, exactly like update, but affects only one single subpackage in multi-packages ports. One subpackage update, cute and targeted πŸ’…

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. Testing era, no cap πŸ”₯

test-depends 🧚

Before running regression tests, install and verify dependencies constructed from TEST_DEPENDS. Test deps first, bestie πŸ’–

unlock πŸ”“

Manually release a lock on a given directory. See lock. Unlock and release ✨

update-patches 🩹

Create or update patches for a port, using update-patches(1). See EDIT_PATCHES. Patch refresh vibes πŸŽ€

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): update is always β€˜best-effort’ and will often not work correctly when updating to a significantly different newer version. Bestie, this is not a magic fix β€” it's giving β€œwe try our best” πŸ˜­πŸ’–

update-or-install

Updates an already-installed package or does a fresh install, using pkg_add -r. In multi-packages ports it handles, like, exactly one single package β€” very "one at a time bestie" energy. Also peep UPDATE_COOKIES_DIR and FORCE_UPDATE. πŸ’…

update-or-install-all

Same deal as update-or-install (pkg_add -r, etc.) but it handles all the packages in multi-packages ports. Also see UPDATE_COOKIES_DIR and FORCE_UPDATE. ✨

update-plist

Updates the packing-lists for a port β€” using the fake installation plus the existing packing lists β€” by invoking update-plist(1) with the correct parameters, along with port-specific options (UPDATE_PLIST_ARGS) and user settings (UPDATE_PLIST_OPTS). Lowkey also check out SUBST_VARS for the deets on how variable substitution is handled by default. πŸŽ€

verbose-show

Basically show but extra: it prefixes each value with the variable name, like VAR=value. And heads up β€” it does not show undefined variables, which is the opposite of show, who will happily output blank lines for those. πŸ™ˆ

wantlib-args

Calls port-wantlib-args and fake-wantlib-args, compares the two results, and errors out if there's any discrepancy. See print-package-args. πŸ’€


✨ VARIABLES ✨

Ok so quick heads up before we dive in πŸ‘‘: some of these variables are marked as β€˜User settings’, which means individual ports should not be out here modifying them, tyvm. And some are marked β€˜read-only’, which means they shouldn't ever be changed, periodt.

Also β€” in a MULTI_PACKAGES setup, some variables have settings specific to a given subpackage. Go read β€œFLAVORS AND MULTI_PACKAGES” for that whole situation. πŸ¦‹

show β€” Invoked as make show=name, and it shows the contents of ${name}. Invoked as make show="name1 name2 ...", and it shows the contents of ${name1} ${name2} ..., one variable value per line. Slay. πŸ’–


ALL_DISTFILES

List of all the actual files coming from every DISTFILES* setting, after applying the β€˜filename{url}sufx’ conversion. Occasionally useful for setting EXTRACT_ONLY by hand. 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 the actual files coming from every PATCHFILES* setting, after applying the β€˜filename{url}sufx’ conversion. Read-only. πŸŽ€

ALL_SUPDISTFILES

List of all the 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 the software. Default is all. Can be set to empty, which gives you a package's default target. 🫢

APM_ARCHS

Set to the list of apm(4) architectures. Read-only. Use it with ONLY_FOR_ARCHS.

ARCH

Current machine architecture. Read-only. πŸ”’

AUTOCONF

Location of the autoconf binary, if you need it. 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 (iconic, honestly). The main autoconf script is a shell wrapper in the devel/metaauto package, and it's similar 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 too. AUTOMAKE_VERSION must be set before trying to run automake. Defaults to 1.4.

AUTORECONF

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

BASE_PKGPATH

Full pkgpath(7) 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 the 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 it 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 in order 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) for the deets.

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 being 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): 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, because the pseudo-flavor gets 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. Wild, right? 😭

BUILD_PKGPATH

Full pkgpath(7) to the current port, taking flavors and pseudo-flavors into account. See also BASE_PKGPATH, which doesn't include pseudo-flavors.

Mostly useful for writing dependencies for subpackages like this: LIB_DEPENDS-foo=${BUILD_PKGPATH} β€” and avoiding starting to build a package with some other flavor combination. See pkgpath(7) 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 this only for broken ports β€” set it to the 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 that are broken on a given architecture. This is 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 the 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 applies 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 by default. 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 by default. Can be set on a per-${PKGPATH} basis, e.g. BULK_TARGETS_${PKGPATH}=... πŸ’…

BZIP2

Name of the bzip2 binary.

CATEGORIES

List of descriptive categories this port falls into. Mandatory. One entry must match the current pkgpath: devel/gmake must belong to the β€˜devel’ category. πŸ‘‘

  • CCACHE_DIR β€” where the cache lives when USE_CCACHE is set to yes, bestie πŸ’… defaults to ${WRKOBJDIR}/.ccache.
  • CCACHE_ENV β€” extra env vars to shove in when USE_CCACHE is set to yes. Like, say you want verbose logging, you'd go CCACHE_ENV="CCACHE_LOGFILE=/tmp/ccache.log". Obsessed with the debugging potential tbh.
  • CDIAGFLAGS β€” flags that get appended to CFLAGS if WARNINGS is set. Diagnostic slay ✨
  • CFLAGS β€” the default flags handed to the compiler when building. Fair warning: many ports literally ignore it πŸ’€ see also COPTS, CDIAGFLAGS.
  • CFLAGS_${CHOSEN_COMPILER} β€” more flags, appended to CFLAGS depending on what CHOSEN_COMPILER ended up being. The common usage pattern is giving:
CFLAGS_base-clang =      -Wno-error=unused-but-set-variable

see also COMPILER, COMPILER_LANGS and CHOSEN_COMPILER.

  • CHECK_LIB_DEPENDS β€” user settings, your call 🫢 if you set it to β€˜Yes’, every single package build will verify that shared libraries are correctly registered. It's basically the same as running β€˜make lib-depends-check’ after each package build. Defaults to β€˜No’, because (a) that's a big performance hit, and (b) because lib-depends-check doesn't know about library subdirectories or dynamic loading through dlopen(3). So like, no cap, it can't see everything 😭
  • CHECK_LIB_DEPENDS_ARGS β€” a list of extra arguments for check-lib-depends(1).
  • CHECKSUMFILES β€” the list of all the 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 β€” where this port's checksums live, used by checksum, makesum, and dpb(1). Defaults to distinfo.
  • CHECKSUM_PACKAGES β€” user settings again πŸ’… choose whether or not to checksum packages while building. The result gets deposited in ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums/${FULLPKGNAME}.sha256. Set it to β€˜Yes’ to compute a checksum for all packages, or to β€˜ftp’ to compute it only for PERMIT_PACKAGE packages. Defaults to β€˜no’, which computes no checksum at all. Zero. Nada. 🌸
  • CHOSEN_COMPILER β€” read-only πŸ”’ the compiler suite that the COMPILER mechanism picked. Set it to β€˜irrelevant’ to straight-up disable COMPILER.
  • CLEANDEPENDS β€” if you set it to β€˜Yes’, the clean target will also clean the dependencies. Iconic. You can override it per-${PKGPATH} by setting CLEANDEPENDS_${PKGPATH} 🧹
  • COMMENT β€” the short description of the port (no more than 60 characters, so keep it cute and brief πŸŽ€), used for the package and the INDEX. It shouldn't start with an uppercase letter unless that capital actually means something semantically.
  • COMMENT-foo β€” same as COMMENT but it's for the sub package -foo in a multi-package setup.
  • COMMENT-vanilla β€” same as COMMENT but for a flavored package, specifically when the non-flavored comment just isn't it πŸ™ˆ
  • COMMENT-foo-vanilla β€” same as COMMENT but for a sub-, flavored package. Yes the name is a whole journey.
  • COMES_WITH β€” the first release where the port became part of the standard distribution. If the current OpenBSD version is >= this version, then instead of building the port you'll just get a notice displayed. It's giving "we already have that at home" πŸ’€
  • COMPILER β€” picks your preferred compiler. The first element in the list that matches gets chosen πŸ‘‘
    • base-gcc β€” the gcc 4.2 compiler from base
    • base-clang β€” the clang compiler from base
    • ports-gcc β€” the gcc 8 compiler from ports (heeds MODGCC4_ARCHS from the module)
    • ports-clang β€” the clang compiler from ports (heeds MODCLANG_ARCHS from the module)

The first compiler that matches criteria wins. On clang-based architectures β€˜base-gcc’ never matches, like not even a little bit πŸ’…

Defaults to base compilers, e.g., β€˜base-clang base-gcc’.

The usual reasons for explicitly setting COMPILER are, honestly: 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 😭 classic.

With COMPILER in effect, MODGCC4_ARCHS and MODCLANG_ARCHS default to β€˜${GCC49_ARCHS}’ and β€˜${LLVM_ARCHS}’ respectively.

ONLY_FOR_ARCHS will also be set if applicable.

  • COMPILER_LANGS β€” whatever you put in COMPILER_LANGS gets 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 the old modules annotations, so that it's possible to select, e.g., β€˜gfortran’ from gcc 8 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, forcing the compiler flags to be set (-B is required for clang to find ${WRKDIR}/bin/ld as used by USE_WXNEEDED) and to call COMPILER_WRAPPER if one's in use πŸ› οΈ
  • COMPILER_WRAPPER β€” an external program used to "wrap" compilers. It gets populated automatically by USE_CCACHE, or you can set it explicitly for other purposes (e.g. distcc).
  • CONFIG_SITE_LIST β€” used when CONFIGURE_STYLE=gnu, or with MODULES += gnu. It's a list of config.site fragments that speed up gnu-configure and stop it from preferring various gnu programs unless BUILD_DEPENDS explicitly asks for them. Read-only, but it's available for debugging purposes πŸ”
  • CLANG_ARCHS, GCC4_ARCHS β€” the list of architectures using Clang or GCC 4.2.1 as the base compiler. Read-only. Use these with NOT_FOR_ARCHS or ONLY_FOR_ARCHS to limit ports to architectures where they actually compile πŸ™
  • CONFIGURE_ARGS β€” arguments passed to the configure script. Defaults are empty, except for GNU-style configure, where prefix and sysconfdir are set.
  • CONFIGURE_ENV β€” the basic environment passed to the configure script (path and libtool setup). GNU-style configure adds a lot more variables.
  • CONFIGURE_SCRIPT β€” set it to the name of the script invoked by the configure target, if appropriate. It should be either an absolute path, or relative to ${WRKSRC}.
  • CONFIGURE_STYLE β€” set this to the style of configuration that needs to happen. The choices, bestie:
    • If β€˜perl’, assume perl(1)'s ExtUtils::MakeMaker(3p) 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 the port doesn't handle DESTDIR correctly and needs to be configured to add DESTDIR to prefixes (see also DESTDIRNAME). Add β€˜old’ if the port is an older autoconf port that doesn't 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 the port configures using the X11 ports Imakefile framework. Add β€˜noman’ if the port has no man pages that the Imakefile should try installing.
    • If β€˜simple’, there is a configure script, it just doesn't fit the normal GNU configure conventions.

Extensions may be defined by specific MODULES β€” see port-modules(5) for the details.

  • COPTS β€” user settings πŸ’– supplementary options appended to ${CFLAGS} for building. Since most ports ignore the COPTS convention, they actually get told to use ${CFLAGS} ${COPTS} as CFLAGS. Sneaky but it works.
  • CXXDIAGFLAGS β€” flags appended to CXXFLAGS if WARNINGS is set.
  • CXXFLAGS β€” the default flags passed to the C++ compiler for building. Many ports ignore it, shrug 😭
  • CXXFLAGS_${CHOSEN_COMPILER} β€” additional flags 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 β€” a list of ${SUBPACKAGES} for which debug packages should be built "on the side". Usually set as DEBUG_PACKAGES=${BUILD_PACKAGES} for packages where debug info is desirable. Heads up: the subpackages with PKG_ARCH=* get automatically stripped from that list. See β€œTHE DEBUG_PACKAGES INFRASTRUCTURE” below for the details πŸ‘€
  • DEBUGINFO_ARCHS β€” the list of archs for which debug information may be provided as extra packages. Normally only amd64 and aarch64, for performance reasons ⚑
  • DESCR β€” the location of the description file for the package. Defaults to ${PKGDIR}/DESCR (or ${PKGDIR}/DESCR${SUBPACKAGE} for multi-packages).
  • DESTDIR β€” see DESTDIRNAME.
  • DESTDIRNAME β€” the name of the variable to set to ${WRKINST} while faking. Usually DESTDIR. This is for the rare cases where a port heeds DESTDIR in a few directories and needs to be configured with β€˜gnu dest’, so those few directories don't get in the way πŸŽ€
  • DIST_TUPLE β€” a list of distfile templates to use, each one consisting of five entries: name account project tagname/commithash targetdir. The template name should currently be one of β€˜codeberg’, β€˜fdo’, β€˜github’, β€˜gitlab’, β€˜gnome’, β€˜kde’, or β€˜srht’ (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 get moved to ${WRKDIST}/<targetdir>. Using β€˜.’ for targetdir will disable the move 🚚

  • DISTDIR β€” user settings. The directory where all ports distribution files and patchfiles are stashed. Defaults to ${PORTSDIR}/distfiles. Override it if your distribution files are stored somewhere else. And always use FULLDISTDIR to refer to a port's distribution files location, because it takes an eventual DIST_SUBDIR into account πŸ’…βœ¨
  • DISTFILES* β€” the main port's distribution files, aka the actual software source (binary-only ports sit this one out 🫢). These get pulled from the matching SITES* (peep fetch), checksummed, then extracted (peep checksum, extract). Normally DISTFILES is just a list of files.

Here's the cute part: slap a suffix on DISTFILES and the site entry switches over to the matching SITES variable, like so:

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

Each entry can optionally be shaped like filename{url}sufx, which is the move when a site only hands out archives as weird urls β€” it transfers urlsufx into the result file filenamesufx. So if you've got

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

then fetch retrieves from the url minetest/archive/${V}${EXTRACT_SUFX} into minetest-${V}${EXTRACT_SUFX}. Iconic behaviour, honestly.

If your ${DISTFILES*} changes depending on FLAVORS or architecture, use SUPDISTFILES* so that distfiles mirroring and makesum's proper operation still work. No cap, you need this one.

And if no DISTFILES* is set and SITES isn't null, then DISTFILES gets set to ${DISTNAME}${EXTRACT_SUFX}. Free real estate ✨

  • DISTNAME β€” the name used to identify the port. See DISTFILES* and PKGNAME.
  • DISTORIG β€” the suffix distpatch uses to rename original files. Defaults to .bak.orig. It's deliberately different from PATCHORIG so you don't confuse update-patches πŸ’…
  • DIST_SUBDIR β€” optional subdirectory of ${DISTDIR} where this port's distribution files and patchfiles live. See target fetch.
  • DPB β€” set by the Distributed Ports Builder so it only grabs the info it actually needs from dump-vars.
  • DPB_LOCKNAME β€” if set, dpb(1) uses this instead of the default PKGPATH-derived name. Heads up: this feature comes with large restrictions and shouldn't be used unless it's absolutely necessary. Specifically, it can let dpb build several flavors of the same port at the same time, but beware: under MULTI_PACKAGES and PSEUDO_FLAVORS conditions, if some of those packages are identical across flavors, this will not work 😭 It also makes interacting with locks harder when the names aren't obvious.
  • DPB_PROPERTIES β€” annotations for the Distributed Ports Builder. See dpb(1) for the semantics.
  • DUMMY_PACKAGE β€” if defined, bsd.port.mk provides dummy values for the variables that are mandatory for a minimally functional port. It's what the sqlports package and dpb(1) use to do introspection and grab bsd.port.mk's default values for variables without needing to touch any specific port.
  • DWZ β€” the command line invocation of dwz(1) used to shrink debug info while building debug packages. Defaults to dwz -L 100000000. You can set it to : to not run dwz(1) at all. See β€œTHE DEBUG_PACKAGES INFRASTRUCTURE” for the deets.
  • ECHO_MSG β€” user settings. Used to display ===> Configuring for foo and other similarly informative messages. Override it if you wanna turn that 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 β€” the epoch number of the current package. Used when the port version changed but packages-specs(7) doesn't consider the new version to be newer. Once added, it cannot be removed or go backwards 🚨 Defaults to empty (no need for numbering changes), and then numbering starts at 0. It gets automatically incorporated into FULLPKGNAME as v${EPOCH} to form a full package-name that conforms to packages-specs(7).
  • ERRORS β€” the list of errors found while parsing the port's Makefile. These get displayed before making any target, and if any error starts with "Fatal":, nothing gets made at all. Like:
.if !defined(COMMENT)
ERRORS+="Fatal: Missing comment"
.endif

A porter can add to ERRORS, for instance to flag erroneous combos 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. Sad but true πŸ™ˆ

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 (a 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 these 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 that bsd.port.mk doesn't support directly can be added, and existing cases can be overridden. For example, this 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 this to the list of distfiles to actually extract, if some distfiles shouldn't be extracted during the do-extract stage. Defaults to ${ALL_DISTFILES}, and can even be set to empty.
  • EXTRACT_SUFX β€” used to set the 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 the distfiles. Its content is subject to shell evaluation as part of EXTRACT_CASES, and it gets passed as the file ... argument to tar(1) or unzip(1) β€” so glob(7) patterns and shell brace expansion are fair game πŸ’… Empty by default, which means extract all the files.
  • FAKE_FLAGS β€” extra flags passed to ${MAKE_PROGRAM} during the fake invocation. Empty by default. Also see ALL_FAKE_FLAGS.
  • FAKE_SETUP β€” the list of environment values normally set during fake invocations. Exposed so modules can provide their own do-install. Read-only β€” see β€œTHE FAKE FRAMEWORK” section for the details.
  • FAKE_TARGET β€” the target built by ${MAKE_PROGRAM} on fake invocation. Defaults to ${INSTALL_TARGET}.
  • FAKEOBJDIR β€” user settings. If non-empty, it's used as a base for the fake staging area, and the real fake directory ${WRKINST} gets created inside it. You can set it on a per-${PKGPATH} basis β€” so setting FAKEOBJDIR_www/mozilla-firefox=/tmp/obj affects only the mozilla-firefox port. Obsessed with the precision 🎯
  • FETCH_CMD β€” user settings. The command used to fetch distribution files for this port. Defaults to ftp(1). Can be used to get 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 can't be fetched automatically for licensing reasons 😭 In this case, set FETCH_MANUALLY to a list of strings that get 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 it to pkg_add(1) options. It instructs the package target to download packages missing from the repository from locations in ${PKG_PATH} and drop them into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/, only building them if no suitable packages are found. For instance,
make FETCH_PACKAGES=

to use it without any options, or

make FETCH_PACKAGES=-Dsnap

to use close to release.

  • FILESDIR β€” the location of other files related to the current port. Default: files.
  • FETCH_USER β€” the 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 that 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), and to avoid problems with patches (especially when they're 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 the contents of ${WRKDIR} to world-readable at the end of extract. Used for some distfile contents that 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 the functionalities that are wanted.
  • FLAVORS β€” the 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 β€” the canonical list of flavors being set for the current build, dash-separated. See FULLPKGNAME.
  • FORCE_UPDATE β€” user setting bestie πŸ’… if it's set to 'Yes', then the update target will always update an installed package the second its signature differs, and every dependency that installs packages will force an update too. Set it to 'hard' and the update target gon' update installed packages even when the signature didn't change at all. no cap.
  • FULLDISTDIR β€” the complete path to the directory where ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*} live, for use in hand-crafted extraction targets. Read-only, so don't come for her 🫢
  • FULLPKGNAME β€” the full name of the created package, flavors taken into account. Defaults to ${PKGNAME}${FLAVOR_EXT}. Also peek at EPOCH and REVISION ✨
  • FULLPKGPATH β€” path to the current port's directory, relative to ${PORTSDIR}, flavors and subpackages included. See pkgpath(7) πŸ¦‹
  • GH_* β€” simple support for GitHub-hosted projects. Leave it empty for projects that aren't hosted there. It yields a suitable default for SITES_GITHUB and DISTNAME. For messier situations, use DIST_TUPLE β€” iykyk πŸ’€
  • GH_ACCOUNT β€” account name of the GitHub user hosting the project.
  • GH_COMMIT β€” the 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, periodt. ${WRKDIST} is auto-generated based on the ${GH_TAGNAME} if specified, otherwise ${GH_COMMIT} gets used to generate ${WRKDIST}.
  • GMAKE β€” location of the GNU make binary, if you need it. Defaults to gmake.
  • HOMEPAGE β€” URL to the homepage of the software, if applicable πŸ’–
  • IGNORE β€” for ignored ports, set this to the reasons the port is ignored. If it's non-empty, most common targets that actually 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 setting. If set to 'Yes', ignored ports become fatal errors πŸ’€
  • IGNORE_SILENT β€” user setting. If set to 'Yes', print nothing at all when ignoring a port 🀫
  • INSTALL_DEBUG_PACKAGES β€” user setting. 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 β€” the target invoked to install the software, during fake installation. Default is 'install'.
  • INTERACTIVE β€” user setting. Set to 'Yes' to skip all non-interactive ports. Used together with BATCH to simplify bulk-package builds.
  • IS_INTERACTIVE β€” set to 'Yes' if the port needs human interaction to build.
Heads up bestie: 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 β€” the way that's just cleaner ✨

  • LE_ARCHS β€” set to the list of little-endian architectures. Read-only. Use it 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) for more details πŸ¦‹

  • lib_depends_args β€” controls the behavior of pkg_create(1) 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 β€” since ld.lld(1) doesn't have a default emulation mode, if it's the linker in-use, LLD_EMUL defaults to the correct option to set the emulation mode; otherwise it stays empty. Read-only. Seldom used, since it's 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 the 'lang/clang' port module, see port-modules(5). 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 setting. Defaults to ${WRKOBJDIR}/locks. If set, points to a local directory common for all instances of concurrent ports builds πŸ”’
  • LOCK_CMD β€” user setting. Expands to a command that will acquire a lock, namely portlock(1). See also ports(7).
  • LOCK_VERBOSE β€” user setting. 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 the 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'.
Fair warning bestie 😭 make(1) still has bugs that may prevent parallel build from working correctly! not me getting personally victimized by a race condition
  • MAKE_PROGRAM β€” the make program used for building the port. Set to ${MAKE} or ${GMAKE} depending on USE_GMAKE. Read-only.
  • MAKEFILE_LIST β€” introspection variable, see make(1).
  • MAKESUMFILES β€” list of all files that need to be retrieved by fetch-all, with DIST_SUBDIR prepended and with the 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 it 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 that needs to be replaced with "#!/usr/bin/perl", list them in MODPERL_ADJ_FILES. File paths here should be relative to WRKSRC. These files get 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 gets regenerated using a current version of Devel::PPPort(3p). 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's possible to do 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) ✨
  • 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 the port doesn't need any build stage at all πŸ¦‹
  • 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) to dodge checksums entirely, because dpb(1) is already out here handling checksums internally like the responsible main character it is. No cap.

NO_DEPENDS 🚫

User settings. Don't verify the build of dependencies, bestie. Do NOT use this in any ports Makefile β€” it's strictly a user-convenience thing for when, say, you just wanna browse through a port's source and you're not trying to trigger a whole dependency build cascade. We've all been there. πŸ™ˆ

NO_IGNORE 🩹

User settings. If set to Yes, avoid ignoring a port for the usual reasons. Use it for, like, fetching all distribution files, or fixing a broken port. Also peep IGNORE and TRY_BROKEN β€” they're in the group chat too. πŸ’…

NO_SCCACHE ⚑

Set to Yes to stop sccache from being used when building a certain port, even when USE_SCCACHE is set. Like, we know the setting is on, we're just not doing it for this one. Periodt.

NO_TEST πŸ§ͺ

This port has no regression tests. Only set it to Yes for ports with genuinely zero regression tests β€” leave it alone for ports with empty regression tests, and for ports with failing tests. Why? Because that way, if a later update of the port suddenly acquires actual regression tests, they get picked up automatically. Foresight queen behavior. πŸ‘‘

ONLY_FOR_ARCHS πŸ–₯️

The list of architectures on which this port builds. It can hold both processor-specific info (e.g. powerpc) and more specific model info (e.g. macppc). This one is subpackage dependent β€” so if some subpackages should only build on some architectures, go read the corresponding part of "FLAVORS AND MULTI_PACKAGES". iykyk.

OSREV πŸ”’

Revision number of OpenBSD. Read-only β€” hands off, she's not yours.

PACKAGE_REPOSITORY πŸ“¦

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

PARALLEL_MAKE_FLAGS πŸƒβ€β™€οΈ

Used when DPB_PROPERTIES contains parallel. These are the flags passed to MAKE_PROGRAM to get a parallel build, and it defaults to -j${MAKE_JOBS}. Mostly it gets set to empty by ports that use other mechanisms for setting the number of jobs β€” different strokes. πŸ’«

PARALLEL_MAKE_JOBS 🧡

User settings. The value of MAKE_JOBS to use when you're building a port manually and DPB_PROPERTIES contains parallel. Defaults to the number of online cpus. Free performance, bestie. πŸ”₯

PATCH 🩹

The command used to apply all patches. Defaults to /usr/bin/patch. Iconic, reliable, no notes.

PATCHORIG 🏷️

The suffix used by patch to rename original files, and by 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. Also peep distpatch and 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 get automatically appended to handle gzip'ed, bzip'ed and lzip'ed patches, so the default case is more or less equivalent to this shell fragment β€” verbatim, bestie:

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. Simple, elegant, slay.

PATCHFILES* ⬇️

Files to fetch from the master sites like DISTFILES*, but serving a different purpose β€” they hold distribution patches that get applied at the patch stage. Also see SUPDISTFILES*. πŸŽ€

PATCH_ARGS βš™οΈ

The full list of options used while applying the port's patches.

PATCH_CHECK_ONLY βœ…

Set to Yes by the checkpatch target. Don't touch it unless the default checkpatch target genuinely needs redefining. Ideally, user-defined patch subtargets ought to test checkpatch β€” in practice, they don't. 😭

PATCH_DIST_ARGS βš™οΈ

The full list of options used while applying distribution patches.

PATCH_DIST_STRIP βœ‚οΈ

The 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. Also 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. Stealth mode.

PATCH_STRIP βœ‚οΈ

The patch option used to strip directory levels while applying the 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 it to the 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. Fr fr, don't guess on legal stuff. 😭

If PERMIT_PACKAGE is set to Yes, PERMIT_DISTFILES will default to Yes.

PKG_ADD πŸ“₯

User settings. Path to the 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), in addition to the default ones.

PKG_CREATE πŸ› οΈ

User settings. Path to the pkg_create(1) 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 it to Warn to have the differences printed as a warning instead of an error β€” that's the default, bestie. πŸ’…

PKG_DBDIR πŸ—„οΈ

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

PKG_DELETE πŸ—‘οΈ

User settings. Path to the pkg_delete(1) command, with possible options.

PKG_INFO πŸ”

User settings. Path to the pkg_info(1) command, with possible options.

PKG_TMPDIR 🌑️

See pkg_add(1). Normally points to /var/tmp, as per default.

PORTHOME 🏠

Setting of the env variable HOME for most shell invocations. The default will trip ports that try to write into $HOME while building: non-existent /${PKGPATH}_writes_to_HOME/. Not me getting caught trying to write to a folder that literally does not exist πŸ’€

PORTPATH πŸ›£οΈ

Path used by most shell invocations. Don't override unless really needed. Like, actually. πŸ™

PORTSDIR 🌳

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

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, ports get built as BUILD_USER and distfiles get fetched 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 be used in concert with dpb(1), which uses the same permissions (see 'THE SECURITY MODEL OF DPB' in dpb(1)).

Basically, BUILD_USER must be able to write into ${WRKOBJDIR}, ${PACKAGE_REPOSITORY}, ${PLIST_REPOSITORY}, and FETCH_USER must be able to write into ${DISTDIR}. Those 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) by setting SUDO=doas in mk.conf(5) and using the following minimal doas.conf(5) β€” exact vibes:

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. Big nope energy.

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

As dpb(1) 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. Stay in your lane, PKGNAME. πŸ’…

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. The vibe check for package names, honestly. βœ…

PKGNAME-foo 🧬

Package name for sub-package foo, if the default value of ${PKGNAME}${SUBPACKAGE} is not appropriate. Custom fit. πŸŽ€

PKGPATH πŸ—ΊοΈ

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

PKGPATHS

Read-only, bestie β€” don't even think about touching it. πŸ’… It's the list of every package path the port generates, with FLAVORS and MULTI_PACKAGES all factored in. And the order? Matches PKGNAMES exactly, one-to-one, no cap.


PKGSPEC

The default package spec you get when using this port as a dependency. Defaults to stem-*, derived from FULLPKGNAME. πŸŽ€

Do not override this without genuinely good reasons β€” and by good reasons we mean software that coexists as different incompatible versions with the same stem. Which is, and I quote the manpage, "already a mess." 😭

Also peep the description of -P in pkg_create(1), iykyk.


PKGSTEM

The base for the package name, minus any version number. Used in README file names and the actual contents of those READMEs. You can override it for ports that have branches β€” like php, for example:

PKGSTEM-main = php-5.6

PLIST

Where the package packing-list lives. Defaults to ${PKGDIR}/PLIST, or to ${PKGDIR}/PLIST${SUBPACKAGE} for multi-packages. πŸ¦‹


PLIST_DB

Deprecated, babe. Go see PLIST_REPOSITORY instead. πŸ’€


PLIST_REPOSITORY

User settings ✨ β€” this is the base directory used to save generated packing-lists as persistent information. Those packing-lists get processed by a script, register-plist(1), which will absolutely call you out when packing-lists change without a REVISION bump. It also knows enough about package version numbers that when something in the package or its dependencies goes backward, it catches those EPOCH issues too. Iconic detective behaviour, honestly.

This directory is never cleaned during normal operation. make clean=plist should only ever be used during debugging, by port maintainers, periodt.

Defaults to ${PORTSDIR}/plist β€” and yes, the plists actually get saved into ${PLIST_REPOSITORY}/${MACHINE_ARCH}. If you set it to empty, nothing gets registered at all: very much unsafe. πŸ™ˆ


PORTROACH

Controls the behavior of misc/portroach, documented in detail at https://jasperla.github.io/portroach/docs/portroach-portconfig.txt β€” go read it, it ate.


PREFIX

The 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. Also, firmware files generally install under ${BASESYSCONFDIR}. 🧚


PREPARE_CHECK_ONLY

Build settings πŸ’– β€” prevents the prepare stage from installing anything. It just checks dependencies and handles [:target] dependencies. Mostly used by dpb(1), which already installs everything before running prepare. Lowkey efficient.


PROGRESS_METER

User settings. Defaults to Yes. Forces commands like ftp(1) and pkg_create(1) to use their progress-meter even when there's no terminal in sight. The little bar slays on regardless. πŸ”₯


PROPERTIES

A list of properties specific to a given machine architecture, obtained through including bsd.port.arch.mk(5). You can vibe-check them 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 setups, using ONLY_FOR_ARCHS-sub and BUILD_PACKAGES is generally preferred β€” and simpler, ngl. Possible properties include:

  • apm β€” the architecture possesses suspend (apm) support.
  • be β€” the architecture is big-endian.
  • gccN β€” gccN architecture.
  • le β€” the architecture is little-endian.
  • lp64 β€” lp64 architecture.
  • llvm β€” there's lang/llvm support on this architecture.
  • mono β€” there's lang/mono support on this architecture.

PSEUDO_FLAVOR

The list of flavors in FLAVOR that are actually pseudo-flavors. Only for introspection purposes. Read-only, hands off. πŸ™…


PSEUDO_FLAVORS

The extra list of flavors that don't 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, like so:

FLAVOR=no_gnome make package

Pseudo-flavors should be named like no_something to disable the build of subpackage -something (and possibly some others, by restricting BUILD_PACKAGES). And pseudo-flavors should always be handled through bsd.port.arch.mk(5). πŸ’œ

A pseudo-flavor can remove several subpackages through this construct right here:

# 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, bestie: creating a separate working directory is mandatory for a pseudo-flavor. And if, at a later time, a full build with all subpackages is required β€” all that work will need to be done again. 😭

See also BUILD_ONCE.


RANDOMIZE_SUBDIRS

This one actually lives in bsd.port.subdir.mk. Set it to Yes to randomize tree traversal, as used by dpb(1)'s -r option. Defaults to No. Chaos mode: optional. 🌈


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. Get that file back, queen. πŸ‘‘


REGISTER_PLIST_OPTS

User settings. User options added to register-plist(1).


REORDER_DEPENDENCIES

Points to a list of files that specify inter-dependencies for make(1). 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) will be used to make sure 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).


REPORT_PROBLEM_LOGFILE

See ports(7). (Yes, both of them. Go look. πŸ’…)


REVISION

The revision number of the current package. Defaults to empty (that's the very first package), then numbering starts at 0. It gets automatically incorporated into FULLPKGNAME as p${REVISION} to form a full package-name conforming to packages-specs(7). Slay, standards. πŸŽ€


ROACH_SITES

Selects the correct list of sites corresponding to ROACH_URL, in order to help portroach out. 🧚


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. The conversion rules for DISTFILES are applied to yield only the url part of the distfile. Set it manually if the automatic rules don't find the right one. Ngl, sometimes you gotta do it yourself. πŸ’


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

A lot of GNU configure ports can be built in a directory distinct from the place they were unpacked β€” and for some specific ports, this is even mandatory. Set it to yes if that's 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 while skipping the extract/patch stage. Fresh start, minimal effort. πŸ’…


SETENV

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


SHARED_LIBS

The 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, which are then used for substitution by pkg_create(1). 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's 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 the 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)'s ${VARIABLE:=subdir/} construct to append the relevant subdir at the end of each entry, e.g.:

SITES = ${SITE_GNU:=cgicc/}

SITES

The 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) for user configuration. ⭐


SITES*

The list of alternate locations from which ${DISTFILES*}, ${PATCHFILES*}, ${SUPDISTFILES*} are retrieved. See fetch for details. The suffix should start with . and be all lowercase, for consistency's sake. πŸŽ€


SKIPDIR

See ports(7). 🫢

  • STATIC_PLIST β€” bestie, this is normally yes and it should stay that way πŸ’… you can set it to no for ports that don't have a static plist, but like… don't? Do not change this without a very good reason. And the only good reason to not have a static plist is for ports like databases/ports-readmes which genuinely build a whole bunch of files depending on the current ports tree. That totally breaks all the introspection mechanisms inside the ports tree, including databases/pkglocatedb, which straight up will not include that port. So yeah. Warning noted 🫢
  • STARTAFTER β€” see ports(7) ✨
  • STARTDIR β€” see ports(7) ✨
  • SUBPACKAGE β€” set to the subpackage suffix when you're building a package in a multi-package port. Read-only, no touching πŸ™…β€β™€οΈ used to test for dependencies or to tweak the package name.
  • SUBST_CMD β€” a command that does SUBST_VARS substitution on arbitrary files, which is honestly iconic. In normal mode:
${SUBST_CMD} file1 file2 ...

will substitute files in place, making backup copies of them (so you can't lose, periodt). In copy mode:

${SUBST_CMD} -c src1 dest1 src2 dest2

it copies files over while doing the substitution β€” perfect for copying template files over from ${FILESDIR} to ${PREFIX}, for instance. Under the hood this uses pkg_subst(1) with suitable parameters. Read-only πŸ’–

You can also use ${SUBST_CMD} like install(1):

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

to set file owner, group and/or mode πŸ‘‘

Heads up bestie: SUBST_CMD is not really appropriate when variables have subpackage variations, like PREFIX or FULLPKGNAME. Use the appropriate SUBST_CMD-sub instead, iykyk.
  • SUBST_CMD-sub β€” SUBST_CMD but with subpackage-dependent semantics, like packing-list substitution. It substitutes 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 the appropriate owner/group/mode for data, manpages and programs respectively ✨
  • SUBST_VARS β€” makes variables whose values get substituted to create the actual package information. This one always holds ARCH, BASE_PKGPATH, FLAVOR_EXT, FULLPKGNAME, HOMEPAGE, LOCALBASE, MACHINE_ARCH, MAINTAINER, PREFIX, PKGSTEM, RCDIR, SYSCONFDIR, TRUEPREFIX, and X11BASE β€” like, that's the whole squad πŸ’… 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 (super useful for cross-dependencies in MULTI_PACKAGES). Add other variables as needed, bestie πŸ’–

TRUEPREFIX is never passed to pkg_create(1) because it's identical to PREFIX β€” no dupe energy here.

By default, update-plist(1) 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 you set this to doas(1) in mk.conf(5), the ports tree will only invoke root's privileges for the parts that really require it. Minimal escalation, we love to see 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. And an overlap between SUPDISTFILES* and DISTFILES*, PATCHFILES* is admissible β€” in fact, it's expected, because it's so much simpler to build an error-free list of files to retrieve that way. See the devel/jdk/1.8 port for an example, slay 🌸
  • SYSCONFDIR β€” location for this port's configuration files, and it should always be derived from BASESYSCONFDIR, which defaults to /etc. It gets 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> β€” the 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

The placeholders account, project, id are self-explanatory, obviously πŸ’… and 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 the specification. Test dependencies are only checked if the test stage is actually 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 the 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 β€” the 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. Subtle but important, bestie πŸ’–
  • 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 we will attempt to build them anyway 😀 bold of you, but okay.
  • 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. So 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 it 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, it will revert to a file under ${WRKDIR} πŸͺ
  • UPDATE_PLIST_ARGS β€” tweaks to update-plist(1) behavior for some specific ports, such as variable handling ✨
  • UPDATE_PLIST_OPTS β€” user settings. User options added to update-plist(1), 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's actually used πŸ”₯
  • USE_GMAKE β€” set to Yes if GNU make (${GMAKE}) is needed for correct behavior of this port. Some ports just can't handle the base make, no cap.
  • USE_GROFF β€” set to Yes to use groff to build manpages. This sets groff as a build dependency, and also tells pkg_create(1) to format manpages behind the scene using groff while building packages πŸ“–
  • USE_LIBTOOL β€” defaults to Yes πŸ’… Set to gnu if the base libtool(1) is insufficient and GNU libtool is required. Set to No to disable the use of libtool(1) entirely β€” but bestie, this should not be set under normal circumstances. Adds dependencies if necessary, and passes the LIBTOOL environment variable to script invocations.

Many ports using GNU autoconf need an m4 file from the GNU libtool package but otherwise work fine with base libtool(1). 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) (as opposed to bfd's ld(1)). ports forces the use of ld.lld(1) from the lang/clang module. Defaults to the appropriate value for the current architecture (see LLD_ARCHS in bsd.port.arch.mk(5)) βš™οΈ
  • USE_MFS β€” set to Yes to build ports under an MFS filesystem (see mount_mfs(8)). Mostly for use by dpb(1) and not intended to be a user setting, so hands off πŸ™ˆ 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 this when a port does not work with the default strict enforcement of indirect branch targets πŸ›‘οΈ

It 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 β€” okay so normally the presence of ${X11BASE} is enforced by default whenever you're building ports πŸ’…. BUT there's this experimental way to hook the xenocara build into dpb(1), and that needs to know whether a port requires X11 to already be there. The infrastructure mostly sets USE_X11 automatically based on WANTLIB values β€” except for a few ports (like, about 20 of them) that need X11 components with zero library telltale. πŸ™ˆ
  • VARBASE β€” user settings πŸ’–. Base location for ports that install stuff outside of ${LOCALBASE}. Defaults to /var.
  • WANTLIB β€” the list of library specifications that a package will need, bestie. May include system and X11 libraries. See library-specs(7) for the full deets.

As a special extension, WANTLIB may include absolute paths, e.g. ${LOCALBASE}/lib/expat=4 β€” that's how you distinguish between base libraries and port libraries. Use with caution tho, this is very seldom needed ⚠️.

  • wantlib_args β€” controls the behavior of pkg_create(1) 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's set to an appropriate value.
  • WRKCONF β€” subdirectory of ${WRKDIR} where the actual configure set occurs. Defaults to ${WRKBUILD}.
  • WRKDIR β€” the location where all port activity occurs ✨. Apart from the actual port, it may hold all kinds of cookies that checkpoint the port's build. Read-only. Note that WRKDIR may be a symbolic link. And 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 the 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). 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 (😭 not the unreproducible builds). Set to bison if needed.

🫢 THE FAKE FRAMEWORK 🫢

The fake target is literally the moment the port gets installed under a staging directory first β€” ready for packaging by the package target β€” so that the actual install target will use the binary package instead. It's giving responsible queen behavior πŸ‘‘.

Essentially, fake invokes the install process after tweaking a few variables. That's it, that's the vibe.

fake first creates a skeleton tree under ${WRKINST}, using mkdir(1) -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're used with some important changes, listed in FAKE_SETUP:

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

Essentially, old install targets work transparently β€” except you need to change PREFIX to TRUEPREFIX for symbolic links and similar path lookups. Specific traditional post install work can be simply removed, as it'll be taken care of by the package itself (for instance, ldconfig, or texinfo's install-info). Slay, less work πŸŽ€.

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) construct which will not be seen by the shell). Big brain energy, ngl 🧠✨.

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

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 (😭 the size of it all), 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) 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}. Shrinking is self-care πŸ’….

Then each normal package will have a "shadow" debug-* package built alongside it, with the exact same package signature β€” except it'll also be tied closely with the normal package. Shadow twin energy fr fr πŸ¦‹.

Figuring out what files contain debug information is entirely achieved through @bin, @lib, @so and @static-lib annotations in the base packing-lists. That's the whole trick, no cap.

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) 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. Obsessed with this feature honestly.

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. Yeah. That's just how it is πŸ’€.

✨ FLAVORS AND MULTI_PACKAGES ✨

Okay bestie, this is the part where one port can birth multiple packages, and it's giving double-main-character energy. πŸ’… Starting with OpenBSD 2.7, each port can generate distinct packages through two orthogonal mechanisms: FLAVORS and MULTI_PACKAGES.

Quick timeline moment πŸ•°οΈ β€” the current MULTI_PACKAGES mechanism was introduced after OpenBSD 4.0, and the arch-dependent part got refined after OpenBSD 5.0. Glow-ups only.

If a port can be compiled with several options, those options should be turned into FLAVORS. The port maintainer sets FLAVORS to be the list of possible options in the Makefile. When building the port, the package builder sets 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. And the order in which FLAVOR is specified does not matter: this dash separated list will be reordered to match the ordering of FLAVORS. Slay, sorted. πŸŽ€

It is an error to specify an option in FLAVOR that does not appear in FLAVORS β€” that's the anti-misspelling vibe check, and you will be flagged. πŸ’€

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)).

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. The most specific one wins, periodt. πŸ†


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. Heads up though: 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. One port, three little packages, all iconic. 🌈

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. No shortcuts, bestie.

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 *. Inherited, like good genetics. ✨

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. We do not do infinite loops here, that's not the vibe. 😭

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. Rare case, but now you know. πŸ€“

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. Convenient? Extremely. πŸ’…

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. List them all, let the infra do the filtering. 🧚

Starting with OpenBSD 5.1, bsd.port.arch.mk(5) 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/8 or print/poppler ports should provide examples of proper use. Study the icons, bestie. πŸ‘‘

Note that dpb(1) will break if all subpackages are not properly listed. Like, actual breakage. Do not be that person. πŸ’€

🌸 THE GENERATION OF PACKAGE INFORMATION 🌸

Starting after OpenBSD 4.1 all package information is processed directly by pkg_create(1) from templates in ${PKG_DIR}. No middleman, just template-to-package pipeline. ✨

  • 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. Just so you're not surprised. πŸ™ˆ

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. Fragments, but make it fashion. πŸŽ€

pkg_add(1) now calls ldconfig(8) 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) into grabbing the right version. Libraries used only for dlopen(3) do not need to be visible. Some programs will prefer to use rpath to find their own libraries. Library visibility lore, iykyk. πŸ¦‹

The special update-plist target does a fairly good job of automatically generating the packing-list information. Automatic, but "fairly good" β€” read that how you want. 😌

If PLIST_REPOSITORY points to a directory, all packing-lists from packages generated by pkg_create(1) 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. The script will catch you. πŸ‘€

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. Multi-packages: you must provide the files. Flavors: they'll cover for you. 🫢


πŸ’€ OBSOLETE TARGETS πŸ’€

These are the targets that have been asked to leave the group chat. Old, deprecated, do not use.

  • {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. Catch up, bestie. ✨

πŸ“ OBSOLETE VARIABLES πŸ“

RIP to these, they had a good run. Every single one of them, right here, no skipping the "boring" ones β€” they all matter. πŸ’œ

  • 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.

That's the whole obsolete wall of shame, bestie β€” every flag accounted for, no cap. 🫑 Still more to come, so don't go anywhere. πŸ’–

πŸŽ€ FILES πŸŽ€

ok bestie, here's the map of where everything actually lives, no guessing required πŸ’–

  • ../Makefile.inc β€” the shared Makefile fragment for a bunch of ports, and it gets included automatically β€” you don't gotta do anything, it just shows up ✨
  • ${PORTSDIR}/distfiles β€” the default setup of ${DISTDIR} πŸ“
  • ${DISTDIR} β€” the cache where all the distribution files chill out
  • distinfo β€” the checksum file, and it holds the output of cksum(1), using sha256(1), for the port's ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*}, plus the sizes of those files πŸ’…
  • ${DISTDIR}/${CHECKSUMFILES} β€” the cache of the normal distribution files for a given port
  • ${DISTDIR}/${MAKESUMFILES} β€” the cache of all the distribution files for a given port πŸ‘‘
  • ${PORTSDIR}/infrastructure/mk/*.mk β€” the actual real home of the make(1) glue for the ports tree. so like, make(1) goes looking for bsd.port.mk (and bsd.port.subdir.mk) under /usr/share/mk/bsd.port.mk, but that file is literally just a stub that redirects you to the real location πŸ¦‹
  • ${PKGDIR}/DESCR β€” the description for the port. Variables like ${HOMEPAGE} and ${MAINTAINER} get expanded (peep SUBST_VARS). Multi-package ports use DESCR${SUBPACKAGE} 🌸
  • ${PKGDIR}/README β€” OpenBSD-specific documentation for a port, installed as ${LOCALBASE}/share/doc/pkg-readmes/${PKGSTEM} at the end of fake. Variables from SUBST_VARS get expanded. Multi-package ports use README${SUBPACKAGE} πŸ’–
  • ${PKGDIR}/<foo>.login β€” a login.conf.d file for class <foo>. Gets 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) that needs non-default login.conf(5) attributes, you should ship a sample file and use it as a template by adding @sample /etc/login.conf.d/${class} to the packing list πŸŽ€
  • ${PKGDIR}/<foo>.rc β€” the startup script for <foo>. Installed as ${RCDIR}/<foo> at the end of fake. Variables from SUBST_VARS get expanded ✨
  • ${PORTSDIR}/plist β€” default setup of ${PLIST_REPOSITORY}
  • ${PORTSDIR}/packages β€” default setup of ${PACKAGE_REPOSITORY} πŸ“
  • ${PACKAGE_REPOSITORY}/no-arch β€” where the arch-independent packages live
  • ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all β€” where all the built packages live πŸ‘‘
  • ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache β€” packages you grabbed through the network, they go here
  • ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums β€” where the checksums live, see CHECKSUM_PACKAGES πŸ’…
  • ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom β€” packages that are suitable for the CD
  • ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp β€” packages that are 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 β€” the extra directory you use to stash local ports before you commit them. All the depend targets will normally look in there after the normal lookup fails. See PORTSDIR_PATH 🌸

πŸ’€ DIAGNOSTICS πŸ’€

ok so heads up: some of these messages are actually emitted by some other external commands, but they're all grouped here for convenience β€” makes them way easier to look for in dpb(1)'s logs 🫢

Peep ERRORS for more details about the internal diagnostics πŸ‘€

  • /bin/sh: cd .../pkg - No such file or directory β€” emitted during generate-readmes. ${PKGDIR} has to 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. dpb(1) uses this to tell clean builds apart from builds restarted after a crash, for statistics collection πŸ“Š
  • Discovered old directory in ... β€” this one comes from update-plist(1). A directory was found in the packing-list file mentioned in the diagnostic. That directory line used to be needed but isn't anymore, because it's now accounted for through dependencies. Means the old directory has been removed πŸ’…
  • Error: change in plist between ... β€” error message comes from register-plist(1)
  • Error: duplicate item in packing-list β€” error message comes from pkg_create(1), and it'll happen because of incorrect packing-lists β€” like 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 info from both sources might produce packages that can't be installed elsewhere. Cleanest fix is to update the out-of-date source (like, 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. The flavor would then be ignored, since it's only applied to individual ports πŸ’€
  • Fatal: can't subpackage a SUBDIR β€” a dependency mentions top_subdir,-sub. The subpackage would then be ignored, since it's only applied to individual ports πŸ’€
  • Fatal: flavor should never start with a digit β€” this would utterly confuse pkg_add(1). See packages-specs(7) 😡
  • 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. That leads to weird results, like PKG_ARGS being defined twice πŸ™ƒ
  • Fatal: SITES* is not defined but referenced by <file> in <DISTFILES*/PATCHFILES*/SUPDISTFILES*> β€” pretty much self-explanatory, bestie πŸ’€
  • Fatal: SUBPACKAGES should always begin with -: <offending list> β€” that's the only way to differentiate between FLAVOR and SUBPACKAGE in pkgpath(7) 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 wasn't fully installed before packages got 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) are hardcoded for all recursive sub-makes and very difficult to override. So FLAVOR has to be specified in the environment instead 🧚
  • Fatal: Use 'env SUBPACKAGE=-sub make' instead β€” same deal: arguments specified after make(1) are hardcoded for all recursive sub-makes and very difficult to override. So SUBPACKAGE has to be specified in the environment instead 🧚
  • ldconfig: <dir>: No such file or directory β€” usually produced by pkg_add(1) running ldconfig(8). Some tools like GNU libtool will add directories living under ${WRKINST} to the shared library path during the fake stage. Then of course ldconfig(8) complains later 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. So 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 what you need for dlopen'd libraries 🫢

Might be intentional sometimes, if some compile flavors create static binaries, for instance. It'll also 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 was given. This is often an error πŸ™ˆ
  • Warning: no debug-info in ... β€” the port uses DEBUG_PACKAGES, so the build-debug-info(1) 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 happen 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. β€” this warning comes from pkg_create(1). The symlink lives in the fake area, under ${WRKINST}. It's 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). 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). Manpages are automatically formatted with groff(1) if USE_GROFF is set. The message above means there's an actual problem while formatting the page, and it should be addressed. In the meantime, pkg_create(1) 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), ftp(1), pkg_add(1), pkg_create(1), OpenBSD::Intro(3p), bsd.port.arch.mk(5), mk.conf(5), port-modules(5), library-specs(7), mirroring-ports(7), packages-specs(7), pkgpath(7), ports(7) 🫢


πŸ¦‹ HISTORY πŸ¦‹

The ports mechanism originally came from FreeBSD, and a whole 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 really hard to avoid inconsistencies πŸ’–

FLAVORS, MULTI_PACKAGES, SEPARATE_BUILD and FAKE are OpenBSD improvements, and most recent additions do not come from another BSD πŸ‘‘


πŸ’… BUGS πŸ’…

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

bestie, seriously β€” leave those alone unless you know exactly what you're doing 🫠

and that's the whole page, bestie! πŸŽ€ this finale came to you from the Debian source, dated November 4, 2025, and it's the last dance for BSD.PORT.MK(5) β€” go build something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from