xref: /openbsd-src/share/man/man5/bsd.port.mk.5 (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1.\" $OpenBSD: bsd.port.mk.5,v 1.226 2009/01/24 11:41:26 espie Exp $
2.\"
3.\" Copyright (c) 2000-2008 Marc Espie
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: January 24 2009 $
28.Dt BSD.PORT.MK 5
29.Os
30.Sh NAME
31.Nm bsd.port.mk
32.Nd ports tree master Makefile fragment
33.Sh SYNOPSIS
34.Fd .include <bsd.port.mk>
35.Sh DESCRIPTION
36.Nm
37holds all the standard routines used by the ports tree.
38Some variables and targets are for its internal use only.
39The rest is documented here.
40.Pp
41Other BSD variants, as well as older versions of
42.Nm bsd.port.mk ,
43include other targets and variables.
44Conversion methods are outlined here.
45.Pp
46Most variables and targets are documented, with very few exceptions.
47.Pp
48This documentation covers the current targets, variables and paths used by
49.Nm bsd.port.mk ,
50followed by sections on obsolete constructs that a porter may need
51when converting from other ports systems.
52There is a separate section covering the fake framework, a section
53explaining flavors and multi-packages, and a section covering
54the generation of package information.
55.Pp
56Binary package details are mostly covered in
57.Xr pkg_create 1
58for the packing-list details,
59and in
60.Xr pkg_add 1
61for the installation semantics.
62.Pp
63Selected common user activity such as the building of every package in
64the system is covered by
65.Xr ports 7
66instead.
67.Xr packages 7
68provides an overview of the result.
69.Sh TARGETS
70.Bl -tag -width do-configure
71.It Ar {build,run,all,regress}-dir-depends
72Print all dependencies for a port in order to build it, run it, build and
73run it, or to run regression tests.
74The output is formatted as package specification pairs, in a form suitable
75for
76.Xr tsort 1 .
77.It Ar full-{build,run,all}-depends
78Print all dependencies a package depends upon for building, running,
79or both, as a list of package names.
80.It Ar {build,lib,run}-depends-list
81Print a list of first level package specifications a port depends as
82build dependencies, library dependencies, or run dependencies.
83.It Ar print-{build,run}-depends
84User convenience target that displays the result of
85.Ar full-{build,run}-depends
86in a more readable way.
87.It Ar {pre,do,post}-*
88Most standard targets can be specialized according to a given port's needs.
89If defined,
90the
91.Ar pre-*
92hook will be invoked before running the normal action;
93the
94.Ar do-*
95hook will be invoked instead of the normal action;
96the
97.Ar post-*
98hook will be invoked after the normal action.
99Specialization hooks exist for
100.Ar build ,
101.Ar configure ,
102.Ar distpatch ,
103.Ar extract ,
104.Ar fake ,
105.Ar fetch ,
106.Ar install ,
107.Ar package ,
108.Ar patch ,
109.Ar regress .
110See individual targets for exceptions.
111.It Ar addsum
112Complete the ${CHECKSUM_FILE} record of checksums with files that have been
113added since
114.Ar makesum .
115Complain if anything does not match.
116.It Ar build , Ar all
117Default target.
118Build the port.
119Essentially invoke
120.Bd -literal
121env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \e
122	-f ${MAKE_FILE} ${ALL_TARGET}
123.Ed
124.It Ar build-depends
125Verify the ports mentioned in
126.Ev BUILD_DEPENDS ,
127by checking the corresponding packages are actually installed,
128and install the missing ports by recursing through the ports tree.
129Invoked right after creating the working directory.
130.It Ar checkpatch
131Debugging version of the
132.Ar patch
133target that simulates invoking
134.Xr patch 1 .
135.It Ar checksum
136Check distribution archives and distribution patches control sum against
137the results recorded in ${CHECKSUM_FILE},
138using the cryptographic signature utilities listed in ${PREFERRED_CIPHERS}.
139All the files needed to recreate a port should be in ${CHECKSUMFILES} and
140checksummed.
141Invoking
142.Ar checksum
143with REFETCH=true
144will try to fetch a version with the correct checksum from the
145.Ox
146main archive site in the case of a checksum mismatch.
147.Ev NO_CHECKSUM
148can be used to avoid all checksumming steps.
149.It Ar clean
150Clean ports contents.
151By default, it will clean the work directory.
152It can be invoked as
153make clean='[depends build bulk work fake flavors dist install sub package
154packages plist readme]'.
155.Bl -tag -width packages
156.It Va work
157Clean work directory.
158.It Va bulk
159Clean bulk cookie.
160.It Va build
161Clean the
162.Va WRKBUILD
163directory (only useful if
164.Va SEPARATE_BUILD
165is set).
166.It Va depends
167Recurse into dependencies.
168.It Va dist
169Clean distribution files.
170.It Va fake
171Clean fake installation directory.
172.It Va flavors
173Clean all work directories.
174.It Va install
175Uninstall package.
176.It Va package
177Remove all copies of package file.
178.It Va plist
179Remove registered packing lists of all subpackages.
180.It Va readmes
181Clean files generated through the
182.Ar readme
183targets (html files).
184.It Va sub
185With
186.Va install
187or
188.Va package ,
189clean subpackages as well.
190.It Va packages
191Short-hand for `sub package'.
192.El
193.It Ar clean-depends
194Short hand for make clean=depends.
195.It Ar configure
196Configure the port.
197Might be a void operation.
198Unless overridden, configure creates the ${WRKBUILD}
199directory (see SEPARATE_BUILD),
200and runs whatever configuration methods are recorded in
201.Ev CONFIGURE_STYLE .
202.It Ar depends
203Check all the port's dependencies, that is:
204.Ar build-depends ,
205.Ar lib-depends ,
206.Ar run-depends ,
207.Ar regress-depends .
208.It Ar describe
209Prints a one-line index entry of the port, suitable for
210.Pa ${PORTSDIR}/INDEX .
211.It Ar distclean
212Short-hand for make clean=dist.
213.It Ar distpatch
214Apply distribution patches only.
215See
216.Ar patch
217and
218.Ev PATCH_CASES
219for details.
220.It Ar dump-vars
221Dumps the values of all relevant variables in a port, prepended with the
222port's FULLPKGPATH.
223.It Ar extract
224Extract the distribution files under
225.Pa ${WRKDIR}
226(but see
227.Ev EXTRACT_ONLY ) .
228Refer to
229.Ev EXTRACT_CASES
230for a complete description.
231Do not use
232.Ev pre-extract
233and
234.Ev do-extract
235hooks.
236.It Ar fake
237Do a fake port installation, that is, simulate the port installation under
238${WRKINST}.
239There is no
240.Ev do-fake
241and
242.Ev post-fake
243hooks.
244.Ar fake
245actually uses
246.Ev pre-fake ,
247.Ev pre-install ,
248.Ev do-install
249and
250.Ev post-install .
251Override
252.Ev pre-install ,
253.Ev do-install ,
254or
255.Ev post-install
256to change behavior.
257Do not touch
258.Ev pre-fake
259unless you really know what you are doing.
260Described in a separate section below.
261.It Ar fetch
262Fetch the distribution files and patchfiles, using ${FETCH_CMD}.
263Each file of the
264.Ev DISTFILES
265and
266.Ev PATCHFILES
267lists is retrieved, if necessary, from the list of sites in
268.Ev MASTER_SITES .
269If a filename ends with a
270.Sq :0
271to
272.Sq :9
273extension, it will be retrieved from
274.Ev MASTER_SITES0
275to
276.Ev MASTER_SITES9
277instead.
278The ports framework uses
279.Pa ${DISTDIR}/${DIST_SUBDIR}
280(aliased to
281.Pa ${FULLDISTDIR} )
282to cache the ports distribution files and patch files.
283Note that this framework is also used by mirroring scripts,
284which will also retrieve
285.Ev SUPDISTFILES ,
286to fill with supplementary distribution files which are not needed for
287every configuration.
288Use of
289.Ar {pre,do,post}-fetch
290hooks is strongly discouraged, and will probably be removed in the
291near future, as this makes mirroring of distfiles very complicated.
292See
293.Ev CHECKSUMFILES ,
294.Ev CDROM_SITE ,
295.Ev DISTDIR ,
296.Ev DISTFILES ,
297.Ev DIST_SUBDIR ,
298.Ev FETCH_CMD ,
299.Ev FETCH_MANUALLY ,
300.Ev FETCH_SYMLINK_DISTFILES ,
301.Ev FULLDISTDIR ,
302.Ev MAKESUMFILES ,
303.Ev MASTER_SITES ,
304.Ev MASTER_SITES0 , ... ,
305.Ev MASTER_SITES9 ,
306.Ev PATCHFILES ,
307.Ev SUPDISTFILES ,
308.Ev REFETCH .
309.It Ar index
310Top-level target, see
311.Xr ports 7 .
312.It Ar install
313Install the package after building.
314See the description of THE FAKE FRAMEWORK
315for the non-intuitive details of the way
316.Ar {pre,do,post}-install
317hooks are actually used by the ports tree.
318.It Ar install-all
319Install all packages in a multi-packages port.
320.It Ar lib-depends
321Verify that the library dependencies a port needs are actually there,
322by checking the library specifications.
323.It Ar lib-depends-check
324Verify that the
325.Ev LIB_DEPENDS
326and
327.Ev WANTLIB
328are accurate for the port.
329See
330.Ar port-lib-depends-check ,
331which is quicker.
332.It Ar license-check
333Check that
334.Ev PERMIT_PACKAGE_*
335settings match:
336if any dependency has a more restrictive setting, warn about it.
337This warning is advisory, because the automated license checking cannot
338figure out which ports were used only for building and did not taint
339the current port.
340.It Ar link-categories
341Create symbolic links in other directories that correspond to the port's
342.Ev CATEGORIES .
343Note that this does not affect bulk package building, since those links
344don't appear in the upper-level Makefiles.
345See also
346.Ar unlink-categories .
347.It Ar lock
348Manually obtain a lock on a given directory.
349Output must be used to update environment variables.
350The lock can be released with
351.Ar unlock .
352Seldom used, see
353.Xr ports 7
354for details.
355.It Ar makesum
356Create the ${CHECKSUM_FILE} list of recorded checksums by running the
357cryptographic fingerprints sha256, sha1, md5 and rmd160 on ${MAKESUMFILES}.
358.Ev NO_CHECKSUM
359can be used to avoid all checksumming steps.
360.It Ar manpages-check
361Verify that
362.Xr makewhatis 8
363can do a correct job with the port's manpages.
364.It Ar mirror-maker
365Top-level target, see
366.Xr mirroring-ports 7 .
367.It Ar package
368Build a port package (or packages in
369.Ev MULTI_PACKAGES
370cases) from the fake installation.
371Involves creating packaging information from templates
372(see
373.Ev COMMENT ,
374.Ev SUBST_VARS
375among others) and invoking
376.Xr pkg_create 1
377for each package in the
378.Ev MULTI_PACKAGES
379list.
380If the repository already contains up-to-date packages, they are not rebuilt.
381Arch-independent packages are created in ${PACKAGE_REPOSITORY}/no-arch,
382and copied into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all as needed.
383If ${PERMIT_PACKAGE_FTP} is set to
384.Sq Yes ,
385copies built packages into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp, using
386hard links if possible.
387If ${PERMIT_PACKAGE_CDROM} is set to
388.Sq Yes ,
389copies built packages into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom}, using
390hard links if possible.
391.It Ar patch
392Apply distribution and
393.Ox
394specific patches.
395Because of historical accident,
396.Ar patch
397does not follow the exact same scheme other standard targets do.
398Namely,
399.Ar patch
400invokes
401.Ar pre-patch
402(if defined),
403.Ar do-patch ,
404and
405.Ar post-patch ,
406but the default
407.Ar do-patch
408target invokes
409.Ar distpatch
410directly.
411So, if the
412.Ar do-patch
413target is overridden, it should still begin by calling
414make distpatch, before applying
415.Ox
416specific patches.
417Accordingly, the exact sequence of hooks is:
418.Ar pre-patch ,
419.Ar do-distpatch ,
420.Ar post-distpatch ,
421.Ar do-patch ,
422.Ar post-patch .
423If
424.Pa ${PATCHDIR}
425exists, the files described under
426.Ev PATCH_LIST
427will be applied under
428.Ev WRKDIST .
429See also
430.Ev REORDER_DEPENDENCIES
431for possible
432.Ar post-patch
433clean-up.
434.It Ar peek-ftp
435Connect to the first site in
436.Ev MASTER_SITES ,
437in the right directory, and leaves user at ftp prompt.
438.It Ar pkglocatedb
439Top-level target, see
440.Xr ports 7 .
441.It Ar port-lib-depends-check
442Verify that the
443.Ev LIB_DEPENDS
444and
445.Ev WANTLIB
446hold all shared libraries used for every package in the port.
447See
448.Xr library-specs 7 .
449This makes use of
450.Ar print-plist-with-depends
451to avoid actually building the packages, it only needs the
452completion of the
453.Ar fake
454stage, and thus is quicker than
455.Ar lib-depends-check ,
456unless you already have all binary packages.
457.It Ar print-package-signature
458Print the package signature, in the same format used for
459.Xr pkg_info 1
460.Fl S .
461.It Ar print-plist
462Generate and print a package packing-list from the static information
463present in the port.
464.It Ar print-plist-contents
465Generate and print a package contents from the static information
466present in the port.
467In contrast with
468.Ar print-plist ,
469the package contents only consists of files, all tagged with category
470markers such as @file.
471See
472.Xr pkg_create 1 .
473.It Ar print-plist-with-depends
474Like
475.Ar print-plist ,
476but slower.
477It also handles
478.Ev LIB_DEPENDS ,
479.Ev RUN_DEPENDS ,
480and
481.Ev WANTLIB ,
482so that the packing-list is complete.
483.It Ar readmes
484Create an html description of packages, including comments, description,
485and dependencies.
486.It Ar rebuild
487Force rebuild of the port.
488.It Ar regress
489Run regression tests for the port.
490Essentially depend on a correct build and invoke
491.Bd -literal
492env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${ALL_REGRESS_FLAGS} \e
493	-f ${MAKE_FILE} ${REGRESS_TARGET} ${REGRESS_LOG}
494.Ed
495.Pp
496If a port needs some other ports installed to run regression tests,
497use
498.Ev REGRESS_DEPENDS .
499If a port needs special configuration or build options to enable regression
500testing, define a
501.Sq regress
502.Ev FLAVOR .
503.It Ar regress-depends
504Verify packages needed for regression tests, using the same scheme as
505.Ar build-depends .
506Only invoked when regression tests are run, or explicitly through
507.Ar depends .
508.It Ar reinstall
509Force reinstallation of a port, by first cleaning the old installation.
510Seldom needed, as
511.Ar update
512will often do the right thing.
513.It Ar repackage
514For rebuilding of the packages of a port, by first removing the old packages.
515.It Ar run-depends
516Verify the ports mentioned in
517.Ev RUN_DEPENDS ,
518by checking the corresponding packages are actually installed,
519and install the missing ports by recursing through the ports tree.
520Invoked right before installing the package.
521.It Ar show
522Invoked as make show=name, show the contents of ${name}.
523Invoked as make show="name1 name2 ...",
524show the contents of ${name1} ${name2} ...,
525one variable value per line.
526Mostly used from recursive makes, or to know the contents of another
527port's variables without guessing wrongly.
528.It Ar show-required-by
529Prints the list of pkgpaths for all ports that will be affected by the
530current port changing.
531Works by walking the list of dependencies, in reverse.
532.It Ar subupdate
533Update an existing installation to a newer package, exactly
534like
535.Ar update ,
536but affects only one single subpackage in multi-packages ports.
537.It Ar unlink-categories
538Remove symbolic links in other directories that correspond to the port's
539.Ev CATEGORIES .
540See also
541.Ar link-categories .
542.It Ar unlock
543Manually release a lock on a given directory.
544See
545.Ar lock .
546.It Ar update-patches
547Create or update patches for a port, using
548.Xr diff 1
549between
550.Pa file
551and
552.Pa file.orig ,
553based on
554.Pa file.orig
555existence.
556In order to generate a patch, the original file needs to be named
557.Pa file.orig
558and
559.Pa file
560edited.
561After the target is invoked, the patches are placed under the
562patches/ directory.
563It moves existing patches from
564.Pa patch-file
565to
566.Pa patch-file.orig
567.It Ar update
568Update an existing installation to a newer package:
569scan the installation for a package with the same
570.Ev FULLPKGPATH ,
571and update it using
572.Sq pkg_add -r
573if a newer package is available.
574In multi-packages ports, all relevant packages are updated.
575See
576.Ev UPDATE_COOKIES_DIR
577and
578.Ev FORCE_UPDATE
579as well.
580.It Ar update-or-install
581Update an installed package or perform a fresh installation,
582by using
583.Sq pkg_add -r .
584Handles one single package in multi-packages ports.
585See
586.Ev UPDATE_COOKIES_DIR
587and
588.Ev FORCE_UPDATE
589as well.
590.It Ar update-or-install-all
591Update installed packages or perform a fresh installation,
592by using
593.Sq pkg_add -r .
594Handles all packages in multi-packages ports.
595See
596.Ev UPDATE_COOKIES_DIR
597and
598.Ev FORCE_UPDATE
599as well.
600.It Ar update-plist
601Update the packing lists for a port, using the fake installation and the
602existing packing lists.
603.Ar update-plist
604should produce mostly correct
605.Pa PLIST ,
606.Pa PFRAG.shared
607and
608.Pa PFRAG.no-shared
609files, handling shared libraries, GNU
610.Xr info 1
611files, setuid files, and empty directories.
612It moves existing files to
613.Pa PLIST.orig ,
614.Pa PFRAG.shared.orig
615and
616.Pa PFRAG.no-shared.orig .
617If the generated lists include files and directories that shouldn't be
618included, comment these like this:
619.Bd -literal
620@comment unwanted-file
621@comment @dirrm unwanted-dir
622.Ed
623.Pp
624Subsequent calls to
625.Ar update-plist
626will automatically recognize and handle such lines correctly.
627.Pp
628.Ar update-plist
629does not handle flavor situations yet, so beware.
630.El
631.Sh VARIABLES
632Note that some variables are marked as
633.Sq User-settings ,
634which means that individual ports should not modify them,
635and that some variables are marked as
636.Sq read-only ,
637which means that they shouldn't ever be changed.
638In a
639.Ev MULTI_PACKAGES
640setup, some variables have settings specific to a given subpackage.
641See
642.Qq Flavors and multi-packages .
643.Bl -tag -width MASTER_SITES
644.It Ev show
645Invoked as make show=name, show the contents of ${name}.
646Invoked as make show="name1 name2 ...", show the contents of
647${name1} ${name2} ...,
648one variable value per line.
649.It Ev ALL_FAKE_FLAGS
650Flags passed to ${MAKE} invocations during the fake process.
651Equals
652.Li ${MAKE_FLAGS} ${DESTDIRNAME}=${WRKINST} ${FAKE_FLAGS} .
653Read-only.
654.It Ev ALL_REGRESS_FLAGS
655Flags passed to ${MAKE} invocations during regress.
656Equals
657.Li ${MAKE_FLAGS} ${REGRESS_FLAGS} .
658Read-only.
659.It Ev ALL_TARGET
660Target used to build software.
661Default is
662.Sq all .
663Can be set to empty, to yield a package's default target.
664.It Ev ARCH
665Current machine architecture.
666Read-only.
667.It Ev AUTOCONF
668Location of the autoconf binary if needed.
669Defaults to autoconf (though make autoreconf might be more appropriate).
670.It Ev AUTOCONF_DIR
671Where to invoke autoconf if ${CONFIGURE_STYLE} includes autoconf.
672Defaults to ${WRKSRC}.
673.\" AUTOCONF_DIR should probably be a list, and be renamed to AUTOCONF_DIRS ?
674.It Ev AUTOCONF_VERSION
675Starting with
676.Ox 3.3 ,
677several versions of autoconf may coexist peacefully.
678Setting
679.Ev AUTOCONF_VERSION
680along with
681.Ev CONFIGURE_STYLE
682set to autoconf is the correct way to specify which one to use.
683If autoconf must be run manually,
684.Ev MODGNU_AUTOCONF_DEPENDS
685can be used to specify what packages to depend upon.
686.It Ev BASE_PKGPATH
687Full pkgpath to the current port, taking flavors into account.
688Read-only.
689.It Ev BATCH
690User-settings.
691Set to
692.Sq Yes
693to avoid ports that require user-interaction.
694Use in conjunction with
695.Ev INTERACTIVE
696to simplify bulk-package builds.
697.Pq See IGNORE .
698.It Ev BROKEN
699Define only for broken ports, set to reason the port is broken.
700See also
701.Ev NO_IGNORE .
702.It Ev BSD_INSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]
703Macros passed to make and configure invocations.
704Set based on corresponding INSTALL_* variables.
705.It Ev BUILD_DEPENDS
706List of other ports the current port needs to build correctly.
707Each item has the form
708.Sq [legacy]:[pkgspec]:directory[,-subpackage][,flavor ...][:target] .
709.Sq target
710defaults to
711.Sq install
712if it is not specified.
713.Sq legacy
714used to be a file to check.
715The ports tree now uses
716.Sq pkgspec
717instead, as a package that must be installed prior to the build.
718.Sq directory
719is set relative to ${PORTSDIR}.
720.Sq subpackage
721is an optional subpackage name, to install instead of the default main
722package name.
723.Sq flavor ...
724is a comma separated list of flavors.
725By default, the dependency will build the default flavor.
726Build dependencies are checked at the beginning of the extract stage.
727.Pp
728Build dependencies that are not the default
729.Ar package
730or
731.Ar install
732target will be processed in a subdirectory of the working directory,
733specifically, in ${WRKDIR}/directory.
734.It Ev BUILD_PKGPATH
735Full pkgpath to the current port, taking flavors and pseudo-flavors
736into account.
737Mostly useful to write dependencies for subpackages like this:
738.Li "LIB_DEPENDS-foo=::${BUILD_PKGPATH}"
739and avoid starting to build a package with some other flavor combination.
740Read-only.
741.It Ev BULK
742User settings.
743If set to
744.Sq Yes ,
745successful package builds and installations will clean
746their working directories, after invoking
747any targets mentioned in BULK_TARGETS,
748and commands mentioned in BULK_DO.
749Can be set on a per-${PKGPATH} basis.
750For instance, setting BULK_misc/screen=No
751will override any BULK=Yes passed on the command line.
752See
753.Ev BULK_COOKIES_DIR ,
754.Ev TRUST_PACKAGES .
755.It Ev BULK_COOKIES_DIR
756User settings.
757Used to store cookies for successful bulk-package builds, defaults to
758.Pa ${PORTSDIR}/bulk/${MACHINE_ARCH} .
759.It Ev BULK_DO
760Commands to run after each bulk package build before cleaning up the
761working directory.
762Empty defaults.
763Can be set on a per-${PKGPATH} basis, e.g.,
764BULK_DO_${PKGPATH}=...
765.It Ev BULK_FLAGS
766Flags to pass to build each target in
767.Ev BULK_TARGETS .
768.It Ev BULK_TARGETS
769Targets to run after each bulk package build before cleaning up the
770working directory.
771Empty defaults.
772Can be set on a per-${PKGPATH} basis, e.g.,
773BULK_TARGETS_${PKGPATH}=...
774.It Ev BZIP2
775Name of the bzip2 binary.
776.It Ev CATEGORIES
777List of descriptive categories into which this port falls.
778Mandatory.
779See
780.Ar link-categories ,
781.Ar unlink-categories .
782.It Ev CDIAGFLAGS
783Flags appended to
784.Ev CFLAGS
785if
786.Ev WARNINGS
787is set.
788.It Ev CDROM_SITE
789Path to a local database that holds distribution files (usually a CD-ROM
790or other similar media), used to retrieve distribution files before going
791to the network.
792Defaults to empty, set to
793.Pa /cdrom/distfiles/${DIST_SUBDIR}
794to check that path.
795Distribution files are still copied or linked (see
796.Ev FETCH_SYMLINK_DISFILES )
797into
798.Ev DISTDIR
799if they are found under CDROM_SITE.
800.It Ev CFLAGS
801Default flags passed to the compiler for building.
802Many ports ignore it.
803See also
804.Ev COPTS ,
805.Ev CDIAGFLAGS .
806.It Ev CHECK_LIB_DEPENDS
807Use settings.
808If set to
809.Sq Yes ,
810every package build will verify that shared libraries are correctly
811registered.
812Defaults to
813.Sq \&No ,
814as this can be a big performance hit.
815.It Ev CHECKSUMFILES
816List of all files that need to be retrieved by
817.Ar fetch ,
818with
819.Ev DIST_SUBDIR
820prepended and with master site selection extension removed.
821Read-only.
822See also
823.Ev MAKESUMFILES .
824.It Ev CHECKSUM_FILE
825Location for this port's checksums, used by
826.Ar addsum ,
827.Ar checksum ,
828and
829.Ar makesum .
830Defaults to distinfo.
831.It Ev CLEANDEPENDS
832If set to
833.Sq Yes ,
834.Sq make clean
835will also clean dependencies.
836Can be overridden on a per-${PKGPATH} basis,
837by setting CLEANDEPENDS_${PKGPATH}.
838.It Ev COMMENT
839Short, one line description of the port, used for the package, and in the
840INDEX.
841.It Ev COMMENT-foo
842Same as COMMENT but used for sub package foo in a multi-package setup.
843.It Ev COMMENT-vanilla
844Same as COMMENT but used for a flavored package, if the non-flavored comment
845is inappropriate.
846.It Ev COMMENT-foo-vanilla
847Same as COMMENT but used for a sub-, flavored package.
848.It Ev COMES_WITH
849The first release where the port was made part of the standard
850distribution.
851If the current
852.Ox
853version is >= this version then a notice
854will be displayed instead of the port being built.
855.It Ev CONFIGURE_ARGS
856Arguments to pass to configure script.
857Defaults are empty, except for
858GNU-style configure, where prefix and sysconfdir are set.
859.It Ev CONFIGURE_ENV
860Basic environment passed to configure script (path and libtool setup).
861GNU-style configure adds a lot more variables.
862.It Ev CONFIGURE_SCRIPT
863Set to name of script invoked by
864.Ar configure
865target, if appropriate.
866Should be either an absolute path, or relative to ${WRKSRC}.
867.It Ev CONFIGURE_SHARED
868Set by default to --enable-shared or --disable-shared, depending on whether
869the architecture supports shared libraries.
870Should be appended to CONFIGURE_ARGS, for ports that build dynamic libraries
871and whose configure script supports these options.
872.It Ev CONFIGURE_STYLE
873Set to style of configuration that needs to happen.
874If
875.Sq perl ,
876assume
877.Xr perl 1
878.Xr ExtUtils::MakeMaker 3p
879style.
880Add
881.Sq modbuild ,
882to enable
883.Xr perl 1
884.Xr Module::Build 3p
885style.
886If
887.Sq gnu ,
888assume
889GNU configure style.
890Add
891.Sq dest
892if port does not handle DESTDIR correctly, and needs to be configured to
893add DESTDIR to prefixes
894.Po
895see also
896.Ev DESTDIRNAME
897.Pc .
898Add
899.Sq old
900if port is an older autoconf port that does not recognize --sysconfdir.
901Add
902.Sq autoconf
903if autoconf needs to be rerun first.
904Add
905.Sq automake
906if automake may need to be rerun.
907Otherwise, automake will be explicitly disabled.
908If
909.Sq imake ,
910assume port configures using X11 ports Imakefile framework.
911Add
912.Sq noman
913if port has no man pages the Imakefile should try installing.
914If
915.Sq simple ,
916there is a configure script, but it does not fit the normal GNU configure
917conventions.
918.It Ev COPTS
919User settings.
920Supplementary options appended to ${CFLAGS} for building.
921Since most ports ignore the COPTS convention, they are actually told to use
922${CFLAGS} ${COPTS} as CFLAGS.
923.It Ev CXXDIAGFLAGS
924Flags appended to
925.Ev CXXFLAGS
926if
927.Ev WARNINGS
928is set.
929.It Ev CXXFLAGS
930Default flags passed to the C++ compiler for building.
931Many ports ignore it.
932.It Ev CXXOPTS
933User settings.
934Supplementary options appended to ${CXXFLAGS} for building.
935.It Ev DEF_UMASK
936Correct value of umask for the port to build and package correctly.
937Tested against the actual umask at
938.Ar fake
939time.
940Default is 022.
941Don't override.
942.It Ev DESTDIR
943See
944.Ev DESTDIRNAME .
945.It Ev DESTDIRNAME
946Name of variable to set to ${WRKINST} while faking.
947Usually DESTDIR.
948To be used in the rare cases where a port heeds DESTDIR in a few
949directories and needs to be configured with
950.Sq gnu dest ,
951so that those few directories do not get in the way.
952.It Ev DISTDIR
953Directory where all ports distribution files and patchfiles are stashed.
954Defaults to
955.Pa ${PORTSDIR}/distfiles .
956Override if distribution files are stored elsewhere.
957Always use
958.Ev FULLDISTDIR
959to refer to ports' distribution files location, as it takes an eventual
960.Ev DIST_SUBDIR
961into account.
962.It Ev DISTFILES
963The main port's distribution files (the actual software source, except
964for binary-only ports).
965Will be retrieved from the MASTER_SITES (see
966.Ar fetch ) ,
967checksummed and extracted (see
968.Ar checksum ,
969.Ar extract ) .
970.Ev DISTFILES
971normally holds a list of files, possibly with
972.Sq :0
973to
974.Sq :9
975appended to select a different
976.Ev MASTER_SITES .
977See also
978.Ev SUPDISTFILES .
979.It Ev DISTNAME
980Name used to identify the port.
981See
982.Ev DISTFILES
983and
984.Ev PKGNAME .
985.It Ev DISTORIG
986Suffix used by
987.Ar distpatch
988to rename original files.
989Defaults to
990.Pa .bak.orig .
991Distinct from
992.Pa .orig
993to avoid confusing
994.Ar update-patches .
995.It Ev DIST_SUBDIR
996Optional subdirectory of ${DISTDIR} where the current port's distribution
997files and patchfiles will be located.
998See target
999.Ar fetch .
1000.It Ev ECHO_MSG
1001User settings.
1002Used to display
1003.Sq ===> Configuring for foo
1004and similar informative messages.
1005Override to turn off, for instance.
1006.It Ev ECHO_REORDER
1007User settings.
1008Set it to
1009.Sq echo
1010to see
1011.Ev REORDER_DEPENDENCIES
1012actions.
1013Silent by default.
1014.It Ev ERRORS
1015List of errors found while parsing the port's Makefile.
1016Display the errors before making any target, and if any error starts with
1017.Qq Fatal: ,
1018do not make anything.
1019For instance:
1020.Bd -literal -offset indent
1021\&.if !defined(COMMENT)
1022ERRORS+="Fatal: Missing comment"
1023\&.endif
1024.Ed
1025.It Ev EXTRACT_CASES
1026In the normal extraction stage (when
1027.Ev EXTRACT_ONLY
1028is not empty), this is the contents of a case statement, used to extract files.
1029Fragments are automatically appended to extract tar and zip
1030archives, so that the default case is equivalent to the following shell
1031fragment:
1032.Bd -literal
1033set -e
1034cd ${WRKDIR}
1035for archive in ${EXTRACT_ONLY}
1036do
1037    case $$archive in
1038	*.zip)
1039	  unzip -q ${FULLDISTDIR}/$$archive -d ${WRKDIR};;
1040	*.tar.bz2)
1041	  bzip2 -dc ${FULLDISTDIR}/$$archive| tar xf -;;
1042	*.shar.gz|*.shar.Z|*.sh.Z|*.sh.gz)
1043	  gzcat ${FULLDISTDIR}/$$archive | /bin/sh;;
1044	*.shar|*.sh)
1045	  /bin/sh ${FULLDISTDIR}/$$archive;;
1046	*.tar)
1047	  tar xf ${FULLDISTDIR}/$$archive;;
1048	*)
1049	  gzip -dc ${FULLDISTDIR}/$$archive | tar xf -;;
1050    esac
1051done
1052.Ed
1053.It Ev EXTRACT_ONLY
1054Set if not all ${DISTFILES} should be extracted at do-extract stage.
1055Default value is ${DISTFILES}.
1056.It Ev EXTRACT_SUFX
1057Used to set DISTFILES default value to ${DISTNAME}${EXTRACT_SUFX}.
1058Default value is .tar.gz.
1059.It Ev FAKE_FLAGS
1060Extra flags passed to ${MAKE_PROGRAM} on fake invocation.
1061Empty by default.
1062.It Ev FAKE_TARGET
1063Target built by ${MAKE_PROGRAM} on fake invocation.
1064Defaults to ${INSTALL_TARGET}.
1065.It Ev FAKEOBJDIR
1066If non empty, used as a base for the fake area.
1067The real fake directory ${WRKINST} is created there.
1068Can be set on a per-${PKGPATH} basis.
1069For instance, setting FAKEOBJDIR_www/mozilla=/tmp/obj
1070will affect only the mozilla port.
1071.It Ev FETCH_CMD
1072Command used to fetch distribution files for this port.
1073Defaults to
1074.Xr ftp 1 .
1075User settings.
1076Can be used to go through excessively paranoid firewalls.
1077.It Ev FETCH_MANUALLY
1078Some ports' distfiles cannot be fetched automatically for licensing reasons.
1079In this case, set
1080.Ev FETCH_MANUALLY
1081to a list of strings that will be displayed, one per line, e.g.,
1082.Bd -literal
1083FETCH_MANUALLY= "You must fetch foo-1.0.tgz"
1084FETCH_MANUALLY+="from http://www.fubar.com/ manually,"
1085FETCH_MANUALLY+="after reading and agreeing to the license."
1086.Ed
1087Automatically sets
1088.Ev IS_INTERACTIVE
1089if some distribution files are missing.
1090.It Ev FETCH_PACKAGES
1091User settings.
1092If set to
1093.Sq Yes ,
1094the
1095.Ar package
1096target will download packages missing from the repository from locations in
1097${PKG_PATH} and place them into
1098.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/
1099It will only build them if no suitable packages are found.
1100.It Ev FETCH_SYMLINK_DISTFILES
1101User settings.
1102Set to
1103.Sq Yes
1104to link distribution files off
1105.Ev CDROM_SITE
1106instead of copying them.
1107.It Ev FILESDIR
1108Location of other files related to the current ports.
1109(default: files.${ARCH} or files).
1110.It Ev FLAVOR
1111The port's current options.
1112Set by the user, and tested by the port to activate wanted functionalities.
1113.It Ev FLAVORS
1114List of all flavors keywords a port may match.
1115Used to sort FLAVOR into a canonical order to build the package name,
1116or to select the packing-list, and as a quick validity check.
1117See also
1118.Ev PSEUDO_FLAVORS .
1119.It Ev FLAVOR_EXT
1120Canonical list of flavors being set for the current build, dash-separated.
1121See
1122.Ev FULLPKGNAME .
1123.It Ev FORCE_UPDATE
1124User settings.
1125If set to
1126.Sq Yes ,
1127the
1128.Ar update
1129target will always update an installed package,
1130as soon as its signature differs,
1131and all dependencies that install packages will
1132also force an update.
1133If set to
1134.Sq hard ,
1135the
1136.Ar update
1137target will also update installed packages even when the signature
1138did not change.
1139.It Ev FULLDISTDIR
1140Complete path to directory where ${DISTFILES} and ${PATCHFILES} will be
1141located, to be used in hand-crafted extraction targets.
1142Read-only.
1143.It Ev FULLPKGNAME
1144Full name of the created package, taking flavors into account.
1145Defaults to ${PKGNAME}${FLAVOR_EXT}.
1146.It Ev FULLPKGPATH
1147Path to the current port's directory, relative to ${PORTSDIR},
1148including flavors and subpackages.
1149.It Ev GMAKE
1150Location of the GNU make binary, if needed.
1151Defaults to gmake.
1152.It Ev HOMEPAGE
1153Set to a link to the homepage of the software, if applicable.
1154.It Ev IGNORE
1155The port is ignored and ${IGNORE} is printed if defined.
1156Usually set to the reason the port is ignored.
1157See also
1158.Ev BATCH ,
1159.Ev BROKEN ,
1160.Ev IGNORE_SILENT ,
1161.Ev INTERACTIVE ,
1162.Ev IS_INTERACTIVE ,
1163.Ev NOT_FOR_ARCHS ,
1164.Ev NO_IGNORE ,
1165.Ev ONLY_FOR_ARCHS ,
1166.Ev USE_X11 .
1167.It Ev IGNORE_SILENT
1168If set to
1169.Sq Yes ,
1170do not print anything when ignoring a port.
1171.It Ev INSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]
1172Macros to use to install a program, a script, data, or a man page (or the
1173corresponding directory), respectively.
1174.It Ev INSTALL_TARGET
1175Target invoked to install the software, during fake installation.
1176Default is
1177.Sq install .
1178.It Ev INTERACTIVE
1179User settings.
1180Set to
1181.Sq Yes
1182to skip all non-interactive ports.
1183Used in conjunction with
1184.Ev BATCH
1185to simplify bulk-package builds.
1186.It Ev IS_INTERACTIVE
1187Set to
1188.Sq Yes
1189if port needs human interaction to build.
1190Usually implies NO_PACKAGE as well.
1191Porters should strive to minimize IS_INTERACTIVE ports, by using
1192FLAVORS for multiple choice ports, and by postponing human intervention
1193to package installation time.
1194.It Ev LIB_DEPENDS
1195Libraries this port depends upon.
1196Each item has the form
1197.Sq lib_specs:[pkgspec]:directory[,-subpackage][,flavor ...][:target] .
1198Similar to BUILD_DEPENDS, except for
1199.Sq lib_specs ,
1200which is a comma-separated list of
1201.Sq lib_spec
1202of the form:
1203.Sq libname.[version.[subversion]] .
1204See
1205.Xr library-specs 7
1206for more details.
1207.Pp
1208On architectures that use dynamic libraries,
1209.Ev LIB_DEPENDS
1210is also used as a run-time dependency, and recorded in the package as
1211such.
1212.It Ev LIBTOOL
1213Location of the libtool binary for ports that set
1214.Ev USE_LIBTOOL
1215(default: ${LOCALBASE}/bin/libtool).
1216.It Ev LIBTOOL_FLAGS
1217Arguments to pass to libtool.
1218If USE_LIBTOOL is set, the environment variable LIBTOOL is set
1219to ${LIBTOOL} ${LIBTOOL_FLAGS}.
1220.It Ev LOCALBASE
1221where other ports have already been installed (default: /usr/local)
1222.It Ev LOCKDIR
1223User settings.
1224If set, points to a directory common for all instances of concurrent ports
1225builds.
1226.It Ev LOCK_CMD
1227User settings.
1228If set, expands to a command that will acquire a lock.
1229This lock will reside in
1230.Pa ${LOCKDIR} .
1231See also
1232.Xr ports 7 .
1233.It Ev LP64_ARCHS
1234Set to the list of 64-bit architectures.
1235Use with
1236.Ev NOT_FOR_ARCHS .
1237.It Ev MAINTAINER
1238E-mail address with full name of the port's maintainer.
1239Defaults to ports@openbsd.org.
1240.It Ev MAKE_ENV
1241Environment variables passed to make invocations.
1242Sets at least PATH, PREFIX, LOCALBASE, X11BASE, CFLAGS, TRUEPREFIX, DESTDIR,
1243and the BSD_INSTALL_* macros.
1244.It Ev MAKE_FLAGS
1245Flags used for all make invocations, except for the
1246.Ar fake
1247stage, which adds
1248.Ev FAKE_FLAGS
1249(see
1250.Ev ALL_FAKE_FLAGS )
1251and for the regress stage, which adds
1252.Ev REGRESS_FLAGS
1253(see
1254.Ev ALL_REGRESS_FLAGS ) .
1255.It Ev MAKE_FILE
1256Name of the Makefile used for ports building.
1257Defaults to Makefile.
1258Used after changing directory to ${WRKBUILD}.
1259.It Ev MAKE_PROGRAM
1260The make program that is used for building the port.
1261Set to ${MAKE} or ${GMAKE} depending on USE_GMAKE.
1262Read-only.
1263.It Ev MAKESUMFILES
1264List of all files that need to be retrieved by
1265.Ar fetch-all ,
1266with
1267.Ev DIST_SUBDIR
1268prepende and with master site selection extension removed.
1269Read-only.
1270See also
1271.Ev CHECKSUMFILES .
1272.It Ev MASTER_SITES
1273List of primary location from which distribution files and patchfiles are
1274retrieved.
1275See the
1276.Ar fetch
1277target for more details.
1278See
1279.Xr ports 7
1280for user configuration.
1281.It Ev MASTER_SITES0 , ... , MASTER_SITES9
1282Supplementary locations from which distribution files and patchfiles are
1283retrieved.
1284.It Ev MESSAGE
1285File recorded in the package and displayed during installation.
1286Defaults to ${PKGDIR}/MESSAGE if this file exists.
1287Leave empty if no message is needed.
1288.It Ev MTREE_FILE
1289.Xr mtree 8
1290specification to check when creating a PLIST with the
1291.Ar update-plist
1292target.
1293.Ev MTREE_FILE
1294can hold a list of file names, to which
1295.Pa ${PORTSDIR}/infrastructure/db/fake.mtree
1296is always appended.
1297These specifications are rooted at
1298.Pa ${WRKINST} ,
1299and are subject to
1300.Ev SUBST_VARS
1301substitution, to ease
1302.Pa ${PREFIX}
1303independence.
1304This feature is primarily intended for large, interconnected ports,
1305such as the kde suite, where a base package sets up a large, extra
1306directory hierarchy that would make the manual checking of packing lists
1307tedious.
1308.It Ev MODGNU_CONFIG_GUESS_DIRS
1309If a port uses config.guess outside WRKSRC, the directories
1310containing the other copies must be set here.
1311.It Ev MODULES
1312External modules mechanism, documented separately.
1313See
1314.Xr port-modules 5 .
1315.It Ev MOTIFLIB
1316Read-only.
1317Correct incantation to link with motif.
1318.It Ev MULTI_PACKAGES
1319Set to a list of package extensions for ports that create multiple packages.
1320See
1321.Qq Flavors and multi-packages
1322below.
1323.It Ev NOT_FOR_ARCHS
1324List of architectures on which this port does not build.
1325See also
1326.Ev ONLY_FOR_ARCHS .
1327See also
1328.Ev SHARED_ONLY .
1329Do not use instead of
1330.Ev SHARED_ONLY
1331without very good reasons.
1332.It Ev NO_BUILD
1333Port does not need any build stage.
1334.It Ev NO_CHECKSUM
1335Set to
1336.Sq Yes
1337to avoid
1338.Ar checksum ,
1339.Ar makesum ,
1340and
1341.Ar addsum
1342actions entirely.
1343User settings.
1344Beware of the full implications of this mechanism, namely that it disables
1345entirely the basic authentication mechanisms of the ports tree.
1346.It Ev NO_DEPENDS
1347User settings.
1348Don't verify build of dependencies.
1349Do not use in any ports Makefile.
1350This is only meant as a user convenience when, e.g., you just want to browse
1351through a given port's source and do not wish to trigger the build of
1352dependencies.
1353.It Ev NO_IGNORE
1354User settings.
1355If set to
1356.Sq Yes ,
1357avoid ignoring a port for the usual reasons.
1358Use, for instance, for fetching all distribution files, or for fixing a
1359broken port.
1360See also
1361.Ev IGNORE .
1362.It Ev NO_REGRESS
1363Port does not have any regression targets.
1364.It Ev NO_SHARED_ARCHS
1365Set to the list of platforms that do not support shared libraries.
1366Use with
1367.Ev NOT_FOR_ARCHS .
1368.It Ev NO_SHARED_LIBS
1369Set to
1370.Sq Yes
1371if platform does not support shared libraries.
1372To be tested after including
1373.Nm bsd.port.mk ,
1374if neither PFRAG.shared nor CONFIGURE_SHARED are enough.
1375.It Ev NO_SYSTRACE
1376Port does not build with systrace enabled build targets.
1377.It Ev ONLY_FOR_ARCHS
1378List of architectures on which this port builds.
1379Can hold both processor-specific information (e.g., m68k), and more
1380specific model information (e.g., hp300).
1381.It Ev OPSYS
1382Always
1383.Ox .
1384Read-only.
1385.It Ev OPSYS_VER
1386Revision number of
1387.Ox .
1388Read-only.
1389.It Ev PACKAGE_REPOSITORY
1390User settings.
1391Default location for built packages.
1392Defaults to
1393.Pa ${PORTSDIR}/packages .
1394See
1395.Ar package
1396for details.
1397.It Ev PATCH
1398Command to use to apply all patches.
1399Defaults to
1400.Pa /usr/bin/patch .
1401.It Ev PATCHORIG
1402Suffix used by
1403.Ar patch
1404to rename original files, and
1405.Ar update-patches
1406to re-generate
1407.Pa ${PATCHDIR}/${PATCH_LIST}
1408by looking for files using this suffix.
1409Defaults to
1410.Pa .orig .
1411For a port that already contains
1412.Pa .orig
1413files in the ${DISTFILES},
1414set this to something else, such as
1415.Pa .pat.orig .
1416See also
1417.Ar distpatch ,
1418.Ev DISTORIG .
1419.It Ev PATCH_CASES
1420In the normal distpatch stage (when
1421.Ev PATCHFILES
1422is not empty), this is the contents of a case statement, used to apply
1423distribution patches.
1424Fragments are automatically appended to handle gzip'ed and bzip'ed
1425patches, so that the default case is equivalent to the following shell
1426fragment:
1427.Bd -literal
1428set -e
1429cd ${FULLDISTDIR}
1430for patchfile in ${_PATCHFILES}
1431do
1432    case $$patchfile in
1433	*.bz2)
1434	  bzip2 -dc $$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
1435	*.Z|*.gz)
1436	  gzcat $$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
1437	*)
1438	  ${PATCH} ${PATCH_DIST_ARGS} <$$patchfile;;
1439    esac
1440done
1441.Ed
1442.It Ev PATCHDIR
1443Location for patches applied by patch target (default: patches.${ARCH} or
1444patches).
1445.It Ev PATCHFILES
1446Files to fetch from the master sites like
1447.Ev DISTFILES ,
1448but serving a different purpose, as they hold distribution patches that
1449will be applied at the
1450.Ar patch
1451stage.
1452See also
1453.Ev SUPDISTFILES .
1454.It Ev PATCH_ARGS
1455Full list of options used while applying port's patches.
1456.It Ev PATCH_CHECK_ONLY
1457Set to Yes by the
1458.Ar checkpatch
1459target.
1460Don't touch unless the default
1461.Ar checkpatch
1462target needs to be redefined.
1463Ideally, user-defined patch subtargets ought to test checkpatch.
1464In practice, they don't.
1465.It Ev PATCH_DEBUG
1466If set to
1467.Sq Yes ,
1468the
1469.Ar patch
1470stage will output extra debug information.
1471.It Ev PATCH_DIST_ARGS
1472Full list of options used while applying distribution patches.
1473.It Ev PATCH_DIST_STRIP
1474Patch option used to strip directory levels while applying distribution
1475patches.
1476Defaults to -p0 .
1477.It Ev PATCH_LIST
1478Wildcard pattern of patches to select under ${PATCHDIR} (default: patch-*).
1479Note that filenames ending in .orig, or ~ are never applied.
1480Note that
1481.Ev PATCH_LIST
1482can hold absolute pathnames, for instance to share patches among similar
1483ports:
1484.Bd -literal
1485PATCH_LIST=${PORTSDIR}/x11/kde/libs2/patches/p-* patch-*
1486.Ed
1487.It Ev PATCH_STRIP
1488Patch option used to strip directory levels while applying port's patches.
1489Defaults to -p0 .
1490.It Ev PERMIT_{DISTFILES,PACKAGE}_{CDROM,FTP}
1491Set to
1492.Sq Yes
1493if package or distribution files can be allowed on FTP sites or CD-ROM without
1494legal issues.
1495Set to reason not to otherwise.
1496PERMIT_* lines in the Makefile should be preceded with a comment explaining
1497details about licensing and patents issues the port may have.
1498Porters must be very thorough in their checks.
1499In case of doubt, ask.
1500.It Ev PKG_ARCH
1501Comma-separated list of architectures on which this package may install.
1502Defaults to ${MACHINE_ARCH},${ARCH}.
1503Use * to mean any arch.
1504.It Ev PKG_DBDIR
1505Path to package installation records.
1506Defaults to
1507.Pa /var/db/pkg .
1508User settings.
1509.It Ev PORTHOME
1510Setting of env variable
1511.Ev HOME
1512for most shell invocations.
1513Default will trip ports that try to write into $HOME while building.
1514.It Ev PORTPATH
1515Path used by most shell invocations.
1516Don't override unless really needed.
1517.It Ev PORTSDIR
1518Root of the ports tree (default:
1519.Pa /usr/ports ) .
1520.It Ev PORTSDIR_PATH
1521Path used by dependencies and
1522.Pa bsd.port.subdir.mk
1523to look up package specifications.
1524Defaults to
1525.Pa ${PORTSDIR}:${PORTSDIR}/mystuff .
1526.It Ev PKGDIR
1527Location for packaging information (packing list, port description, port
1528short description).
1529Default: pkg.${ARCH} or pkg.
1530.It Ev PKGNAME
1531Name of the created package.
1532Default is ${DISTNAME}.
1533This does not take flavors into account.
1534See
1535.Ev FULLPKGNAME
1536for that.
1537.It Ev PKGNAMES
1538Read-only.
1539List of all package names generated by the port, with
1540.Ev FLAVORS
1541and
1542.Ev MULTI_PACKAGES
1543taken into account.
1544Mostly used as
1545.Sq make show=PKGNAMES
1546to verify that bumped package names are correct.
1547.It Ev PKGNAME-foo
1548Package name for sub-package foo, if the default value
1549of ${PKGNAME}${SUBPACKAGE} is not appropriate.
1550.It Ev PKGPATH
1551Path to the current port's directory, relative to ${PORTSDIR}.
1552Read-only.
1553.It Ev PLIST_DB
1554User settings.
1555Directory used to save generated packing-lists, for further processing,
1556such as looking for unregistered conflicts.
1557Defaults to empty.
1558.It Ev PREFERRED_CIPHERS
1559List of cryptographic ciphers to use, in order of preference.
1560Default is
1561.Sq sha256 sha1 rmd160 md5 .
1562The first cipher that matches in ${CHECKSUM_FILE} is verified.
1563.It Ev PREFIX
1564Base directory for the current port installation.
1565Usually ${LOCALBASE}, though some ports may elect a location under
1566.Pa /var ,
1567and some multi-package ports may install under several locations.
1568.It Ev PSEUDO_FLAVORS
1569Extra list of flavors that do not register in package names, but are still
1570used to control build logic, and e.g., working directory names.
1571Its main use is for disabling part of a multi-packages build, for instance:
1572.Bd -literal
1573FLAVOR=no_gnome make package
1574.Ed
1575.Pp
1576Creation of a separate working directory is mandatory.
1577If, at a later time, a full build with all subpackages is required,
1578all the work will need to be done again.
1579.It Ev REFETCH
1580User settings.
1581If set to true,
1582.Ar checksum
1583will analyze ${CHECKSUM_FILE}, and try retrieving files with the correct
1584checksum off
1585.Pa ftp.openbsd.org ,
1586in the directory
1587.Pa /pub/OpenBSD/distfiles/$cipher/$value/$file .
1588.It Ev REGRESS_DEPENDS
1589See
1590.Ev BUILD_DEPENDS
1591for specification.
1592Regress dependencies are only checked if the regress stage is invoked.
1593.It Ev REGRESS_FLAGS
1594Extra flags passed to ${MAKE_PROGRAM} to run the regression tests.
1595Empty by default.
1596.It Ev REGRESS_IS_INTERACTIVE
1597Set to
1598.Sq Yes
1599if port needs human interaction to run its tests.
1600.It Ev REGRESS_LOG
1601Command used to log the results of regression tests to REGRESS_LOGFILE.
1602.It Ev REGRESS_LOGFILE
1603Log file containing the results of regression tests.
1604.It Ev REGRESS_TARGET
1605Target to run regression tests.
1606Defaults to
1607.Sq regress ,
1608except for
1609.Sq perl
1610and
1611.Sq gnu
1612.Ev CONFIGURE_STYLE ,
1613which default to
1614.Sq test
1615and
1616.Sq check
1617respectively.
1618.It Ev REORDER_DEPENDENCIES
1619Points to a list of files that specify inter-dependencies for
1620.Xr make 1 .
1621If defined, each line of the file is either a comment (starting with #)
1622or a pair of two files: most_recent older.
1623At the end of
1624.Ar post-patch ,
1625.Xr touch 1
1626will be used to ensure those files are put in the proper order.
1627The files are assumed to be under
1628.Pa ${WRKSRC} .
1629The notation /file can be used to ask for a recursive search, e.g.,
1630to make sure that all Makefile.in are up-to-date.
1631See
1632.Pa ${PORTSDIR}/infrastructure/mk/automake.dep
1633for an example.
1634.It Ev REPORT_PROBLEM
1635See
1636.Xr ports 7 .
1637.It Ev REPORT_PROBLEM_LOGFILE
1638See
1639.Xr ports 7 .
1640.It Ev RUN_DEPENDS
1641Specification of ports this port needs installed to be functional.
1642Same format as BUILD_DEPENDS.
1643The corresponding packages will be built at
1644.Ar install
1645stage, and
1646.Xr pkg_add 1
1647will take care of installing them.
1648.It Ev SEPARATE_BUILD
1649Many GNU configure ports can be built in a directory distinct from the
1650place they were unpacked.
1651For some specific ports, this is even mandatory.
1652Set to
1653.Sq simple
1654if this is the case.
1655The ports infrastructure will generate a separate ${WRKBUILD} directory
1656in which the port will be configured and built.
1657Wipe ${WRKBUILD} to start anew, but skipping the extract/patch stage.
1658Set to
1659.Sq flavored
1660if distinct flavors of the port may share a common source tree.
1661.It Ev SHARED_LIBS
1662List of shared libraries that the port may build, as a list of the form
1663.Sq libname
1664.Sq libversion .
1665Used to set variables of the form
1666.Ev LIBlibname_VERSION
1667that are then used for substitution by
1668.Xr pkg_create 1 .
1669The porter is responsible for making sure the port uses those version numbers
1670when shared libraries are built.
1671.Pp
1672The intent is that the
1673.Ox
1674ports system must have control over shared library versions because of global
1675changes that may require bumping the major version of every shared library in
1676the system, or simply because the third party programmers do not understand
1677the rules for shared library versions, thus breaking the update mechanism.
1678For that reason it is advised to set libversion to 0.0 when first importing a
1679port.
1680.Pp
1681Porters of software using libtool should also set
1682.Ev USE_LIBTOOL
1683and make sure
1684.Ev MAKE_FLAGS
1685get propagated to the libtool invocations.
1686This should be enough, in most cases.
1687.It Ev SHARED_ONLY
1688Set to
1689.Sq Yes
1690if port can only be built on architectures with shared libraries.
1691.It Ev SKIPDIR
1692See
1693.Xr ports 7 .
1694.It Ev STARTDIR
1695See
1696.Xr ports 7 .
1697.It Ev SUBPACKAGE
1698Set to the sub package suffix when building a package in a multi-package port.
1699Read-only.
1700Used to test for dependencies or to adjust the package name.
1701.It Ev SUBST_CMD
1702A command that can be used to perform
1703.Ev SUBST_VARS
1704substitution on arbitrary files.
1705In normal mode,
1706.Pp
1707.Dl ${SUBST_CMD} file1 file2 ...
1708.Pp
1709will substitute files in place, creating backup copies of them.
1710In copy mode,
1711.Pp
1712.Dl ${SUBST_CMD} -c src1 dest1 src2 dest2
1713.Pp
1714will copy files over while performing the substitution, as suitable for
1715copying template files over from
1716.Pa ${FILESDIR}
1717to
1718.Pa ${PREFIX} ,
1719for instance.
1720Read-only.
1721.It Ev SUBST_VARS
1722Make variables whose values get substituted to create the actual package
1723information.
1724Always holds
1725.Ev ARCH ,
1726.Ev BASE_PKGPATH ,
1727.Ev FLAVOR_EXT ,
1728.Ev HOMEPAGE ,
1729.Ev MACHINE_ARCH ,
1730.Ev MAINTAINER ,
1731.Ev PREFIX ,
1732and
1733.Ev SYSCONFDIR .
1734The special construct
1735.Sq ${FLAVORS}
1736can be used in the packing-list to specify the current list of dash
1737separated flavors the port is compiled with (useful for cross-dependencies
1738in
1739.Ev MULTI_PACKAGES ) .
1740Add other
1741variables as needed.
1742Some variable names are prefixed by a ^.
1743This is only relevant for
1744.Ar update-plist ,
1745where it means the variable will only be substituted at the beginning of
1746a path.
1747.It Ev SUDO
1748User settings.
1749If set to
1750.Xr sudo 8
1751in
1752.Xr mk.conf 5 ,
1753the ports tree will only invoke root's privileges for the parts that
1754really require it.
1755.It Ev SUPDISTFILES
1756Supplementary files that need to be retrieved under some specific
1757circumstances.
1758For instance, a port might need architecture-specific files.
1759.Ev SUPDISTFILES
1760should hold a list of all distribution files and patchfiles that are not
1761always needed, so that a mirror will be able to grab all files, or that
1762.Ar makesum
1763will work.
1764Having an overlap between
1765.Ev SUPDISTFILES
1766and
1767.Ev DISTFILES ,
1768.Ev PATCHFILES
1769is admissible, and in fact, expected, as it is much simpler to build
1770an error-free list of files to retrieve in that way.
1771See the xanim port for an example.
1772.It Ev SYSCONFDIR
1773Location for ports system configuration files.
1774Defaults to
1775.Pa /etc ,
1776should never be set to
1777.Pa /usr/local/etc .
1778.It Ev SYSTRACE_FILTER
1779Location of the systrace filter file which is the basis for a port's
1780actual systrace policy file.
1781Defaults to
1782.Pa ${PORTSDIR}/infrastructure/db/systrace.filter .
1783.It Ev SYSTRACE_SUBST_VARS
1784List of variables used in ${SYSTRACE_FILTER} that will be substituted
1785by their real value when creating the systrace policy file.
1786Always holds
1787.Ev WRKOBJDIR ,
1788.Ev PORTSDIR ,
1789and
1790.Ev DISTDIR .
1791.It Ev TAR
1792Name of the tar binary.
1793.It Ev TEMPLATES
1794Base location for the templates used in the
1795.Ar readmes
1796target.
1797User settings.
1798.It Ev TRUST_PACKAGES
1799User settings.
1800If set to
1801.Sq Yes ,
1802dependency mechanisms will assume the database of installed packages is
1803correct.
1804See also
1805.Ev BULK .
1806.It Ev UNLOCK_CMD
1807User settings.
1808If set, expands to a command that will release a lock.
1809This lock will reside in
1810.Pa ${LOCKDIR} .
1811.It Ev UNMESSAGE
1812File recorded in the package and displayed during deinstallation.
1813Defaults to ${PKGDIR}/UNMESSAGE if this file exists.
1814Leave empty if no message is needed.
1815.It Ev UNZIP
1816Name of the unzip binary.
1817.It Ev UPDATE_COOKIES_DIR
1818User settings.
1819Used to store cookies for package updates and defaults to
1820.Pa ${PORTSDIR}/update/${MACHINE_ARCH} .
1821If set to empty, will revert to a file under
1822.Pa ${WRKDIR} .
1823.It Ev USE_GMAKE
1824Set to
1825.Sq Yes
1826if GNU make (${GMAKE}) is needed for correct behavior of this port.
1827.It Ev USE_LIBTOOL
1828Set to
1829.Sq Yes
1830if libtool is required for correct behavior of this port.
1831Adds correct dependencies, and passes LIBTOOL environment variable to
1832scripts invocations.
1833.It Ev USE_MOTIF
1834Set to
1835.Sq any
1836if port works with any version of motif;
1837.Sq lesstif
1838if port requires lesstif to work;
1839.Sq openmotif
1840if ports requires openmotif to work.
1841The
1842.Sq any
1843setting creates an extra flavor choice of
1844.Sq lesstif .
1845See also
1846.Ev MOTIFLIB
1847.It Ev USE_SYSTRACE
1848User settings.
1849Set to
1850.Sq Yes
1851to protect port building with systrace.
1852.It Ev USE_X11
1853Set to
1854.Sq Yes
1855if port requires X11 to work.
1856.It Ev VMEM_WARNING
1857Set to
1858.Sq Yes
1859if the port requires a lot of memory to compile, and the user is
1860likely to see a message like
1861.Qq virtual memory exhausted
1862with the default process limits.
1863.It Ev WANTLIB
1864Extra list of library specifications that a package will need.
1865May include system and X11 libraries.
1866.Pp
1867As a special extension,
1868.Ev WANTLIB
1869may include absolute paths, e.g.,
1870.Pa ${LOCALBASE}/lib/expat.=4
1871to distinguish between base libraries and port libraries.
1872Use with caution, this is very seldom needed.
1873.It Ev WARNINGS
1874User settings.
1875If set to
1876.Sq Yes ,
1877add
1878.Ev CDIAGFLAGS
1879to
1880.Ev CFLAGS
1881and
1882.Ev CXXDIAGFLAGS
1883to
1884.Ev CXXFLAGS .
1885.It Ev WRKBUILD
1886Subdirectory of ${WRKDIR} where the actual build occurs.
1887Defaults to ${WRKSRC}, unless SEPARATE_BUILD is involved, in which case
1888it is set to an appropriate value.
1889.It Ev WRKCONF
1890Subdirectory of ${WRKDIR} where the actual configure set occurs.
1891Defaults to ${WRKBUILD}.
1892.It Ev WRKDIR
1893Location where all port activity occurs.
1894Apart from the actual port, may
1895hold all kinds of cookies that checkpoint the port's build.
1896Read-only.
1897Ports that need to know the WRKDIR of another port must use
1898cd that_port_dir && make show=WRKDIR for this.
1899Note that WRKDIR may be a symbolic link.
1900During ports building,
1901.Pa ${WRKDIR}/bin
1902is put at the front of the
1903.Ev PATH .
1904.It Ev WRKDIST
1905Subdirectory of ${WRKDIR} in which the distribution files normally unpacks.
1906Base for all patches (default: ${WRKDIR}/${DISTNAME}).
1907Note that WRKDIST may be a symbolic link, if set to ${WRKDIR}.
1908.It Ev WRKSRC
1909Subdirectory of ${WRKDIR} where the actual source is.
1910Base for configuration (default: ${WRKDIST})
1911Note that WRKSRC may be a symbolic link, if set to ${WRKDIR}.
1912.It Ev WRKINST
1913Subdirectory of ${WRKDIR} where port normally installs (see
1914.Ar fake
1915target).
1916.It Ev WRKOBJDIR
1917If non empty, used as a base for the actual port working directory.
1918The real working directory ${WRKDIR} is created there.
1919Can be set on a per-${PKGPATH} basis.
1920For instance, setting WRKOBJDIR_www/mozilla=/tmp/obj
1921will affect only the mozilla port.
1922.It Ev X11BASE
1923Where X11 has been installed (default: /usr/X11R6).
1924.It Ev XMKMF
1925Invocation of xmkmf for CONFIGURE_STYLE=imake port.
1926Defaults to xmkmf -a -DPorts.
1927The -DPorts is specific to
1928.Ox
1929and is always appended.
1930.It Ev YACC
1931Name of yacc program to pass to GNU-configure, defaults to yacc.
1932(GNU-configure would always try to use bison otherwise, which leads to
1933unreproducible builds.)
1934Set to bison if needed.
1935.El
1936.Sh FILES
1937.Bl -tag -width files/md5
1938.It Pa ../Makefile.inc
1939Common Makefile fragment for a set of ports, included automatically.
1940.It Pa /cdrom/distfiles
1941Default path to a CD-ROM (or other media) full of distribution files.
1942.It Pa Makefile.${ARCH}
1943Arch-dependent Makefile fragment, included automatically.
1944.It Pa ${DISTDIR}
1945cache of all distribution files.
1946.It Pa distinfo
1947Checksum file.
1948Holds the output of
1949.Xr cksum 1 ,
1950using ${PREFERRED_CIPHERS},
1951for the port's ${DISTFILES} and ${PATCHFILES},
1952as well as the sizes of these files.
1953.It Pa ${DISTDIR}/${CHECKSUMFILES}
1954cache of normal distribution files for a given port.
1955.It Pa ${DISTDIR}/${MAKESUMFILES}
1956cache of all distribution files for a given port.
1957.It Pa ${PKGDIR}/DESCR
1958Description for the port.
1959Variables such as ${HOMEPAGE} and ${MAINTAINER} will be expanded
1960(see SUBST_VARS).
1961Multi-package ports will use DESCR${SUBPACKAGE}.
1962.It Pa ${PORTSDIR}/infrastructure/db/fake.mtree
1963Specification used for populating ${WRKINST} at the start of
1964.Ar fake .
1965Use
1966.Ar pre-fake
1967if this is incomplete.
1968.It Pa ${PORTSDIR}/packages/${MACHINE_ARCH}/cdrom
1969Default setup of ${PACKAGE_REPOSITORY}.
1970.It Pa ${PACKAGE_REPOSITORY}/no-arch
1971Location of arch-independent packages.
1972.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all
1973Location of all built packages.
1974.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache
1975Location of packages retrieved through the network.
1976.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom
1977Location of packages suitable for the CD.
1978.It Pa ${PORTSDIR}/packages/${MACHINE_ARCH}/ftp
1979Location of packages suitable for FTP.
1980.It Pa ${PORTSDIR}/bulk/${MACHINE_ARCH}
1981Default setup of ${BULK_COOKIES_DIR}.
1982.It Pa ${PORTSDIR}/update/${MACHINE_ARCH}
1983Default setup of ${UPDATE_COOKIES_DIR}.
1984.It Pa ${PORTSDIR}/mystuff
1985Extra directory used to store local ports before committing them.
1986All depend targets will normally look there after the normal lookup fails.
1987See
1988.Ev PORTSDIR_PATH .
1989.It Pa systrace.filter
1990List of additional port specific filters, included automatically.
1991.It Pa systrace.policy
1992List of additional port specific policies, included automatically.
1993.El
1994.Sh OBSOLETE TARGETS
1995.Bl -tag -width do-configure
1996.It Ar cdrom-packages , ftp-packages
1997Links are now created during the
1998.Ar package
1999target.
2000.It Ar depends-list
2001Renamed into
2002.Ar full-build-depends
2003.It Ar {pre,do}-extract
2004Don't override.
2005Set
2006.Ev EXTRACT_ONLY
2007to nothing and override
2008.Ar post-extract
2009instead.
2010.It Ar fetch-all , Ar fetch-list , Ar mirror-distfiles
2011See
2012.Xr mirroring-ports 7
2013for more efficient and flexible ways to build mirrors.
2014.It Ar obj
2015Starting with
2016.Ox 3.3 ,
2017using
2018.Ev WRKOBJDIR
2019no longer creates a symlink between the current directory and
2020a subdirectory of ${WRKOBJDIR}, so
2021.Ar obj
2022is no longer applicable.
2023.It Ar print-depends
2024Use
2025.Ar print-build-depends
2026and
2027.Ar print-run-depends
2028instead.
2029.It Ar print-depends-list
2030Renamed into
2031.Ar print-build-depends
2032.It Ar print-package-depends
2033Renamed into
2034.Ar print-run-depends
2035.El
2036.Sh OBSOLETE VARIABLES
2037.Bl -tag -width MASTER_SITES
2038.It Ev BIN_PACKAGES
2039Old user settings.
2040The infrastructure always trusts the repository to contain correct packages.
2041So, if the package name did not change and if it exists in the repository,
2042it will not be rebuilt without manual user action.
2043.It Ev CATn
2044List of formatted manpages, per section.
2045.It Ev CATPREFIX
2046Location for storing formatted manpages.
2047Derived directly from
2048.Ev PREFIX .
2049.It Ev CDROM_PACKAGES
2050Old user settings.
2051Base location where packages suitable for a CD-ROM (see
2052PERMIT_PACKAGE_CDROM) will be placed.
2053Now hardwired to
2054.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom .
2055.It Ev COMMENT
2056Used to be the name of the comment file for a package.
2057It now holds the comment itself.
2058Some magic has been put in to allow for a seamless transition.
2059.It Ev DESCR_SRC
2060From
2061.Nx .
2062This is DESCR.
2063.Ox
2064does not give a specific name to the generated file.
2065It is not recommended to try to access it directly.
2066.It Ev EXTRACT_AFTER_ARGS
2067Was used to cobble together the normal extraction command, as
2068${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${EXTRACT_AFTER_ARGS}.
2069Use
2070.Ev EXTRACT_CASES
2071instead.
2072.It Ev EXTRACT_BEFORE_ARGS
2073Likewise, use
2074.Ev EXTRACT_CASES
2075instead.
2076.It Ev EXTRACT_CMD
2077Likewise, use
2078.Ev EXTRACT_CASES
2079instead.
2080.It Ev FETCH_BEFORE_ARGS , Ev FETCH_AFTER_ARGS
2081Set
2082.Ev FETCH_CMD
2083to point to a script that does any required special treatment instead.
2084.It Ev FETCH_DEPENDS
2085Used to specify dependencies that were needed to fetch files.
2086It is much easier to mirror locally weird distribution files.
2087.It Ev FTP_PACKAGES
2088User settings.
2089Base location where packages suitable for FTP (see
2090PERMIT_PACKAGE_FTP) will be placed.
2091Now hardwired to
2092.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp .
2093(default: ${PKGREPOSITORYBASE}/ftp)
2094.It Ev GNU_CONFIGURE
2095Use
2096.Ev CONFIGURE_STYLE
2097instead.
2098.It Ev HAS_CONFIGURE
2099Use
2100.Ev CONFIGURE_STYLE
2101instead.
2102.It Ev HAVE_MOTIF
2103Old user settings.
2104No longer needed since OpenMotif is now free.
2105.It Ev IGNOREFILES
2106Set to the list of files that can't be checksummed.
2107All uses of it have led to postponing the correct action: talking
2108to the software author and getting him to provide versioned archives.
2109.It Ev MANn
2110List of unformatted manpages, per section.
2111.It Ev MANPREFIX
2112Location for storing unformatted manpages.
2113Derived directly from
2114.Ev PREFIX .
2115.It Ev MASTERDIR
2116From
2117.Fx .
2118Used to organize a collection of ports that share most files.
2119.Ox
2120uses a single port with flavors or multi-packages to produce
2121package variations instead.
2122.It Ev MASTER_SITE_SUBDIR
2123Contents were used to replace
2124.Sq %SUBDIR%
2125in all
2126.Ev MASTER_SITES
2127variables.
2128Since
2129.Sq %SUBDIR%
2130almost always occur at the end of the directory,
2131the simpler
2132.Li ${VARIABLE:=subdir/}
2133construct is now used instead
2134.Po
2135taken from
2136.Nx
2137.Pc .
2138.It Ev MD5_FILE
2139Use
2140.Ev CHECKSUM_FILE
2141instead.
2142.It Ev MIRROR_DISTFILE
2143Use
2144.Ev PERMIT_DISTFILES_FTP
2145and
2146.Ev PERMIT_DISTFILES_CDROM
2147to determine which files can be mirrored instead.
2148See
2149.Xr mirroring-ports 7 .
2150.It Ev NEED_VERSION
2151Used to set a requirement on a specific revision of
2152.Nm
2153needed by a port.
2154No longer needed as
2155.Nm
2156should always be kept up-to-date.
2157.It Ev NO_CONFIGURE
2158If ${CONFIGURE_SCRIPT} does not exist, no automatic configuration will
2159be done anyway.
2160.It Ev NO_DESCRIBE
2161All ports should generate a description.
2162.It Ev NO_EXTRACT
2163Set EXTRACT_ONLY= instead.
2164.It Ev NO_INSTALL_MANPAGES
2165Use
2166.Ev CONFIGURE_STYLE
2167instead.
2168.It Ev NO_MTREE
2169Starting with
2170.Ox 2.7 ,
2171the operating system installation script runs the /usr/local specification
2172globally, instead of embedding it in each package.
2173So packages no longer record an
2174.Xr mtree 8
2175specification.
2176Use an explicit
2177.Sq @exec
2178command if needed.
2179.It Ev NO_PACKAGE
2180All ports should generate a package, preferably before install.
2181.It Ev NO_PATCH
2182The absence of a patches directory does the same.
2183Use PATCHDIR and PATCH_LIST if patches need to be changed dynamically.
2184.It Ev NO_WRKDIR
2185All ports should have a working directory, as this is necessary to store
2186cookies and keep state.
2187.It Ev NO_WRKSUBDIR
2188The same functionality is obtained by setting WRKDIST=${WRKDIR} .
2189.It Ev NOCLEANDEPENDS
2190Use CLEANDEPENDS instead.
2191.It Ev NOMANCOMPRESS
2192.Fx
2193ships with compressed man pages, and uses this variable to control
2194that behavior.
2195.It Ev OBJMACHINE
2196Starting with
2197.Ox 3.3 ,
2198setting
2199.Ev WRKOBJDIR
2200creates the whole
2201.Ev WRKDIR
2202hierarchy under ${WRKOBJDIR}, so
2203.Ev OBJMACHINE
2204is no longer useful.
2205.It Ev PACKAGES
2206Base location for packages built, renamed
2207.Ev PKGREPOSITORYBASE .
2208.It Ev PACKAGING
2209Used to be set during package creation, so that the port would test it
2210to tweak some settings at this point.
2211All its effects are now achieved through
2212.Ev MULTI_PACKAGES .
2213.It Ev PATCH_SITES
2214.Ev PATCHFILES
2215used to be retrieved from a separate site list.
2216For greater flexibility, all files are now retrieved from
2217.Ev MASTER_SITES ,
2218.Ev MASTER_SITES0 , ... ,
2219.Ev MASTER_SITES9 ,
2220using a
2221.Sq :0
2222to
2223.Sq :9
2224extension to the file name, e.g.,
2225.Bd -literal -offset indent
2226PATCHFILES=foo.diff.gz
2227PATCH_SITES=ftp://ftp.zoinx.org/pub/
2228.Ed
2229.Pp
2230becomes
2231.Bd -literal -offset indent
2232PATCHFILES=foo.diff.gz:0
2233MASTER_SITES0=ftp://ftp.zoinx.org/pub/
2234.Ed
2235.It Ev PKGREPOSITORY
2236Old user settings.
2237See
2238.Ev PACKAGE_REPOSITORY .
2239.It Ev PKGREPOSITORYBASE
2240Old user settings.
2241See
2242.Ev PACKAGE_REPOSITORY .
2243.It Ev PLIST_SRC
2244From
2245.Nx .
2246This is PLIST.
2247.Ox
2248does not give a specific name to the generated file.
2249It is not recommended to try to access them directly.
2250.It Ev PKGNAME
2251Used to refer to the full package name, has been superseded by
2252.Ev FULLPKGNAME-foo ,
2253for
2254.Ev SUBPACKAGE
2255-foo .
2256.Ev PKGNAME
2257now holds the package name, not taking multi-packages or flavors
2258into account.
2259Most ports are not concerned by this change.
2260.It Ev PLIST_SUBST
2261From
2262.Nx
2263and
2264.Fx .
2265Use SUBST_VARS instead.
2266.Ox
2267does not allow general substitutions of the form VAR=value, but uses
2268only a list of variables instead.
2269Most package files gets transformed, instead of only the packing list.
2270.It Ev RESTRICTED
2271Port has cryptographic issues.
2272.Ox
2273focuses on
2274.Ev PERMIT_PACKAGE_{FTP,CDROM}
2275instead.
2276.It Ev SED_PLIST
2277old pipeline for creating packing-lists at the ports level.
2278Necessary functionality has been integrated directly into
2279.Xr pkg_create 1 .
2280.It Ev SCRIPTDIR
2281Old location for scripts related to the current port.
2282There is no reason for the semantic distinction, use
2283.Ev FILESDIR
2284for those.
2285.It Ev SCRIPTS_ENV
2286Used to contain the environment for invoking various scripts.
2287.Ev CONFIGURE_ENV
2288and
2289.Ev MAKE_ENV
2290are enough.
2291.It Ev USE_AUTOCONF
2292Use
2293.Ev CONFIGURE_STYLE
2294instead.
2295.It Ev USE_BZIP2
2296The framework will automatically detect the presence of
2297.Pa .tar.bz2
2298files to extract.
2299.It Ev USE_IMAKE
2300Use
2301.Ev CONFIGURE_STYLE
2302instead.
2303.It Ev USE_ZIP
2304The framework will automatically detect the presence of
2305.Pa .zip
2306files to extract.
2307.It Ev VARNAME
2308Use make show=name instead of make show VARNAME=name.
2309.It Ev WRKPKG
2310Directory used to build package information from the templates under
2311.Pa ${PKGDIR} .
2312This information is now built on the fly by
2313.Xr pkg_create 1 .
2314.El
2315.Sh OBSOLETE FILES
2316.Bl -tag -width files/md5
2317.It Pa ${FILESDIR}/md5
2318Renamed to
2319.Pa distinfo
2320to match other BSD, and save directories.
2321.It Pa ${SCRIPTDIR}/{pre,do,post}-*
2322Identical functionality can be obtained through a {pre,do,post}-* target,
2323invoking the script manually if necessary.
2324.It Pa ${SCRIPTDIR}/configure
2325No longer invoked automatically.
2326Just inline the instructions in
2327.Ar do-configure
2328in the Makefile, or put the script in ${FILESDIR} and
2329invoke it.
2330.It Pa ${PKGDIR}/COMMENT
2331Use COMMENT variable instead.
2332.It Pa ${PKGDIR}/DEINSTALL*
2333Use @unexec annotations in the packing-list instead.
2334.It Pa ${PKGDIR}/INSTALL*
2335Use @exec annotations in the packing-list instead.
2336.It Pa ${PKGDIR}/PLIST.noshared
2337Use PFRAG.shared or PFRAG.no-shared instead.
2338PLIST.noshared was too easy to forget when updating ports.
2339.It Pa ${PKGDIR}/PLIST.sed
2340Use PLIST directly.
2341Until revision 1.295,
2342.Nm
2343did not substitute variables in the packing list unless this special form
2344was used.
2345.It Pa ${PKGDIR}/REQ*
2346Old requirement script.
2347Was mostly unused anyway.
2348.It Pa /usr/share/mk/bsd.port.mk
2349Original location of
2350.Nm bsd.port.mk .
2351The current file lives under
2352.Pa ${PORTSDIR}/infrastructure/mk/bsd.port.mk ,
2353whereas
2354.Pa /usr/share/mk/bsd.port.mk
2355is just a stub.
2356.It Pa {scripts,files,patches}.${OPSYS}
2357The
2358.Ox
2359ports tree focuses on robustness, not on being portable to other operating
2360systems.
2361In any case, portability should not need to depend on operating
2362system dependent patches.
2363.It Pa /usr/local/etc
2364Used by
2365.Fx
2366to marshall system configuration files.
2367All
2368.Ox
2369system configuration files are located in
2370.Pa /etc ,
2371or in a subdirectory of
2372.Pa /etc .
2373.El
2374.Sh THE FAKE FRAMEWORK
2375The
2376.Ar fake
2377target is used to install the port in a private directory first, ready for
2378packaging by the
2379.Ar package
2380target, so that the real installation will use the package.
2381.Pp
2382Essentially,
2383.Ar fake
2384invokes a real
2385.Ar install
2386process after tweaking a few variables.
2387.Pp
2388.Ar fake
2389first creates a skeleton tree under ${WRKINST}, using the
2390.Xr mtree 8
2391specification
2392.Pa ${PORTSDIR}/infrastructure/db/fake.mtree .
2393.Pp
2394A
2395.Ar pre-fake
2396target may be used to complete that skeleton tree.
2397For instance, a few ports may need supplementary stuff to be present (as
2398it would be installed if the ports' dependencies were present).
2399.Pp
2400If {pre,do,post}-install overrides are present, they are used with some
2401important changes: PREFIX is set to ${WRKINST}${PREFIX}, ${DESTDIRNAME}
2402is set to ${WRKINST}, and TRUEPREFIX is set to ${PREFIX}.
2403Essentially, old install targets work transparently, except for a need to
2404change PREFIX to TRUEPREFIX for symbolic links and similar path lookups.
2405Specific traditional post install work can be simply removed, as it will
2406be taken care of by the package itself (for instance, ldconfig, or
2407texinfo's install-info).
2408.Pp
2409If no do-install override is present, the port is installed using
2410.Bd -literal -offset 2n
2411env -i ${MAKE_ENV}
2412PREFIX=${WRKINST}${PREFIX} ${DESTDIRNAME}=${WRKINST} TRUEPREFIX=${PREFIX}
2413${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
2414.Ed
2415.Pp
2416Note that this does set both PREFIX and ${DESTDIRNAME}.
2417If a port's Makefile both heeds ${DESTDIRNAME},
2418and references PREFIX explicitly,
2419FAKE_FLAGS may rectify the problem by setting PREFIX=${PREFIX}
2420(which will do the right thing, since ${PREFIX} is a
2421.Xr make 1
2422construct which will not be seen by the shell).
2423.Pp
2424${FAKE_FLAGS} is used to set variables on
2425.Xr make 1
2426command line, which will override the port Makefile contents.
2427Thus, a port that mentions DESTDIR= does not need any patch to work with fake.
2428.Sh FLAVORS AND MULTI_PACKAGES
2429Starting with
2430.Ox 2.7 ,
2431each port can generate distinct packages through two orthogonal mechanisms:
2432FLAVORS and MULTI_PACKAGES.
2433.Pp
2434The current MULTI_PACKAGES mechanism was introduced after
2435.Ox 4.0 .
2436.Pp
2437If a port can be compiled with several options, set FLAVORS to the list of
2438possible options in the Makefile.
2439When building the port, set
2440.Li "FLAVOR='option1 option2...'"
2441to build a specific flavor of the port.
2442The Makefile should test the value of FLAVOR as follows:
2443.Bd -literal -offset indent
2444FLAVOR?=
2445\&.if ${FLAVOR:L:Moption1}
2446# what to do if option1
2447\&.endif
2448\&.if ${FLAVOR:L:Moption2}
2449# what to do if option2
2450\&.endif
2451.Ed
2452.Pp
2453.Pa bsd.port.mk
2454takes care of a few details, such as generating a distinct work directory for
2455each flavor, or adding a dash separated list of options to the package
2456name.
2457The order in which FLAVOR is specified does not matter: the generated list,
2458called the canonical package extension, matches the ordering of FLAVORS.
2459Also, it is an error to specify an option in FLAVOR that does not appear
2460in FLAVORS.
2461.Pp
2462In recursive package building, flavors can be specified as a comma
2463separated list after the package directory, e.g., SUBDIR+=vim,no_x11.
2464.Pp
2465Finally, package information will use templates with the canonical package
2466extension if they are available: if FLAVOR='option1 option2' and both
2467COMMENT and COMMENT-option1-option2 are available, COMMENT-option1-option2 will
2468be used.
2469.Pp
2470If one build of a port can generate several distinct packages, set
2471MULTI_PACKAGES accordingly.
2472Each extension of a MULTI_PACKAGES name should start with a dash, so that
2473they cannot be confused with FLAVORS.
2474In dependency checking and recursive builds, a subpackage can be
2475specified after a comma, e.g., SUBDIR+=quake,-server.
2476MULTI_PACKAGES only affects the actual package building step (and the
2477describe step, since a MULTI_PACKAGES port will produce several
2478descriptions).
2479.Pp
2480If MULTI_PACKAGES is set, the packaging stage happens once for every
2481subpackage, using subpackage-specific variables.
2482For instance, if MULTI_PACKAGES=-main -lib -server,
2483.Ev PKG_ARCH-main ,
2484.Ev PKG_ARCH-lib
2485and
2486.Ev PKG_ARCH-server
2487will be used for the subpackages respectively called
2488.Ev FULLPKGNAME-main ,
2489.Ev FULLPKGNAME-lib
2490and
2491.Ev FULLPKGNAME-server .
2492.Pp
2493All package information is also derived from
2494templates with SUBPACKAGE appended.
2495In the preceding example, the packing-list template for FULLPKGNAME-lib
2496must be in PLIST-lib.
2497.Pp
2498The following variables are subpackage dependent:
2499.Ev COMMENT ,
2500.Ev PKG_ARCH ,
2501.Ev PERMIT_PACKAGE_FTP ,
2502.Ev PERMIT_PACKAGE_CDROM ,
2503.Ev PKGNAME ,
2504.Ev FULLPKGNAME ,
2505.Ev FULLPKGPATH ,
2506.Ev RUN_DEPENDS ,
2507.Ev WANTLIB ,
2508.Ev LIB_DEPENDS ,
2509.Ev PREFIX ,
2510.Ev CATEGORIES ,
2511.Ev MESSAGE ,
2512.Ev UNMESSAGE ,
2513.Ev DESCR ,
2514.Ev PLIST .
2515.Pp
2516The usual non-MULTI_PACKAGES variables are simply used as default values
2517for all subpackages.
2518So, if you set
2519.Li "PKG_ARCH=*"
2520.Li "PKG_ARCH-main=i386"
2521then
2522.Ev PKG_ARCH-lib
2523and
2524.Ev PKG_ARCH-server
2525will both be
2526.Sq * .
2527.Pp
2528.Ev WANTLIB
2529and
2530.Ev LIB_DEPENDS
2531are special.
2532At the beginning of build,
2533all build dependencies will be checked,
2534which includes both
2535.Ev LIB_DEPENDS ,
2536.Ev WANTLIB
2537and the subpackage-specific version of these.
2538As an exception, any
2539.Ev LIB_DEPENDS-sub
2540that references the current port will be ignored as a build dependency,
2541in order to avoid recursion.
2542.Pp
2543.Ev FULLPKGPATH
2544and
2545.Ev FULLPKGNAME
2546are special as well.
2547You must set
2548.Ev PKGNAME-sub
2549or
2550.Ev FULLPKGNAME-sub
2551for each subpackage, and
2552.Ev FULLPKGPATH-sub
2553is set automatically to the right value.
2554In very rare cases, one can override
2555.Ev FULLPKGPATH-sub
2556(for instance, if one specific subpackage is not affected by option
2557settings that affect other subpackages, e.g., for include files packs).
2558.Pp
2559In terms of implementation, quite a few targets will have a subpackage
2560specific subtarget:
2561invoking
2562.Ar package
2563is the same as invoking
2564.Ar subpackage
2565for all subpackages,
2566invoking
2567.Ar install-all
2568is the same as invoking
2569.Ar install
2570for all subpackages,
2571and invoking
2572.Ar update
2573is the same as invoking
2574subupdate
2575for all subpackages.
2576.Sh THE GENERATION OF PACKAGE INFORMATION
2577Starting after
2578.Ox 4.1
2579all package information is processed directly by
2580.Xr pkg_create 1
2581from templates in ${PKG_DIR}.
2582.Pp
2583.Bl -bullet -compact
2584.It
2585If not overridden by the user, determine which set of templates to use,
2586depending on the current SUBPACKAGE and FLAVOR information.
2587Set ${PLIST${SUBPACKAGE}}, ${DESCR${SUBPACKAGE}}, ${COMMENT${SUBPACKAGE}}, ${MESSAGE${SUBPACKAGE}}, ${UNMESSAGE${SUBPACKAGE}} accordingly.
2588.It
2589Detect the existence of ${PKGDIR}/{REQ,INSTALL,DEINSTALL}${SUBPACKAGE}.
2590These are now deprecated.
2591Use @exec and @unexec annotations instead.
2592.It
2593Generate the actual DESCR, and if needed, MESSAGE, UNMESSAGE,
2594from the templates in ${DESCR}, ${MESSAGE}, ${UNMESSAGE}, by
2595substituting the variables in ${SUBST_VARS}, and by substituting
2596${FLAVORS} with the canonical flavor extension for this port,
2597e.g., if FLAVORS=no_map gfx qt2, if FLAVOR=gfx no_map, this is
2598.Sq -no_map-gfx .
2599.It
2600Generate the actual PLIST from the template ${PLIST},
2601by inserting shared/no-shared fragments, merging other fragments,
2602and applying the same variable substitutions as other package information.
2603.El
2604.Pp
2605Note that ${COMMENT} is currently not substituted, to speed up
2606.Ar describe
2607generation.
2608.Pp
2609To avoid substitution, variables can be escaped as follows:
2610.Li "$\e{PREFIX}"
2611.Pp
2612Constructs such as the line
2613.Li "%%SHARED%%"
2614or
2615.Li "!%%SHARED%%"
2616in the packing-list template trigger the inclusion of the
2617.Pa ${PKGDIR}/PFRAG.shared${SUBPACKAGE}
2618or
2619.Pa ${PKGDIR}/PFRAG.no-shared${SUBPACKAGE} .
2620.Pp
2621Similarly, if FLAVORS lists flav1, then the line
2622.Li "%%flav1%%"
2623(resp.
2624.Li "!%%flav1%%" )
2625will trigger the inclusion of
2626.Pa ${PKGDIR}/PFRAG.flav1${SUBPACKAGE}
2627(resp.
2628.Pa ${PKGDIR}/PFRAG.no-flav1${SUBPACKAGE} )
2629in the packing-list.
2630Other fragments can be defined by simply adding
2631.Li "-Dfrag=1"
2632or
2633.Li "-Dfrag=0"
2634to
2635.Ev PKG_ARGS
2636.Pp
2637.Xr pkg_add 1
2638now calls
2639.Xr ldconfig 8
2640directly, provided dynamic libraries have been annotated with
2641.Li "@lib libthingy.so.5.0" .
2642Adding new directories to the dynamic loader cache has been
2643deprecated.
2644It is often better to let libraries be visible as a link
2645under ${LOCALBASE}.
2646Having a separate directory is enough to trick
2647.Xr ld 1
2648into grabbing the right version.
2649Libraries used only for
2650.Xr dlopen 3
2651do not need to be visible.
2652Some programs will prefer to use rpath to find their own libraries.
2653.Pp
2654The special
2655.Ar update-plist
2656target does a fairly good job of automatically generating PLIST and
2657PFRAG.shared fragments.
2658.Pp
2659If
2660.Ev PLIST_DB
2661points to a directory, all packing-lists from packages generated by
2662.Xr pkg_create 1
2663during the
2664.Ar package
2665stage are saved in that location by a script:
2666.Pa ${PORTSDIR}/infrastructure/packages/register-plist .
2667This script strips some irrelevant information and normalizes the
2668packing-list somehow, and compares it to existing information, looking
2669for relevant changes.
2670Since a package name must always be changed when the packing-list changes,
2671any attempt to replace a packing-list of a given name with a different
2672packing-list will be flagged as an error.
2673.Pp
2674In MULTI_PACKAGES mode, there must be separate COMMENT, DESCR, and PLIST
2675templates for each SUBPACKAGE (and optional distinct MESSAGE, UNMESSAGE
2676files in a similar way).
2677This contrasts with the FLAVORS
2678situation, where all these files will automatically default to the
2679non-flavor version if there is no flavor-specific file around.
2680.Sh SEE ALSO
2681.Xr ftp 1 ,
2682.Xr pkg_add 1 ,
2683.Xr pkg_create 1 ,
2684.Xr OpenBSD::Intro 3p ,
2685.Xr port-modules 5 ,
2686.Xr library-specs 7 ,
2687.Xr mirroring-ports 7 ,
2688.Xr packages-specs 7 ,
2689.Xr ports 7
2690.Sh HISTORY
2691The ports mechanism originally came from
2692.Fx .
2693A lot of additions were taken from
2694.Nx
2695over the seminal years.
2696.Pp
2697Since 1998, the framework has been systematically cleaned-up and reorganized
2698to remove bugs.
2699New features have been carefully introduced, trying hard to avoid
2700inconsistencies.
2701.Pp
2702FLAVORS, MULTI_PACKAGES and FAKE are
2703.Ox
2704improvements.
2705Most recent additions do not come from another BSD.
2706.\" Voluntarily undocumented:
2707.\" AUTOCONF_ENV: probably not needed anyway, should be internal.
2708.Sh BUGS AND LIMITATIONS
2709.Ev LOCALBASE ,
2710.Ev X11BASE ,
2711.Ev SYSCONFDIR
2712and
2713.Ev PREFIX
2714are not heeded consistently.
2715Most of the ports tree will probably fall
2716apart if one tries to build/use stuff elsewhere.
2717