BSD.PORT.MK(5)
π 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 fortsort(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 withtsort(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 offull-{build,run}-dependsin 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, thepre-*hook will be invoked before running the normal action; thedo-*hook will be invoked instead of the normal action; thepost-*hook will be invoked after the normal action. Specialization hooks exist forbuild,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 fullLIB_DEPENDSlist into a form suitable forpkg_create(1), seeprint-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 (seePLIST_REPOSITORY). Itβs a vibe check for registration, basically. βcheck-register-allβ Applycheck-registerto 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 asha256(1)digest of${CHECKSUMFILES}(files listed inDISTFILES*andPATCHFILES*) and check it against${CHECKSUM_FILE}, normallydistinfo. In case of a mismatch, runningchecksumwithREFETCH=truewill 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 asmake clean='[depends build bulk work fake flavors dist install sub package packages plist test]'.workβ Clean work directory.bulkβ Clean bulk cookie. πͺbuildβ Clean theWRKBUILDdirectory (only useful ifSEPARATE_BUILDis 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β Withinstallorpackage, clean subpackages as well.packagesβ Shorthand forsub package.allβ Shorthand forwork flavors packages plist.
clean-dependsβ Shorthand formake clean=depends. Easy. πconfigureβ Configure the port. By default,configurecreates the${WRKBUILD}directory (seeSEPARATE_BUILD), and runs whatever configuration methods are recorded inCONFIGURE_STYLE. Itβs the βset up the vibe before the real workβ target. π οΈdistcleanβ Shorthand formake clean=dist. π§Ήdistpatchβ Apply distribution patches only. Seepatch,PATCH_CASESandFIX_CRLF_FILESfor 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βsFULLPKGPATH. It can be limited to some specific information by settingDPBto nothing orfetch. Mostly used bydpb(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 seeEXTRACT_ONLY,FIX_EXTRACT_PERMISSIONSandNO_DEPENDS). Refer toEXTRACT_CASESfor a complete description. Do not usepre-extractanddo-extracthooks. Like, do not. π ββοΈfakeβ Do a fake port installation, that is, simulate the port installation into the staging area${WRKINST}. There is nodo-fakeandpost-fakehooks: insteadfakerunspre-fake,pre-install,do-installandpost-install. Overridepre-install,do-install, orpost-installto 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β CheckWANTLIBagainst the list of installed packages and libraries in the ports tree. Seeprint-package-args. Itβs the βdo these libraries actually existβ check. πfetchβ Fetch the list of files inDISTFILES*andPATCHFILES*using${FETCH_CMD}. Files are normally retrieved from the list of sites inSITES*.
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β Likefetch, but also fetchesSUPDISTFILES*, for use by e.g.,makesum. Itβs fetchβs overachieving sibling. πfix-permissionsβ Ensure permissions are correct when usingPORTS_PRIVSEPand/ordpb(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 usingautomake,autoconf,autoreconfand similar GNU tools. This target only has modules (MODxxx_gen) and ado-genhooks. Then adjust timestamps to avoid regeneration during build (seeREORDER_DEPENDENCIES). Autotools era, but make it timestamp-safe. π°οΈgenerate-readmesβ GenerateREADMEs, rc scripts andlogin.conf.dfiles from${PKGDIR}into${WRKINST}. Run afterfakeand beforepackageorupdate-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 fromRUN_DEPENDS,LIB_DEPENDS, andWANTLIB. 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}-installhooks 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β FilterLIB_DEPENDSto keep only entries required byWANTLIB, and output a list of dependencies suitable forpkg_create(1), seeprint-package-args. Only the needed library friends make the list. βοΈlib-depends-checkβ Verify that theLIB_DEPENDSandWANTLIBrecorded in the portβs packages are accurate. Seeport-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-package-args π¨οΈ
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-update-signature πͺ
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 π
print-plist π
Generate and print a package packing-list from the static information present in the port. Static info only, bestie β¨
print-plist-all π
Iterate over print-plist for all subpackages in a given port. All of them, no skipping π
print-plist-all-with-depends π¦
Iterate over print-plist-with-depends for all subpackages in a given port. Same all-subpackages energy, but with depends π
print-plist-contents π
Generate and print package contents from the static information present in the port. In contrast with print-plist, the package contents only consists of files, all tagged with category markers such as @file. See pkg_create(1). Files only, tagged and cute π
print-plist-libs π
Generate and print the list of static and dynamic libraries present in the port. See pkg_create(1). Library inventory bestie β¨
print-plist-all-libs πΈ
Iterate over print-plist-libs for all subpackages in a given port. All the libs, all the subpackages π
print-plist-libs-with-depends π§
Like print-plist-libs, but slower. It also handles LIB_DEPENDS, RUN_DEPENDS, and WANTLIB, so that the packing-list has complete dependency information. Slower but thorough β highkey worth it π«Ά
print-plist-with-depends π₯
Like print-plist, but slower. It also handles LIB_DEPENDS, RUN_DEPENDS, and WANTLIB, so that the packing-list is complete. 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β inports(7):updateis 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 whenUSE_CCACHEis set to yes, bestie π defaults to${WRKOBJDIR}/.ccache.CCACHE_ENVβ extra env vars to shove in whenUSE_CCACHEis set to yes. Like, say you want verbose logging, you'd goCCACHE_ENV="CCACHE_LOGFILE=/tmp/ccache.log". Obsessed with the debugging potential tbh.CDIAGFLAGSβ flags that get appended toCFLAGSifWARNINGSis set. Diagnostic slay β¨CFLAGSβ the default flags handed to the compiler when building. Fair warning: many ports literally ignore it π see alsoCOPTS,CDIAGFLAGS.CFLAGS_${CHOSEN_COMPILER}β more flags, appended toCFLAGSdepending on whatCHOSEN_COMPILERended 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 throughdlopen(3). So like, no cap, it can't see everything πCHECK_LIB_DEPENDS_ARGSβ a list of extra arguments forcheck-lib-depends(1).CHECKSUMFILESβ the list of all the files that need to be retrieved by fetch, withDIST_SUBDIRprepended and with the master site selection extension removed. Read-only π«βοΈ see alsoMAKESUMFILES.CHECKSUM_FILEβ where this port's checksums live, used bychecksum,makesum, anddpb(1). Defaults todistinfo.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 forPERMIT_PACKAGEpackages. Defaults to βnoβ, which computes no checksum at all. Zero. Nada. πΈCHOSEN_COMPILERβ read-only π the compiler suite that theCOMPILERmechanism picked. Set it to βirrelevantβ to straight-up disableCOMPILER.CLEANDEPENDSβ if you set it to βYesβ, thecleantarget will also clean the dependencies. Iconic. You can override it per-${PKGPATH}by settingCLEANDEPENDS_${PKGPATH}π§ΉCOMMENTβ the short description of the port (no more than 60 characters, so keep it cute and brief π), used for the package and theINDEX. It shouldn't start with an uppercase letter unless that capital actually means something semantically.COMMENT-fooβ same asCOMMENTbut it's for the sub package-fooin a multi-package setup.COMMENT-vanillaβ same asCOMMENTbut for a flavored package, specifically when the non-flavored comment just isn't it πCOMMENT-foo-vanillaβ same asCOMMENTbut 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 basebase-clangβ the clang compiler from baseports-gccβ the gcc 8 compiler from ports (heedsMODGCC4_ARCHSfrom the module)ports-clangβ the clang compiler from ports (heedsMODCLANG_ARCHSfrom 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 inCOMPILER_LANGSgets 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 alsoCHOSEN_COMPILER.COMPILER_LINKSβ used bybsd.port.mkand compilerMODULESto build scripts in${WRKDIR}/bin, forcing the compiler flags to be set (-Bis required for clang to find${WRKDIR}/bin/ldas used byUSE_WXNEEDED) and to callCOMPILER_WRAPPERif one's in use π οΈCOMPILER_WRAPPERβ an external program used to "wrap" compilers. It gets populated automatically byUSE_CCACHE, or you can set it explicitly for other purposes (e.g. distcc).CONFIG_SITE_LISTβ used whenCONFIGURE_STYLE=gnu, or withMODULES += gnu. It's a list ofconfig.sitefragments that speed up gnu-configure and stop it from preferring various gnu programs unlessBUILD_DEPENDSexplicitly 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 withNOT_FOR_ARCHSorONLY_FOR_ARCHSto limit ports to architectures where they actually compile πCONFIGURE_ARGSβ arguments passed to the configure script. Defaults are empty, except for GNU-style configure, whereprefixandsysconfdirare 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 theconfiguretarget, 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)'sExtUtils::MakeMaker(3p)style. Add βmodbuildβ to enableModule::Build(3p), βmodbuild tinyβ to enableModule::Build::Tiny(3p), or βmodinstβ forModule::Install(3p)style. - If βgnuβ, βautoconfβ, or βautoreconfβ, assume GNU configure style. Add βdestβ if the port doesn't handle
DESTDIRcorrectly and needs to be configured to addDESTDIRto prefixes (see alsoDESTDIRNAME). 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.
- If βperlβ, assume
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 theCOPTSconvention, they actually get told to use${CFLAGS} ${COPTS}asCFLAGS. Sneaky but it works.CXXDIAGFLAGSβ flags appended toCXXFLAGSifWARNINGSis set.CXXFLAGSβ the default flags passed to the C++ compiler for building. Many ports ignore it, shrug πCXXFLAGS_${CHOSEN_COMPILER}β additional flags appended toCXXFLAGSdepending on the value ofCHOSEN_COMPILER. See alsoCOMPILER,COMPILER_LANGSandCHOSEN_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 asDEBUG_PACKAGES=${BUILD_PACKAGES}for packages where debug info is desirable. Heads up: the subpackages withPKG_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 onlyamd64andaarch64, 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β seeDESTDIRNAME.DESTDIRNAMEβ the name of the variable to set to${WRKINST}while faking. UsuallyDESTDIR. This is for the rare cases where a port heedsDESTDIRin 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β additionalTEMPLATE_DISTFILES.<name>andTEMPLATE_HOMEPAGE.<name>entries can be added as needed). The components are used to buildSITES.nameDISTFILES.nameand (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 useFULLDISTDIRto refer to a port's distribution files location, because it takes an eventualDIST_SUBDIRinto 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 matchingSITES*(peepfetch), checksummed, then extracted (peepchecksum,extract). NormallyDISTFILESis 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. SeeDISTFILES*andPKGNAME.DISTORIGβ the suffixdistpatchuses to rename original files. Defaults to.bak.orig. It's deliberately different fromPATCHORIGso you don't confuseupdate-patchesπDIST_SUBDIRβ optional subdirectory of${DISTDIR}where this port's distribution files and patchfiles live. See targetfetch.DPBβ set by the Distributed Ports Builder so it only grabs the info it actually needs fromdump-vars.DPB_LOCKNAMEβ if set,dpb(1)uses this instead of the defaultPKGPATH-derived name. Heads up: this feature comes with large restrictions and shouldn't be used unless it's absolutely necessary. Specifically, it can letdpbbuild several flavors of the same port at the same time, but beware: underMULTI_PACKAGESandPSEUDO_FLAVORSconditions, 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. Seedpb(1)for the semantics.DUMMY_PACKAGEβ if defined,bsd.port.mkprovides dummy values for the variables that are mandatory for a minimally functional port. It's what thesqlportspackage anddpb(1)use to do introspection and grabbsd.port.mk's default values for variables without needing to touch any specific port.DWZβ the command line invocation ofdwz(1)used to shrink debug info while building debug packages. Defaults todwz -L 100000000. You can set it to:to not rundwz(1)at all. See βTHE DEBUG_PACKAGES INFRASTRUCTUREβ for the deets.ECHO_MSGβ user settings. Used to display===> Configuring for fooand other similarly informative messages. Override it if you wanna turn that off, for instance.ECHO_REORDERβ user settings. Set it toechoto seeREORDER_DEPENDENCIESactions. Silent by default πEDIT_PATCHESβ user settings. If set toNo,update-patcheswill not open changed files in an editor.EPOCHβ the epoch number of the current package. Used when the port version changed butpackages-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 at0. It gets automatically incorporated intoFULLPKGNAMEasv${EPOCH}to form a full package-name that conforms topackages-specs(7).ERRORSβ the list of errors found while parsing the port'sMakefile. 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}witharchive(a shell variable) set to each element ofEXTRACT_ONLYin 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,tgztarβtararchivers/bzip2βtar.bz2,tbz2,tbzarchivers/xzβtar.xz,tar.lzma,tar.lzarchivers/unzipβziparchivers/zstdβtar.zst,tar.zstdconverters/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 thedo-extractstage. Defaults to${ALL_DISTFILES}, and can even be set to empty.EXTRACT_SUFXβ used to set theDISTFILESdefault value to${DISTNAME}${EXTRACT_SUFX}. Default value is.tar.gz.
Note thatDISTFILESwill only be set in the absence ofDISTFILES.sufxas well, or ifSITESis not empty.
EXTRACT_SUFX.<name>β theEXTRACT_SUFXvalue for a template defined throughDIST_TUPLE.EXTRACT_FILESβ set to the list of files to actually extract from the distfiles. Its content is subject to shell evaluation as part ofEXTRACT_CASES, and it gets passed as thefile ...argument totar(1)orunzip(1)β soglob(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 seeALL_FAKE_FLAGS.FAKE_SETUPβ the list of environment values normally set during fake invocations. Exposed so modules can provide their owndo-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 settingFAKEOBJDIR_www/mozilla-firefox=/tmp/objaffects only themozilla-firefoxport. Obsessed with the precision π―FETCH_CMDβ user settings. The command used to fetch distribution files for this port. Defaults toftp(1). Can be used to get through excessively paranoid firewalls. Note thatFETCH_CMDshould support a few ftp options β chief among them being-Cand-o dest, but also-m,-S,-v,-V. Most of these can be no-ops in aFETCH_CMDscript. See${PORTSDIR}/infrastructure/template/fetch_cmd.templatefor a skeleton script.FETCH_MANUALLYβ some ports' distfiles can't be fetched automatically for licensing reasons π In this case, setFETCH_MANUALLYto 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 toNo. Set it topkg_add(1)options. It instructs thepackagetarget 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 usingPORTS_PRIVSEP. Defaults to_pfetch.FIX_CLEANUP_PERMISSIONSβ ifYes, restore read, write and directory search permissions for the build user on${WRKDIR}before runningclean. Used for build systems that set paranoid permissions at build time. Defaults toNo.FIX_CRLF_FILESβ name(s) of files with line endings to correct at the end ofdistpatch. 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.mkchanges toWRKDISTbefore converting files β shell wildcards may be used.FIX_EXTRACT_PERMISSIONSβ ifYes, restore the contents of${WRKDIR}to world-readable at the end ofextract. Used for some distfile contents that have paranoid permissions for no reason. Defaults toNo.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 sortFLAVORinto a canonical order to build the package name, or to select the packing-list, and as a quick validity check. See alsoPSEUDO_FLAVORS.FLAVOR_EXTβ the canonical list of flavors being set for the current build, dash-separated. SeeFULLPKGNAME.FORCE_UPDATEβ user setting bestie π if it's set to'Yes', then theupdatetarget 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 theupdatetarget 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 atEPOCHandREVISIONβ¨FULLPKGPATHβ path to the current port's directory, relative to${PORTSDIR}, flavors and subpackages included. Seepkgpath(7)π¦GH_*β simple support for GitHub-hosted projects. Leave it empty for projects that aren't hosted there. It yields a suitable default forSITES_GITHUBandDISTNAME. For messier situations, useDIST_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 bybsd.port.mkto the generated name of the distribution file. This can be useful for ports listing multipleDISTFILES*.GH_PROJECTβ name of the project on GitHub.GH_TAGNAMEβ name of the tag to download. Setting${GH_TAGNAME}tomasteris 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 togmake.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 alsoBATCH,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 withBATCHto 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 withNOT_FOR_ARCHSandONLY_FOR_ARCHS.LIB_DEPENDSβ list of packages used by a port for its library dependencies. Each item has the form'[pkgspec:]pkgpath'. Similar toBUILD_DEPENDSandRUN_DEPENDS, but with specific rules:LIB_DEPENDSalways turn intoBUILD_DEPENDS(but see βFLAVORS AND MULTI PACKAGESβ).LIB_DEPENDSis also used as a run-time dependency, and recorded in the package as such, if any of the libraries mentioned inWANTLIBis a shared library that originates within the dependent port.
See library-specs(7) for more details π¦
lib_depends_argsβ controls the behavior ofpkg_create(1)related targets, seeprint-package-argsfor details.LIBCXXβ list of standard C++ libraries for the base compiler. Read-only. Use inWANTLIB.LIBTOOLβ location of the libtool binary. Default:/usr/bin/libtool.LIBTOOL_FLAGSβ arguments to pass to libtool. IfUSE_LIBTOOLis set, the environment variableLIBTOOLis set to${LIBTOOL} ${LIBTOOL_FLAGS}.LLD_EMULβ sinceld.lld(1)doesn't have a default emulation mode, if it's the linker in-use,LLD_EMULdefaults 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, seeport-modules(5). Read-only. Use withNOT_FOR_ARCHSorONLY_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 fromBASELOCALSTATEDIR, 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, namelyportlock(1). See alsoports(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 withNOT_FOR_ARCHS.MAINTAINERβ email address with the full name of the port's maintainer. Defaults toports@openbsd.orgπMAKE_ENVβ environment variables passed to make invocations and tests. Sets at leastPATH,PREFIX,LOCALBASE,X11BASE,CFLAGS,TRUEPREFIX,DESTDIR, and theBSD_INSTALL_*macros.MAKE_FLAGSβ flags used for all make invocations, except for the fake stage, which addsFAKE_FLAGS(seeALL_FAKE_FLAGS), and for the test stage, which addsTEST_FLAGS(seeALL_TEST_FLAGS).MAKE_FILEβ name of the Makefile used for ports building. Defaults toMakefile. Used after changing directory to${WRKBUILD}.MAKE_JOBSβ number of jobs to use when building the port, normally passed toMAKE_PROGRAMthroughPARALLEL_MAKE_FLAGS. Mostly set automatically whenDPB_PROPERTIEScontains'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 onUSE_GMAKE. Read-only.MAKEFILE_LISTβ introspection variable, seemake(1).MAKESUMFILESβ list of all files that need to be retrieved byfetch-all, withDIST_SUBDIRprepended and with the master site selection extension removed. Read-only. See alsoCHECKSUMFILESπMESSAGEβ file recorded in the package and displayed during installation. Defaults to${PKGDIR}/MESSAGEif this file exists. Leave it empty if no message is needed.MISSING_FILESβ whenFETCH_MANUALLYis set,MISSING_FILESwill contain the list of missing distfiles or patchfiles that need to be fetched manually. Read-only πMODGNU_CONFIG_GUESS_DIRSβ if a port usesconfig.guessoutsideWRKSRC, 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 inMODPERL_ADJ_FILES. File paths here should be relative toWRKSRC. These files get patched automatically at the end ofpre-configureπMODPERL_BIN_ADJβ shell fragment to patch the Perl interpreter path in executable scripts. Used byMODPERL_ADJ_FILES.MODPERL_BUILD_TARGETβ normal content ofdo-buildwhenCONFIGURE_STYLEuses perl. Provided as a separate variable if a port wants to overridedo-buildfor its own reasons.MODPERL_INSTALL_TARGETβ likewise fordo-install.MODPERL_TEST_TARGETβ likewise fordo-test.MODPERL_REGEN_PPPORTβ normally, ifppport.his present, it gets regenerated using a current version ofDevel::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 rightCONFIGURE_STYLE. Note that it's possible to doCONFIGURE_STYLE = simple,MODULES += gnuto just get the effects ofCONFIG_SITEandMODGNU_CONFIG_GUESS_DIRSalong with the defaultTEST_TARGET, in case the normal GNU configure script was wrapped in a separate script that takes different arguments. Seeport-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 aboutONLY_FOR_ARCHSwhen 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 wherePKG_ARCH=*, which end up under${PACKAGE_REPOSITORY}/${NO_ARCH}.NOT_FOR_ARCHSβ list of architectures on which this port does not build. See alsoONLY_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 whenUSE_CCACHEis 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'slang/llvmsupport on this architecture.monoβ there'slang/monosupport 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 normallyyesand it should stay that way π you can set it tonofor 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 likedatabases/ports-readmeswhich genuinely build a whole bunch of files depending on the current ports tree. That totally breaks all the introspection mechanisms inside the ports tree, includingdatabases/pkglocatedb, which straight up will not include that port. So yeah. Warning noted π«ΆSTARTAFTERβ seeports(7)β¨STARTDIRβ seeports(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 doesSUBST_VARSsubstitution 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_CMDis not really appropriate when variables have subpackage variations, likePREFIXorFULLPKGNAME. Use the appropriateSUBST_CMD-sub instead, iykyk.
SUBST_CMD-sub βSUBST_CMDbut with subpackage-dependent semantics, like packing-list substitution. It substitutes the right variable depending on the desired subpackage β e.g.SUBST_CMD-foowill substitute the value ofFULLPKGNAME-foofor${FULLPKGNAME}π¦SUBST_DATA,SUBST_MAN,SUBST_PROGRAMβ specialized versions ofSUBST_CMDthat use-cand 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 holdsARCH,BASE_PKGPATH,FLAVOR_EXT,FULLPKGNAME,HOMEPAGE,LOCALBASE,MACHINE_ARCH,MAINTAINER,PREFIX,PKGSTEM,RCDIR,SYSCONFDIR,TRUEPREFIX, andX11BASEβ 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 inMULTI_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 todoas(1)inmk.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 withmakesum. 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 betweenSUPDISTFILES*andDISTFILES*,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 thedevel/jdk/1.8port for an example, slay πΈSYSCONFDIRβ location for this port's configuration files, and it should always be derived fromBASESYSCONFDIR, 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 thesqlportspackage πTEMPLATE_DISTFILES.<name>β the template used to constructDISTFILES.namebased on aDIST_TUPLEentry, by filling in placeholder strings. For instance,TEMPLATE_DISTFILES.githubdefaults 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 generatedHOMEPAGEwhen usingDIST_TUPLE. Very similar toTEMPLATE_DISTFILES.<name>β¨TEST_DEPENDSβ seeBUILD_DEPENDSfor 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 toYesif the port needs human interaction to run its tests π or set toX11if the tests need an active X11 display to work.TEST_LOGβ command used to log the results of regression tests toTEST_LOGFILE. Read-only.TEST_LOGFILEβ the log file containing the results of regression tests πTEST_TARGETβ target to run regression tests. Defaults totest, except forperlandgnuCONFIGURE_STYLE, which default totestandcheck, 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 toYes, don't setIGNOREforBROKENports, 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 likesqlportsfor consistency. So instead, setUNLINKEDto atagthat will make the portIGNOREd unlessBUILD_UNLINKEDcontains that specific tag πUNMESSAGEβ file recorded in the package and displayed during deinstallation. Defaults to${PKGDIR}/UNMESSAGEif 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 toupdate-plist(1)behavior for some specific ports, such as variable handling β¨UPDATE_PLIST_OPTSβ user settings. User options added toupdate-plist(1), mostly-vfor now πUSE_CCACHEβ user settings. Set toYesto useccachewhen building ports. Sets up the build environment so that it's actually used π₯USE_GMAKEβ set toYesif 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 toYesto use groff to build manpages. This sets groff as a build dependency, and also tellspkg_create(1)to format manpages behind the scene using groff while building packages πUSE_LIBTOOLβ defaults toYesπ Set tognuif the baselibtool(1)is insufficient and GNU libtool is required. Set toNoto disable the use oflibtool(1)entirely β but bestie, this should not be set under normal circumstances. Adds dependencies if necessary, and passes theLIBTOOLenvironment 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 toYes,Noorportsto force the use ofld.lld(1)(as opposed to bfd'sld(1)).portsforces the use ofld.lld(1)from thelang/clangmodule. Defaults to the appropriate value for the current architecture (seeLLD_ARCHSinbsd.port.arch.mk(5)) βοΈUSE_MFSβ set toYesto build ports under an MFS filesystem (seemount_mfs(8)). Mostly for use bydpb(1)and not intended to be a user setting, so hands off π SeeWRKOBJDIR_MFSfor configuration.USE_NOBTCFIβ if set toYes, writes a wrapper script to${WRKDIR}/bin/ldin patch to request that the linker adds aPT_OPENBSD_NOBTCFIELF 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 toYes, writes a wrapper script to${WRKDIR}/bin/ldin 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 toYesto usesccachewhen building Rust ports π¦π₯USE_WXNEEDEDβ if set toYes, writes a wrapper script to${WRKDIR}/bin/ldin patch to request that the linker adds aPT_OPENBSD_WXNEEDEDELF 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 intodpb(1), and that needs to know whether a port requires X11 to already be there. The infrastructure mostly setsUSE_X11automatically based onWANTLIBvalues β 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. Seelibrary-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 ofpkg_create(1)related targets, seeprint-package-argsfor details.WARNINGSβ user settings π. If set to βYesβ, addCDIAGFLAGStoCFLAGSandCXXDIAGFLAGStoCXXFLAGS.WRKBUILDβ subdirectory of${WRKDIR}where the actual build occurs. Defaults to${WRKSRC}, unlessSEPARATE_BUILDis 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 thatWRKDIRmay be a symbolic link. And during ports building,${WRKDIR}/binis put at the front of thePATH. πWRKDISTβ subdirectory of${WRKDIR}in which the distribution files normally unpack. Base for all patches. Defaults to${WRKDIR}/${DISTNAME}. Note thatWRKDISTmay be a symbolic link, if set to${WRKDIR}.WRKSRCβ subdirectory of${WRKDIR}where the actual source is. Base for configuration (default:${WRKDIST}). Note thatWRKSRCmay be a symbolic link, if set to${WRKDIR}.WRKINSTβ subdirectory of${WRKDIR}used as a staging area for installing the port. (See thefaketarget.) π§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, settingWRKOBJDIR_www/mozilla=/tmp/objwill 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 withdpb(1). Active whenUSE_MFSis β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 ofxmkmffor aCONFIGURE_STYLE=imakeport. Defaults toxmkmf -a -DPorts. The-DPortsis specific to OpenBSD and is always appended. πYACCβ name of yacc program to pass to GNU-configure, defaults toyacc. GNU-configure would always try to use bison otherwise, which leads to unreproducible builds (π not the unreproducible builds). Set tobisonif 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 inFLAVORthat does not appear inFLAVORSβ 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
SUBPACKAGEandFLAVORinformation. SetPLIST${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., ifFLAVORS=no_map gfx qt2, ifFLAVOR=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 meshesBUILD_DEPENDS,LIB_DEPENDS,RUN_DEPENDS,WANTLIBandMULTI_PACKAGES. Refer toprepare,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β setFETCH_CMDto 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β setEXTRACT_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 settingWRKDIST=${WRKDIR}.OPSYS_VERβ useOSREVinstead.PKGNAMEβ used to refer to the full package name, has been superseded byFULLPKGNAME-foo, forSUBPACKAGE-foo.PKGNAMEnow 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. UseSUBST_VARSinstead. OpenBSD does not allow general substitutions of the formVAR=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, useFILESDIRfor those.SITES0, ...,SITES9β supplementary locations from which distribution files and patchfiles were retrieved, superseded by the more genericSITES.sufxmatchingDISTFILES.sufxconstruct.USE_BZIP2β the framework will automatically detect the presence of.tar.bz2files to extract. See alsoBZIP2,EXTRACT_CASES, andEXTRACT_SUFX.USE_ZIPβ the framework will automatically detect the presence of.zipfiles to extract. See alsoZIP,EXTRACT_CASES, andEXTRACT_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 outdistinfoβ the checksum file, and it holds the output ofcksum(1), usingsha256(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 themake(1)glue for the ports tree. so like,make(1)goes looking forbsd.port.mk(andbsd.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 (peepSUBST_VARS). Multi-package ports useDESCR${SUBPACKAGE}πΈ${PKGDIR}/READMEβ OpenBSD-specific documentation for a port, installed as${LOCALBASE}/share/doc/pkg-readmes/${PKGSTEM}at the end of fake. Variables fromSUBST_VARSget expanded. Multi-package ports useREADME${SUBPACKAGE}π${PKGDIR}/<foo>.loginβ a login.conf.d file for class <foo>. Gets installed as${PREFIX}/share/examples/login.conf.d/fooat the end of fake. When a port provides a daemon started byrc.d(8)that needs non-defaultlogin.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 fromSUBST_VARSget 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, seeCHECKSUM_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. SeePORTSDIR_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 duringgenerate-readmes.${PKGDIR}has to point to an existing directory so thatbsd.port.mkcan 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 fromupdate-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 fromregister-plist(1)Error: duplicate item in packing-listβ error message comes frompkg_create(1), and it'll happen because of incorrect packing-lists β like including several fragments with the same file, or having incorrectPKG_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 usePKG_CREATE_NO_CHECKSinstead, assuming they understand the implications. Seeprint-package-args(wantlib-args) for details πFatal: can't flavor a SUBDIRβ a dependency mentionstop_subdir,flavor. The flavor would then be ignored, since it's only applied to individual ports πFatal: can't subpackage a SUBDIRβ a dependency mentionstop_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 confusepkg_add(1). Seepackages-specs(7)π΅Fatal: inclusion of <file> from <file>βbsd.port.mkorbsd.port.subdir.mkhas been included from a MODULE or fromMakefile.inc, resulting in a double inclusion. That leads to weird results, likePKG_ARGSbeing 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 inpkgpath(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-defaultsis distributed as a symlink in thexshare*.tgzfile 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 allPERMIT_*values πFatal: Use 'env FLAVOR=flavor make' insteadβ arguments specified aftermake(1)are hardcoded for all recursive sub-makes and very difficult to override. SoFLAVORhas to be specified in the environment instead π§Fatal: Use 'env SUBPACKAGE=-sub make' insteadβ same deal: arguments specified aftermake(1)are hardcoded for all recursive sub-makes and very difficult to override. SoSUBPACKAGEhas to be specified in the environment instead π§ldconfig: <dir>: No such file or directoryβ usually produced bypkg_add(1)runningldconfig(8). Some tools like GNU libtool will add directories living under${WRKINST}to the shared library path during the fake stage. Then of courseldconfig(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 givenLIB_DEPENDS. So theLIB_DEPENDSwon't turn into a@dependsline in the created package. This is often because of confusion betweenLIB_DEPENDSandRUN_DEPENDS:RUN_DEPENDSis 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>)β seeUNLINKEDWarning: FULLPKGNAME-sub defined but not FULLPKGPATH-subβFULLPKGNAME-subhas been explicitly defined by the port instead of relying on the default, but no value ofFULLPKGPATH-subwas given. This is often an error πWarning: no debug-info in ...β the port usesDEBUG_PACKAGES, so thebuild-debug-info(1)script expects debug information on all binaries and libraries. Most probably the build machinery for that specific port omitted-gsomewhere, or it runs strips during fake anyway. It can also happen ifDEBUG_PACKAGESincludes subpackages with no files holding debug info πWarning: old style distfiles <files>... foundβ seefetchfor the newer wayWarning: symlink(s) point to non existent file.β this warning comes frompkg_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 timemake packageis run πWarning: @option no-default-conflict with no @conflictβ warning message comes frompkg_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 possibleREVISIONbumps. Any other version or FLAVOR won't conflict. This is generally an error, apart from very few ports likedevel/autoconf/*π¬groff produced empty result for <manpage>...β warning message comes frompkg_create(1). Manpages are automatically formatted withgroff(1)ifUSE_GROFFis 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
- nixpkgs unstable: cvs-export
- Copyright (c) 2000-2008 Marc Espie
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms