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

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

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

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

bsd.port.mk also uses quite a few helper scripts.
Those live under ${PORTSDIR}/infrastructure/bin,
and they do have manpages under
${PORTSDIR}/infrastructure/man.

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.

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

Compute a
sha256(1) digest of
${CHECKSUM_FILES} (files listed in DISTFILES and PATCHFILES) and check it
against ${CHECKSUM_FILE}, normally distinfo.
In case of a mismatch, running checksum with
REFETCH=true
will fetch alternative versions of files keyed on their checksum fron the
OpenBSD main archive site.

Extract the distribution files under
${WRKDIR} (but see
EXTRACT_ONLY,
FIX_EXTRACT_PERMISSIONS and
NO_DEPENDS). Refer to
EXTRACT_CASES for a complete
description. Do not use pre-extract and
do-extract hooks.

Do a fake port installation, that is, simulate the port
installation under ${WRKINST}. There is no
do-fake and
post-fake hooks.
fake actually uses
pre-fake,
pre-install,
do-install and
post-install. Override
pre-install,
do-install, or
post-install to change behavior. Do not touch
pre-fake unless you really know what you are
doing. See THE FAKE
FRAMEWORK section below.

Fetch the list of files in
DISTFILES and
PATCHFILES using ${FETCH_CMD}. Files
are normally retrieved from the list of sites in
MASTER_SITES.

Appending ‘:0’ to ‘:9’ to an entry will let
${FETCH_CMD} retrieve from
MASTER_SITES0 to
MASTER_SITES9 instead. 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.

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

Run sha256(1)
on ${MAKESUMFILES} that is, files listed in ${DISTFILES}, ${SUPDISTFILES}
and ${PATCHFILES}, and store the result in ${CHECKSUM_FILE}, normally
distinfo. Also store the lengths of all files
for a quick check during fetch.

Build a port package (or packages in a
MULTI_PACKAGES case) from the fake
installation. Involves creating packaging information from templates (see
COMMENT,
SUBST_VARS among others) and invoking
pkg_create(1) 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 resulting packaging information is
compared with existing stuff, and saved if new, with loud complaints if it
changed without a REVISION bump. Arch-independent packages are created in
${PACKAGE_REPOSITORY}/no-arch, and copied into
${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all as needed. If
${PERMIT_PACKAGE_FTP} is set to ‘Yes’, copies built packages
into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp, using hard links if
possible. If ${PERMIT_PACKAGE_CDROM} is set to ‘Yes’, copies
built packages into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom, using
hard links if possible.

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. See also
REORDER_DEPENDENCIES for possible
post-patch clean-up.

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.

Print all dependency-related information that will be
passed as parameters to
pkg_create(1), e.g.,
-Wwantlib
and -Pdepends 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.

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

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.

Create or update patches for a port, using
update-patches(1),
which invokes diff(1) between
file and
file.orig, based on
file.orig existence. In order to generate a
patch, the original file needs to be named
file.orig and
file edited. After the target is invoked, the
patches are placed under the patches/ directory. It moves existing patches
from patch-file to
patch-file.orig.

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.

Update the packing lists for a port, using the fake
installation and the existing packing lists.
update-plist should produce a mostly correct
PLIST file, handling GNU
info(1) files, setuid files,
and empty directories. It moves an existing file to
PLIST.orig. If the generated list includes
files and directories that shouldn't be included, comment these like this:

@comment unwanted-file
@comment unwanted-dir/

Subsequent calls to update-plist will
automatically recognize and handle such lines correctly.

update-plist may not handle flavor and
multi-packages situations correctly yet, so beware.

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

Starting with OpenBSD 3.3, several
versions of autoconf may coexist peacefully. The main autoconf script is a
shell wrapper in the devel/metaauto package,
and similarly for automake. Setting
AUTOCONF_VERSION along with
CONFIGURE_STYLE set to autoconf is the
correct way to specify which one to use.
AUTOCONF_VERSION defaults to 2.13. If
autoconf must be run manually,
MODGNU_AUTOCONF_DEPENDS can be used to
specify what packages to depend upon.

Several versions of automake may coexist peacefully.
AUTOMAKE_VERSION must be set before
trying to run automake. Defaults to 1.4. Note that even if
CONFIGURE_STYLE includes automake,
automake should still be run manually during the right
configure stage.

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

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

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, as the pseudo-flavor will be automatically removed.

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

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 to write dependencies for subpackages like
this: LIB_DEPENDS-foo=${BUILD_PKGPATH} and avoid
starting to build a package with some other flavor combination. See
pkgpath(7) on the subject
of ‘pkgpath normalisation’. Read-only.

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

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

User settings. If set to ‘Yes’, every package
build will verify that shared libraries are correctly registered. This is
essentially the same as running ‘make
lib-depends-check’ after each package build. Defaults to
‘No’, as this can be a big performance hit.

User settings. Choose whether or not to checksum packages
while building. Deposits result in
${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums/${FULLPKGNAME}.sha256.
Can be set to ‘Yes’ to compute a checksum for all packages,
‘cdrom’ to compute it only for
PERMIT_PACKAGE_CDROM packages or to
‘ftp’ to compute it only for
PERMIT_PACKAGE_FTP packages. Defaults
to ‘no’, which does not compute a checksum at all.

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

base-gcc

gcc 4.2 compiler from base

base-clang

clang compiler from base

gcc3

gcc 3 compiler from base

ports-gcc

gcc 4.9 compiler from ports (heeds
MODGCC4_ARCHS from the module)

ports-clang

clang compiler from ports (heeds
MODCLANG_ARCHS from the
module)

The first compiler that matches criteria will be chosen. On clang-based
architectures, even though gcc is still compiled in base,
‘base-gcc’ never matches.

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

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

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

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

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

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

If ‘gnu’, assume GNU configure style. Add ‘dest’
if port does not handle DESTDIR correctly, and needs to be configured to
add DESTDIR to prefixes (see also
DESTDIRNAME). Add ‘old’
if port is an older autoconf port that does not recognize --sysconfdir.
Add ‘autoconf’ if autoconf needs to be rerun first, but set
‘no-autoheader’ to prevent autoheader from running. Add
‘automake’ if automake may need to be rerun. Otherwise,
automake will be explicitly disabled. Note that automake is never run
automatically. In order to use it,
CONFIGURE_STYLE should include
‘automake’ and there should be a
{pre,do}-configure target running automake.

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

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

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

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

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

The main port's distribution files (the actual software
source, except for binary-only ports). Will be retrieved from the
MASTER_SITES (see fetch), checksummed and
extracted (see checksum,
extract).
DISTFILES normally holds a list of
files, possibly with ‘:0’ to ‘:9’ appended to
select a different MASTER_SITES.

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

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

then fetch will retrieve from url
‘minetest/archive/${V}${EXTRACT_SUFX}’ into
‘minetest-${V}${EXTRACT_SUFX}’.

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

Epoch number of the current package. Defaults to empty (no
need for numbering changes), then numbering starts at 0. Gets
automatically incorporated into
FULLPKGNAME as
‘v${EPOCH}’ to form a full package-name conforming to
packages-specs(7).

In the normal extraction stage (when
EXTRACT_ONLY is not empty), this is the
contents of a case statement, used to extract files. Fragments are
automatically appended to extract tar, xz and zip archives, so that the
default case is more or less equivalent to the following shell fragment:

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

User settings. If set to ‘Yes’, the
package target will download packages missing
from the repository from locations in ${PKG_PATH} and place them into
${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/.
It will only build them if no suitable packages are found.

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

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

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

For ignored ports, set to the reasons for which the port is
ignored. If non-empty, most common targets that do something (e.g.,
fetch, build,
install...) will be
ignored. See also BATCH,
BROKEN,
FETCH_MANUALLY,
IGNORE_IS_FATAL,
IGNORE_SILENT,
INTERACTIVE,
IS_INTERACTIVE,
NOT_FOR_ARCHS,
NO_IGNORE,
ONLY_FOR_ARCHS.

Set to ‘Yes’ if port needs human interaction
to build. Porters should strive to minimize
IS_INTERACTIVE ports, by using
FLAVORS for multiple choice ports, and
by postponing human intervention to package installation time.

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

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

List of primary locations from which distribution files and
patchfiles are retrieved. See the fetch
target for details. Defaults to ${MASTER_SITES_GITHUB} for GitHub-hosted
projects, see GH_*. See
ports(7) for user
configuration.

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

External modules mechanism, documented separately. Modules
such as ‘imake’ and ‘gnu’ are normally
included automatically with the right
CONFIGURE_STYLE. Note that it is
possible to CONFIGURE_STYLE = simple,
MODULES += gnu to just get the effects of
CONFIG_SITE and
MODGNU_CONFIG_GUESS_DIRS along with the
default TEST_TARGET, in case the normal
GNU configure script was wrapped in a separate script that takes different
arguments. See
port-modules(5).

Set to a list of subpackage extensions for ports that
create multiple packages. See
FLAVORS AND
MULTI_PACKAGES below. Especially read the part about
ONLY_FOR_ARCHS when some of the
packages only exist for some architectures.

NO_ARCH

Location for arch-independent packages. Defaults to
‘no-arch’. Normally, packages are generated under
${PACKAGE_REPOSITORY}/${MACHINE_ARCH}, except for packages where
PKG_ARCH=*, which end up under ${PACKAGE_REPOSITORY}/${NO_ARCH}.

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

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

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

Suffix used by patch to rename
original files, and update-patches to
re-generate ${PATCHDIR}/${PATCH_LIST} by
looking for files using this suffix. Defaults to
.orig. For a port that already contains
.orig files in the ${DISTFILES}, set this to
something else, such as .pat.orig. See also
distpatch,
DISTORIG.

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

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

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

If PERMIT_PACKAGE_CDROM is set to
‘Yes’, PERMIT_PACKAGE_FTP
and PERMIT_DISTFILES_FTP will default
to ‘Yes’.

If PERMIT_PACKAGE_FTP is set to
‘Yes’,
PERMIT_DISTFILES_FTP will default to
‘Yes’.

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

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.

Default package spec for using this port as a dependency.
Defaults to ‘stem-*’, derived from the
FULLPKGNAME. Do not override without
very good reasons, namely software that coexist as different incompatible
versions with the same stem, e.g., already a mess.

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

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

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

FLAVOR=no_gnome make package

Pseudo-flavors should be named as ‘no_something’ to disable
the build of subpackage ‘-something’ (and possibly some
others, by restricting BUILD_PACKAGES).
Pseudo-flavors should always be handled through
bsd.port.arch.mk(5).
A pseudo-flavor can remove several subpackages through the following
construct.

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.

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
ensure those files are put in the proper order. The files are assumed to
be under ${WRKSRC}. The notation /file can be
used to ask for a recursive search, e.g., to make sure that all
Makefile.in are up to date. See
${PORTSDIR}/infrastructure/mk/automake.dep
for an example.

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

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.

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

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

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

Porters of software using libtool should make sure
MAKE_FLAGS get propagated to the
libtool invocations. This should be enough in most cases.

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

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

${SUBST_CMD} file1 file2 ...

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

${SUBST_CMD} -c src1 dest1 src2
dest2

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

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

Make variables whose values get substituted to create the
actual package information. Always holds
ARCH,
BASE_PKGPATH,
FLAVOR_EXT,
FULLPKGNAME,
HOMEPAGE,
LOCALBASE,
MACHINE_ARCH,
MAINTAINER,
PREFIX,
RCDIR,
SYSCONFDIR,
TRUEPREFIX, and
X11BASE. The special construct
‘${FLAVORS}’ can be used in the packing-list to specify the
current list of dash separated flavors the port is compiled with (useful
for cross-dependencies in
MULTI_PACKAGES). Add other variables as
needed. Some variable names are prefixed by a ^. This is only relevant for
update-plist, where it means the variable
will only be substituted at the beginning of a path.

Supplementary files that need to be retrieved under some
specific circumstances. For instance, a port might need
architecture-specific files.
SUPDISTFILES should hold a list of all
distribution files and patchfiles that are not always needed, so that a
mirror will be able to grab all files, or that
makesum will work. Having an overlap between
SUPDISTFILES and
DISTFILES,
PATCHFILES is admissible, and in fact,
expected, as it is much simpler to build an error-free list of files to
retrieve in that way. See the xanim port for an example.

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

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

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

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

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

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

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

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

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

Discovered old directory in
...

This message comes from
make-plist(1). A
directory was found in the PLIST that used to be needed but is no longer,
because it's now accounted for through dependencies. Indicates the old
directory has been removed.

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

Fatal: can't flavor a SUBDIR

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

Fatal: can't subpackage a
SUBDIR

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

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

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

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

Fatal: building ports requires
correctly installed X11

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

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

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

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

Every port must have explicit defines of all
PERMIT_* values.

Fatal: Use 'env FLAVOR=flavor make'
instead

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

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

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

ldconfig: <dir>: No such file or
directory

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

LIB_DEPENDS <spec> not needed for
<FULLPKGPATH>

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

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

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

Warning: FULLPKGNAME-sub defined but
not FULLPKGPATH-sub

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

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

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

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

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

groff produced empty result for
<manpage>...

Warning message comes from
pkg_create(1). Manpages
are automatically formatted with
groff(1) if
USE_GROFF is set. The above message
denotes an actual problem while formatting the page, which 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.

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

${DISTDIR}/${CHECKSUMFILES}

Cache of normal distribution files for a given port.

${DISTDIR}/${MAKESUMFILES}

Cache of all distribution files for a given port.

${PKGDIR}/DESCR

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

${PKGDIR}/README

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

${PKGDIR}/<foo>.rc

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

${PORTSDIR}/infrastructure/db/fake.mtree

Specification used for populating ${WRKINST} at the start
of fake. Use
pre-fake if this is incomplete.

${PORTSDIR}/packages/${MACHINE_ARCH}

Default setup of ${PACKAGE_REPOSITORY}.

${PACKAGE_REPOSITORY}/no-arch

Location of arch-independent packages.

${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all

Location of all built packages.

${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache

Location of packages retrieved through the network.

${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums

Location of checksums, see
CHECKSUM_PACKAGES.

${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom

Location of packages suitable for the CD.

${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp

Location of packages suitable for FTP.

${PORTSDIR}/bulk/${MACHINE_ARCH}

Default setup of ${BULK_COOKIES_DIR}.

${PORTSDIR}/update/${MACHINE_ARCH}

Default setup of ${UPDATE_COOKIES_DIR}.

${PORTSDIR}/mystuff

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

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

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

${FAKE_FLAGS} is used to set variables on
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.

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

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

The current MULTI_PACKAGES mechanism was introduced after
OpenBSD 4.0.

The arch-dependent part was refined after OpenBSD 5.0.

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

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

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

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

In bulk package building, flavors can be specified as a comma separated list
after the package directory, e.g., SUBDIR+=vim,no_x11 (see
pkgpath(7))

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

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

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

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

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

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

FULLPKGPATH and
FULLPKGNAME are special as well. You must
set PKGNAME-sub or
FULLPKGNAME-sub for each subpackage, but
FULLPKGPATH-sub is set automatically to the
right value. In very rare cases, one may override
FULLPKGPATH-sub. (for instance, if one
specific subpackage is not affected by option settings that affect other
subpackages, e.g., for include files packs).

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

ONLY_FOR_ARCHS and
NOT_FOR_ARCHS interact with
MULTI_PACKAGES and
IGNORE. The infrastructure will
automatically filter subpackages that are not suitable for the current
architecture. Thus, MULTI_PACKAGES should
always list all subpackages, even things not buildable on the current
architecture, for indexing purposes.

Starting with OpenBSD 5.1,
bsd.port.arch.mk(5)
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/4.9 or
print/poppler ports should provide examples of
proper use.

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

Starting after OpenBSD 4.1 all package information is
processed directly by
pkg_create(1) from templates
in ${PKG_DIR}.

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

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

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

Note that ${COMMENT} is currently not substituted, to speed up
describe generation.

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.

If libraries are built using bsd.lib.mk, special
care should be taken for mips64* architectures, which do not ever build
*pic.a files (all mips code is pic already).
bsd.port.mk automatically adds
-Dno_mips64=1 or -Dno_mips64=0
to PKG_ARGS, and the porter only needs to
provide the appropriate fragment.

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.

The special update-plist target does a fairly good
job of automatically generating the PLIST.

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.

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.

Old user settings. The infrastructure always trusts the
repository to contain correct packages. So, if the package name did not
change and if it exists in the repository, it will not be rebuilt without
manual user action.

Contents were used to replace ‘%SUBDIR%’ in
all MASTER_SITES variables. Since
‘%SUBDIR%’ almost always occur at the end of the directory,
the simpler ${VARIABLE:=subdir/} construct is now
used instead (taken from NetBSD).

Starting with OpenBSD 2.7, the
operating system installation script runs the /usr/local specification
globally, instead of embedding it in each package. So packages no longer
record an mtree(8)
specification. Use an explicit ‘@exec’ command if
needed.

PATCHFILES
used to be retrieved from a separate site list. For greater flexibility,
all files are now retrieved from
MASTER_SITES,
MASTER_SITES0,
...,
MASTER_SITES9, using a
‘:0’ to ‘:9’ extension to the file name, e.g.,

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

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

Offensive to introspection, makes it impossible to build a
decent sqlports on a given arch. Hasn't been used for a long time, and
there are lots of mechanisms such as
PKG_ARGS and fragment substitution, or
PATCH_LIST to achieve similar
results.

Makefile.${ARCH}

Likewise, offensive to introspection too.

${FILESDIR}/md5

Renamed to distinfo to match
other BSD, and save directories.

${SCRIPTDIR}/{pre,do,post}-*

Identical functionality can be obtained through a
{pre,do,post}-* target, invoking the script
manually if necessary.

${SCRIPTDIR}/configure

No longer invoked automatically. Just inline the
instructions in do-configure in the Makefile,
or put the script in ${FILESDIR} and invoke it.

${PKGDIR}/COMMENT

Use COMMENT variable instead.

${PKGDIR}/DEINSTALL*

Use @unexec annotations in the packing-list instead.

${PKGDIR}/INSTALL*

Use @exec annotations in the packing-list instead.

${PKGDIR}/PLIST.{noshared,no-shared,shared}

Packaging list fragments to handle platforms that did not
support shared libraries.

${PKGDIR}/PLIST.sed

Use PLIST directly. Until revision 1.295,
bsd.port.mk did not substitute variables in
the packing list unless this special form was used.

${PKGDIR}/REQ*

Old requirement script. Was mostly unused anyway.

/usr/share/mk/bsd.port.mk

Original location of
bsd.port.mk. The current file lives under
${PORTSDIR}/infrastructure/mk/bsd.port.mk,
whereas /usr/share/mk/bsd.port.mk is just a
stub.

{scripts,files,patches}.${OPSYS}

The OpenBSD ports tree focuses on
robustness, not on being portable to other operating systems. In any case,
portability should not need to depend on operating system dependent
patches.

/usr/local/etc

Used by FreeBSD to marshall system
configuration files. All OpenBSD system
configuration files are located in /etc, or
in a subdirectory of /etc.