| BSD.PORT.MK(5) | File Formats Manual | BSD.PORT.MK(5) |
bsd.port.mk —
ports tree master Makefile fragment
.include <bsd.port.mk>
bsd.port.mk contains the
ports(7) tree
make(1) framework, in the form of
documented public targets, variables and paths.
The actual bsd.port.mk file lives under
${PORTSDIR}/infrastructure/mk, with
make(1)'s system include file
redirecting to it.
Optional parts of this framework have been moved to
port-modules(5) in an
effort to shrink the main file (see also
MODULES).
Identifiers beginning with an underscore are internal-use only and likely to change without notice.
This documentation contains sections covering targets, variables, diagnostics, and filenames, ordered in alphabetic order, followed by a section covering the fake framework, a section covering debug packages generation, a section explaining flavors and multi-packages, and a section covering the generation of package information.
It ends with sections covering some obsolete targets, variables and files, outlining conversion methods from older incarnations of the ports tree or from other BSD variants.
bsd.port.mk also uses quite a few helper
scripts which live under
${PORTSDIR}/infrastructure/bin.
Binary package details are mostly covered in pkg_create(1) 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.
{build,run,all,test}-dir-dependsNote that it is possible to obtain reverse dependency
information by using the show-reverse-deps
script from the sqlports package.
full-{build,run,all,test}-depends{build,lib,test,run}-depends-listprint-{build,run}-dependsfull-{build,run}-depends in a more readable
way.{pre,do,post}-*pre-* hook will be invoked
before running the normal action; the do-* hook
will be invoked instead of the normal action; the
post-* hook will be invoked after the normal
action. Specialization hooks exist for build,
configure, distpatch,
extract, fake,
gen, install,
patch, test. See
individual targets for exceptions.all-lib-depends-argsLIB_DEPENDS list into a form
suitable for pkg_create(1),
see print-package-args.build,
allenv -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
-f ${MAKE_FILE} ${ALL_TARGET}
check-registerPLIST_REPOSITORY).check-register-allcheck-register to all subpackages of the
current port.checkpatchchecksumchecksum with
REFETCH=true will fetch
alternative versions of files keyed on their checksum from the
OpenBSD main archive site.cleanWRKBUILD directory (only useful if
SEPARATE_BUILD is set).clean-dependsmake
clean=depends’.configureconfigure creates
the ${WRKBUILD} directory (see SEPARATE_BUILD),
and runs whatever configuration methods are recorded in
CONFIGURE_STYLE.distcleanmake
clean=dist’.distpatchpatch,
PATCH_CASES and
FIX_CRLF_FILES for details.dump-varsCan be limited to some specific information by setting
DPB to nothing or ‘fetch’. Mostly
used by dpb(1) for obtaining
vital information from the ports tree.
extractEXTRACT_ONLY,
FIX_EXTRACT_PERMISSIONS and
NO_DEPENDS). Refer to
EXTRACT_CASES for a complete description. Do not
use pre-extract and
do-extract hooks.fakedo-fake
and post-fake hooks: instead
fake runs pre-fake,
pre-install, do-install
and post-install. Override
pre-install, do-install,
or post-install to change behavior.
There are only a handful of ports that use
pre-fake: that hook can be used to finish
setting up a fake directory before starting the
installation proper. Stuff run during pre-fake
will not register with update-plist, whereas
stuff run during pre-install will be considered
part of the installation process.
See THE FAKE FRAMEWORK section below.
fake-wantlib-argsWANTLIB against the list of installed
packages and libraries in the ports tree. See
print-package-args.fetchDISTFILES* and
PATCHFILES* using ${FETCH_CMD}. Files are normally
retrieved from the list of sites in SITES*.
Adding a suffix to DISTFILES,
PATCHFILES, SUPDISTFILES
will switch the site entry to the corresponding
SITES variable, e.g.,
DISTFILES.go = ... SITES.go = ...
If the rest of the entry parses as ‘filename{url}sufx’ ${FETCH_CMD} will fetch urlsufx instead, but store the result as filenamesufx.
Transfers in progress are stored as filenamesufx.part and moved after completion.
The actual filesystem paths to all distfiles (resp.
patchfiles) after url/filename substitution, including suffixed sources,
is conveniently stored as ALL_DISTFILES (resp.
ALL_PATCHFILES). The ports framework uses
${DISTDIR}/${DIST_SUBDIR} (aliased to
${FULLDISTDIR}) to save the ports distribution
files and patch files.
If you want to fetch a significant number of distfiles
quickly, say all files relevant to a port, dpb
-F is more efficient.
There are no {pre,do,post}-fetch
hooks, as this would break
dpb(1).
See ALL_DISTFILES,
ALL_PATCHFILES,
ALL_SUPDISTFILES,
CHECKSUMFILES, DISTDIR,
DISTFILES*, DIST_SUBDIR,
FETCH_CMD,
FETCH_MANUALLY,
FULLDISTDIR,
MAKESUMFILES,
PATCHFILES*,
SUPDISTFILES*, REFETCH.
SITES*,
fetch-allfetch, but also fetches
SUPDISTFILES*, for use by e.g.,
makesum.fix-permissionsPORTS_PRIVSEP and/or
dpb(1).
If necessary, creates directory
DISTDIR owned by
FETCH_USER, and creates directories
LOCKDIR,
PACKAGE_REPOSITORY,
PLIST_REPOSITORY and
WRKOBJDIR owned by
BUILD_USER.
If these directories already exist, ownership of their
contents is modified to conform to PORTS_PRIVSEP
and dpb(1) requirements.
genMODxxx_gen) and a do-gen
hooks. Then adjust timestamps to avoid regeneration during build (see
REORDER_DEPENDENCIES).generate-readmesfake and before
package or update-plist.
Always rerun, as it is cheap enough.install-dependsRUN_DEPENDS,
LIB_DEPENDS, and
WANTLIB.install{pre,do,post}-install hooks are actually used by
the ports tree.install-alllib-depends-argsLIB_DEPENDS to keep only entries required
by WANTLIB, and output a list of dependencies
suitable for pkg_create(1),
see print-package-args.lib-depends-checkLIB_DEPENDS and
WANTLIB recorded in the port's packages are
accurate. See port-lib-depends-check, which checks
files under the fake staging directory instead, and thus has faster
turn-around.license-checkPERMIT_PACKAGE settings match: if any
dependency has a more restrictive setting, warn about it. This warning is
advisory, because automated license checking cannot know that some ports
were only used for building and did not taint the current port.lockunlock. Seldom used, see
ports(7) for details.makesumfetch-all to fetch missing ${MAKESUMFILES}
without verifying their digest, then run
sha256(1) on them that is,
files listed in ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*}. The
result is stored in ${CHECKSUM_FILE}, normally
distinfo. Also store the lengths of all files for
a quick check during fetch,
fetch-all.no-lib-depends-argslib-depends-args that does not
do anything. See print-package-args.no-wantlib-argswantlib-args that does not do
anything. See print-package-args.packageMULTI_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 default), the resulting packaging information
is compared with existing stuff, and saved if new, with loud complaints if
it changed without a REVISION bump.
if DEBUG_PACKAGES is set, some debug
information may also be set aside and saved in
debug-* packages transparently.
Also note that ${PLIST_REPOSITORY}/${MACHINE_ARCH}/history contains LRU caches for all files (see package(5)). 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.
patchpatch does not
follow the exact same scheme other standard targets do. Namely,
patch invokes pre-patch
(if defined), do-patch, and
post-patch, but the default
do-patch target invokes
distpatch directly. So, if the
do-patch target is overridden, it should still
begin by calling ‘make distpatch’,
before applying OpenBSD specific patches.
Accordingly, the exact sequence of hooks is:
pre-patch, do-distpatch,
post-distpatch, do-patch,
post-patch. If ${PATCHDIR}
exists, the files described under PATCH_LIST will
be applied under WRKDIST.peek-ftpSITES, in the right
directory, and leaves user at
ftp(1)'s prompt.pkglocatedbport-lib-depends-checkLIB_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.port-wantlib-argsWANTLIB 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.prepareBUILD_DEPENDS, LIB_DEPENDS
and WANTLIB. In
MULTI_PACKAGES setups, see
FLAVORS AND
MULTI_PACKAGES.print-package-args-W wantlib and
-P depends lines.
Those parameters are generated by
run-depends-args for
RUN_DEPENDENCIES handling, a form of
lib-depends-args for
LIB_DEPENDS and WANTLIB
interaction, and a form of wantlib-args for
WANTLIB resolution.
Variables lib_depends_args and
wantlib_args control the exact behavior:
lib_depends_args is normally set to
lib-depends-args, but will be set to
all-lib-depends-args by
port-lib-depends-check, in order to have access
to the full list of LIB_DEPENDS for figuring out missing WANTLIB.
wantlib_args is normally set to
wantlib-args but it may be set to
port-wantlib-args for introspection purposes, to
fake-wantlib-args to avoid some checks, or to
no-wantlib-args to avoid expensive WANTLIB
checks entirely.
print-update-signature-S.print-plistprint-plist-allprint-plist for all subpackages in a
given port.print-plist-all-with-dependsprint-plist-with-depends for all
subpackages in a given port.print-plist-contentsprint-plist, the
package contents only consists of files, all tagged with category markers
such as @file. See
pkg_create(1).print-plist-libsprint-plist-all-libsprint-plist-libs for all subpackages
in a given port.print-plist-libs-with-dependsprint-plist-libs, but slower. It also handles
LIB_DEPENDS, RUN_DEPENDS,
and WANTLIB, so that the packing-list has complete
dependency information.print-plist-with-dependsprint-plist, but slower. It also handles
LIB_DEPENDS, RUN_DEPENDS,
and WANTLIB, so that the packing-list is
complete.rebuildregenreinstallupdate might do
the right thing.repackagerun-depends-argsRUN_DEPENDS and outputs a list of
dependencies suitable for
pkg_create(1), see
print-package-args.reprepareretestshowshow-debug-infoshow-fake-sizeBULK_TARGETS.show-indexedshow. Invoked as make
show-indexed=name, show the contents of ${name${SUBPACKAGE}}, or ${name}
if the variable name is not
SUBPACKAGE dependent.show-listshow. Shows "list-like"
variables, one entry per line. Mostly useful as a debugging target, since
some internal variables may now exceed
ARG_MAX.show-prepare-resultsprepare.show-prepare-test-resultsprepare and
test-depends.show-required-byVery slow, prefer installing the
sqlports package and using
show-reverse-deps.
show-run-dependssubpackagepackage, but
affects only one single subpackage in multi-packages ports.show-sizeBULK_TARGETS.subupdateupdate, but affects only one single subpackage in
multi-packages ports.testenv -i ${ALL_TEST_ENV} ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} \
-f ${MAKE_FILE} ${TEST_TARGET} ${TEST_LOG}
If a port needs some other ports installed to run regression
tests, use TEST_DEPENDS. If a port needs special
configuration or build options to enable regression testing, define a
‘test’ FLAVOR.
test-dependsTEST_DEPENDS.unlocklock.update-patchesEDIT_PATCHES.updateFULLPKGPATH, and
update it using ‘pkg_add -r’ if a newer package is
available. In multi-packages ports, all relevant packages are updated. See
UPDATE_COOKIES_DIR and
FORCE_UPDATE as well.
However, see CAVEATS in
ports(7):
update is always ‘best-effort’ and
will often not work correctly when updating to a significantly different
newer version.
update-or-installUPDATE_COOKIES_DIR and
FORCE_UPDATE as well.update-or-install-allUPDATE_COOKIES_DIR and
FORCE_UPDATE as well.update-plistUPDATE_PLIST_ARGS) and user settings
(UPDATE_PLIST_OPTS). Also see
SUBST_VARS for details about the default handling
of variable substitution.verbose-showshow, except that it prefixes each
value with the variable name, e.g., VAR=value.
Also note that it does not show undefined variables, contrary to
show which outputs blank lines for these.wantlib-argsport-wantlib-args and
fake-wantlib-args and compare the results, errors
out in case of discrepancies. See
print-package-args.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.
showALL_DISTFILESDISTFILES* setting, after applying the
‘filename{url}sufx’
conversion, occasionally useful for setting
EXTRACT_ONLY manually. Read-only.ALL_FAKE_FLAGS${MAKE_FLAGS} ${DESTDIRNAME}=${WRKINST}
${FAKE_FLAGS}. Read-only.ALL_PATCHFILESPATCHFILES* setting, after applying the
‘filename{url}sufx’
conversion. Read-only.ALL_SUPDISTFILESSUPDISTFILES* setting, after applying the
‘filename{url}sufx’
conversion. Read-only.ALL_TEST_ENV${MAKE_ENV}
${TEST_ENV}. Read-only.ALL_TEST_FLAGS${MAKE_FLAGS} ${TEST_FLAGS}. Read-only.ALL_TARGETAPM_ARCHSONLY_FOR_ARCHS.ARCHAUTOCONFAUTOCONF_DIRAUTOCONF_ENVCONFIGURE_STYLE is gnu or
higher.AUTOCONF_VERSIONAUTOCONF_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.AUTOHEADERAUTOMAKE_VERSIONAUTOMAKE_VERSION must be set before trying to run
automake. Defaults to 1.4.AUTORECONFBASE_PKGPATHBUILD_PKGPATH, which also includes pseudo-flavors.
Read-only.BASELOCALSTATEDIRLOCALSTATEDIR.BASESYSCONFDIRSYSCONFDIR.BATCHINTERACTIVE to simplify bulk-package builds. (See
IGNORE).BE_ARCHSNOT_FOR_ARCHS and
ONLY_FOR_ARCHS.BUILD_DEPENDSPKGSPEC). 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’.
BUILD_ONCEWhen 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.
BUILD_PKGPATHBASE_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.BUILD_PACKAGESBROKENNO_IGNORE,
TRY_BROKEN.BUILD_UNLINKEDIGNOREd even though the ports are currently
UNLINKED.BUILD_USERPORTS_PRIVSEP,
defaults to ‘_pbuild’.BROKEN-<arch>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]BULKBULK_COOKIES_DIR.
Defaults to ‘Auto’.BULK_COOKIES_DIRBULK_DOBULK_FLAGSBULK_TARGETS.BULK_TARGETSBZIP2CATEGORIESCCACHE_DIRUSE_CCACHE is
set to yes. Defaults to ${WRKOBJDIR}/.ccache.CCACHE_ENVUSE_CCACHE is set to yes. For instance, to enable
verbose logging, set
CCACHE_ENV="CCACHE_LOGFILE=/tmp/ccache.log"CDIAGFLAGSCFLAGS if
WARNINGS is set.CFLAGSCOPTS,
CDIAGFLAGS.CFLAGS_${CHOSEN_COMPILER}CFLAGS
depending on the value of CHOSEN_COMPILER. Common
usage pattern:
CFLAGS_base-clang = -Wno-error=unused-but-set-variable
See also COMPILER,
COMPILER_LANGS and
CHOSEN_COMPILER.
CHECK_LIB_DEPENDSmake
lib-depends-check’ after each package build. Defaults to
‘No’, as this can be a big performance hit, and also because
lib-depends-check doesn't know about library
subdirectories or dynamic loading through
dlopen(3).CHECK_LIB_DEPENDS_ARGSCHECKSUMFILESfetch, with DIST_SUBDIR
prepended and with the master site selection extension removed. Read-only.
See also MAKESUMFILES.CHECKSUM_FILEchecksum, makesum, and
dpb(1). Defaults to
distinfo.CHECKSUM_PACKAGESPERMIT_PACKAGE packages. Defaults to
‘no’, which does not compute a checksum at all.CHOSEN_COMPILERCOMPILER
mechanism. Set to ‘irrelevant’ to disable
COMPILER.CLEANDEPENDSclean target
will also clean dependencies. Can be overridden on a per-${PKGPATH} basis,
by setting CLEANDEPENDS_${PKGPATH}.COMMENTCOMMENT-fooCOMMENT-vanillaCOMMENT-foo-vanillaCOMES_WITHCOMPILERMODGCC4_ARCHS
from the module)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.
ONLY_FOR_ARCHS will also be set if
applicable.
COMPILER_LANGSCOMPILER_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 8 while having clang from base. See also
CHOSEN_COMPILER.COMPILER_LINKSbsd.port.mk and compiler
MODULES to build scripts in
${WRKDIR}/bin to force setting compiler flags
(-B is required for clang to find
${WRKDIR}/bin/ld as used by
USE_WXNEEDED) and call
COMPILER_WRAPPER if used.COMPILER_WRAPPERUSE_CCACHE or can be set
explicitly for other purposes (e.g. distcc).CONFIG_SITE_LISTCONFIGURE_STYLE=gnu, or with
MODULES += gnu. List of
config.site fragments that will speed up
gnu-configure, and prevent it from preferring various gnu programs, unless
BUILD_DEPENDS explicitly ask for them. Read-only,
available for debugging purposes.CLANG_ARCHS,
GCC3_ARCHS, GCC4_ARCHSNOT_FOR_ARCHS or
ONLY_FOR_ARCHS to limit ports to architectures
where they compile.CONFIGURE_ARGSCONFIGURE_ENVCONFIGURE_SCRIPTconfigure
target, if appropriate. Should be either an absolute path, or relative to
${WRKSRC}.CONFIGURE_STYLEIf ‘perl’, assume perl(1)'s ExtUtils::MakeMaker(3p) style. Add ‘modbuild’ to enable Module::Build(3p), ‘modbuild tiny’ to enable Module::Build::Tiny(3p), or ‘modinst’ for Module::Install(3p) style.
If ‘gnu’, 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.
Alternatively, add ‘autoreconf’ to rerun autoconf,
automake, and related tools to completely regenerate the GNU build
framework.
If ‘imake’, assume port configures using X11 ports Imakefile framework. Add ‘noman’ if port has no man pages the Imakefile should try installing.
If ‘simple’, there is a configure script, but it does not fit the normal GNU configure conventions.
Extensions may be defined by specific MODULES. See port-modules(5) for details.
COPTSCXXDIAGFLAGSCXXFLAGS if
WARNINGS is set.CXXFLAGSCXXFLAGS_${CHOSEN_COMPILER}CXXFLAGS
depending on the value of CHOSEN_COMPILER. See
also COMPILER,
COMPILER_LANGS and
CHOSEN_COMPILER.CXXOPTSDEBUG_CONFIGURE_ARGSDEBUG_PACKAGESDEBUG_PACKAGES=${BUILD_PACKAGES} for packages
where debug information is desirable. Note the subpackages with
PKG_ARCH=* will automatically be stripped from
that list. See THE
DEBUG_PACKAGES INFRASTRUCTURE below for details.DEBUGINFO_ARCHSDESCRDESTDIRDESTDIRNAME.DESTDIRNAMEDIST_TUPLETEMPLATE_DISTFILES.<name> and
TEMPLATE_HOMEPAGE.<name> entries can be
added as needed). The components are used to build
SITES.name DISTFILES.name
and (optionally) HOMEPAGE.
At the end of post-extract, the files
are moved to ${WRKDIST}/<targetdir>. Using
‘.’ for targetdir will disable the
move.
DISTDIRFULLDISTDIR to refer to ports' distribution files
location, as it takes an eventual DIST_SUBDIR into
account.DISTFILES*fetch), checksummed and extracted (see
checksum, extract).
DISTFILES normally holds a list of files.
Preferably, adding a suffix to
DISTFILES, will switch the site entry to the
corresponding SITES variable, e.g.,
DISTFILES.go = ... SITES.go = ...
Each entry may optionally be of the form ‘filename{url}sufx’ to deal with sites that only offer archives as weird urls, doing the transfer of 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's proper operation.
If no DISTFILES* is set and if
SITES is not null, then
DISTFILES will be set to
${DISTNAME}${EXTRACT_SUFX}.
DISTNAMEDISTFILES* and
PKGNAME.DISTORIGdistpatch to rename original files.
Defaults to .bak.orig. Distinct from
PATCHORIG to avoid confusing
update-patches.DIST_SUBDIRfetch.DPBdump-vars.DPB_LOCKNAMEPKGPATH-derived name. This
feature comes with large restrictions and shouldn't be used unless
absolutely necessary. Specifically, it can allow
dpb to build several flavors of the same port at
the same time, but beware: under MULTI_PACKAGES
and PSEUDO_FLAVORS conditions, if some of these
packages are identical across flavors, this will not work. This also makes
it harder to interact with locks if the names are not obvious.DPB_PROPERTIESDUMMY_PACKAGEbsd.port.mk will provide dummy values
for variables mandatory for a minimally functional port. Used by the
sqlports package and
dpb(1) to perform introspection
and obtain bsd.port.mk's default values for
variables without needing to access any specific port.DWZECHO_MSGECHO_REORDERREORDER_DEPENDENCIES actions. Silent by
default.EDIT_PATCHESupdate-patches will not open changed files in an
editor.EPOCHFULLPKGNAME as
‘v${EPOCH}’ to form a full package-name conforming to
packages-specs(7).ERRORS.if !defined(COMMENT) ERRORS+="Fatal: Missing comment" .endif
ERRORS, for instance to flag
erroneous combinations of FLAVORS (but see
ONLY_FOR_ARCHS
NOT_FOR_ARCHS and BROKEN
for other common issues).
Note that setting fatal errors defeats all introspection mechanisms and breaks the sqlports package.
Tip: if you need to debug a fatal error, you can always
override ERRORS on the command line, e.g.,
make ERRORS= show=<var>
EXTRACT_CASESarchive (shell variable) set to each element
of EXTRACT_ONLY in order, which is then processed
by a case switch: ${EXTRACT_CASES}.
bsd.port.mk detects extensions in
${CHECKSUMFILES} and automatically adds
BUILD_DEPENDS and fragments to handle the
following archives:
Other cases not supported directly in
bsd.port.mk can be added, and existing cases can
be overridden. For example the following snippet sets extra conversion
flags to unzip, and adds support for rar:
*.zip) ${UNZIP} -Laq ${FULLDISTDIR}/$$archive -d ${WRKDIR};; \
*.rar) ${LOCALBASE}/bin/unrar x -idq ${DISTDIR}/$$archive;;
EXTRACT_ONLYdo-extract stage.
Defaults to ${ALL_DISTFILES}, can even be set to empty.EXTRACT_SUFXDISTFILES default value to
${DISTNAME}${EXTRACT_SUFX}. Default value is
.tar.gz.
Note that DISTFILES will only be set
in the absence of DISTFILES.sufx as well, or if
SITES is not empty.
EXTRACT_SUFX.<name>EXTRACT_SUFX value for a template defined
through DIST_TUPLE.EXTRACT_FILESEXTRACT_CASES and passed as file
... argument to tar(1) or
unzip(1), e.g.,
glob(7) patterns and shell brace
expansion may be used. Empty by default to extract all files.FAKE_FLAGSALL_FAKE_FLAGS.FAKE_SETUPdo-install.
Read-only, see THE FAKE
FRAMEWORK section for details.FAKE_TARGETFAKEOBJDIRFETCH_CMDFETCH_CMD should support a few ftp options, chief
among them being -C and -o
dest, but also -m,
-S, -v,
-V. Most of these can be no-ops in a FETCH_CMD
script, See
${PORTSDIR}/infrastructure/template/fetch_cmd.template
for a skeleton script.FETCH_MANUALLYFETCH_MANUALLY to a
list of strings that will be displayed, one per line, e.g.,
FETCH_MANUALLY= "You must fetch foo-1.0.tgz" FETCH_MANUALLY+="from http://www.fubar.com/ manually," FETCH_MANUALLY+="after reading and agreeing to the license."
IS_INTERACTIVE if some distribution
files are missing.FETCH_PACKAGESpackage target to download packages missing
from the repository from locations in ${PKG_PATH} and place them into
${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/, only
building them if no suitable packages are found. For instance,
make FETCH_PACKAGES=
to use without any options, or
make FETCH_PACKAGES=-Dsnap
to use close to release.
FILESDIRFETCH_USERPORTS_PRIVSEP, defaults to
‘_pfetch’.FIX_CLEANUP_PERMISSIONSclean. Used for build systems which set
paranoid permissions at build time. Defaults to ‘No’.FIX_CRLF_FILESdistpatch. Sometimes a port will include files
with MS-DOS line endings (CR LF). To avoid problems with patches
(especially when sent by email) these should be converted to LF.
bsd.port.mk changes to WRKDIST before converting
files - shell wildcards may be used.FIX_EXTRACT_PERMISSIONSextract. Used for some distfile contents which
have paranoid permissions for no reason. Defaults to
‘No’.FLAVORFLAVORSFLAVOR into a canonical order to build the package
name, or to select the packing-list, and as a quick validity check. See
also PSEUDO_FLAVORS.FLAVOR_EXTFULLPKGNAME.FORCE_UPDATEupdate 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.FULLDISTDIRFULLPKGNAMEEPOCH and
REVISION.FULLPKGPATHGH_*SITES_GITHUB and DISTNAME.
Use DIST_TUPLE for more complicated
situations.
GH_ACCOUNTGH_COMMITGH_DISTFILEbsd.port.mk to the generated name of the
distribution file. This can be useful for ports listing multiple
DISTFILES*.GH_PROJECTGH_TAGNAMEGMAKEHOMEPAGEIGNOREfetch, build,
install ...) will be
ignored. See also BATCH,
BUILD_UNLINKED, BROKEN,
FETCH_MANUALLY,
IGNORE_IS_FATAL,
IGNORE_SILENT,
INTERACTIVE,
IS_INTERACTIVE,
NOT_FOR_ARCHS, NO_IGNORE,
ONLY_FOR_ARCHS,
UNLINKED.IGNORE_IS_FATALIGNORE_SILENTINSTALL_DEBUG_PACKAGESINSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]INSTALL_TARGETINTERACTIVEBATCH to simplify
bulk-package builds.IS_INTERACTIVENote that IS_INTERACTIVE ports won't
be built as official packages, so avoid at all cost.
Human intervention should be moved to binary package installation and/or post-installation configuration instead.
Discrete Yes/No choices are better modelled as
FLAVORS.
LE_ARCHSNOT_FOR_ARCHS and
ONLY_FOR_ARCHS.LIB_DEPENDSBUILD_DEPENDS and
RUN_DEPENDS, but with specific rules:
LIB_DEPENDS always turn into
BUILD_DEPENDS (but see
FLAVORS AND MULTI
PACKAGES).
LIB_DEPENDS is also used as a run-time
dependency, and recorded in the package as such, if any of the libraries
mentioned in WANTLIB is a shared library that
originates within the dependent port.
See library-specs(7) for more details.
lib_depends_argsprint-package-args for details.LIBCXXWANTLIB.LIBTOOLLIBTOOL_FLAGSLLD_EMULLLD_EMUL defaults to the correct option to set the
emulation mode; Otherwise, it stays empty. Read-only. Seldom used, as it
is only needed to link binary data without using the compiler.LLVM_ARCHSNOT_FOR_ARCHS or
ONLY_FOR_ARCHS.LOCALBASELOCALSTATEDIRBASELOCALSTATEDIR, which defaults to
/var. Passed to gnu configure scripts.LOCKDIRLOCK_CMDLOCK_VERBOSELP64_ARCHSNOT_FOR_ARCHS.MAINTAINERMAKE_ENVMAKE_FLAGSfake stage, which adds
FAKE_FLAGS (see
ALL_FAKE_FLAGS) and for the
test stage, which adds
TEST_FLAGS (see
ALL_TEST_FLAGS).MAKE_FILEMAKE_JOBSMAKE_PROGRAM through
PARALLEL_MAKE_FLAGS. Mostly set automatically when
DPB_PROPERTIES contains ‘parallel’.
Note that make(1) still has bugs that may prevent parallel build from working correctly!
MAKE_PROGRAMMAKEFILE_LISTMAKESUMFILESfetch-all, with
DIST_SUBDIR prepended and with master site
selection extension removed. Read-only. See also
CHECKSUMFILES.MESSAGEMISSING_FILESFETCH_MANUALLY is set,
MISSING_FILES will contain the list of missing
distfiles or patchfiles that need to be fetched manually. Read-only.MODGNU_CONFIG_GUESS_DIRSMODPERL_ADJ_FILESMODPERL_ADJ_FILES. File paths here should be
relative to WRKSRC. These files are patched
automatically at the end of pre-configure.MODPERL_BIN_ADJMODPERL_ADJ_FILES.MODPERL_BUILD_TARGETdo-build when
CONFIGURE_STYLE uses perl. Provided as a separate
variable if a port wants to override do-build for
its own reasons.MODPERL_INSTALL_TARGETdo-install.MODPERL_TEST_TARGETdo-test.MODPERL_REGEN_PPPORTMODULESCONFIGURE_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).MULTI_PACKAGESONLY_FOR_ARCHS when some of the packages only
exist for some architectures.NO_ARCHNOT_FOR_ARCHSONLY_FOR_ARCHS.NO_BUILDNO_CCACHEUSE_CCACHE is set.NO_CHECKSUMchecksum entirely, as
dpb(1) already deals with
checksums internally.NO_DEPENDSNO_IGNOREIGNORE and
TRY_BROKEN.NO_SCCACHEUSE_SCCACHE is
set.NO_TESTONLY_FOR_ARCHSOSREVPACKAGE_REPOSITORYpackage target for details.PARALLEL_MAKE_FLAGSDPB_PROPERTIES contains
‘parallel’. Flags to pass to
MAKE_PROGRAM to yield a parallel build. Defaults
to -j${MAKE_JOBS}. Mostly set to empty by ports
that use other mechanisms for setting the number of jobs.PARALLEL_MAKE_JOBSMAKE_JOBS to use when
building manually a port with DPB_PROPERTIES
containing ‘parallel’. Defaults to the number of online
cpus.PATCHPATCHORIGpatch to rename original files, and
update-patches to re-generate
${PATCHDIR}/${PATCH_LIST} by looking for files
using this suffix. Defaults to .orig.port. In the
unlikely event that one of the ${DISTFILES*} already contains
.orig.port files, set this to something else, such
as .orig.obsdport. See also
distpatch, DISTORIG.PATCH_CASESdistpatch stage (when
PATCHFILES* is not empty), this is the contents of
a case statement, used to apply distribution patches. Fragments are
automatically appended to handle gzip'ed, bzip'ed and lzip'ed patches, so
that the default case is more or less equivalent to the following shell
fragment:
set -e
cd ${FULLDISTDIR}
for patchfile in ${ALL_PATCHFILES}
do
case $$patchfile in
*.bz2)
${BZIP2} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
*.zst|*.zstd)
zstdcat -c <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
*.Z|*.gz)
${GZIP_CMD} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
*)
${PATCH} ${PATCH_DIST_ARGS} <$$patchfile;;
esac
done
PATCHDIRpatch target.
Default: patches.PATCHFILES*DISTFILES*, but serving a different purpose, as
they hold distribution patches that will be applied at the
patch stage. See also
SUPDISTFILES*.PATCH_ARGSPATCH_CHECK_ONLYcheckpatch
target. Don't touch unless the default checkpatch
target needs to be redefined. Ideally, user-defined patch subtargets ought
to test checkpatch. In practice, they don't.PATCH_DIST_ARGSPATCH_DIST_STRIPPATCH_LISTPATCH_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_QUIETPATCH will work quietly.PATCH_STRIPPERMIT_DISTFILES,
PERMIT_PACKAGEIf PERMIT_PACKAGE is set to
‘Yes’, PERMIT_DISTFILES will
default to ‘Yes’.
PKG_ADDPKG_ARCHFor 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_ARGSPKG_CREATEPKG_CREATE_NO_CHECKSWANTLIB (see
wantlib-args). May result in bogus packages that
mix @depends lines obtained from the ports tree
with @wantlib lines that come from the installed
system. Set to ‘Warn’ to have the differences printed as a
warning instead of an error (the default).PKG_DBDIRPKG_DELETEPKG_INFOPKG_TMPDIRPORTHOMEHOME for most shell
invocations. Default will trip ports that try to write into $HOME while
building: non-existent
/${PKGPATH}_writes_to_HOME/.PORTPATHPORTSDIRPORTSDIR_PATHPORTS_PRIVSEPBUILD_USER and fetch distfiles as
FETCH_USER.
To work fully, this does require the ports tree to be
world-readable, and ${WRKDIR} to be
world-readable as well (update-patches and
friends won't work otherwise).
Meant to use in concert with dpb(1), 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}. The directories and permissions can
be set correctly using fix-permissions.
The regular user must be allowed to execute commands as
BUILD_USER and
FETCH_USER. Running commands as another user can
be achieved with doas(1) by
setting SUDO=doas in
mk.conf(5) and using the
following minimal
doas.conf(5):
permit keepenv nopass solene as _pbuild permit keepenv nopass solene as _pfetch
It is reasonably safe to allow your user id to run commands as
the BUILD_USER or
FETCH_USER and using
nopass for these can save a lot of password
entry, however it is inadvisable to allow commands like
pkg_add(1) to run as root
without a password.
Note that this also means that doas(1) 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’.
PKGDIRupdate-plist may create it. Must be a
valid directory. Default: pkg.PKGFILEPKGFILESPKGNAMEFULLPKGNAME for that.
Specific revisions and epoch changes should be handled by
REVISION and EPOCH
instead.PKGNAMESFLAVORS and BUILD_PACKAGES
taken into account. Mostly used as ‘make
show=PKGNAMES’ to verify that bumped package names are
correct.PKGNAME-fooPKGPATHPKGPATHSFLAVORS and MULTI_PACKAGES
taken into account. Order matches PKGNAMES
exactly.PKGSPECFULLPKGNAME. Do not override without very good
reasons, namely software that coexist as different incompatible versions
with the same stem, e.g., already a mess. Also See the description of
-P in
pkg_create(1)PKGSTEMPKGSTEM-main = php-5.6PLISTPLIST_DBPLIST_REPOSITORY.PLIST_REPOSITORYREVISION 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.PORTROACHPREFIXPREPARE_CHECK_ONLYprepare stage from
installing anything, let it just check dependencies, and handle [:target]
dependencies. Mostly used by
dpb(1), which already installs
everything before running prepare.PROGRESS_METERPROPERTIES.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
...
MULTI_PACKAGES setup, use of
ONLY_FOR_ARCHS-sub and
BUILD_PACKAGES is generally preferred (and
simpler). Possible properties include
PSEUDO_FLAVORFLAVOR that are actually
pseudo-flavors. Only for introspection purposes. Read-only.PSEUDO_FLAVORSFLAVOR=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.
# pseudo-flavor no_gui will also remove gtk and gtk3
MULTI_PACKAGES = -main -gtk -gtk3 -gui
# ...
.include <bsd.port.arch.mk>
# remove extra build components
.if !${BUILD_PACKAGES:M-gui}
BUILD_PACKAGES := ${BUILD_PACKAGES:N-gtk:N-gtk3}
.endif
# normal configure setup, e.g.,
.if ${BUILD_PACKAGES:M-gtk}
# ...
Caveat: creation of a separate working directory is mandatory for a pseudo-flavor. If, at a later time, a full build with all subpackages is required, all the work will need to be done again.
See also BUILD_ONCE.
RANDOMIZE_SUBDIRS-r option. Defaults to ‘No’.RCDIRREFETCHchecksum will
analyze ${CHECKSUM_FILE}, and try retrieving files with the correct
checksum off
https://ftp.openbsd.org,
in the directory
/pub/OpenBSD/distfiles/$cipher/$value/$file.REGISTER_PLIST_OPTSREORDER_DEPENDENCIESpost-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.REPORT_PROBLEMREPORT_PROBLEM_LOGFILEREVISIONFULLPKGNAME as ‘p${REVISION}’ to
form a full package-name conforming to
packages-specs(7).ROACH_SITESROACH_URL, in order to help portroach.ROACH_URLDISTFILES are applied to yield only the url part
of the distfile. Set manually if the automatic rules don't find the right
one.RUN_DEPENDSLIB_DEPENDS. The corresponding packages
will be built right before the install stage, and
pkg_add(1) will take care of
installing them.SCCACHE_DIRUSE_SCCACHE is
set to yes. Defaults to ${WRKOBJDIR}/.sccache.SCCACHE_ENVUSE_SCCACHE is set to yes.SEPARATE_BUILDSETENV/usr/bin/env -i. Prepended to
every command invocation that requires a clean environment. Do not
override.SHARED_LIBSLIBlibname_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.
Most common build systems in the ports tree have been modified to handle this mechanism correctly.
SITE_BACKUPMASTER_SITES* to
SITES* which means that
MASTER_SITE_BACKUP should be set instead until the
transition is complete.)SITE_*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/}SITESfetch target for details.
Defaults to ${SITES_GITHUB} for GitHub-hosted projects, see
GH_*. See
ports(7) for user
configuration.SITES*fetch for
details. Suffix should start with ‘.’ and be all lowercase
for consistency.SKIPDIRSTATIC_PLISTSTARTAFTERSTARTDIRSUBPACKAGESUBST_CMDSUBST_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
dest2will 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} can be used like install(1):
${SUBST_CMD}
[-g group]
[-o owner]
[-m mode]
file...Note that SUBST_CMD is not really
appropriate when variables have subpackage variations, like
PREFIX or FULLPKGNAME.
Use the appropriate SUBST_CMD-sub instead.
SUBST_CMD-subSUBST_CMD
with subpackage-dependent semantics, like packing-list substitution. It
will substitute the right variable depending on the desired subpackage,
e.g., SUBST_CMD-foo will substitute the value of
FULLPKGNAME-foo for
${FULLPKGNAME}.SUBST_DATA,
SUBST_MAN,
SUBST_PROGRAMSUBST_CMD that use
-c and appropriate owner/group/mode for data,
manpages and programs respectively.SUBST_VARSARCH,
BASE_PKGPATH, FLAVOR_EXT,
FULLPKGNAME, HOMEPAGE,
LOCALBASE, MACHINE_ARCH,
MAINTAINER, PREFIX,
PKGSTEM, RCDIR,
SYSCONFDIR, TRUEPREFIX,
and X11BASE. The special construct
‘${FLAVORS}’ can be used in the packing-list to specify the
current list of dash separated flavors the port is compiled with (useful
for cross-dependencies in MULTI_PACKAGES). Add
other variables as needed.
TRUEPREFIX is never passed to
pkg_create(1) as it is
identical to PREFIX.
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
SUDOSUPDISTFILES*makesum. For instance, a port might need
architecture-specific files, or have some flavor that requires more code.
SUPDISTFILES* should hold a list of all those
distribution files and patchfiles that are not always needed. Having an
overlap between SUPDISTFILES* and
DISTFILES*, PATCHFILES* is
admissible, and in fact, expected, as it is much simpler to build an
error-free list of files to retrieve in that way. See the
devel/jdk/1.8 port for an example.SYSCONFDIRBASESYSCONFDIR, which defaults to
/etc. Passed to gnu configure scripts and
substituted in packing-lists.TARTARGETS{pre,do,post}-* and module hooks). Used by
introspection tools such as the sqlports
package.TEMPLATE_DISTFILES.<name>DISTFILES.name based on
a DIST_TUPLE entry by filling in placeholder
strings. For instance, TEMPLATE_DISTFILES.github
defaults to
<account>-<project>-{<account>/<project>/archive/<subdir>}<id>.tar.gz
with DIST_TUPLE += github foo bar baz
qux. We end up with the following
DISTFILES.github entry:
foo-bar-{foo/bar/archive/ref/tags}baz.tar.gz
Placeholders ‘account’, ‘project’, ‘id’ are self-explanatory. ‘subdir’ is set automatically by figuring out whether id is a tagname or a hash.
TEMPLATE_HOMEPAGE.<name>HOMEPAGE when
using DIST_TUPLE. Very similar to
TEMPLATE_DISTFILES.<name>.TEST_DEPENDSBUILD_DEPENDS for specification. Test
dependencies are only checked if the test stage is
invoked.TEST_ENVTEST_FLAGSTEST_IS_INTERACTIVETEST_LOGTEST_LOGFILETEST_TARGETCONFIGURE_STYLE, which default to
‘test’ and ‘check’, respectively.TRUEPREFIXfake. Refer to
THE FAKE FRAMEWORK section
for details.TRY_BROKENIGNORE for BROKEN ports,
so that we will attempt to build them.UNLOCK_CMDUNLINKEDUNLINKED to a ‘tag’
that will make the port IGNOREd unless
BUILD_UNLINKED contains that specific tag.UNMESSAGEUNZIPUPDATE_COOKIES_DIRUPDATE_PLIST_ARGSUPDATE_PLIST_OPTS-v for now.USE_CCACHEUSE_GMAKEUSE_GROFFUSE_LIBTOOLMany ports using GNU autoconf need an m4 file from the GNU
libtool package but otherwise work with base
libtool(1). In those cases
do not set USE_LIBTOOL, instead just set
BUILD_DEPENDS = devel/libtool.
USE_LLDLLD_ARCHS in
bsd.port.arch.mk(5)).USE_MFSWRKOBJDIR_MFS for
configuration.USE_NOBTCFIpatch
to request that the linker adds a
PT_OPENBSD_NOBTCFI ELF section. Use when a port
does not work with the default strict enforcement of indirect branch
targets.
Applies to all architectures; set
USE_NOBTCFI-${MACHINE_ARCH} to apply to only a
specific architecture.
USE_NOEXECONLYpatch
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_SCCACHEUSE_WXNEEDEDpatch
to request that the linker adds a
PT_OPENBSD_WXNEEDED ELF section. Use when a port
requires memory mappings that are both executable and writable and cannot
be modified to avoid this.USE_X11The 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.
VARBASEWANTLIBAs a special extension, WANTLIB may
include absolute paths, e.g.,
${LOCALBASE}/lib/expat=4 to distinguish between
base libraries and port libraries. Use with caution, this is very seldom
needed.
wantlib_argsprint-package-args for details.WARNINGSCDIAGFLAGS to CFLAGS and
CXXDIAGFLAGS to
CXXFLAGS.WRKBUILDSEPARATE_BUILD is involved, in
which case it is set to an appropriate value.WRKCONFWRKDIRPATH.WRKDISTWRKSRCWRKINSTfake target).WRKOBJDIRWRKOBJDIR_MFSUSE_MFS is ‘Yes’. Defaults to
/tmp/pobj.X11BASEXAUTHORITYXMKMFCONFIGURE_STYLE=imake
port. Defaults to xmkmf -a -DPorts. The -DPorts is specific to
OpenBSD and is always appended.YACCThe fake target is used to install the
port under a staging directory first, ready for packaging by the
package target, so that the actual
install target will use the binary package
instead.
Essentially, fake invokes the install
process after tweaking a few variables.
fake first creates a skeleton tree under
${WRKINST}, using mkdir(1)
-p.
A pre-fake target may be used to complete
that skeleton tree. For instance, a few ports may need supplementary stuff
to be present (as it would be installed if the port's dependencies were
present).
In most cases, pre-install is
preferred.
If {pre,do,post}-install overrides are
present, they are used with some important changes, listed in
FAKE_SETUP:
TRUEPREFIX=${PREFIX}
PREFIX=${WRKINST}${PREFIX}
${DESTDIRNAME}=${WRKINST}
Essentially, old install targets work transparently, except for a
need to change PREFIX to
TRUEPREFIX for symbolic links and similar path
lookups. Specific traditional post install work can be simply removed, as it
will be taken care of by the package itself (for instance, ldconfig, or
texinfo's install-info).
If no do-install override is present, the
port is installed using
env -i ${MAKE_ENV} ${FAKE_SETUP} ${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
Note that this does set both PREFIX and ${DESTDIRNAME}. If a port's Makefile both heeds ${DESTDIRNAME}, and references PREFIX explicitly, FAKE_FLAGS may rectify the problem by setting PREFIX=${PREFIX} (which will do the right thing, since ${PREFIX} is a make(1) 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).
If DEBUG_PACKAGES is not empty, debug
packages will be built "on the side". Since debug information is
usually large, this is controlled on a per-arch basis with
DEBUGINFO_ARCHS controlling the behavior (set to
amd64 by default).
During the normal package target ,
build-debug-info(1)
will be invoked to deduce debug packing-lists from the normal packing-lists,
and some extra makefile rules will be invoked to set aside the debug
information, and shrink it by processing it through ${DWZ}.
Then each normal package will have a "shadow" debug-* package built alongside it, with the exact same package signature, except it will also be tied closely with the normal package.
Figuring out what files contain debug information is entirely
achieved through @bin, @lib,
@so and @static-lib
annotations in the base packing-lists.
Debug packages will be produced for all subpackages in
DEBUG_PACKAGES. Usually, the heuristics of trimming
arch-independent packages from BUILD_PACKAGES is
enough. In case this still produces empty debug packages, the
DEBUG_PACKAGES list should be produced manually.
The actual debug packages are not registered through register-plist(1) since the information was automatically generated.
debug package names and debug package filenames are added to
PKGNAMES and PKGFILES
respectively for introspection purpose.
egdb(1) from ports can read debug information from a separate file, as long as the original ELF file was annotated with a debuginfo link.
That feature is used to set debug information on the side, in .debug/ subdirectories alongside the normal binaries, shared objects and shared libraries.
For static libraries, the information can't be separated, instead the full static library with debug information is provided in the .debug/ subdirectory, while the normal static library gets stripped.
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.
If MULTI_PACKAGES is set, the packaging
stage happens once for every subpackage, using subpackage-specific
variables. For instance, if MULTI_PACKAGES=-main -lib
-server, PKG_ARCH-main,
PKG_ARCH-lib and
PKG_ARCH-server will be used for the subpackages
respectively called FULLPKGNAME-main,
FULLPKGNAME-lib and
FULLPKGNAME-server.
All package information is also derived from templates with SUBPACKAGE appended. In the preceding example, the packing-list template for FULLPKGNAME-lib must be in PLIST-lib.
The following variables are subpackage dependent:
COMMENT, PKG_ARCH,
PERMIT_PACKAGE, PKGFILE,
PKGNAME, PKGSTEM,
FULLPKGNAME, REVISION,
EPOCH, FULLPKGPATH,
RUN_DEPENDS, WANTLIB,
LIB_DEPENDS, IGNORE,
ONLY_FOR_ARCHS,
NOT_FOR_ARCHS, PKG_ARGS,
PREFIX, CATEGORIES,
MESSAGE, UNMESSAGE,
DESCR, PLIST,
STATIC_PLIST, PKGSPEC.
The usual non-MULTI_PACKAGES variables are simply used as default
values for all subpackages. So, if you set
PKG_ARCH=*
PKG_ARCH-main=i386 then
PKG_ARCH-lib and
PKG_ARCH-server will both be ‘*’.
WANTLIB and
LIB_DEPENDS are special. At the beginning of the
build, during prepare, all build dependencies will
be checked, which includes LIB_DEPENDS,
WANTLIB for every subpackage. As an exception, any
LIB_DEPENDS-sub that references the current port
will be ignored as a build dependency, in order to avoid recursion.
FULLPKGPATH and
FULLPKGNAME are special as well. If
PKGNAME is <stem>-<version>, then
PKGNAME-sub will be set to
<stem>-sub-<version> by default, except for
PKGNAME-main which has
PKGNAME as a default. Normally,
FULLPKGPATH-sub is automatically set to the right
value, but in very rare cases, one may need to override the default: for
instance, if one specific subpackage is not affected by flavor settings that
affect other subpackages, e.g., for include files packs, then the flavoring
part of the fullpkgpath may need to be dropped.
In terms of using the port, quite a few targets will have a
subpackage specific subtarget: invoking package is
the same as invoking subpackage for all subpackages,
invoking install-all is the same as invoking
install for all subpackages, and invoking
update is the same as invoking
subupdate for all subpackages.
ONLY_FOR_ARCHS and
NOT_FOR_ARCHS interact with
MULTI_PACKAGES and IGNORE.
The infrastructure will automatically filter subpackages that are not
suitable for the current architecture. Thus,
MULTI_PACKAGES should always list all subpackages,
even things not buildable on the current architecture, for indexing
purposes.
Starting with OpenBSD 5.1,
bsd.port.arch.mk(5)
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.
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}.
FLAVORS=no_map gfx qt2, if
FLAVOR=gfx no_map, this is
‘-no_map-gfx’.Note that ${COMMENT} is currently not substituted.
To avoid substitution, variables can be escaped as follows:
$\{PREFIX}
If FLAVORS lists flv, then constructs such
as the line %%flv%% or
!%%flv%% in the packing-list template trigger the
inclusion of ${PKGDIR}/PFRAG.flv${SUBPACKAGE} or
${PKGDIR}/PFRAG.no-flv${SUBPACKAGE}. Other fragments
can be defined by simply adding -Dfrag=1 or
-Dfrag=0 to PKG_ARGS.
pkg_add(1) now calls
ldconfig(8) 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 packing-list
information.
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.
{build,run,lib}-dependsBUILD_DEPENDS,
LIB_DEPENDS, RUN_DEPENDS,
WANTLIB and MULTI_PACKAGES. Refer to
prepare, install-depends,
test-depends.FETCH_BEFORE_ARGS,
FETCH_AFTER_ARGSFETCH_CMD to point to a script that does any
required special treatment instead.FETCH_DEPENDSNO_EXTRACTNO_WRKDIRNO_WRKSUBDIROPSYS_VEROSREV instead.PKGNAMEFULLPKGNAME-foo, for
SUBPACKAGE -foo. PKGNAME
now holds the package name, not taking multi-packages or flavors into
account. Most ports are not concerned by this change.PLIST_SUBSTSCRIPTDIRFILESDIR for
those.SITES0,
..., SITES9SITES.sufx matching
DISTFILES.sufx construct.USE_BZIP2BZIP2, EXTRACT_CASES, and
EXTRACT_SUFX.USE_ZIPZIP, EXTRACT_CASES, and
EXTRACT_SUFX.fake. Variables from
SUBST_VARS will be expanded. Multi-package ports
will use README${SUBPACKAGE}.fake. When a port provides a daemon started by
rc.d(8) requiring non-default
login.conf(5) attributes, a
sample file should be provided and used as a template by adding
@sample
/etc/login.conf.d/${class} to the packing
list.fake. Variables from
SUBST_VARS will be expanded.CHECKSUM_PACKAGES.PORTSDIR_PATH.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.
See ERRORS for more details about internal
diagnostics.
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.PKG_ARGS-sub.PKG_CREATE_NO_CHECKS instead,
assuming they understand the implications. See
print-package-args
(wantlib-args) for details.MODULE or from
Makefile.inc, resulting in a double inclusion.
This would lead to weird results, such as PKG_ARGS
being defined twice.FLAVOR and SUBPACKAGE in
pkgpath(7)
specifications.PERMIT_* values.FLAVOR must be specified in the environment
instead.SUBPACKAGE must be specified in the
environment instead.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.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.
UNLINKED.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.DEBUG_PACKAGES so the
build-debug-info(1)
script expects debug information on all binaries and libraries. Most
probably, the build machinery for that specific port omitted -g somewhere,
or it runs strips during fake anyway. It can also occur if
DEBUG_PACKAGES includes subpackages with no files
holding debug info.fetch for the newer way.make package’ is run.REVISION bumps. Any other version or
FLAVOR won't conflict. This is generally an error,
apart from very few ports like
devel/autoconf/*.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.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)
The ports mechanism originally came from FreeBSD. A lot of additions were taken from NetBSD over the seminal years.
Since 1998, the framework has been systematically cleaned-up and reorganized to remove bugs. New features have been carefully introduced, trying hard to avoid inconsistencies.
FLAVORS,
MULTI_PACKAGES,
SEPARATE_BUILD and FAKE are
OpenBSD improvements. Most recent additions do not
come from another BSD.
LOCALBASE,
X11BASE, BASESYSCONFDIR,
VARBASE and PREFIX are not
heeded consistently. Using anything but the default values has not been
heavily tested. Some ports may not build if you change them.
| October 6, 2024 | openbsd |