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