xref: /openbsd-src/share/man/man5/bsd.port.mk.5 (revision e1668dfc1242668dc9d8d8e44edd40e3408ff920)
1.\" $OpenBSD: bsd.port.mk.5,v 1.648 2024/10/06 10:24:52 kn 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: October 6 2024 $
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
37contains the
38.Xr ports 7
39tree
40.Xr make 1
41framework, in the form of documented public targets,
42variables and paths.
43.Pp
44The actual
45.Nm
46file lives under
47.Pa ${PORTSDIR}/infrastructure/mk ,
48with
49.Xr make 1 Ns 's
50system include file redirecting to it.
51.Pp
52Optional parts of this framework have been moved to
53.Xr port-modules 5
54in an effort to shrink the main file
55.Po
56see also
57.Ev MODULES
58.Pc .
59.Pp
60Identifiers beginning with an underscore
61are internal-use only and likely to change without
62notice.
63.Pp
64This documentation contains sections covering targets, variables,
65diagnostics, and filenames, ordered in alphabetic order, followed
66by a section covering the fake framework, a section covering debug
67packages generation, a section explaining flavors and multi-packages,
68and a section covering the generation of package information.
69.Pp
70It ends with sections covering some obsolete targets, variables and files,
71outlining conversion
72methods from older incarnations of the ports tree or from other
73.Bx
74variants.
75.Pp
76.Nm
77also uses quite a few helper scripts which live under
78.Pa ${PORTSDIR}/infrastructure/bin .
79.Pp
80Binary package details are mostly covered in
81.Xr pkg_create 1
82for the packing-list details,
83and in
84.Xr pkg_add 1
85for the installation semantics.
86.Pp
87Common usage such as building every package in
88the system is covered by
89.Xr ports 7
90and
91.Xr bulk 8
92instead, with
93.Xr packages 7
94providing an overview of the result.
95.Sh TARGETS
96.Bl -tag -width Ds
97.It Cm {build,run,all,test}-dir-depends
98Print all dependencies for a port in order to build it, run it, build and
99run it, or to run regression tests.
100The output is formatted as package specification pairs, in a form suitable
101for
102.Xr tsort 1 .
103.Pp
104Note that it is possible to obtain reverse dependency information by
105using the
106.Nm show-reverse-deps
107script from the
108.Pa sqlports
109package.
110.It Cm full-{build,run,all,test}-depends
111Print all dependencies a package depends upon for building, running,
112or both, as a list of package names, sorted by dependency order with
113.Xr tsort 1 ,
114most dependent port first.
115.It Cm {build,lib,test,run}-depends-list
116Print a list of first level package specifications a port depends as
117build dependencies, library dependencies, test dependencies or
118run dependencies.
119.It Cm print-{build,run}-depends
120User convenience target that displays the result of
121.Cm full-{build,run}-depends
122in a more readable way.
123.It Cm {pre,do,post}-*
124Most standard targets can be specialized according to a given port's needs.
125If defined,
126the
127.Cm pre-*
128hook will be invoked before running the normal action;
129the
130.Cm do-*
131hook will be invoked instead of the normal action;
132the
133.Cm post-*
134hook will be invoked after the normal action.
135Specialization hooks exist for
136.Cm build ,
137.Cm configure ,
138.Cm distpatch ,
139.Cm extract ,
140.Cm fake ,
141.Cm gen ,
142.Cm install ,
143.Cm patch ,
144.Cm test .
145See individual targets for exceptions.
146.It Cm all-lib-depends-args
147Process the full
148.Ev LIB_DEPENDS
149list into a form suitable for
150.Xr pkg_create 1 ,
151see
152.Cm print-package-args .
153.It Cm build , Cm all
154Default target.
155Build the port.
156Essentially invoke
157.Bd -literal
158env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \e
159	-f ${MAKE_FILE} ${ALL_TARGET}
160.Ed
161.It Cm check-register
162Introspection target.
163Verify from the ports tree, without building anything, that the current
164subpackage will register okay
165.Po
166see
167.Ev PLIST_REPOSITORY
168.Pc .
169.It Cm check-register-all
170Apply
171.Cm check-register
172to all subpackages of the current port.
173.It Cm checkpatch
174Check that patches would apply cleanly, but do not modify anything.
175.It Cm checksum
176Compute a
177.Xr sha256 1
178digest
179of ${CHECKSUMFILES} (files listed in DISTFILES* and PATCHFILES*) and
180check it against ${CHECKSUM_FILE}, normally
181.Pa distinfo .
182In case of a mismatch, running
183.Cm checksum
184with
185.Ev REFETCH Ns = Ns Cm true
186will fetch alternative versions of files keyed on their checksum
187from the
188.Ox
189main archive site.
190.It Cm clean
191Clean ports contents.
192By default, it will clean the work directory.
193It can be invoked as
194make clean='[depends build bulk work fake flavors dist install sub package
195packages plist test]'.
196.Bl -tag -width packages
197.It Va work
198Clean work directory.
199.It Va bulk
200Clean bulk cookie.
201.It Va build
202Clean the
203.Ev WRKBUILD
204directory (only useful if
205.Ev SEPARATE_BUILD
206is set).
207.It Va depends
208Recurse into dependencies.
209.It Va dist
210Clean distribution files.
211.It Va fake
212Clean fake installation directory.
213.It Va flavors
214Clean all work directories.
215.It Va install
216Uninstall package.
217.It Va package
218Remove all copies of package file.
219.It Va plist
220Remove registered packing-lists of all subpackages.
221.It Va test
222Clean test cookie.
223.It Va sub
224With
225.Va install
226or
227.Va package ,
228clean subpackages as well.
229.It Va packages
230Shorthand for
231.Sq sub package .
232.It Va all
233Shorthand for
234.Sq work flavors packages plist .
235.El
236.It Cm clean-depends
237Shorthand for
238.Ql make clean=depends .
239.It Cm configure
240Configure the port.
241By default,
242.Cm configure
243creates the ${WRKBUILD} directory (see
244.Ev SEPARATE_BUILD ) ,
245and runs whatever configuration methods are recorded in
246.Ev CONFIGURE_STYLE .
247.It Cm distclean
248Shorthand for
249.Ql make clean=dist .
250.It Cm distpatch
251Apply distribution patches only.
252See
253.Cm patch ,
254.Ev PATCH_CASES
255and
256.Ev FIX_CRLF_FILES
257for details.
258.It Cm dump-vars
259Dump the values of all relevant variables in a port, prepended with the
260port's FULLPKGPATH.
261.Pp
262Can be limited to some specific information by setting
263.Ev DPB
264to nothing or
265.Sq fetch .
266Mostly used by
267.Xr dpb 1
268for obtaining vital information from the ports tree.
269.It Cm extract
270Extract the distribution files under
271.Pa ${WRKDIR}
272(but see
273.Ev EXTRACT_ONLY ,
274.Ev FIX_EXTRACT_PERMISSIONS
275and
276.Ev NO_DEPENDS ) .
277Refer to
278.Ev EXTRACT_CASES
279for a complete description.
280Do not use
281.Cm pre-extract
282and
283.Cm do-extract
284hooks.
285.It Cm fake
286Do a fake port installation, that is, simulate the port installation into
287the staging area ${WRKINST}.
288There is no
289.Cm do-fake
290and
291.Cm post-fake
292hooks:
293instead
294.Cm fake
295runs
296.Cm pre-fake ,
297.Cm pre-install ,
298.Cm do-install
299and
300.Cm post-install .
301Override
302.Cm pre-install ,
303.Cm do-install ,
304or
305.Cm post-install
306to change behavior.
307.Pp
308There are only a handful of ports that use
309.Cm pre-fake :
310that hook can be used to finish setting up a
311.Pa fake
312directory before starting the installation proper.
313Stuff run during
314.Cm pre-fake
315will not register with
316.Cm update-plist ,
317whereas stuff run during
318.Cm pre-install
319will be considered part of the installation process.
320.Pp
321See
322.Sx THE FAKE FRAMEWORK
323section below.
324.It Cm fake-wantlib-args
325Check
326.Ev WANTLIB
327against the list of installed packages and libraries in the ports tree.
328See
329.Cm print-package-args .
330.It Cm fetch
331Fetch the list of files in
332.Ev DISTFILES*
333and
334.Ev PATCHFILES*
335using ${FETCH_CMD}.
336Files are normally retrieved from the list of sites in
337.Ev SITES* .
338.Pp
339Adding a suffix to
340.Ev DISTFILES ,
341.Ev PATCHFILES ,
342.Ev SUPDISTFILES
343will switch the site entry to the corresponding
344.Ev SITES
345variable, e.g.,
346.Bd -literal -offset indent
347DISTFILES.go = ...
348SITES.go = ...
349.Ed
350.Pp
351If the rest of the entry parses as
352.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
353${FETCH_CMD} will fetch
354.Ar url Ns Ar sufx
355instead, but store the result as
356.Ar filename Ns Ar sufx .
357.Pp
358Transfers in progress are stored as
359.Ar filenamesufx.part
360and moved after completion.
361.Pp
362The actual filesystem paths to all distfiles (resp. patchfiles) after
363url/filename substitution, including suffixed sources, is conveniently
364stored as
365.Ev ALL_DISTFILES
366.Po
367resp.
368.Ev ALL_PATCHFILES
369.Pc .
370The ports framework uses
371.Pa ${DISTDIR}/${DIST_SUBDIR}
372(aliased to
373.Pa ${FULLDISTDIR} )
374to save the ports distribution files and patch files.
375.Pp
376If you want to fetch a significant number of distfiles quickly, say
377all files relevant to a port,
378.Cm dpb Fl F
379is more efficient.
380.Pp
381There are no
382.Cm {pre,do,post}-fetch
383hooks, as this would break
384.Xr dpb 1 .
385.Pp
386See
387.Ev ALL_DISTFILES ,
388.Ev ALL_PATCHFILES ,
389.Ev ALL_SUPDISTFILES ,
390.Ev CHECKSUMFILES ,
391.Ev DISTDIR ,
392.Ev DISTFILES* ,
393.Ev DIST_SUBDIR ,
394.Ev FETCH_CMD ,
395.Ev FETCH_MANUALLY ,
396.Ev FULLDISTDIR ,
397.Ev MAKESUMFILES ,
398.Ev PATCHFILES* ,
399.Ev SUPDISTFILES* ,
400.Ev REFETCH .
401.Ev SITES* ,
402.It Cm fetch-all
403Like
404.Cm fetch ,
405but also fetches
406.Ev SUPDISTFILES* ,
407for use by e.g.,
408.Cm makesum .
409.It Cm fix-permissions
410Ensure permissions are correct when using
411.Ev PORTS_PRIVSEP
412and/or
413.Xr dpb 1 .
414.Pp
415If necessary, creates directory
416.Ev DISTDIR
417owned by
418.Ev FETCH_USER ,
419and creates directories
420.Ev LOCKDIR ,
421.Ev PACKAGE_REPOSITORY ,
422.Ev PLIST_REPOSITORY
423and
424.Ev WRKOBJDIR
425owned by
426.Ev BUILD_USER .
427.Pp
428If these directories already exist,
429ownership of their contents is modified to conform to
430.Ev PORTS_PRIVSEP
431and
432.Xr dpb 1
433requirements.
434.It Cm gen
435Generate configure script when needed, either after patching
436input files, or from scratch for some ports,
437generally using automake, autoconf, autoreconf and similar GNU tools.
438This target only has modules
439.Po Ev MODxxx_gen Pc
440and a
441.Ar do-gen
442hooks.
443Then adjust timestamps to avoid regeneration during build
444.Po
445see
446.Ev REORDER_DEPENDENCIES
447.Pc .
448.It Cm generate-readmes
449Generate READMEs, rc scripts and login.conf.d files from
450.Pa ${PKGDIR}
451into
452.Pa ${WRKINST} .
453Run after
454.Cm fake
455and before
456.Cm package
457or
458.Cm update-plist .
459Always rerun, as it is cheap enough.
460.It Cm install-depends
461Before package installation, install and verify dependencies constructed from
462.Ev RUN_DEPENDS , LIB_DEPENDS ,
463and
464.Ev WANTLIB .
465.It Cm install
466Install the package after building.
467See the description of
468.Sx THE FAKE FRAMEWORK
469for the non-intuitive details of the way
470.Cm {pre,do,post}-install
471hooks are actually used by the ports tree.
472.It Cm install-all
473Install all packages in a multi-packages port.
474.It Cm lib-depends-args
475Filter
476.Ev LIB_DEPENDS
477to keep only entries required by
478.Ev WANTLIB ,
479and output a list of dependencies suitable for
480.Xr pkg_create 1 ,
481see
482.Cm print-package-args .
483.It Cm lib-depends-check
484Verify that the
485.Ev LIB_DEPENDS
486and
487.Ev WANTLIB
488recorded in the port's packages are accurate.
489See
490.Cm port-lib-depends-check ,
491which checks files under the fake staging directory instead,
492and thus has faster turn-around.
493.It Cm license-check
494Check that
495.Ev PERMIT_PACKAGE
496settings match:
497if any dependency has a more restrictive setting, warn about it.
498This warning is advisory, because automated license checking cannot
499know that some ports were only used for building and did not taint
500the current port.
501.It Cm lock
502Manually obtain a lock on a given directory.
503Output must be used to update environment variables.
504The lock can be released with
505.Cm unlock .
506Seldom used, see
507.Xr ports 7
508for details.
509.It Cm makesum
510Uses
511.Cm fetch-all
512to fetch missing ${MAKESUMFILES}
513without verifying their digest, then run
514.Xr sha256 1
515on them that is,
516files listed in ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*}.
517The result is stored in ${CHECKSUM_FILE}, normally
518.Pa distinfo .
519Also store the lengths of all files for a quick check during
520.Cm fetch ,
521.Cm fetch-all .
522.It Cm no-lib-depends-args
523Degenerate form of
524.Cm lib-depends-args
525that does not do anything.
526See
527.Cm print-package-args .
528.It Cm no-wantlib-args
529Degenerate form of
530.Cm wantlib-args
531that does not do anything.
532See
533.Cm print-package-args .
534.It Cm package
535Build a port package (or packages in a
536.Ev MULTI_PACKAGES
537case) from the fake installation.
538Involves creating packaging information from templates
539(see
540.Ev COMMENT ,
541.Ev SUBST_VARS
542among others) and invoking
543.Xr pkg_create 1
544for each package in the
545.Ev MULTI_PACKAGES
546list.
547If the repository already contains up-to-date packages, they are not rebuilt.
548If PLIST_REPOSITORY is set (the default), the resulting packaging
549information is compared with existing stuff, and saved if new,
550with loud complaints if it changed without a
551.Ev REVISION
552bump.
553.Pp
554if
555.Ev DEBUG_PACKAGES
556is set, some debug information may also be set aside and saved
557in
558.Pa debug-*
559packages transparently.
560.Pp
561Also note that
562.Pa ${PLIST_REPOSITORY}/${MACHINE_ARCH}/history
563contains LRU caches for all files
564.Po
565see
566.Xr package 5
567.Pc .
568Arch-independent packages are created in ${PACKAGE_REPOSITORY}/no-arch,
569and copied into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all as needed.
570If ${PERMIT_PACKAGE} is set to
571.Sq Yes ,
572copies built packages into ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp, using
573hard links if possible.
574.It Cm patch
575Apply distribution and
576.Ox
577specific patches.
578Because of historical accident,
579.Cm patch
580does not follow the exact same scheme other standard targets do.
581Namely,
582.Cm patch
583invokes
584.Cm pre-patch
585(if defined),
586.Cm do-patch ,
587and
588.Cm post-patch ,
589but the default
590.Cm do-patch
591target invokes
592.Cm distpatch
593directly.
594So, if the
595.Cm do-patch
596target is overridden, it should still begin by calling
597.Ql make distpatch ,
598before applying
599.Ox
600specific patches.
601Accordingly, the exact sequence of hooks is:
602.Cm pre-patch ,
603.Cm do-distpatch ,
604.Cm post-distpatch ,
605.Cm do-patch ,
606.Cm post-patch .
607If
608.Pa ${PATCHDIR}
609exists, the files described under
610.Ev PATCH_LIST
611will be applied under
612.Ev WRKDIST .
613.It Cm peek-ftp
614Connect to the first site in
615.Ev SITES ,
616in the right directory, and leaves user at
617.Xr ftp 1 Ns 's
618prompt.
619.It Cm pkglocatedb
620Top-level target, see
621.Xr ports 7 .
622.It Cm port-lib-depends-check
623Verify that the
624.Ev LIB_DEPENDS
625and
626.Ev WANTLIB
627hold all shared libraries used for every package in the port.
628See
629.Xr library-specs 7 .
630This makes use of
631.Cm print-plist-with-depends
632to avoid actually building the packages, it only needs the
633completion of the
634.Cm fake
635stage, and thus is quicker than
636.Cm lib-depends-check ,
637unless you already have all binary packages.
638.It Cm port-wantlib-args
639Resolve
640.Ev WANTLIB
641against the ports tree itself and system libraries, without looking at built
642or installed packages, and writes a list of options suitable for
643.Xr pkg_create 1 .
644See
645.Cm print-package-args .
646.It Cm prepare
647Before port building, install and verify dependencies constructed from
648.Ev BUILD_DEPENDS ,
649.Ev LIB_DEPENDS
650and
651.Ev WANTLIB .
652In
653.Ev MULTI_PACKAGES
654setups,
655see
656.Sx FLAVORS AND MULTI_PACKAGES .
657.It Cm print-package-args
658Print all dependency-related information that will be passed as parameters
659to
660.Xr pkg_create 1 ,
661e.g.,
662.Fl W Ar wantlib
663and
664.Fl P Ar depends
665lines.
666.Pp
667Those parameters are generated by
668.Cm run-depends-args
669for
670.Ev RUN_DEPENDENCIES
671handling, a form of
672.Cm lib-depends-args
673for
674.Ev LIB_DEPENDS
675and
676.Ev WANTLIB
677interaction,
678and a form of
679.Cm wantlib-args
680for
681.Ev WANTLIB
682resolution.
683.Pp
684Variables
685.Ev lib_depends_args
686and
687.Ev wantlib_args
688control the exact behavior:
689.Ev lib_depends_args
690is normally set to
691.Cm lib-depends-args ,
692but will be set to
693.Cm all-lib-depends-args
694by
695.Cm port-lib-depends-check ,
696in order to have access to the full list of LIB_DEPENDS for figuring
697out missing WANTLIB.
698.Ev wantlib_args
699is normally set to
700.Cm wantlib-args
701but it may be set to
702.Cm port-wantlib-args
703for introspection purposes,
704to
705.Cm fake-wantlib-args
706to avoid some checks, or to
707.Cm no-wantlib-args
708to avoid expensive WANTLIB checks entirely.
709.It Cm print-update-signature
710Print the update signature, as computed using information from the ports tree,
711in the same format used for
712.Xr pkg_info 1
713.Fl S .
714.It Cm print-plist
715Generate and print a package packing-list from the static information
716present in the port.
717.It Cm print-plist-all
718Iterate over
719.Cm print-plist
720for all subpackages in a given port.
721.It Cm print-plist-all-with-depends
722Iterate over
723.Cm print-plist-with-depends
724for all subpackages in a given port.
725.It Cm print-plist-contents
726Generate and print package contents from the static information
727present in the port.
728In contrast with
729.Cm print-plist ,
730the package contents only consists of files, all tagged with category
731markers such as @file.
732See
733.Xr pkg_create 1 .
734.It Cm print-plist-libs
735Generate and print the list of static and dynamic libraries present in the port.
736See
737.Xr pkg_create 1 .
738.It Cm print-plist-all-libs
739Iterate over
740.Cm print-plist-libs
741for all subpackages in a given port.
742.It Cm print-plist-libs-with-depends
743Like
744.Cm print-plist-libs ,
745but slower.
746It also handles
747.Ev LIB_DEPENDS ,
748.Ev RUN_DEPENDS ,
749and
750.Ev WANTLIB ,
751so that the packing-list has complete dependency information.
752.It Cm print-plist-with-depends
753Like
754.Cm print-plist ,
755but slower.
756It also handles
757.Ev LIB_DEPENDS ,
758.Ev RUN_DEPENDS ,
759and
760.Ev WANTLIB ,
761so that the packing-list is complete.
762.It Cm rebuild
763Force rebuild of the port.
764.It Cm regen
765Force rebuilding configure scripts using
766.Ar gen
767steps.
768.It Cm reinstall
769Force reinstallation of a port, by first cleaning the old installation.
770This will obviously not work for software used as dependencies of other
771installed software.
772In that case,
773.Cm update
774might do the right thing.
775.It Cm repackage
776Rebuild the packages of a port after removing existing packages.
777.It Cm run-depends-args
778Process
779.Ev RUN_DEPENDS
780and outputs a list of dependencies suitable for
781.Xr pkg_create 1 ,
782see
783.Cm print-package-args .
784.It Cm reprepare
785Force running the
786.Ar prepare
787target again.
788.It Cm retest
789Force running the
790.Ar test
791target again.
792.It Cm show
793Invoked as make show=name, show the contents of ${name}.
794Invoked as make show="name1 name2 ...",
795show the contents of ${name1} ${name2} ...,
796one variable value per line.
797Mostly used from recursive makes, or to know the contents of another
798port's variables without guessing wrongly.
799.It Cm show-debug-info
800Displays the information that was generated by
801.Xr build-debug-info 1 .
802.It Cm show-fake-size
803Print the size of ${WRKINST}, in kilobytes.
804Used by some options of
805.Xr dpb 1 ,
806suitable for
807.Ev BULK_TARGETS .
808.It Cm show-indexed
809Similar to
810.Cm show .
811Invoked as make show-indexed=name, show the contents of ${name${SUBPACKAGE}},
812or ${name} if the variable
813.Ev name
814is not
815.Ev SUBPACKAGE
816dependent.
817.It Cm show-list
818Similar to
819.Cm show .
820Shows "list-like" variables, one entry per line.
821Mostly useful as a debugging target, since some internal variables may now
822exceed
823.Dv ARG_MAX .
824.It Cm show-prepare-results
825Print the list of actual installed packages found out by
826.Cm prepare .
827.It Cm show-prepare-test-results
828Print the list of actual installed packages found out by
829.Cm prepare
830and
831.Cm test-depends .
832.It Cm show-required-by
833Print the list of
834.Xr pkgpath 7
835for all ports that will be affected by the
836current port changing.
837Works by walking the full list of all dependencies of all ports, in reverse.
838.Pp
839Very slow, prefer installing the
840.Pa sqlports
841package and using
842.Nm show-reverse-deps .
843.It Cm show-run-depends
844Print all running dependencies for a port, one per-line, without duplicates.
845.It Cm subpackage
846Build a port package.
847Exactly like
848.Cm package ,
849but affects only one single subpackage in multi-packages ports.
850.It Cm show-size
851Print the size of the work directory, in kilobytes.
852Used by some options of
853.Xr dpb 1 ,
854suitable for
855.Ev BULK_TARGETS .
856.It Cm subupdate
857Update an existing installation to a newer package, exactly
858like
859.Cm update ,
860but affects only one single subpackage in multi-packages ports.
861.It Cm test
862Run regression tests for the port.
863Essentially depend on a correct build and invoke
864.Bd -literal
865env -i ${ALL_TEST_ENV} ${MAKE_PROGRAM} ${ALL_TEST_FLAGS} \e
866	-f ${MAKE_FILE} ${TEST_TARGET} ${TEST_LOG}
867.Ed
868.Pp
869If a port needs some other ports installed to run regression tests,
870use
871.Ev TEST_DEPENDS .
872If a port needs special configuration or build options to enable regression
873testing, define a
874.Sq test
875.Ev FLAVOR .
876.It Cm test-depends
877Before running regression tests, Install and verify dependencies
878constructed from
879.Ev TEST_DEPENDS .
880.It Cm unlock
881Manually release a lock on a given directory.
882See
883.Cm lock .
884.It Cm update-patches
885Create or update patches for a port, using
886.Xr update-patches 1 .
887See
888.Ev EDIT_PATCHES .
889.It Cm update
890Update an existing installation to a newer package:
891scan the installation for a package with the same
892.Ev FULLPKGPATH ,
893and update it using
894.Sq pkg_add -r
895if a newer package is available.
896In multi-packages ports, all relevant packages are updated.
897See
898.Ev UPDATE_COOKIES_DIR
899and
900.Ev FORCE_UPDATE
901as well.
902.Pp
903However, see
904.Sx CAVEATS
905in
906.Xr ports 7 :
907.Cm update
908is always
909.Sq best-effort
910and will often not work correctly when
911updating to a significantly different newer version.
912.It Cm update-or-install
913Update an installed package or perform a fresh installation,
914by using
915.Sq pkg_add -r .
916Handles one single package in multi-packages ports.
917See
918.Ev UPDATE_COOKIES_DIR
919and
920.Ev FORCE_UPDATE
921as well.
922.It Cm update-or-install-all
923Update installed packages or perform a fresh installation,
924by using
925.Sq pkg_add -r .
926Handles all packages in multi-packages ports.
927See
928.Ev UPDATE_COOKIES_DIR
929and
930.Ev FORCE_UPDATE
931as well.
932.It Cm update-plist
933Update the packing-lists for a port, using the fake installation and the
934existing packing lists, by invoking
935.Xr update-plist 1
936with the correct parameters, along with
937port-specific options
938.Po
939.Ev UPDATE_PLIST_ARGS
940.Pc
941and user settings
942.Po
943.Ev UPDATE_PLIST_OPTS
944.Pc .
945Also see
946.Ev SUBST_VARS
947for details about the default handling of variable substitution.
948.It Cm verbose-show
949Similar to
950.Cm show ,
951except that it prefixes each value with the variable name, e.g.,
952.Li VAR=value .
953Also note that it does not show undefined variables, contrary to
954.Cm show
955which outputs blank lines for these.
956.It Cm wantlib-args
957Call
958.Cm port-wantlib-args
959and
960.Cm fake-wantlib-args
961and compare the results, errors out in case of discrepancies.
962See
963.Cm print-package-args .
964.El
965.Sh VARIABLES
966Note that some variables are marked as
967.Sq User settings ,
968which means that individual ports should not modify them,
969and that some variables are marked as
970.Sq read-only ,
971which means that they shouldn't ever be changed.
972In a
973.Ev MULTI_PACKAGES
974setup, some variables have settings specific to a given subpackage.
975See
976.Sx FLAVORS AND MULTI_PACKAGES .
977.Bl -tag -width Ds
978.It Ev show
979Invoked as make show=name, show the contents of ${name}.
980Invoked as make show="name1 name2 ...", show the contents of
981${name1} ${name2} ...,
982one variable value per line.
983.It Ev ALL_DISTFILES
984List of all actual files coming from every
985.Ev DISTFILES*
986setting, after applying the
987.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
988conversion, occasionally useful for setting
989.Ev EXTRACT_ONLY
990manually.
991Read-only.
992.It Ev ALL_FAKE_FLAGS
993Flags passed to ${MAKE} invocations during the fake process.
994Equals
995.Li ${MAKE_FLAGS} ${DESTDIRNAME}=${WRKINST} ${FAKE_FLAGS} .
996Read-only.
997.It Ev ALL_PATCHFILES
998List of all actual files coming from every
999.Ev PATCHFILES*
1000setting, after applying the
1001.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
1002conversion.
1003Read-only.
1004.It Ev ALL_SUPDISTFILES
1005List of all actual files coming from every
1006.Ev SUPDISTFILES*
1007setting, after applying the
1008.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
1009conversion.
1010Read-only.
1011.It Ev ALL_TEST_ENV
1012Environment passed to test.
1013Equals
1014.Li ${MAKE_ENV} ${TEST_ENV} .
1015Read-only.
1016.It Ev ALL_TEST_FLAGS
1017Flags passed to ${MAKE} invocations during test.
1018Equals
1019.Li ${MAKE_FLAGS} ${TEST_FLAGS} .
1020Read-only.
1021.It Ev ALL_TARGET
1022Target used to build software.
1023Default is
1024.Sq all .
1025Can be set to empty, to yield a package's default target.
1026.It Ev APM_ARCHS
1027Set to the list of
1028.Xr apm 4
1029architectures.
1030Read-only.
1031Use with
1032.Ev ONLY_FOR_ARCHS .
1033.It Ev ARCH
1034Current machine architecture.
1035Read-only.
1036.It Ev AUTOCONF
1037Location of the autoconf binary if needed.
1038Defaults to autoconf.
1039.It Ev AUTOCONF_DIR
1040Where to invoke autoconf or autoreconf if ${CONFIGURE_STYLE} includes
1041.Sq autoconf
1042or
1043.Sq autoreconf ,
1044respectively.
1045Defaults to ${WRKSRC}.
1046.\" AUTOCONF_DIR should probably be a list, and be renamed to AUTOCONF_DIRS ?
1047.It Ev AUTOCONF_ENV
1048Environment values that should be passed to all runs of autoconf, automake
1049and related tools.
1050Specifically, version numbers and PATH.
1051Automatically set as soon as
1052.Ev CONFIGURE_STYLE
1053is gnu or higher.
1054.It Ev AUTOCONF_VERSION
1055Several versions of autoconf may coexist peacefully.
1056The main autoconf script is a shell wrapper in the
1057.Pa devel/metaauto
1058package, and similarly for automake.
1059Setting
1060.Ev AUTOCONF_VERSION
1061along with
1062.Ev CONFIGURE_STYLE
1063set to autoconf is the correct way to specify which one to use.
1064.Ev AUTOCONF_VERSION
1065defaults to 2.13.
1066If autoconf must be run manually,
1067.Ev MODGNU_AUTOCONF_DEPENDS
1068can be used to specify what packages to depend upon.
1069.It Ev AUTOHEADER
1070Location of the autoheader binary.
1071Defaults to autoheader.
1072.It Ev AUTOMAKE_VERSION
1073Several versions of automake may coexist peacefully.
1074.Ev AUTOMAKE_VERSION
1075must be set before trying to run automake.
1076Defaults to 1.4.
1077.It Ev AUTORECONF
1078Location of the autoreconf binary and the arguments it is invoked with.
1079Can be set to
1080.Sq autogen.sh
1081if such a script is available.
1082Defaults to autoreconf --force --install.
1083.It Ev BASE_PKGPATH
1084Full
1085.Xr pkgpath 7
1086to the current port, taking flavors into account.
1087See also
1088.Ev BUILD_PKGPATH ,
1089which also includes pseudo-flavors.
1090Read-only.
1091.It Ev BASELOCALSTATEDIR
1092User settings.
1093Base location for system-wide state directory.
1094Defaults to
1095.Pa ${VARBASE} .
1096See
1097.Ev LOCALSTATEDIR .
1098.It Ev BASESYSCONFDIR
1099User settings.
1100Base location for system-wide configuration files.
1101Defaults to
1102.Pa /etc .
1103See
1104.Ev SYSCONFDIR .
1105.It Ev BATCH
1106User settings.
1107Set to
1108.Sq Yes
1109to avoid ports that require user-interaction.
1110Use in conjunction with
1111.Ev INTERACTIVE
1112to simplify bulk-package builds.
1113.Pq See IGNORE .
1114.It Ev BE_ARCHS
1115Set to the list of big-endian architectures.
1116Read-only.
1117Use with
1118.Ev NOT_FOR_ARCHS
1119and
1120.Ev ONLY_FOR_ARCHS .
1121.It Ev BUILD_DEPENDS
1122List of other ports the current port needs to build correctly.
1123Each item has the form
1124.Sq [pkgspec:]pkgpath[:target] .
1125.Sq target
1126defaults to
1127.Sq install .
1128The package installed must conform to the
1129.Sq pkgspec ,
1130which is by default obtained from the dependent
1131.Sq pkgpath
1132.Po
1133see
1134.Ev PKGSPEC
1135.Pc .
1136If no installation is involved, the infrastructure will still check
1137that the directory would provide a package conforming to the
1138.Sq pkgspec .
1139.Sq pkgpath
1140is set relative to ${PORTSDIR},
1141see
1142.Xr pkgpath 7
1143for details.
1144Build dependencies are checked before the
1145.Cm extract
1146stage during
1147.Cm prepare .
1148.Pp
1149Build dependencies with a
1150.Cm patch ,
1151.Cm configure
1152or
1153.Cm build
1154target will be processed in a subdirectory of the working directory,
1155specifically, in ${WRKDIR}/some/directory,
1156with
1157.Pa some/directory
1158the directory part of the
1159.Sq pkgpath .
1160.It Ev BUILD_ONCE
1161User settings.
1162Defaults to
1163.Sq \&No .
1164Set to
1165.Sq Yes
1166during bulk builds.
1167.Pp
1168When
1169.Ev BUILD_ONCE
1170is set to
1171.Sq Yes ,
1172all
1173.Ev PSEUDO_FLAVORS
1174matching
1175.Sq no_*
1176will be disabled, unless the special pseudo-flavor
1177.Sq bootstrap
1178is also set.
1179.Pp
1180This is a bulk build optimisation, automatically set by
1181.Xr dpb 1 :
1182to avoid rebuilding the same package several times, a full bulk build will
1183strip most ports of pseudo-packages variations that remove subpackages.
1184.Pp
1185For instance, an individual package may depend on
1186.Pa databases/db/v4,no_java,no_tcl ,
1187to avoid bringing a jdk in during a quick build.
1188Nevertheless, during a full bulk build,
1189.Pa databases/db/v4
1190will only be built once, as the pseudo-flavor will be automatically removed.
1191.Pp
1192However, the extra
1193.Sq bootstrap
1194rule is needed to take build cycles into account.
1195For instance, the
1196.Pa x11/gnome/gvfs,-goa
1197subpackage depends on gnome-online-accounts, which in turn requires
1198.Pa x11/gnome/gvfs,-main
1199to build (through its dependencies).
1200So
1201.Pa x11/gnome/gvfs
1202has
1203.Li PSEUDO_FLAVORS = no_smb no_goa bootstrap
1204and the GNOME build first builds
1205.Pa x11/gnome/gvfs,no_smb,no_goa,bootstrap,-main
1206which is later used to rebuild
1207.Pa x11/gnome/gvfs .
1208.It Ev BUILD_PKGPATH
1209Full
1210.Xr pkgpath 7
1211to the current port, taking flavors and pseudo-flavors
1212into account.
1213See also
1214.Ev BASE_PKGPATH ,
1215which doesn't include pseudo-flavors.
1216Mostly useful to write dependencies for subpackages like this:
1217.Li "LIB_DEPENDS-foo=${BUILD_PKGPATH}"
1218and avoid starting to build a package with some other flavor combination.
1219See
1220.Xr pkgpath 7
1221on the subject of
1222.Sq pkgpath normalisation .
1223Read-only.
1224.It Ev BUILD_PACKAGES
1225The actual list of packages that will be built, once architecture problems
1226and pseudo-flavors have been taken into account.
1227See
1228.Sx FLAVORS AND MULTI_PACKAGES .
1229.It Ev BROKEN
1230Define only for broken ports, set to reason the port is broken.
1231See also
1232.Ev NO_IGNORE ,
1233.Ev TRY_BROKEN .
1234.It Ev BUILD_UNLINKED
1235User settings.
1236List of tags that shouldn't be
1237.Ev IGNORE Ns d
1238even though the ports are currently
1239.Ev UNLINKED .
1240.It Ev BUILD_USER
1241User to switch to when using
1242.Ev PORTS_PRIVSEP ,
1243defaults to
1244.Sq _pbuild .
1245.It Ev BROKEN-<arch>
1246Define only for ports broken on a given architecture.
1247Distinct from
1248.Ev ONLY_FOR_ARCHS
1249and
1250.Ev NOT_FOR_ARCHS ,
1251which are used to mark ports for which support for some architectures
1252does not exist at all, or is completely obsolete.
1253.It Ev BSD_INSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]
1254Macros passed to make and configure invocations.
1255Set based on corresponding INSTALL_* variables.
1256.It Ev BULK
1257User settings.
1258If set to
1259.Sq Yes ,
1260all successful package builds and installations will clean
1261their working directories, after invoking
1262any targets mentioned in BULK_TARGETS,
1263and commands mentioned in BULK_DO.
1264Can be set on a per-${PKGPATH} basis.
1265For instance, setting BULK_misc/screen=No
1266will override any BULK=Yes passed on the command line.
1267If set to
1268.Sq Auto ,
1269it will apply to dependencies, but not to the current port itself.
1270See
1271.Ev BULK_COOKIES_DIR .
1272Defaults to
1273.Sq Auto .
1274.It Ev BULK_COOKIES_DIR
1275User settings.
1276Used to store cookies for successful bulk-package builds, defaults to
1277.Pa ${PORTSDIR}/bulk/${MACHINE_ARCH} .
1278.It Ev BULK_DO
1279Commands to run after each bulk package build before cleaning up the
1280working directory.
1281Empty defaults.
1282Can be set on a per-${PKGPATH} basis, e.g.,
1283BULK_DO_${PKGPATH}=...
1284.It Ev BULK_FLAGS
1285Flags to pass to build each target in
1286.Ev BULK_TARGETS .
1287.It Ev BULK_TARGETS
1288Targets to run after each bulk package build before cleaning up the
1289working directory.
1290Empty defaults.
1291Can be set on a per-${PKGPATH} basis, e.g.,
1292BULK_TARGETS_${PKGPATH}=...
1293.It Ev BZIP2
1294Name of the bzip2 binary.
1295.It Ev CATEGORIES
1296List of descriptive categories into which this port falls.
1297Mandatory.
1298One entry must match the current pkgpath:
1299.Pa devel/gmake
1300must belong to the
1301.Sq devel
1302category.
1303.It Ev CCACHE_DIR
1304Sets the cache directory used when
1305.Ev USE_CCACHE
1306is set to yes.
1307Defaults to ${WRKOBJDIR}/.ccache.
1308.It Ev CCACHE_ENV
1309Sets additional environment variables when
1310.Ev USE_CCACHE
1311is set to yes.
1312For instance, to enable verbose logging, set
1313CCACHE_ENV="CCACHE_LOGFILE=/tmp/ccache.log"
1314.It Ev CDIAGFLAGS
1315Flags appended to
1316.Ev CFLAGS
1317if
1318.Ev WARNINGS
1319is set.
1320.It Ev CFLAGS
1321Default flags passed to the compiler for building.
1322Many ports ignore it.
1323See also
1324.Ev COPTS ,
1325.Ev CDIAGFLAGS .
1326.It Ev CFLAGS_${CHOSEN_COMPILER}
1327Additional flags that will be appended to
1328.Ev CFLAGS
1329depending on the value of
1330.Ev CHOSEN_COMPILER .
1331Common usage pattern:
1332.Bd -literal -offset indent
1333CFLAGS_base-clang =      -Wno-error=unused-but-set-variable
1334.Ed
1335.Pp
1336See also
1337.Ev COMPILER , COMPILER_LANGS
1338and
1339.Ev CHOSEN_COMPILER .
1340.It Ev CHECK_LIB_DEPENDS
1341User settings.
1342If set to
1343.Sq Yes ,
1344every package build will verify that shared libraries are correctly
1345registered.
1346This is essentially the same as running
1347.Ql make lib-depends-check
1348after each package build.
1349Defaults to
1350.Sq \&No ,
1351as this can be a big performance hit, and also because
1352.Ev lib-depends-check
1353doesn't know about library subdirectories or dynamic loading through
1354.Xr dlopen 3 .
1355.It Ev CHECK_LIB_DEPENDS_ARGS
1356List of extra arguments for
1357.Xr check-lib-depends 1 .
1358.It Ev CHECKSUMFILES
1359List of all files that need to be retrieved by
1360.Cm fetch ,
1361with
1362.Ev DIST_SUBDIR
1363prepended and with the master site selection extension removed.
1364Read-only.
1365See also
1366.Ev MAKESUMFILES .
1367.It Ev CHECKSUM_FILE
1368Location for this port's checksums, used by
1369.Cm checksum ,
1370.Cm makesum ,
1371and
1372.Xr dpb 1 .
1373Defaults to
1374.Pa distinfo .
1375.It Ev CHECKSUM_PACKAGES
1376User settings.
1377Choose whether or not to checksum packages while building.
1378Deposits result in
1379.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums/${FULLPKGNAME}.sha256 .
1380Can be set to
1381.Sq Yes
1382to compute a checksum for all packages,
1383or to
1384.Sq ftp
1385to compute it only for
1386.Ev PERMIT_PACKAGE
1387packages.
1388Defaults to
1389.Sq no ,
1390which does not compute a checksum at all.
1391.It Ev CHOSEN_COMPILER
1392Read-only.
1393Compiler suite chosen by the
1394.Ev COMPILER
1395mechanism.
1396Set to
1397.Sq irrelevant
1398to disable
1399.Ev COMPILER .
1400.It Ev CLEANDEPENDS
1401If set to
1402.Sq Yes ,
1403the
1404.Cm clean
1405target will also clean dependencies.
1406Can be overridden on a per-${PKGPATH} basis,
1407by setting CLEANDEPENDS_${PKGPATH}.
1408.It Ev COMMENT
1409Short (no more than 60 characters) description of the port, used for
1410the package and the INDEX.
1411It should not start with an uppercase letter unless semantically
1412significant.
1413.It Ev COMMENT-foo
1414Same as COMMENT but used for sub package -foo in a multi-package setup.
1415.It Ev COMMENT-vanilla
1416Same as COMMENT but used for a flavored package, if the non-flavored comment
1417is inappropriate.
1418.It Ev COMMENT-foo-vanilla
1419Same as COMMENT but used for a sub-, flavored package.
1420.It Ev COMES_WITH
1421The first release where the port was made part of the standard
1422distribution.
1423If the current
1424.Ox
1425version is >= this version then a notice
1426will be displayed instead of the port being built.
1427.It Ev COMPILER
1428Select preferred compiler.
1429First element in the list that matches will be chosen.
1430.Bl -tag -width ports-gccxx
1431.It base-gcc
1432gcc 4.2 compiler from base
1433.It base-clang
1434clang compiler from base
1435.It gcc3
1436gcc 3 compiler from base
1437.It ports-gcc
1438gcc 8 compiler from ports
1439(heeds
1440.Ev MODGCC4_ARCHS
1441from the module)
1442.It ports-clang
1443clang compiler from ports
1444(heeds
1445.Ev MODCLANG_ARCHS
1446from the module)
1447.El
1448.Pp
1449The first compiler that matches criteria will be chosen.
1450On clang-based architectures, even though gcc is still compiled in base,
1451.Sq base-gcc
1452never matches.
1453.Pp
1454Defaults to base compilers, e.g.,
1455.Sq base-clang base-gcc gcc3 .
1456.Pp
1457Common reasons for explicitly setting
1458.Ev COMPILER
1459will most often be C++11 support, thread-local-storage support (emulated),
1460atomic operations on some arches, sometimes assembler support, ABI
1461compatibility with dependent/depending ports, or plain old internal compiler
1462errors.
1463.Pp
1464With
1465.Ev COMPILER
1466in effect,
1467.Ev MODGCC4_ARCHS
1468and
1469.Ev MODCLANG_ARCHS
1470default to
1471.Sq ${GCC49_ARCHS}
1472and
1473.Sq ${LLVM_ARCHS}
1474respectively.
1475.Pp
1476.Ev ONLY_FOR_ARCHS
1477will also be set if applicable.
1478.It Ev COMPILER_LANGS
1479The value of
1480.Ev COMPILER_LANGS
1481will be added to the respective module's supported langs.
1482Defaults to
1483.Sq c c++ .
1484Only
1485.Sq c
1486and
1487.Sq c++
1488are supported by this mechanism.
1489.Sq fortran
1490or
1491.Sq java
1492still need old modules annotations, so that it's possible
1493to select, e.g.,
1494.Sq gfortran
1495from gcc 8 while having clang from base.
1496See also
1497.Ev CHOSEN_COMPILER .
1498.It Ev COMPILER_LINKS
1499Used by
1500.Nm
1501and compiler
1502.Ev MODULES
1503to build scripts in
1504.Pa ${WRKDIR}/bin
1505to force setting compiler flags
1506.Po
1507.Fl B
1508is required for clang to find
1509.Pa ${WRKDIR}/bin/ld
1510as used by
1511.Ev USE_WXNEEDED
1512.Pc
1513and call
1514.Ev COMPILER_WRAPPER
1515if used.
1516.It Ev COMPILER_WRAPPER
1517External program used to "wrap" compilers.
1518Populated automatically by
1519.Ev USE_CCACHE
1520or can be set explicitly for other purposes (e.g. distcc).
1521.It Ev CONFIG_SITE_LIST
1522Used when
1523.Li CONFIGURE_STYLE=gnu ,
1524or with
1525.Li MODULES += gnu .
1526List of
1527.Pa config.site
1528fragments that will speed up gnu-configure, and prevent it from
1529preferring various gnu programs, unless
1530.Ev BUILD_DEPENDS
1531explicitly ask for them.
1532Read-only, available for debugging purposes.
1533.It Ev CLANG_ARCHS, GCC3_ARCHS , GCC4_ARCHS
1534List of architectures using Clang, GCC 3.3.6 or GCC 4.2.1 as the base compiler.
1535Read-only.
1536Use with
1537.Ev NOT_FOR_ARCHS
1538or
1539.Ev ONLY_FOR_ARCHS
1540to limit ports to architectures where they compile.
1541.It Ev CONFIGURE_ARGS
1542Arguments to pass to configure script.
1543Defaults are empty, except for
1544GNU-style configure, where prefix and sysconfdir are set.
1545.It Ev CONFIGURE_ENV
1546Basic environment passed to configure script (path and libtool setup).
1547GNU-style configure adds a lot more variables.
1548.It Ev CONFIGURE_SCRIPT
1549Set to name of script invoked by the
1550.Cm configure
1551target, if appropriate.
1552Should be either an absolute path, or relative to ${WRKSRC}.
1553.It Ev CONFIGURE_STYLE
1554Set to style of configuration that needs to happen.
1555.Pp
1556If
1557.Sq perl ,
1558assume
1559.Xr perl 1 Ns 's
1560.Xr ExtUtils::MakeMaker 3p
1561style.
1562Add
1563.Sq modbuild
1564to enable
1565.Xr Module::Build 3p ,
1566.Sq modbuild tiny
1567to enable
1568.Xr Module::Build::Tiny 3p ,
1569or
1570.Sq modinst
1571for
1572.Xr Module::Install 3p
1573style.
1574.Pp
1575If
1576.Sq gnu ,
1577assume
1578GNU configure style.
1579Add
1580.Sq dest
1581if port does not handle DESTDIR correctly, and needs to be configured to
1582add DESTDIR to prefixes
1583.Po
1584see also
1585.Ev DESTDIRNAME
1586.Pc .
1587Add
1588.Sq old
1589if port is an older autoconf port that does not recognize --sysconfdir.
1590Add
1591.Sq autoconf
1592if autoconf needs to be rerun first,
1593but set
1594.Sq no-autoheader
1595to prevent autoheader from running.
1596Alternatively, add
1597.Sq autoreconf
1598to rerun autoconf, automake, and related tools to completely regenerate
1599the GNU build framework.
1600.Pp
1601If
1602.Sq imake ,
1603assume port configures using X11 ports Imakefile framework.
1604Add
1605.Sq noman
1606if port has no man pages the Imakefile should try installing.
1607.Pp
1608If
1609.Sq simple ,
1610there is a configure script, but it does not fit the normal GNU configure
1611conventions.
1612.Pp
1613Extensions may be defined by specific MODULES.
1614See
1615.Xr port-modules 5
1616for details.
1617.It Ev COPTS
1618User settings.
1619Supplementary options appended to ${CFLAGS} for building.
1620Since most ports ignore the COPTS convention, they are actually told to use
1621${CFLAGS} ${COPTS} as CFLAGS.
1622.It Ev CXXDIAGFLAGS
1623Flags appended to
1624.Ev CXXFLAGS
1625if
1626.Ev WARNINGS
1627is set.
1628.It Ev CXXFLAGS
1629Default flags passed to the C++ compiler for building.
1630Many ports ignore it.
1631.It Ev CXXFLAGS_${CHOSEN_COMPILER}
1632Additional flags that will be appended to
1633.Ev CXXFLAGS
1634depending on the
1635value of
1636.Ev CHOSEN_COMPILER .
1637See also
1638.Ev COMPILER , COMPILER_LANGS
1639and
1640.Ev CHOSEN_COMPILER .
1641.It Ev CXXOPTS
1642User settings.
1643Supplementary options appended to ${CXXFLAGS} for building.
1644.It Ev DEBUG_CONFIGURE_ARGS
1645Supplementary ${CONFIGURE_ARGS}
1646for enabling the generation of debugging information.
1647.It Ev DEBUG_PACKAGES
1648List of ${SUBPACKAGES} for which debug packages should be built "on the side".
1649Usually set as
1650.Li DEBUG_PACKAGES=${BUILD_PACKAGES}
1651for packages where debug information is desirable.
1652Note the subpackages with
1653.Li PKG_ARCH=*
1654will automatically be stripped from that list.
1655See
1656.Sx THE DEBUG_PACKAGES INFRASTRUCTURE
1657below for details.
1658.It Ev DEBUGINFO_ARCHS
1659List of archs for which debug information may be provided as extra packages.
1660Normally only amd64 for performance reasons.
1661.It Ev DESCR
1662Location of description file for the package, defaults to
1663.Pa ${PKGDIR}/DESCR
1664(or
1665.Pa ${PKGDIR}/DESCR${SUBPACKAGE}
1666for multi-packages).
1667.It Ev DESTDIR
1668See
1669.Ev DESTDIRNAME .
1670.It Ev DESTDIRNAME
1671Name of variable to set to ${WRKINST} while faking.
1672Usually DESTDIR.
1673To be used in the rare cases where a port heeds DESTDIR in a few
1674directories and needs to be configured with
1675.Sq gnu dest ,
1676so that those few directories do not get in the way.
1677.It Ev DIST_TUPLE
1678List of distfile templates to use, each consisting of five entries:
1679.Ar name account project tagname/commithash targetdir .
1680The template
1681.Ar name
1682should be one of
1683.Sq codeberg ,
1684.Sq github ,
1685.Sq gitlab ,
1686.Sq gnome ,
1687.Sq kde ,
1688or
1689.Sq srht
1690at the moment
1691.Po see
1692.Pa ${PORTSDIR}/infrastructure/db/dist-tuple.pattern ,
1693additional
1694.Ev TEMPLATE_DISTFILES.<name>
1695and
1696.Ev TEMPLATE_HOMEPAGE.<name>
1697entries can be added as needed
1698.Pc .
1699The components are used to build
1700.Ev SITES.name
1701.Ev DISTFILES.name
1702and (optionally)
1703.Ev HOMEPAGE .
1704.Pp
1705At the end of
1706.Cm post-extract ,
1707the files are moved to
1708.Pa ${WRKDIST}/<targetdir> .
1709Using
1710.Sq \&.
1711for
1712.Ar targetdir
1713will disable the move.
1714.It Ev DISTDIR
1715User settings.
1716Directory where all ports distribution files and patchfiles are stashed.
1717Defaults to
1718.Pa ${PORTSDIR}/distfiles .
1719Override if distribution files are stored elsewhere.
1720Always use
1721.Ev FULLDISTDIR
1722to refer to ports' distribution files location, as it takes an eventual
1723.Ev DIST_SUBDIR
1724into account.
1725.It Ev DISTFILES*
1726The main port's distribution files (the actual software source, except
1727for binary-only ports).
1728Will be retrieved from the corresponding SITES* (see
1729.Cm fetch ) ,
1730checksummed and extracted (see
1731.Cm checksum ,
1732.Cm extract ) .
1733.Ev DISTFILES
1734normally holds a list of files.
1735.Pp
1736Preferably, adding a suffix to
1737.Ev DISTFILES ,
1738will switch the site entry to the corresponding
1739.Ev SITES
1740variable, e.g.,
1741.Bd -literal -offset indent
1742DISTFILES.go = ...
1743SITES.go = ...
1744.Ed
1745.Pp
1746Each entry may optionally be of the form
1747.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx
1748to deal with sites that only offer archives as weird urls, doing the transfer
1749of
1750.Ar url Ns Ar sufx
1751into result file
1752.Ar filename Ns Ar sufx .
1753For instance, if
1754.Bd -literal
1755DISTFILES = minetest-{minetest/archive/}${V}${EXTRACT_SUFX}
1756.Ed
1757.Pp
1758then
1759.Cm fetch
1760will retrieve from url
1761.Sq minetest/archive/${V}${EXTRACT_SUFX}
1762into
1763.Sq minetest-${V}${EXTRACT_SUFX} .
1764.Pp
1765If ${DISTFILES*} varies depending on
1766.Ev FLAVORS
1767or architecture, use
1768.Ev SUPDISTFILES*
1769to ensure distfiles mirroring and
1770.Cm makesum Ns 's
1771proper operation.
1772.Pp
1773If no
1774.Ev DISTFILES*
1775is set and if
1776.Ev SITES
1777is not null, then
1778.Ev DISTFILES
1779will be set to
1780.Pa ${DISTNAME}${EXTRACT_SUFX} .
1781.It Ev DISTNAME
1782Name used to identify the port.
1783See
1784.Ev DISTFILES*
1785and
1786.Ev PKGNAME .
1787.It Ev DISTORIG
1788Suffix used by
1789.Cm distpatch
1790to rename original files.
1791Defaults to
1792.Pa .bak.orig .
1793Distinct from
1794.Ev PATCHORIG
1795to avoid confusing
1796.Cm update-patches .
1797.It Ev DIST_SUBDIR
1798Optional subdirectory of ${DISTDIR} where the current port's distribution
1799files and patchfiles will be located.
1800See target
1801.Cm fetch .
1802.It Ev DPB
1803Set by the Distributed Ports Builder to only get the information it needs
1804from
1805.Cm dump-vars .
1806.It Ev DPB_LOCKNAME
1807If set,
1808.Xr dpb 1
1809will use this instead of the default
1810.Ev PKGPATH Ns - Ns
1811derived name.
1812This feature comes with large restrictions and shouldn't be used unless
1813absolutely necessary.
1814Specifically, it can allow
1815.Nm dpb
1816to build several flavors of the same port at the same time,
1817but beware: under
1818.Ev MULTI_PACKAGES
1819and
1820.Ev PSEUDO_FLAVORS
1821conditions, if some of these packages are identical across flavors,
1822this will not work.
1823This also makes it harder to interact with locks if the names are not obvious.
1824.It Ev DPB_PROPERTIES
1825Annotations for the Distributed Ports Builder.
1826See
1827.Xr dpb 1
1828for semantics.
1829.It Ev DUMMY_PACKAGE
1830If defined,
1831.Nm
1832will provide dummy values for variables mandatory for a minimally functional
1833port.
1834Used by the
1835.Pa sqlports
1836package and
1837.Xr dpb 1
1838to perform introspection and obtain
1839.Nm Ns 's
1840default values for variables without needing to access any specific port.
1841.It Ev DWZ
1842Command line invocation of
1843.Xr dwz 1
1844to shrink debug information while building debug packages.
1845Defaults to
1846.Sq dwz -L 100000000
1847Can be set to
1848.Sq \&:
1849to not run
1850.Xr dwz 1
1851at all.
1852See
1853.Sx THE DEBUG_PACKAGES INFRASTRUCTURE
1854for details.
1855.It Ev ECHO_MSG
1856User settings.
1857Used to display
1858.Sq ===> Configuring for foo
1859and similar informative messages.
1860Override to turn off, for instance.
1861.It Ev ECHO_REORDER
1862User settings.
1863Set it to
1864.Sq echo
1865to see
1866.Ev REORDER_DEPENDENCIES
1867actions.
1868Silent by default.
1869.It Ev EDIT_PATCHES
1870User settings.
1871If set to
1872.Sq \&No ,
1873.Cm update-patches
1874will not open changed files in an editor.
1875.It Ev EPOCH
1876Epoch number of the current package.
1877Used when the port version is changed but the new version is not regarded by
1878.Xr packages-specs 7
1879as being newer.
1880Once added, it cannot be removed or go backwards.
1881Defaults to empty (no need for numbering changes), then
1882numbering starts at 0.
1883Gets automatically incorporated into
1884.Ev FULLPKGNAME
1885as
1886.Sq v${EPOCH}
1887to form a full package-name conforming to
1888.Xr packages-specs 7 .
1889.It Ev ERRORS
1890List of errors found while parsing the port's Makefile.
1891Display the errors before making any target, and if any error starts with
1892.Qq Fatal : ,
1893do not make anything.
1894For instance:
1895.Bd -literal -offset indent
1896\&.if !defined(COMMENT)
1897ERRORS+="Fatal: Missing comment"
1898\&.endif
1899.Ed
1900Porter can add to
1901.Ev ERRORS ,
1902for instance to flag erroneous combinations of
1903.Ev FLAVORS
1904(but see
1905.Ev ONLY_FOR_ARCHS
1906.Ev NOT_FOR_ARCHS
1907and
1908.Ev BROKEN
1909for other common issues).
1910.Pp
1911Note that setting fatal errors defeats all introspection mechanisms and breaks
1912the
1913.Pa sqlports
1914package.
1915.Pp
1916Tip: if you need to debug a fatal error, you can always override
1917.Ev ERRORS
1918on the command line, e.g.,
1919.Bd -literal -offset indent
1920make ERRORS= show=<var>
1921.Ed
1922.It Ev EXTRACT_CASES
1923The extraction stage runs a loop under
1924.Pa ${WRKDIR}
1925with
1926.Ev archive
1927(shell variable) set to each element of
1928.Ev EXTRACT_ONLY
1929in order, which is then processed by a case switch: ${EXTRACT_CASES}.
1930.Pp
1931.Nm
1932detects extensions in ${CHECKSUMFILES}
1933and automatically adds
1934.Ev BUILD_DEPENDS
1935and fragments to handle the following archives:
1936.Pp
1937.Bl -tag -width archivers/lzip/lunzip -offset indent -compact
1938.It gzip
1939tar.gz, tgz
1940.It tar
1941tar
1942.It archivers/bzip2
1943tar.bz2, tbz2, tbz
1944.It archivers/xz
1945tar.xz, tar.lzma, tar.lz
1946.It archivers/unzip
1947zip
1948.It archivers/zstd
1949tar.zst, tar.zstd
1950.It converters/rpm2cpio
1951rpm
1952.El
1953.Pp
1954Other cases not supported directly in
1955.Nm
1956can be added, and existing cases can be overridden.
1957For example the following snippet sets extra conversion flags to unzip,
1958and adds support for rar:
1959.Bd -literal
1960	*.zip) ${UNZIP} -Laq ${FULLDISTDIR}/$$archive -d ${WRKDIR};; \\
1961	*.rar) ${LOCALBASE}/bin/unrar x -idq ${DISTDIR}/$$archive;;
1962.Ed
1963.It Ev EXTRACT_ONLY
1964Set to the list of distfiles to actually extract if some distfiles
1965should not be extracted during the
1966.Cm do-extract
1967stage.
1968Defaults to ${ALL_DISTFILES}, can even be set to empty.
1969.It Ev EXTRACT_SUFX
1970Used to set
1971.Ev DISTFILES
1972default value to ${DISTNAME}${EXTRACT_SUFX}.
1973Default value is
1974.Pa .tar.gz .
1975.Pp
1976Note that
1977.Ev DISTFILES
1978will only be set in the absence of
1979.Ev DISTFILES.sufx
1980as well, or if
1981.Ev SITES
1982is not empty.
1983.It Ev EXTRACT_SUFX.<name>
1984The
1985.Ev EXTRACT_SUFX
1986value for a template defined through
1987.Ev DIST_TUPLE .
1988.It Ev EXTRACT_FILES
1989Set to the list of files to actually extract from distfiles.
1990Its content is subject to shell evaluation as part of
1991.Ev EXTRACT_CASES
1992and passed as
1993.Ar file ...
1994argument to
1995.Xr tar 1
1996or
1997.Xr unzip 1 ,
1998e.g.,
1999.Xr glob 7
2000patterns and shell brace expansion may be used.
2001Empty by default to extract all files.
2002.It Ev FAKE_FLAGS
2003Extra flags passed to ${MAKE_PROGRAM} during the
2004fake invocation.
2005Empty by default.
2006Also see
2007.Ev ALL_FAKE_FLAGS .
2008.It Ev FAKE_SETUP
2009List of environment values normally set during fake invocations.
2010Exposed so that modules may provide their own
2011.Cm do-install .
2012Read-only,
2013see
2014.Sx THE FAKE FRAMEWORK
2015section for details.
2016.It Ev FAKE_TARGET
2017Target built by ${MAKE_PROGRAM} on fake invocation.
2018Defaults to ${INSTALL_TARGET}.
2019.It Ev FAKEOBJDIR
2020User settings.
2021If non empty, used as a base for the fake staging area.
2022The real fake directory ${WRKINST} is created there.
2023Can be set on a per-${PKGPATH} basis.
2024For instance, setting FAKEOBJDIR_www/mozilla-firefox=/tmp/obj
2025will affect only the mozilla-firefox port.
2026.It Ev FETCH_CMD
2027User settings.
2028Command used to fetch distribution files for this port.
2029Defaults to
2030.Xr ftp 1 .
2031Can be used to go through excessively paranoid firewalls.
2032Note that
2033.Ev FETCH_CMD
2034should support a few ftp options, chief among them
2035being
2036.Fl C
2037and
2038.Fl o Ar dest ,
2039but also
2040.Fl m ,
2041.Fl S ,
2042.Fl v ,
2043.Fl V .
2044Most of these can be no-ops in a FETCH_CMD script,
2045See
2046.Pa ${PORTSDIR}/infrastructure/template/fetch_cmd.template
2047for a skeleton script.
2048.It Ev FETCH_MANUALLY
2049Some ports' distfiles cannot be fetched automatically for licensing reasons.
2050In this case, set
2051.Ev FETCH_MANUALLY
2052to a list of strings that will be displayed, one per line, e.g.,
2053.Bd -literal
2054FETCH_MANUALLY= "You must fetch foo-1.0.tgz"
2055FETCH_MANUALLY+="from http://www.fubar.com/ manually,"
2056FETCH_MANUALLY+="after reading and agreeing to the license."
2057.Ed
2058Behaves like
2059.Ev IS_INTERACTIVE
2060if some distribution files are missing.
2061.It Ev FETCH_PACKAGES
2062User settings, defaults to
2063.Sq \&No .
2064Set to
2065.Xr pkg_add 1
2066options.
2067Instruct the
2068.Cm package
2069target to download packages missing from the repository from locations in
2070${PKG_PATH} and place them into
2071.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache/ ,
2072only building them if no suitable packages are found.
2073For instance,
2074.Bd -literal -offset indent
2075make FETCH_PACKAGES=
2076.Ed
2077.Pp
2078to use without any options, or
2079.Bd -literal -offset indent
2080make FETCH_PACKAGES=-Dsnap
2081.Ed
2082.Pp
2083to use close to release.
2084.It Ev FILESDIR
2085Location of other files related to the current port.
2086Default: files.
2087.It Ev FETCH_USER
2088User to use to fetch distfiles when using
2089.Ev PORTS_PRIVSEP ,
2090defaults to
2091.Sq _pfetch .
2092.It Ev FIX_CLEANUP_PERMISSIONS
2093If
2094.Sq Yes ,
2095restore read, write and directory search permissions for the build user on
2096.Pa ${WRKDIR}
2097before running
2098.Cm clean .
2099Used for build systems which set paranoid permissions at build time.
2100Defaults to
2101.Sq \&No .
2102.It Ev FIX_CRLF_FILES
2103Name(s) of files with line endings to correct at the end of
2104.Cm distpatch .
2105Sometimes a port will include files with MS-DOS line endings (CR LF).
2106To avoid problems with patches (especially when sent by email)
2107these should be converted to LF.
2108.Nm
2109changes to WRKDIST before converting files - shell wildcards may be used.
2110.It Ev FIX_EXTRACT_PERMISSIONS
2111If
2112.Sq Yes ,
2113restore contents of
2114.Pa ${WRKDIR}
2115to world-readable at the end of
2116.Cm extract .
2117Used for some distfile contents which have paranoid permissions for no reason.
2118Defaults to
2119.Sq \&No .
2120.It Ev FLAVOR
2121The port's current options.
2122Set by the user, and tested by the port to activate wanted functionalities.
2123.It Ev FLAVORS
2124List of all flavors keywords a port may match.
2125Used to sort
2126.Ev FLAVOR
2127into a canonical order to build the package name,
2128or to select the packing-list, and as a quick validity check.
2129See also
2130.Ev PSEUDO_FLAVORS .
2131.It Ev FLAVOR_EXT
2132Canonical list of flavors being set for the current build, dash-separated.
2133See
2134.Ev FULLPKGNAME .
2135.It Ev FORCE_UPDATE
2136User settings.
2137If set to
2138.Sq Yes ,
2139the
2140.Cm update
2141target will always update an installed package,
2142as soon as its signature differs,
2143and all dependencies that install packages will
2144also force an update.
2145If set to
2146.Sq hard ,
2147the
2148.Cm update
2149target will also update installed packages even when the signature
2150did not change.
2151.It Ev FULLDISTDIR
2152Complete path to directory where ${DISTFILES*} ${SUPDISTFILES*} and
2153${PATCHFILES*} will be located, to be used in hand-crafted extraction targets.
2154Read-only.
2155.It Ev FULLPKGNAME
2156Full name of the created package, taking flavors into account.
2157Defaults to ${PKGNAME}${FLAVOR_EXT}.
2158See also
2159.Ev EPOCH
2160and
2161.Ev REVISION .
2162.It Ev FULLPKGPATH
2163Path to the current port's directory, relative to ${PORTSDIR},
2164including flavors and subpackages.
2165See
2166.Xr pkgpath 7 .
2167.It Ev GH_*
2168Simple support for GitHub-hosted projects.
2169Leave empty for non hosted projects.
2170Yields a suitable default for
2171.Ev SITES_GITHUB
2172and
2173.Ev DISTNAME .
2174.Pp
2175Use
2176.Ev DIST_TUPLE
2177for more complicated situations.
2178.It Ev GH_ACCOUNT
2179Account name of the GitHub user hosting the project.
2180.It Ev GH_COMMIT
2181SHA1 commit id to fetch.
2182It is an error to specify ${GH_COMMIT} when ${GH_TAGNAME} is specified.
2183.It Ev GH_DISTFILE
2184Set by
2185.Nm
2186to the generated name of the distribution file.
2187This can be useful for ports listing multiple
2188.Ev DISTFILES* .
2189.It Ev GH_PROJECT
2190Name of the project on GitHub.
2191.It Ev GH_TAGNAME
2192Name of the tag to download.
2193Setting ${GH_TAGNAME} to master is invalid
2194and will throw an error.
2195${WRKDIST} is auto-generated based on the
2196${GH_TAGNAME} if specified, otherwise ${GH_COMMIT} will be used to generate
2197${WRKDIST}.
2198.It Ev GMAKE
2199Location of the GNU make binary, if needed.
2200Defaults to gmake.
2201.It Ev HOMEPAGE
2202URL to the homepage of the software, if applicable.
2203.It Ev IGNORE
2204For ignored ports, set to the reasons for which the port is ignored.
2205If non-empty, most common targets that do something (e.g.,
2206.Cm fetch ,
2207.Cm build ,
2208.Cm install No ... )
2209will be ignored.
2210See also
2211.Ev BATCH ,
2212.Ev BUILD_UNLINKED ,
2213.Ev BROKEN ,
2214.Ev FETCH_MANUALLY ,
2215.Ev IGNORE_IS_FATAL ,
2216.Ev IGNORE_SILENT ,
2217.Ev INTERACTIVE ,
2218.Ev IS_INTERACTIVE ,
2219.Ev NOT_FOR_ARCHS ,
2220.Ev NO_IGNORE ,
2221.Ev ONLY_FOR_ARCHS ,
2222.Ev UNLINKED .
2223.It Ev IGNORE_IS_FATAL
2224User settings.
2225If set to
2226.Sq Yes ,
2227ignored ports will become fatal errors.
2228.It Ev IGNORE_SILENT
2229User settings.
2230If set to
2231.Sq Yes ,
2232do not print anything when ignoring a port.
2233.It Ev INSTALL_DEBUG_PACKAGES
2234User settings.
2235Defaults to
2236.Sq \&No .
2237If
2238.Sq Yes ,
2239install available debug packages during all install/update targets.
2240.It Ev INSTALL_{PROGRAM,SCRIPT,DATA,MAN}[_DIR]
2241Macros to use to install a program, a script, data, or a man page (or the
2242corresponding directory), respectively.
2243.It Ev INSTALL_TARGET
2244Target invoked to install the software, during fake installation.
2245Default is
2246.Sq install .
2247.It Ev INTERACTIVE
2248User settings.
2249Set to
2250.Sq Yes
2251to skip all non-interactive ports.
2252Used in conjunction with
2253.Ev BATCH
2254to simplify bulk-package builds.
2255.It Ev IS_INTERACTIVE
2256Set to
2257.Sq Yes
2258if port needs human interaction to build.
2259.Pp
2260Note that
2261.Ev IS_INTERACTIVE
2262ports won't be built as official packages,
2263so avoid at all cost.
2264.Pp
2265Human intervention should be moved to binary package
2266installation and/or post-installation configuration instead.
2267.Pp
2268Discrete Yes/No choices are better modelled as
2269.Ev FLAVORS .
2270.It Ev LE_ARCHS
2271Set to the list of little-endian architectures.
2272Read-only.
2273Use with
2274.Ev NOT_FOR_ARCHS
2275and
2276.Ev ONLY_FOR_ARCHS .
2277.It Ev LIB_DEPENDS
2278List of packages used by a port for its library dependencies.
2279Each item has the form
2280.Sq [pkgspec:]pkgpath .
2281Similar to
2282.Ev BUILD_DEPENDS
2283and
2284.Ev RUN_DEPENDS ,
2285but with specific rules:
2286.Ev LIB_DEPENDS
2287always turn into
2288.Ev BUILD_DEPENDS
2289.Po
2290but see
2291.Sx FLAVORS AND MULTI PACKAGES
2292.Pc .
2293.Pp
2294.Ev LIB_DEPENDS
2295is also used as a run-time dependency, and recorded in the package as
2296such, if any of the libraries mentioned in
2297.Ev WANTLIB
2298is a shared library that originates within the dependent port.
2299.Pp
2300See
2301.Xr library-specs 7
2302for more details.
2303.It Ev lib_depends_args
2304Controls the behavior of
2305.Xr pkg_create 1
2306related targets, see
2307.Cm print-package-args
2308for details.
2309.It Ev LIBCXX
2310List of standard C++ libraries for the base compiler.
2311Read-only.
2312Use in
2313.Ev WANTLIB .
2314.It Ev LIBTOOL
2315Location of the libtool binary.
2316Default:
2317.Pa /usr/bin/libtool .
2318.It Ev LIBTOOL_FLAGS
2319Arguments to pass to libtool.
2320If USE_LIBTOOL is set, the environment variable LIBTOOL is set
2321to ${LIBTOOL} ${LIBTOOL_FLAGS}.
2322.It Ev LLD_EMUL
2323As
2324.Xr ld.lld 1
2325does not have a default emulation mode,
2326if it is the linker in-use,
2327.Ev LLD_EMUL
2328defaults to the correct option to set the emulation mode;
2329Otherwise, it stays empty.
2330Read-only.
2331Seldom used, as it is only needed to link binary data without using the
2332compiler.
2333.It Ev LLVM_ARCHS
2334Set to the list of architectures where LLVM/Clang could be used,
2335e.g., via
2336.Sq lang/clang
2337port module, see
2338.Xr port-modules 5 .
2339Read-only.
2340Use with
2341.Ev NOT_FOR_ARCHS
2342or
2343.Ev ONLY_FOR_ARCHS .
2344.It Ev LOCALBASE
2345where other ports have already been installed.
2346Default:
2347.Pa /usr/local .
2348.It Ev LOCALSTATEDIR
2349Location for this port's state directory, should always be derived
2350from
2351.Ev BASELOCALSTATEDIR ,
2352which defaults to
2353.Pa /var .
2354Passed to gnu configure scripts.
2355.It Ev LOCKDIR
2356User settings.
2357Defaults to
2358.Pa ${WRKOBJDIR}/locks .
2359If set, points to a local directory common for all instances of
2360concurrent ports builds.
2361.It Ev LOCK_CMD
2362User settings.
2363Expands to a command that will acquire a lock, namely
2364.Xr portlock 1 .
2365See also
2366.Xr ports 7 .
2367.It Ev LOCK_VERBOSE
2368User settings.
2369Defaults to
2370.Sq \&No .
2371Set to
2372.Sq Yes
2373to show every acquire/release lock operation.
2374.It Ev LP64_ARCHS
2375Set to the list of 64-bit architectures.
2376Read-only.
2377Use with
2378.Ev NOT_FOR_ARCHS .
2379.It Ev MAINTAINER
2380Email address with full name of the port's maintainer.
2381Defaults to
2382.Mt ports@openbsd.org .
2383.It Ev MAKE_ENV
2384Environment variables passed to make invocations and tests.
2385Sets at least PATH, PREFIX, LOCALBASE, X11BASE, CFLAGS, TRUEPREFIX, DESTDIR,
2386and the BSD_INSTALL_* macros.
2387.It Ev MAKE_FLAGS
2388Flags used for all make invocations, except for the
2389.Cm fake
2390stage, which adds
2391.Ev FAKE_FLAGS
2392(see
2393.Ev ALL_FAKE_FLAGS )
2394and for the
2395.Cm test
2396stage, which adds
2397.Ev TEST_FLAGS
2398(see
2399.Ev ALL_TEST_FLAGS ) .
2400.It Ev MAKE_FILE
2401Name of the Makefile used for ports building.
2402Defaults to Makefile.
2403Used after changing directory to ${WRKBUILD}.
2404.It Ev MAKE_JOBS
2405Number of jobs to use when building the port, normally passed to
2406.Ev MAKE_PROGRAM
2407through
2408.Ev PARALLEL_MAKE_FLAGS .
2409Mostly set automatically when
2410.Ev DPB_PROPERTIES
2411contains
2412.Sq parallel .
2413.Pp
2414Note that
2415.Xr make 1
2416still has bugs that may prevent parallel build from working correctly!
2417.It Ev MAKE_PROGRAM
2418The make program that is used for building the port.
2419Set to ${MAKE} or ${GMAKE} depending on USE_GMAKE.
2420Read-only.
2421.It Ev MAKEFILE_LIST
2422Introspection variable, see
2423.Xr make 1 .
2424.It Ev MAKESUMFILES
2425List of all files that need to be retrieved by
2426.Cm fetch-all ,
2427with
2428.Ev DIST_SUBDIR
2429prepended and with master site selection extension removed.
2430Read-only.
2431See also
2432.Ev CHECKSUMFILES .
2433.It Ev MESSAGE
2434File recorded in the package and displayed during installation.
2435Defaults to ${PKGDIR}/MESSAGE if this file exists.
2436Leave empty if no message is needed.
2437.It Ev MISSING_FILES
2438When
2439.Ev FETCH_MANUALLY
2440is set,
2441.Ev MISSING_FILES
2442will contain the list of missing distfiles or patchfiles that need to
2443be fetched manually.
2444Read-only.
2445.It Ev MODGNU_CONFIG_GUESS_DIRS
2446If a port uses config.guess outside WRKSRC, the directories
2447containing the other copies must be set here.
2448.It Ev MODPERL_ADJ_FILES
2449If any files have a Perl shebang line, which needs to be replaced
2450with
2451.Dq #!/usr/bin/perl ,
2452list them in
2453.Ev MODPERL_ADJ_FILES .
2454File paths here should be relative to
2455.Ev WRKSRC .
2456These files are patched automatically at the end of
2457.Cm pre-configure .
2458.It Ev MODPERL_BIN_ADJ
2459Shell fragment to patch the Perl interpreter path in executable scripts.
2460Used by
2461.Ev MODPERL_ADJ_FILES .
2462.It Ev MODPERL_BUILD_TARGET
2463Normal content of
2464.Cm do-build
2465when
2466.Ev CONFIGURE_STYLE
2467uses perl.
2468Provided as a separate variable if a port wants to override
2469.Cm do-build
2470for its own reasons.
2471.It Ev MODPERL_INSTALL_TARGET
2472Likewise for
2473.Cm do-install .
2474.It Ev MODPERL_TEST_TARGET
2475Likewise for
2476.Cm do-test .
2477.It Ev MODPERL_REGEN_PPPORT
2478Normally, if ppport.h is present,
2479it will be regenerated using a current version of
2480.Xr Devel::PPPort 3p .
2481Set to the filename under
2482.Pa ${WRKSRC} ,
2483or
2484.Sq \&No
2485to disable.
2486Defaults to
2487.Sq ppport.h .
2488.It Ev MODULES
2489External modules mechanism, documented separately.
2490Modules such as
2491.Sq imake
2492and
2493.Sq gnu
2494are normally included automatically with the right
2495.Ev CONFIGURE_STYLE .
2496Note that it is possible to
2497.Li CONFIGURE_STYLE = simple ,
2498.Li MODULES += gnu
2499to just get the effects of
2500.Ev CONFIG_SITE
2501and
2502.Ev MODGNU_CONFIG_GUESS_DIRS
2503along with the default
2504.Ev TEST_TARGET ,
2505in case the normal GNU configure script was wrapped in a separate script that
2506takes different arguments.
2507See
2508.Xr port-modules 5 .
2509.It Ev MULTI_PACKAGES
2510Set to a list of subpackage extensions for ports that create multiple packages.
2511See
2512.Sx FLAVORS AND MULTI_PACKAGES
2513below.
2514Especially read the part about
2515.Ev ONLY_FOR_ARCHS
2516when some of the packages only exist for some architectures.
2517.It Ev NO_ARCH
2518Location for arch-independent packages.
2519Defaults to
2520.Sq no-arch .
2521Normally, packages are generated under ${PACKAGE_REPOSITORY}/${MACHINE_ARCH},
2522except for packages where PKG_ARCH=*, which end up under
2523${PACKAGE_REPOSITORY}/${NO_ARCH}.
2524.It Ev NOT_FOR_ARCHS
2525List of architectures on which this port does not build.
2526See also
2527.Ev ONLY_FOR_ARCHS .
2528.It Ev NO_BUILD
2529Set to
2530.Sq Yes
2531if port does not need any build stage.
2532.It Ev NO_CCACHE
2533Set to
2534.Sq Yes
2535to prevent ccache from being used when building a certain port,
2536even when
2537.Ev USE_CCACHE
2538is set.
2539.It Ev NO_CHECKSUM
2540Set to
2541.Sq Yes
2542by
2543.Xr dpb 1
2544to avoid
2545.Cm checksum
2546entirely,
2547as
2548.Xr dpb 1
2549already deals with checksums internally.
2550.It Ev NO_DEPENDS
2551User settings.
2552Don't verify build of dependencies.
2553Do not use in any ports Makefile.
2554This is only meant as a user convenience when, e.g., you just want to browse
2555through a given port's source and do not wish to trigger the build of
2556dependencies.
2557.It Ev NO_IGNORE
2558User settings.
2559If set to
2560.Sq Yes ,
2561avoid ignoring a port for the usual reasons.
2562Use, for instance, for fetching all distribution files, or for fixing a
2563broken port.
2564See also
2565.Ev IGNORE
2566and
2567.Ev TRY_BROKEN .
2568.It Ev NO_SCCACHE
2569Set to
2570.Sq Yes
2571to prevent sccache from being used when building a certain port,
2572even when
2573.Ev USE_SCCACHE
2574is set.
2575.It Ev NO_TEST
2576Port does not have any regression tests.
2577Only set to
2578.Sq Yes
2579for ports with no regression test.
2580It should be left alone for ports with empty regression tests, and for
2581ports with failing tests.
2582That way, if a subsequent update of a port acquires actual regression tests,
2583they will be picked up automatically.
2584.It Ev ONLY_FOR_ARCHS
2585List of architectures on which this port builds.
2586Can hold both processor-specific information (e.g., powerpc), and more
2587specific model information (e.g., macppc).
2588This is subpackage dependent.
2589Read the corresponding part of
2590.Sx FLAVORS AND MULTI_PACKAGES
2591if some subpackages should only be built on some architectures.
2592.It Ev OSREV
2593Revision number of
2594.Ox .
2595Read-only.
2596.It Ev PACKAGE_REPOSITORY
2597User settings.
2598Location for built packages.
2599Defaults to
2600.Pa ${PORTSDIR}/packages .
2601See the
2602.Cm package
2603target for details.
2604.It Ev PARALLEL_MAKE_FLAGS
2605Used when
2606.Ev DPB_PROPERTIES
2607contains
2608.Sq parallel .
2609Flags to pass to
2610.Ev MAKE_PROGRAM
2611to yield a parallel build.
2612Defaults to
2613.Li -j${MAKE_JOBS} .
2614Mostly set to empty by ports that use other mechanisms for setting the number
2615of jobs.
2616.It Ev PARALLEL_MAKE_JOBS
2617User settings.
2618Value of
2619.Ev MAKE_JOBS
2620to use when building manually a port with
2621.Ev DPB_PROPERTIES
2622containing
2623.Sq parallel .
2624Defaults to the number of online cpus.
2625.It Ev PATCH
2626Command to use to apply all patches.
2627Defaults to
2628.Pa /usr/bin/patch .
2629.It Ev PATCHORIG
2630Suffix used by
2631.Cm patch
2632to rename original files, and
2633.Cm update-patches
2634to re-generate
2635.Pa ${PATCHDIR}/${PATCH_LIST}
2636by looking for files using this suffix.
2637Defaults to
2638.Pa .orig.port .
2639In the unlikely event that one of the ${DISTFILES*} already contains
2640.Pa .orig.port
2641files, set this to something else, such as
2642.Pa .orig.obsdport .
2643See also
2644.Cm distpatch ,
2645.Ev DISTORIG .
2646.It Ev PATCH_CASES
2647In the normal
2648.Cm distpatch
2649stage (when
2650.Ev PATCHFILES*
2651is not empty), this is the contents of a case statement, used to apply
2652distribution patches.
2653Fragments are automatically appended to handle gzip'ed, bzip'ed and lzip'ed
2654patches, so that the default case is more or less equivalent to the following
2655shell fragment:
2656.Bd -literal
2657set -e
2658cd ${FULLDISTDIR}
2659for patchfile in ${ALL_PATCHFILES}
2660do
2661    case $$patchfile in
2662	*.bz2)
2663	  ${BZIP2} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
2664	*.zst|*.zstd)
2665	  zstdcat -c <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
2666	*.Z|*.gz)
2667	  ${GZIP_CMD} -d <$$patchfile | ${PATCH} ${PATCH_DIST_ARGS};;
2668	*)
2669	  ${PATCH} ${PATCH_DIST_ARGS} <$$patchfile;;
2670    esac
2671done
2672.Ed
2673.It Ev PATCHDIR
2674Location for patches applied by the
2675.Cm patch
2676target.
2677Default:
2678.Pa patches .
2679.It Ev PATCHFILES*
2680Files to fetch from the master sites like
2681.Ev DISTFILES* ,
2682but serving a different purpose, as they hold distribution patches that
2683will be applied at the
2684.Cm patch
2685stage.
2686See also
2687.Ev SUPDISTFILES* .
2688.It Ev PATCH_ARGS
2689Full list of options used while applying port's patches.
2690.It Ev PATCH_CHECK_ONLY
2691Set to
2692.Sq Yes
2693by the
2694.Cm checkpatch
2695target.
2696Don't touch unless the default
2697.Cm checkpatch
2698target needs to be redefined.
2699Ideally, user-defined patch subtargets ought to test checkpatch.
2700In practice, they don't.
2701.It Ev PATCH_DIST_ARGS
2702Full list of options used while applying distribution patches.
2703.It Ev PATCH_DIST_STRIP
2704Patch option used to strip directory levels while applying distribution
2705patches.
2706Defaults to -p0.
2707.It Ev PATCH_LIST
2708Wildcard pattern of patches to select under ${PATCHDIR}.
2709Defaults to patch-*.
2710Note that filenames ending in .orig, or ~ are never applied.
2711Note that
2712.Ev PATCH_LIST
2713can hold absolute pathnames, for instance to share patches among similar
2714ports:
2715.Bd -literal
2716PATCH_LIST=${PORTSDIR}/x11/kde/libs2/patches/p-* patch-*
2717.Ed
2718.Pp
2719But beware that minor variations will result in
2720.Cm update-patches
2721creating useless churn !
2722.It Ev PATCH_QUIET
2723User settings.
2724If set to
2725.Sq Yes ,
2726.Ev PATCH
2727will work quietly.
2728.It Ev PATCH_STRIP
2729Patch option used to strip directory levels while applying port's patches.
2730Defaults to -p0.
2731.It Ev PERMIT_DISTFILES , PERMIT_PACKAGE
2732Set to
2733.Sq Yes
2734if the distribution files or the package can be allowed on FTP sites without
2735legal issues.
2736Set to reason not to otherwise.
2737PERMIT_* lines in the Makefile should be preceded with a comment explaining
2738details about licensing and patents issues the port may have.
2739Porters must be very thorough in their checks.
2740In case of doubt, ask.
2741.Pp
2742If
2743.Ev PERMIT_PACKAGE
2744is set to
2745.Sq Yes ,
2746.Ev PERMIT_DISTFILES
2747will default to
2748.Sq Yes .
2749.It Ev PKG_ADD
2750User settings.
2751Path to
2752.Xr pkg_add 1
2753command, with possible options.
2754.It Ev PKG_ARCH
2755Comma-separated list of architectures on which this package may install.
2756Defaults to ${MACHINE_ARCH},${ARCH}.
2757.Pp
2758For instance:
2759.Ev MACHINE_ARCH Ns = Ns Ar powerpc ,
2760.Ev ARCH Ns = Ns Ar macppc .
2761.Pp
2762Most (if not all packages) will install correctly according to
2763.Ev MACHINE_ARCH .
2764.Pp
2765Use * for arch-independent packages
2766.Po
2767see also
2768.Sx THE DEBUG_PACKAGES INFRASTRUCTURE
2769.Pc .
2770.It Ev PKG_ARGS
2771Special arguments to pass to
2772.Xr pkg_create 1 ,
2773in addition to the default ones.
2774.It Ev PKG_CREATE
2775User settings.
2776Path to
2777.Xr pkg_create 1
2778command, with possible options.
2779.It Ev PKG_CREATE_NO_CHECKS
2780Porters switch.
2781Set to
2782.Sq Yes
2783to avoid checking the ports tree when solving
2784.Ev WANTLIB
2785.Po
2786see
2787.Cm wantlib-args
2788.Pc .
2789May result in bogus packages that mix
2790.Cm @depends
2791lines obtained from
2792the ports tree with
2793.Cm @wantlib
2794lines that come from the installed system.
2795Set to
2796.Sq Warn
2797to have the differences printed as a warning instead of an error
2798.Po
2799the default
2800.Pc .
2801.It Ev PKG_DBDIR
2802User settings.
2803Path to package installation records.
2804Defaults to
2805.Pa /var/db/pkg .
2806.It Ev PKG_DELETE
2807User settings.
2808Path to
2809.Xr pkg_delete 1
2810command, with possible options.
2811.It Ev PKG_INFO
2812User settings.
2813Path to
2814.Xr pkg_info 1
2815command, with possible options.
2816.It Ev PKG_TMPDIR
2817See
2818.Xr pkg_add 1 .
2819Normally points to
2820.Pa /var/tmp ,
2821as per default.
2822.It Ev PORTHOME
2823Setting of env variable
2824.Ev HOME
2825for most shell invocations.
2826Default will trip ports that try to write into $HOME while building:
2827non-existent
2828.Pa /${PKGPATH}_writes_to_HOME/ .
2829.It Ev PORTPATH
2830Path used by most shell invocations.
2831Don't override unless really needed.
2832.It Ev PORTSDIR
2833Root of the ports tree (default:
2834.Pa /usr/ports ) .
2835.It Ev PORTSDIR_PATH
2836Path used by dependencies and
2837.Pa bsd.port.subdir.mk
2838to look up package specifications.
2839Defaults to
2840.Pa ${PORTSDIR}:${PORTSDIR}/mystuff .
2841.It Ev PORTS_PRIVSEP
2842If set to
2843.Sq Yes ,
2844will build ports as
2845.Ev BUILD_USER
2846and fetch distfiles
2847as
2848.Ev FETCH_USER .
2849.Pp
2850To work fully, this does require the ports tree
2851to be world-readable, and
2852.Pa ${WRKDIR}
2853to be world-readable as well
2854.Po
2855.Cm update-patches
2856and friends won't work otherwise
2857.Pc .
2858.Pp
2859Meant to use in concert with
2860.Xr dpb 1 ,
2861which uses the same permissions
2862.Po
2863see
2864.Sq THE SECURITY MODEL OF DPB
2865in
2866.Xr dpb 1
2867.Pc .
2868.Pp
2869Basically,
2870.Ev BUILD_USER
2871must be able to write into
2872.Pa ${WRKOBJDIR} , ${PACKAGE_REPOSITORY} , ${PLIST_REPOSITORY}
2873and
2874.Ev FETCH_USER
2875must be able to write into
2876.Pa ${DISTDIR} .
2877The directories and permissions can be set correctly using
2878.Cm fix-permissions .
2879.Pp
2880The regular user must be allowed to execute commands as
2881.Ev BUILD_USER
2882and
2883.Ev FETCH_USER .
2884Running commands as another user can be achieved with
2885.Xr doas 1
2886by setting
2887.Ev SUDO=doas
2888in
2889.Xr mk.conf 5
2890and using the following minimal
2891.Xr doas.conf 5 :
2892.Bd -literal -offset indent
2893permit keepenv nopass solene as _pbuild
2894permit keepenv nopass solene as _pfetch
2895.Ed
2896.Pp
2897It is reasonably safe to allow your user id to run commands as the
2898.Ev BUILD_USER
2899or
2900.Ev FETCH_USER
2901and using
2902.Ic nopass
2903for these can save a lot of password entry, however it is inadvisable
2904to allow commands like
2905.Xr pkg_add 1
2906to run as root without a password.
2907.Pp
2908Note that this also means that
2909.Xr doas 1
2910must be configured to work within the chroot
2911created by
2912.Xr proot 1 .
2913.Pp
2914As
2915.Xr dpb 1
2916does its own privilege dropping when run as root,
2917it will automatically override
2918.Ev PORTS_PRIVSEP .
2919.Pp
2920User settings, defaults to
2921.Sq \&No .
2922.It Ev PKGDIR
2923Location for packaging information (packing-list, port description, messages).
2924.Cm update-plist
2925may create it.
2926Must be a valid directory.
2927Default: pkg.
2928.It Ev PKGFILE
2929Full path to the created package for the given subpackage.
2930Read-only.
2931.It Ev PKGFILES
2932Full path to all created packages.
2933Read-only.
2934.It Ev PKGNAME
2935Name of the created package.
2936Default is ${DISTNAME}.
2937This does not take flavors into account.
2938See
2939.Ev FULLPKGNAME
2940for that.
2941Specific revisions and epoch changes should be
2942handled by
2943.Ev REVISION
2944and
2945.Ev EPOCH
2946instead.
2947.It Ev PKGNAMES
2948Read-only.
2949List of all package names generated by the port, with
2950.Ev FLAVORS
2951and
2952.Ev BUILD_PACKAGES
2953taken into account.
2954Mostly used as
2955.Ql make show=PKGNAMES
2956to verify that bumped package names are correct.
2957.It Ev PKGNAME-foo
2958Package name for sub-package foo, if the default value
2959of ${PKGNAME}${SUBPACKAGE} is not appropriate.
2960.It Ev PKGPATH
2961Path to the current port's directory, relative to ${PORTSDIR}.
2962Read-only.
2963.It Ev PKGPATHS
2964Read-only.
2965List of all package paths generated by the port, with
2966.Ev FLAVORS
2967and
2968.Ev MULTI_PACKAGES
2969taken into account.
2970Order matches
2971.Ev PKGNAMES
2972exactly.
2973.It Ev PKGSPEC
2974Default package spec for using this port as a dependency.
2975Defaults to
2976.Sq stem-* ,
2977derived from the
2978.Ev FULLPKGNAME .
2979Do not override without very good reasons,
2980namely software that coexist as different incompatible versions with the
2981same stem, e.g., already a mess.
2982Also See the description of
2983.Fl P
2984in
2985.Xr pkg_create 1
2986.It Ev PKGSTEM
2987Base for the package name without any version number.
2988Used in
2989.Pa READMEs
2990file names and actual contents, can be overridden for ports
2991with branches, like php, e.g.,
2992.Li PKGSTEM-main = php-5.6
2993.It Ev PLIST
2994Location of package packing-list.
2995Defaults to
2996.Pa ${PKGDIR}/PLIST ,
2997or to
2998.Pa ${PKGDIR}/PLIST${SUBPACKAGE}
2999for multi-packages.
3000.It Ev PLIST_DB
3001Deprecated, see
3002.Ev PLIST_REPOSITORY .
3003.It Ev PLIST_REPOSITORY
3004User settings.
3005Base directory used to save generated packing-lists, as persistent information.
3006Packing-lists are processed by a script,
3007.Xr register-plist 1 ,
3008which complains when packing-lists change without a
3009.Ev REVISION
3010bump.
3011It also knows enough about package version numbers when something in the
3012package or its dependencies goes backward, thus catching
3013.Ev EPOCH
3014issues.
3015This directory is never cleaned during normal operation.
3016.Ql make clean=plist
3017should only ever be used during debugging by port maintainers.
3018Defaults to
3019.Pa ${PORTSDIR}/plist
3020.Po
3021plists actually get saved into
3022.Pa ${PLIST_REPOSITORY}/${MACHINE_ARCH}
3023.Pc .
3024If set to empty, will not register anything: very much unsafe.
3025.It Ev PORTROACH
3026Controls the behavior of
3027.Pa misc/portroach
3028as documented in detail at
3029.Lk https://jasperla.github.io/portroach/docs/portroach-portconfig.txt
3030.It Ev PREFIX
3031Base directory for the current port installation.
3032Usually ${LOCALBASE}, though some ports may elect a location under
3033.Pa ${VARBASE} ,
3034and some multi-package ports may install under several locations.
3035Additionally, firmware files generally install under
3036.Pa ${BASESYSCONFDIR} .
3037.It Ev PREPARE_CHECK_ONLY
3038Build settings.
3039Prevent the
3040.Cm prepare
3041stage from installing anything, let it just check dependencies, and
3042handle [:target] dependencies.
3043Mostly used by
3044.Xr dpb 1 ,
3045which already installs everything before running
3046.Cm prepare .
3047.It Ev PROGRESS_METER
3048User settings.
3049Defaults to
3050.Sq Yes .
3051Forces commands like
3052.Xr ftp 1
3053and
3054.Xr pkg_create 1
3055to use their progress-meter even in the absence of a terminal.
3056.It Ev PROPERTIES
3057List of properties specific to a given machine architecture,
3058obtained through the inclusion of
3059.Xr bsd.port.arch.mk 5 .
3060These can be checked like this
3061.Bd -literal -offset indent
3062\&.include <bsd.port.arch.mk>
3063\&.if ${PROPERTIES:Mapm}
3064# then add build options specific to apm arches
3065\&...
3066\&.if !${PROPERTIES:Mlp64}
3067# build options specific to lp32 arches
3068\&...
3069.Ed
3070For
3071.Ev MULTI_PACKAGES
3072setup, use of
3073.Ev ONLY_FOR_ARCHS-sub
3074and
3075.Ev BUILD_PACKAGES
3076is generally preferred (and simpler).
3077Possible properties include
3078.Bl -tag -width mono
3079.It apm
3080architecture possesses suspend (apm) support.
3081.It be
3082architecture is big-endian.
3083.It gccN
3084gccN architecture.
3085.It le
3086architecture is little-endian.
3087.It lp64
3088lp64 architecture.
3089.It llvm
3090there is
3091.Pa lang/llvm
3092support on this architecture.
3093.It mono
3094there is
3095.Pa lang/mono
3096support on this architecture.
3097.El
3098.It Ev PSEUDO_FLAVOR
3099List of flavors in
3100.Ev FLAVOR
3101that are actually pseudo-flavors.
3102Only for introspection purposes.
3103Read-only.
3104.It Ev PSEUDO_FLAVORS
3105Extra list of flavors that do not register in package names, but are still
3106used to control build logic, and work directory names.
3107Its only use should be for disabling part of a multi-packages build,
3108for instance:
3109.Bd -literal
3110FLAVOR=no_gnome make package
3111.Ed
3112.Pp
3113Pseudo-flavors should be named as
3114.Sq no_something
3115to disable the build of subpackage
3116.Sq -something
3117.Po
3118and possibly some others, by restricting
3119.Ev BUILD_PACKAGES
3120.Pc .
3121Pseudo-flavors should always be handled through
3122.Xr bsd.port.arch.mk 5 .
3123A pseudo-flavor can remove several subpackages through the following
3124construct.
3125.Bd -literal -offset indent
3126# pseudo-flavor no_gui will also remove gtk and gtk3
3127MULTI_PACKAGES = -main -gtk -gtk3 -gui
3128# ...
3129\&.include <bsd.port.arch.mk>
3130
3131# remove extra build components
3132\&.if !${BUILD_PACKAGES:M-gui}
3133BUILD_PACKAGES := ${BUILD_PACKAGES:N-gtk:N-gtk3}
3134\&.endif
3135
3136# normal configure setup, e.g.,
3137\&.if ${BUILD_PACKAGES:M-gtk}
3138# ...
3139.Ed
3140.Pp
3141Caveat: creation of a separate working directory is mandatory for a
3142pseudo-flavor.
3143If, at a later time, a full build with all subpackages is required,
3144all the work will need to be done again.
3145.Pp
3146See also
3147.Ev BUILD_ONCE .
3148.It Ev RANDOMIZE_SUBDIRS
3149Actually lives in
3150.Pa bsd.port.subdir.mk .
3151Set to
3152.Sq Yes
3153to randomize tree traversal, as used by
3154.Xr dpb 1 Ns 's Fl r
3155option.
3156Defaults to
3157.Sq \&No Ns .
3158.It Ev RCDIR
3159Location for daemon startup scripts.
3160Defaults to
3161.Pa /etc/rc.d .
3162Do not change.
3163.It Ev REFETCH
3164User settings.
3165If set to true,
3166.Cm checksum
3167will analyze ${CHECKSUM_FILE}, and try retrieving files with the correct
3168checksum off
3169.Lk https://ftp.openbsd.org ,
3170in the directory
3171.Pa /pub/OpenBSD/distfiles/$cipher/$value/$file .
3172.It Ev REGISTER_PLIST_OPTS
3173User settings.
3174User options added to
3175.Xr register-plist 1 .
3176.It Ev REORDER_DEPENDENCIES
3177Points to a list of files that specify inter-dependencies for
3178.Xr make 1 .
3179If defined, each line of the file is either a comment (starting with #)
3180or a pair of two files: most_recent older.
3181At the end of
3182.Cm post-patch ,
3183.Xr touch 1
3184will be used to ensure those files are put in the proper order.
3185The files are assumed to be under
3186.Pa ${WRKSRC} .
3187The notation /file can be used to ask for a recursive search, e.g.,
3188to make sure that all Makefile.in are up to date.
3189See
3190.Pa ${PORTSDIR}/infrastructure/mk/automake.dep
3191for an example.
3192.It Ev REPORT_PROBLEM
3193See
3194.Xr ports 7 .
3195.It Ev REPORT_PROBLEM_LOGFILE
3196See
3197.Xr ports 7 .
3198.It Ev REVISION
3199Revision number of the current package.
3200Defaults to empty (very first package), then
3201numbering starts at 0.
3202Gets automatically incorporated into
3203.Ev FULLPKGNAME
3204as
3205.Sq p${REVISION}
3206to form a full package-name conforming to
3207.Xr packages-specs 7 .
3208.It Ev ROACH_SITES
3209Selects the correct list of sites corresponding to
3210.Ev ROACH_URL ,
3211in order to help portroach.
3212.It Ev ROACH_URL
3213The canonical url corresponding to the current port.
3214Gets deduced from ${DISTFILES} by default, using the first value
3215or the first entry in ${DISTFILES.sufx} if there's only one suffix.
3216Conversion rules for
3217.Ev DISTFILES
3218are applied to yield only the url part of the distfile.
3219Set manually if the automatic rules don't find the right one.
3220.It Ev RUN_DEPENDS
3221Specification of ports this port needs installed to be functional.
3222Same format as
3223.Ev LIB_DEPENDS .
3224The corresponding packages will be built right before the
3225.Cm install
3226stage, and
3227.Xr pkg_add 1
3228will take care of installing them.
3229.It Ev SCCACHE_DIR
3230Sets the cache directory used when
3231.Ev USE_SCCACHE
3232is set to yes.
3233Defaults to ${WRKOBJDIR}/.sccache.
3234.It Ev SCCACHE_ENV
3235Sets additional environment variables when
3236.Ev USE_SCCACHE
3237is set to yes.
3238.It Ev SEPARATE_BUILD
3239Many GNU configure ports can be built in a directory distinct from the
3240place they were unpacked.
3241For some specific ports, this is even mandatory.
3242Set to
3243.Sq yes
3244if this is the case.
3245The ports infrastructure will generate a separate ${WRKBUILD} directory
3246in which the port will be configured and built.
3247Wipe ${WRKBUILD} to start anew, but skipping the extract/patch stage.
3248.It Ev SETENV
3249Normally set to
3250.Li /usr/bin/env -i .
3251Prepended to every command invocation that requires a clean environment.
3252Do not override.
3253.It Ev SHARED_LIBS
3254List of shared libraries that the port may build, as a list of the form
3255.Sq libname
3256.Sq libversion .
3257Used to set variables of the form
3258.Ev LIBlibname_VERSION
3259that are then used for substitution by
3260.Xr pkg_create 1 .
3261The porter is responsible for making sure the port uses those version numbers
3262when shared libraries are built.
3263.Pp
3264The intent is that the
3265.Ox
3266ports system must have control over shared library versions because of global
3267changes that may require bumping the major version of every shared library in
3268the system, or simply because the third party programmers do not understand
3269the rules for shared library versions, thus breaking the update mechanism.
3270For that reason it is advised to set libversion to 0.0 when first importing a
3271port.
3272.Pp
3273Porters of software using libtool should make sure
3274.Ev MAKE_FLAGS
3275get propagated to the libtool invocations.
3276.Pp
3277Most common build systems in the ports tree have been modified
3278to handle this mechanism correctly.
3279.It Ev SITE_BACKUP
3280User settings.
3281List of sites to try after normal master sites.
3282Normally includes ${SITE_OPENBSD} and ${SITE_FREEBSD}.
3283.Po
3284For now the ports tree is transitioning from
3285.Ev MASTER_SITES*
3286to
3287.Ev SITES*
3288which means that
3289.Ev MASTER_SITE_BACKUP
3290should be set instead until the transition is complete.
3291.Pc
3292.It Ev SITE_*
3293Lists of standard sites to retrieve files from, refer to
3294.Pa ${PORTSDIR}/infrastructure/db/network.conf
3295for a complete list.
3296.Pp
3297Generally used with the standard
3298.Xr make 1 Ns 's
3299.Li ${VARIABLE:=subdir/}
3300construct to append the relevant subdir at the end of each entry, e.g.,
3301.Dl SITES = ${SITE_GNU:=cgicc/}
3302.It Ev SITES
3303List of primary locations from which distribution files and patchfiles are
3304retrieved.
3305See the
3306.Cm fetch
3307target for details.
3308Defaults to ${SITES_GITHUB} for GitHub-hosted projects,
3309see
3310.Ev GH_* .
3311See
3312.Xr ports 7
3313for user configuration.
3314.It Ev SITES*
3315List of alternate locations from which ${DISTFILES*}, ${PATCHFILES*},
3316${SUPDISTFILES*} are retrieved.
3317See
3318.Cm fetch
3319for details.
3320Suffix should start with
3321.Sq \&.
3322and be all lowercase for consistency.
3323.It Ev SKIPDIR
3324See
3325.Xr ports 7 .
3326.It Ev STATIC_PLIST
3327Normally set to
3328.Sq yes .
3329Can be set to no for ports that do not have a static plist.
3330Do not change without a very good reason.
3331Note that the only good reason to not have a static plist is for ports such
3332as
3333.Pa databases/ports-readmes
3334which actually build a bunch of files depending on the current ports tree.
3335This breaks all introspection mechanisms within the ports tree, including
3336.Pa databases/pkglocatedb
3337which will not include that port.
3338.It Ev STARTAFTER
3339See
3340.Xr ports 7 .
3341.It Ev STARTDIR
3342See
3343.Xr ports 7 .
3344.It Ev SUBPACKAGE
3345Set to the subpackage suffix when building a package in a multi-package port.
3346Read-only.
3347Used to test for dependencies or to adjust the package name.
3348.It Ev SUBST_CMD
3349A command that can be used to perform
3350.Ev SUBST_VARS
3351substitution on arbitrary files.
3352In normal mode,
3353.Pp
3354.Dl ${SUBST_CMD} file1 file2 ...
3355.Pp
3356will substitute files in place, creating backup copies of them.
3357In copy mode,
3358.Pp
3359.Dl ${SUBST_CMD} -c src1 dest1 src2 dest2
3360.Pp
3361will copy files over while performing the substitution, as suitable for
3362copying template files over from
3363.Pa ${FILESDIR}
3364to
3365.Pa ${PREFIX} ,
3366for instance.
3367This uses
3368.Xr pkg_subst 1
3369with suitable parameters.
3370Read-only.
3371.Pp
3372${SUBST_CMD}
3373can be used like
3374.Xr install 1 :
3375.Dl ${SUBST_CMD} Oo Fl g Ar group Oc Oo Fl o Ar owner Oc Oo Fl m Ar mode Oc file...
3376to set file
3377.Ar owner ,
3378.Ar group
3379and/or
3380.Ar mode .
3381.Pp
3382Note that
3383.Ev SUBST_CMD
3384is not really appropriate when variables have subpackage variations, like
3385.Ev PREFIX
3386or
3387.Ev FULLPKGNAME .
3388Use the appropriate
3389.Ev SUBST_CMD-sub
3390instead.
3391.It Ev SUBST_CMD-sub
3392.Ev SUBST_CMD
3393with subpackage-dependent semantics, like packing-list substitution.
3394It will substitute the right variable depending on the desired subpackage,
3395e.g.,
3396.Ev SUBST_CMD-foo
3397will substitute the value of
3398.Ev FULLPKGNAME-foo
3399for
3400.Li ${FULLPKGNAME} .
3401.It Ev SUBST_DATA , SUBST_MAN , SUBST_PROGRAM
3402Specialized versions of
3403.Ev SUBST_CMD
3404that use
3405.Fl c
3406and appropriate owner/group/mode for data, manpages and programs respectively.
3407.It Ev SUBST_VARS
3408Make variables whose values get substituted to create the actual package
3409information.
3410Always holds
3411.Ev ARCH ,
3412.Ev BASE_PKGPATH ,
3413.Ev FLAVOR_EXT ,
3414.Ev FULLPKGNAME ,
3415.Ev HOMEPAGE ,
3416.Ev LOCALBASE ,
3417.Ev MACHINE_ARCH ,
3418.Ev MAINTAINER ,
3419.Ev PREFIX ,
3420.Ev PKGSTEM ,
3421.Ev RCDIR ,
3422.Ev SYSCONFDIR ,
3423.Ev TRUEPREFIX ,
3424and
3425.Ev X11BASE .
3426The special construct
3427.Sq ${FLAVORS}
3428can be used in the packing-list to specify the current list of dash
3429separated flavors the port is compiled with (useful for cross-dependencies
3430in
3431.Ev MULTI_PACKAGES ) .
3432Add other
3433variables as needed.
3434.Pp
3435.Ev TRUEPREFIX
3436is never passed to
3437.Xr pkg_create 1
3438as it is identical to
3439.Ev PREFIX .
3440.Pp
3441By default,
3442.Xr update-plist 1
3443is run with the following options:
3444.Bd -literal -offset indent
3445update-plist -i ARCH -i BASE_PKGPATH -i FULLPKGNAME
3446-i FULLPKGPATH -i LOCALSTATEDIR -i MACHINE_ARCH
3447-s BASE_PKGPATH -s LOCALBASE -s LOCALSTATEDIR -s PREFIX
3448-s RCDIR -s SYSCONFDIR -s X11BASE
3449.Ed
3450.It Ev SUDO
3451User settings.
3452If set to
3453.Xr doas 1
3454in
3455.Xr mk.conf 5 ,
3456the ports tree will only invoke root's privileges for the parts that
3457really require it.
3458.It Ev SUPDISTFILES*
3459Supplementary distribution files for mirroring and creating checksums with
3460.Cm makesum .
3461For instance, a port might need architecture-specific files, or have
3462some flavor that requires more code.
3463.Ev SUPDISTFILES*
3464should hold a list of all those distribution files and patchfiles
3465that are not always needed.
3466Having an overlap between
3467.Ev SUPDISTFILES*
3468and
3469.Ev DISTFILES* ,
3470.Ev PATCHFILES*
3471is admissible, and in fact, expected, as it is much simpler to build
3472an error-free list of files to retrieve in that way.
3473See the
3474.Pa devel/jdk/1.8
3475port for an example.
3476.It Ev SYSCONFDIR
3477Location for this port's configuration files, should always be derived
3478from
3479.Ev BASESYSCONFDIR ,
3480which defaults to
3481.Pa /etc .
3482Passed to gnu configure scripts and substituted in packing-lists.
3483.It Ev TAR
3484Name of the tar binary.
3485.It Ev TARGETS
3486Read-only.
3487Set to the list of special targets for a port
3488.Po
3489.Cm {pre,do,post}-*
3490and module hooks
3491.Pc .
3492Used by introspection tools such as the
3493.Pa sqlports
3494package.
3495.It Ev TEMPLATE_DISTFILES.<name>
3496Template used to construct
3497.Ev DISTFILES.name
3498based on a
3499.Ev DIST_TUPLE
3500entry by filling in placeholder strings.
3501For instance,
3502.Ev TEMPLATE_DISTFILES.github
3503defaults to
3504.Bd -literal
3505<account>-<project>-{<account>/<project>/archive/<subdir>}<id>.tar.gz
3506.Ed
3507.Pp
3508with
3509.Li DIST_TUPLE += github foo bar baz qux.
3510We end up with the following
3511.Ev DISTFILES.github
3512entry:
3513.Bd -literal -offset indent
3514foo-bar-{foo/bar/archive/ref/tags}baz.tar.gz
3515.Ed
3516.Pp
3517Placeholders
3518.Sq account ,
3519.Sq project ,
3520.Sq id
3521are self-explanatory.
3522.Sq subdir
3523is set automatically by figuring out whether
3524.Ar id
3525is a
3526.Ar tagname
3527or a
3528.Ar hash .
3529.It Ev TEMPLATE_HOMEPAGE.<name>
3530Template for automatically generated
3531.Ev HOMEPAGE
3532when using
3533.Ev DIST_TUPLE .
3534Very similar to
3535.Ev TEMPLATE_DISTFILES.<name> .
3536.It Ev TEST_DEPENDS
3537See
3538.Ev BUILD_DEPENDS
3539for specification.
3540Test dependencies are only checked if the
3541.Cm test
3542stage is invoked.
3543.It Ev TEST_ENV
3544Additional environment variables passed to tests.
3545Empty by default.
3546.It Ev TEST_FLAGS
3547Extra flags passed to ${MAKE_PROGRAM} to run the regression tests.
3548Empty by default.
3549.It Ev TEST_IS_INTERACTIVE
3550Set to
3551.Sq Yes
3552if port needs human interaction to run its tests, or set to
3553.Sq X11
3554if the tests need an active X11 display to work.
3555.It Ev TEST_LOG
3556Command used to log the results of regression tests to TEST_LOGFILE.
3557Read-only.
3558.It Ev TEST_LOGFILE
3559Log file containing the results of regression tests.
3560.It Ev TEST_TARGET
3561Target to run regression tests.
3562Defaults to
3563.Sq test ,
3564except for
3565.Sq perl
3566and
3567.Sq gnu
3568.Ev CONFIGURE_STYLE ,
3569which default to
3570.Sq test
3571and
3572.Sq check ,
3573respectively.
3574.It Ev TRUEPREFIX
3575Read-only.
3576Mostly the same as ${PREFIX}, except it never gets ${DESTDIR} prepended
3577during
3578.Cm fake .
3579Refer to
3580.Sx THE FAKE FRAMEWORK
3581section for details.
3582.It Ev TRY_BROKEN
3583User settings.
3584If set to
3585.Sq Yes ,
3586don't set
3587.Ev IGNORE
3588for
3589.Ev BROKEN
3590ports, so that we will attempt to build them.
3591.It Ev UNLOCK_CMD
3592User settings.
3593If set, expands to a command that will release a lock.
3594This lock will reside in
3595.Pa ${LOCKDIR} .
3596.It Ev UNLINKED
3597Some ports should not be built by default for various reasons:
3598not fully integrated into the system yet, bootstrap-specific
3599ports, flavors that conflict badly with the default installation,
3600but these ports should still be indexed by tools like
3601.Pa sqlports
3602for consistency.
3603Instead, set
3604.Ev UNLINKED
3605to a
3606.Sq tag
3607that will make the port
3608.Ev IGNORE Ns d
3609unless
3610.Ev BUILD_UNLINKED
3611contains that specific tag.
3612.It Ev UNMESSAGE
3613File recorded in the package and displayed during deinstallation.
3614Defaults to ${PKGDIR}/UNMESSAGE if this file exists.
3615Leave empty if no message is needed.
3616.It Ev UNZIP
3617Name of the unzip binary.
3618.It Ev UPDATE_COOKIES_DIR
3619User settings.
3620Used to store cookies for package updates and defaults to
3621.Pa ${PORTSDIR}/update/${MACHINE_ARCH} .
3622If set to empty, will revert to a file under
3623.Pa ${WRKDIR} .
3624.It Ev UPDATE_PLIST_ARGS
3625Tweaks to
3626.Xr update-plist 1
3627behavior for some specific ports, such as variable handling.
3628.It Ev UPDATE_PLIST_OPTS
3629User settings.
3630User options added to
3631.Xr update-plist 1 ,
3632mostly
3633.Fl v
3634for now.
3635.It Ev USE_CCACHE
3636User settings.
3637Set to
3638.Sq Yes
3639to use ccache when building ports.
3640Sets up the build environment so that it is used.
3641.It Ev USE_GMAKE
3642Set to
3643.Sq Yes
3644if GNU make (${GMAKE}) is needed for correct behavior of this port.
3645.It Ev USE_GROFF
3646Set to
3647.Sq Yes
3648to use groff to build manpages.
3649This sets groff as a build dependency, and also tells
3650.Xr pkg_create 1
3651to format manpages behind the scene using groff while building packages.
3652.It Ev USE_LIBTOOL
3653Defaults to
3654.Sq Yes .
3655Set to
3656.Sq gnu
3657if the base
3658.Xr libtool 1
3659is insufficient and GNU libtool is required.
3660Set to
3661.Sq \&No
3662to disable the use of
3663.Xr libtool 1
3664entirely; this should not be set under normal circumstances.
3665Adds dependencies if necessary, and passes LIBTOOL environment variable to
3666scripts invocations.
3667.Pp
3668Many ports using GNU autoconf need an m4 file from the GNU libtool package
3669but otherwise work with base
3670.Xr libtool 1 .
3671In those cases do not set
3672.Ev USE_LIBTOOL ,
3673instead just set
3674.Li BUILD_DEPENDS = devel/libtool .
3675.It Ev USE_LLD
3676Set to
3677.Sq Yes ,
3678.Sq \&No
3679or
3680.Sq ports
3681to force the use of
3682.Xr ld.lld 1
3683.Po
3684as opposed to
3685bfd's
3686.Xr ld 1
3687.Pc .
3688.Sq ports
3689forces the use of
3690.Xr ld.lld 1
3691from lang/clang module.
3692Defaults to the appropriate value for the current architecture
3693.Po
3694see
3695.Ev LLD_ARCHS
3696in
3697.Xr bsd.port.arch.mk 5
3698.Pc .
3699.It Ev USE_MFS
3700Set to
3701.Sq Yes
3702to build ports under an MFS filesystem
3703(see
3704.Xr mount_mfs 8 ) .
3705Mostly for use by
3706.Xr dpb 1
3707and not intended to be a user setting.
3708See
3709.Ev WRKOBJDIR_MFS
3710for configuration.
3711.It Ev USE_NOBTCFI
3712If set to
3713.Sq Yes ,
3714writes a wrapper script to
3715.Pa ${WRKDIR}/bin/ld
3716in
3717.Cm patch
3718to request that the linker adds a
3719.Dv PT_OPENBSD_NOBTCFI
3720ELF section.
3721Use when a port does not work with the default strict enforcement of
3722indirect branch targets.
3723.Pp
3724Applies to all architectures; set
3725.Ev USE_NOBTCFI-${MACHINE_ARCH}
3726to apply to only a specific architecture.
3727.It Ev USE_NOEXECONLY
3728If set to
3729.Sq Yes ,
3730writes a wrapper script to
3731.Pa ${WRKDIR}/bin/ld
3732in
3733.Cm patch
3734adding
3735.Fl -no-execute-only .
3736Use when a port does not work with execute-only (unreadable) code sections
3737which are used by default by the linker on some architectures.
3738.It Ev USE_SCCACHE
3739User settings.
3740Set to
3741.Sq Yes
3742to use sccache when building Rust ports.
3743.It Ev USE_WXNEEDED
3744If set to
3745.Sq Yes ,
3746writes a wrapper script to
3747.Pa ${WRKDIR}/bin/ld
3748in
3749.Cm patch
3750to request that the linker adds a
3751.Dv PT_OPENBSD_WXNEEDED
3752ELF section.
3753Use when a port requires memory mappings that are both executable
3754and writable and cannot be modified to avoid this.
3755.It Ev USE_X11
3756Normally, presence of ${X11BASE} is enforced by default for building ports.
3757But there is an experimental way to hook the xenocara build into
3758.Xr dpb 1 ,
3759which requires knowing whether a port requires X11 to already
3760be there.
3761.Pp
3762The infrastructure mostly sets
3763.Ev USE_X11
3764automatically based on
3765.Ev WANTLIB
3766values, there are a few ports (about 20) that require X11 components without
3767any library telltale.
3768.It Ev VARBASE
3769User settings.
3770Base location for ports that install stuff outside of
3771.Pa ${LOCALBASE} .
3772Defaults to
3773.Pa /var .
3774.It Ev WANTLIB
3775List of library specifications that a package will need.
3776May include system and X11 libraries.
3777See
3778.Xr library-specs 7
3779for more details.
3780.Pp
3781As a special extension,
3782.Ev WANTLIB
3783may include absolute paths, e.g.,
3784.Pa ${LOCALBASE}/lib/expat=4
3785to distinguish between base libraries and port libraries.
3786Use with caution, this is very seldom needed.
3787.It Ev wantlib_args
3788Controls the behavior of
3789.Xr pkg_create 1
3790related targets, see
3791.Cm print-package-args
3792for details.
3793.It Ev WARNINGS
3794User settings.
3795If set to
3796.Sq Yes ,
3797add
3798.Ev CDIAGFLAGS
3799to
3800.Ev CFLAGS
3801and
3802.Ev CXXDIAGFLAGS
3803to
3804.Ev CXXFLAGS .
3805.It Ev WRKBUILD
3806Subdirectory of ${WRKDIR} where the actual build occurs.
3807Defaults to ${WRKSRC}, unless
3808.Ev SEPARATE_BUILD
3809is involved, in which case it is set to an appropriate value.
3810.It Ev WRKCONF
3811Subdirectory of ${WRKDIR} where the actual configure set occurs.
3812Defaults to ${WRKBUILD}.
3813.It Ev WRKDIR
3814Location where all port activity occurs.
3815Apart from the actual port, may
3816hold all kinds of cookies that checkpoint the port's build.
3817Read-only.
3818Note that WRKDIR may be a symbolic link.
3819During ports building,
3820.Pa ${WRKDIR}/bin
3821is put at the front of the
3822.Ev PATH .
3823.It Ev WRKDIST
3824Subdirectory of ${WRKDIR} in which the distribution files normally unpack.
3825Base for all patches.
3826Defaults to
3827.Pa ${WRKDIR}/${DISTNAME} .
3828Note that WRKDIST may be a symbolic link, if set to ${WRKDIR}.
3829.It Ev WRKSRC
3830Subdirectory of ${WRKDIR} where the actual source is.
3831Base for configuration (default: ${WRKDIST}).
3832Note that WRKSRC may be a symbolic link, if set to ${WRKDIR}.
3833.It Ev WRKINST
3834Subdirectory of ${WRKDIR} used as a staging area for installing the port.
3835(See
3836.Cm fake
3837target).
3838.It Ev WRKOBJDIR
3839Used as a base for the actual port working directory.
3840Defaults to
3841.Pa ${PORTSDIR}/pobj .
3842The real working directory ${WRKDIR} is created there.
3843Can be set on a per-${PKGPATH} basis.
3844For instance, setting WRKOBJDIR_www/mozilla=/tmp/obj
3845will affect only the mozilla port.
3846If explicitly unset (WRKOBJDIR=), the working directory is
3847created within the port directory.
3848.It Ev WRKOBJDIR_MFS
3849Alternate location for the port working directory.
3850The intent is to use an MFS based filesystem for small ports with
3851.Xr dpb 1 .
3852Active when
3853.Ev USE_MFS
3854is
3855.Sq Yes .
3856Defaults to
3857.Pa /tmp/pobj .
3858.It Ev X11BASE
3859Where X11 has been installed.
3860Default:
3861.Pa /usr/X11R6 .
3862.It Ev XAUTHORITY
3863Points to a suitable authority file for X11 interactive regression tests.
3864Defaults to
3865.Pa ${HOME}/.Xauthority .
3866.It Ev XMKMF
3867Invocation of xmkmf for a
3868.Li CONFIGURE_STYLE=imake
3869port.
3870Defaults to xmkmf -a -DPorts.
3871The -DPorts is specific to
3872.Ox
3873and is always appended.
3874.It Ev YACC
3875Name of yacc program to pass to GNU-configure, defaults to yacc.
3876GNU-configure would always try to use bison otherwise, which leads to
3877unreproducible builds.
3878Set to bison if needed.
3879.El
3880.Sh THE FAKE FRAMEWORK
3881The
3882.Cm fake
3883target is used to install the port under a staging directory first, ready for
3884packaging by the
3885.Cm package
3886target, so that the actual
3887.Cm install
3888target will use the binary package instead.
3889.Pp
3890Essentially,
3891.Cm fake
3892invokes the install process after tweaking a few variables.
3893.Pp
3894.Cm fake
3895first creates a skeleton tree under ${WRKINST}, using
3896.Xr mkdir 1
3897.Fl p .
3898.Pp
3899A
3900.Cm pre-fake
3901target may be used to complete that skeleton tree.
3902For instance, a few ports may need supplementary stuff to be present (as
3903it would be installed if the port's dependencies were present).
3904.Pp
3905In most cases,
3906.Cm pre-install
3907is preferred.
3908.Pp
3909If
3910.Cm {pre,do,post}-install
3911overrides are present, they are used with some
3912important changes, listed in
3913.Ev FAKE_SETUP :
3914.Bd -literal -offset indent
3915TRUEPREFIX=${PREFIX}
3916PREFIX=${WRKINST}${PREFIX}
3917${DESTDIRNAME}=${WRKINST}
3918.Ed
3919.Pp
3920Essentially, old install targets work transparently, except for a need to
3921change
3922.Ev PREFIX
3923to
3924.Ev TRUEPREFIX
3925for symbolic links and similar path lookups.
3926Specific traditional post install work can be simply removed, as it will
3927be taken care of by the package itself (for instance, ldconfig, or
3928texinfo's install-info).
3929.Pp
3930If no
3931.Cm do-install
3932override is present, the port is installed using
3933.Bd -literal -offset 2n
3934env -i ${MAKE_ENV} ${FAKE_SETUP} ${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
3935.Ed
3936.Pp
3937Note that this does set both PREFIX and ${DESTDIRNAME}.
3938If a port's Makefile both heeds ${DESTDIRNAME},
3939and references PREFIX explicitly,
3940FAKE_FLAGS may rectify the problem by setting PREFIX=${PREFIX}
3941(which will do the right thing, since ${PREFIX} is a
3942.Xr make 1
3943construct which will not be seen by the shell).
3944.Pp
3945${FAKE_FLAGS} is used to set variables on
3946.Xr make 1
3947command line, which will override the port Makefile contents.
3948Thus, a port that mentions DESTDIR= does not need any patch to work with fake.
3949.Pp
3950Files such as
3951.Pa ${PKGDIR}/README*
3952or
3953.Pa ${PKGDIR}/*.rc
3954get copied to
3955.Pa ${WRKINST}
3956right after the end of
3957.Cm fake ,
3958during
3959.Cm generate-readmes
3960(see the
3961.Sx FILES
3962section above for details).
3963.Sh THE DEBUG_PACKAGES INFRASTRUCTURE
3964If
3965.Ev DEBUG_PACKAGES
3966is not empty, debug packages will be built "on the side".
3967Since debug information is usually large, this is controlled on a per-arch
3968basis with
3969.Ev DEBUGINFO_ARCHS
3970controlling the behavior (set to amd64 by default).
3971.Pp
3972During the normal
3973.Cm package
3974target ,
3975.Xr build-debug-info 1
3976will be invoked to deduce debug packing-lists from the normal packing-lists,
3977and some extra makefile rules will be invoked to set aside the debug
3978information, and shrink it by processing it through ${DWZ}.
3979.Pp
3980Then each normal package will have a "shadow" debug-* package built alongside
3981it, with the exact same package signature, except it will also be tied closely
3982with the normal package.
3983.Pp
3984Figuring out what files contain debug information is entirely achieved through
3985.Cm @bin ,
3986.Cm @lib ,
3987.Cm @so
3988and
3989.Cm @static-lib
3990annotations in the base packing-lists.
3991.Pp
3992Debug packages will be produced for all subpackages in
3993.Ev DEBUG_PACKAGES .
3994Usually, the heuristics of trimming arch-independent packages
3995from
3996.Ev BUILD_PACKAGES
3997is enough.
3998In case this still produces empty debug packages, the
3999.Ev DEBUG_PACKAGES
4000list should be produced manually.
4001.Pp
4002The actual debug packages are not registered through
4003.Xr register-plist 1
4004since the information was automatically generated.
4005.Pp
4006debug package names and debug package filenames are added to
4007.Ev PKGNAMES
4008and
4009.Ev PKGFILES
4010respectively for introspection purpose.
4011.Pp
4012.Xr egdb 1
4013from ports can read debug information from a separate file, as long as
4014the original ELF file was annotated with a debuginfo link.
4015.Pp
4016That feature is used to set debug information on the side, in
4017.Pa .debug/
4018subdirectories alongside the normal binaries, shared objects and shared
4019libraries.
4020.Pp
4021For static libraries, the information can't be separated, instead the full
4022static library with debug information is provided in the
4023.Pa .debug/
4024subdirectory, while the normal static library gets stripped.
4025.Sh FLAVORS AND MULTI_PACKAGES
4026Starting with
4027.Ox 2.7 ,
4028each port can generate distinct packages through two orthogonal mechanisms:
4029.Ev FLAVORS
4030and
4031.Ev MULTI_PACKAGES .
4032.Pp
4033The current
4034.Ev MULTI_PACKAGES
4035mechanism was introduced after
4036.Ox 4.0 .
4037.Pp
4038The arch-dependent part was refined after
4039.Ox 5.0 .
4040.Pp
4041If a port can be compiled with several options, these options
4042should be turned into
4043.Ev FLAVORS .
4044The port maintainer will set
4045.Ev FLAVORS
4046to be the list of possible options in the Makefile.
4047When building the port, the package builder will set
4048.Li "FLAVOR='option1 option2...'"
4049to build a specific flavor of the port.
4050The Makefile should test the value of FLAVOR as follows:
4051.Bd -literal -offset indent
4052FLAVOR?=
4053\&.if ${FLAVOR:Moption1}
4054# what to do if option1
4055\&.endif
4056\&.if ${FLAVOR:Moption2}
4057# what to do if option2
4058\&.endif
4059.Ed
4060.Pp
4061.Nm
4062takes care of a few details, such as generating a distinct work directory for
4063each flavor, or creating a FULLPKGNAME by adding a dash separated list of
4064flavors to the base package name.
4065The order in which
4066.Ev FLAVOR
4067is specified does not matter: this dash separated list will be
4068reordered to match the ordering of
4069.Ev FLAVORS .
4070.Pp
4071It is an error to specify an option in
4072.Ev FLAVOR
4073that does not appear in
4074.Ev FLAVORS ,
4075to prevent misspellings.
4076.Pp
4077In bulk package building, flavors can be specified as a comma
4078separated list after the package directory, e.g., SUBDIR+=vim,no_x11
4079.Po
4080see
4081.Xr pkgpath 7
4082.Pc
4083.Pp
4084Finally, package information will use templates with the canonical package
4085extension if they are available: if FLAVOR='option1 option2' and both
4086COMMENT and COMMENT-option1-option2 are available, COMMENT-option1-option2 will
4087be used.
4088.Pp
4089If one build of a port can generate several distinct packages, set
4090.Ev MULTI_PACKAGES
4091accordingly.
4092Each extension of a
4093.Ev MULTI_PACKAGES
4094name should start with a dash, so that they cannot be confused with
4095.Ev FLAVORS .
4096In dependency checking and bulk builds, a subpackage can be
4097specified after a comma, e.g.,
4098.Li SUBDIR+=quake,-server .
4099.Ev MULTI_PACKAGES
4100only affects the actual package building step.
4101.Pp
4102If
4103.Ev MULTI_PACKAGES
4104is set, the packaging stage happens once for every
4105subpackage, using subpackage-specific variables.
4106For instance, if
4107.Li MULTI_PACKAGES=-main -lib -server ,
4108.Ev PKG_ARCH-main ,
4109.Ev PKG_ARCH-lib
4110and
4111.Ev PKG_ARCH-server
4112will be used for the subpackages respectively called
4113.Ev FULLPKGNAME-main ,
4114.Ev FULLPKGNAME-lib
4115and
4116.Ev FULLPKGNAME-server .
4117.Pp
4118All package information is also derived from
4119templates with SUBPACKAGE appended.
4120In the preceding example, the packing-list template for FULLPKGNAME-lib
4121must be in PLIST-lib.
4122.Pp
4123The following variables are subpackage dependent:
4124.Ev COMMENT ,
4125.Ev PKG_ARCH ,
4126.Ev PERMIT_PACKAGE ,
4127.Ev PKGFILE ,
4128.Ev PKGNAME ,
4129.Ev PKGSTEM ,
4130.Ev FULLPKGNAME ,
4131.Ev REVISION ,
4132.Ev EPOCH ,
4133.Ev FULLPKGPATH ,
4134.Ev RUN_DEPENDS ,
4135.Ev WANTLIB ,
4136.Ev LIB_DEPENDS ,
4137.Ev IGNORE ,
4138.Ev ONLY_FOR_ARCHS ,
4139.Ev NOT_FOR_ARCHS ,
4140.Ev PKG_ARGS ,
4141.Ev PREFIX ,
4142.Ev CATEGORIES ,
4143.Ev MESSAGE ,
4144.Ev UNMESSAGE ,
4145.Ev DESCR ,
4146.Ev PLIST ,
4147.Ev STATIC_PLIST ,
4148.Ev PKGSPEC .
4149.Pp
4150The usual non-MULTI_PACKAGES variables are simply used as default values
4151for all subpackages.
4152So, if you set
4153.Li "PKG_ARCH=*"
4154.Li "PKG_ARCH-main=i386"
4155then
4156.Ev PKG_ARCH-lib
4157and
4158.Ev PKG_ARCH-server
4159will both be
4160.Sq * .
4161.Pp
4162.Ev WANTLIB
4163and
4164.Ev LIB_DEPENDS
4165are special.
4166At the beginning of the build, during
4167.Cm prepare ,
4168all build dependencies will be checked,
4169which includes
4170.Ev LIB_DEPENDS ,
4171.Ev WANTLIB
4172for every subpackage.
4173As an exception, any
4174.Ev LIB_DEPENDS-sub
4175that references the current port will be ignored as a build dependency,
4176in order to avoid recursion.
4177.Pp
4178.Ev FULLPKGPATH
4179and
4180.Ev FULLPKGNAME
4181are special as well.
4182If
4183.Ev PKGNAME
4184is <stem>-<version>,
4185then
4186.Ev PKGNAME-sub
4187will be set to
4188<stem>-sub-<version>
4189by default, except for
4190.Ev PKGNAME-main
4191which has
4192.Ev PKGNAME
4193as a default.
4194Normally,
4195.Ev FULLPKGPATH-sub
4196is automatically set to the right value,
4197but in very rare cases, one may need to override the default:
4198for instance, if one specific subpackage is not affected by flavor
4199settings that affect other subpackages, e.g., for include files packs,
4200then the flavoring part of the fullpkgpath may need to be dropped.
4201.Pp
4202In terms of using the port, quite a few targets will have a subpackage
4203specific subtarget:
4204invoking
4205.Cm package
4206is the same as invoking
4207.Cm subpackage
4208for all subpackages,
4209invoking
4210.Cm install-all
4211is the same as invoking
4212.Cm install
4213for all subpackages,
4214and invoking
4215.Cm update
4216is the same as invoking
4217.Cm subupdate
4218for all subpackages.
4219.Pp
4220.Ev ONLY_FOR_ARCHS
4221and
4222.Ev NOT_FOR_ARCHS
4223interact with
4224.Ev MULTI_PACKAGES
4225and
4226.Ev IGNORE .
4227The infrastructure will automatically filter subpackages
4228that are not suitable for the current architecture.
4229Thus,
4230.Ev MULTI_PACKAGES
4231should always list all subpackages,
4232even things not buildable on the current architecture,
4233for indexing purposes.
4234.Pp
4235Starting with
4236.Ox 5.1 ,
4237.Xr bsd.port.arch.mk 5
4238should be used to simplify the handling of
4239.Ev MULTI_PACKAGES
4240in arch-dependent setups:
4241.Pp
4242Make sure
4243.Ev MULTI_PACKAGES ,
4244.Ev ONLY_FOR_ARCHS* ,
4245and
4246.Ev PSEUDO_FLAVORS
4247are defined correctly, then
4248.Bd -literal -offset indent
4249\&.include <bsd.port.arch.mk>
4250.Ed
4251.Pp
4252This will compute
4253.Ev BUILD_PACKAGES ,
4254the list of actual subpackages to build with the current setup,
4255by taking arch constraints and pseudo-flavors into account.
4256Then test
4257.Ev BUILD_PACKAGES
4258to set up the right configuration, e.g., to check if
4259.Ev SUBPACKAGE
4260.Ar -mono
4261should be built:
4262.Bd -literal -offset indent
4263\&.if ${BUILD_PACKAGES:M-mono}
4264.Ed
4265.Pp
4266The
4267.Pa lang/gcc/8
4268or
4269.Pa print/poppler
4270ports should provide examples of proper use.
4271.Pp
4272Note that
4273.Xr dpb 1
4274will break if all subpackages are not properly listed.
4275.Sh THE GENERATION OF PACKAGE INFORMATION
4276Starting after
4277.Ox 4.1
4278all package information is processed directly by
4279.Xr pkg_create 1
4280from templates in ${PKG_DIR}.
4281.Pp
4282.Bl -bullet -compact
4283.It
4284If not overridden by the user, determine which set of templates to use,
4285depending on the current SUBPACKAGE and FLAVOR information.
4286Set PLIST${SUBPACKAGE}, DESCR${SUBPACKAGE}, COMMENT${SUBPACKAGE},
4287MESSAGE${SUBPACKAGE}, UNMESSAGE${SUBPACKAGE} accordingly.
4288.It
4289Generate the actual DESCR, and if needed, MESSAGE, UNMESSAGE,
4290from the templates in ${DESCR}, ${MESSAGE}, ${UNMESSAGE}, by
4291substituting the variables in ${SUBST_VARS}, and by substituting
4292${FLAVORS} with the canonical flavor extension for this port,
4293e.g., if
4294.Li FLAVORS=no_map gfx qt2 ,
4295if
4296.Li FLAVOR=gfx no_map ,
4297this is
4298.Sq -no_map-gfx .
4299.It
4300Generate the actual packing-list from the template ${PLIST},
4301by inserting fragments
4302and applying the same variable substitutions as other package information.
4303.El
4304.Pp
4305Note that ${COMMENT} is currently not substituted.
4306.Pp
4307To avoid substitution, variables can be escaped as follows:
4308.Li "$\e{PREFIX}"
4309.Pp
4310If
4311.Ev FLAVORS
4312lists flv, then constructs such as the line
4313.Li "%%flv%%"
4314or
4315.Li "!%%flv%%"
4316in the packing-list template trigger the inclusion of
4317.Pa ${PKGDIR}/PFRAG.flv${SUBPACKAGE}
4318or
4319.Pa ${PKGDIR}/PFRAG.no-flv${SUBPACKAGE} .
4320Other fragments can be defined by simply adding
4321.Li "-Dfrag=1"
4322or
4323.Li "-Dfrag=0"
4324to
4325.Ev PKG_ARGS .
4326.Pp
4327.Xr pkg_add 1
4328now calls
4329.Xr ldconfig 8
4330directly, provided dynamic libraries have been annotated with
4331.Li "@lib libthingy.so.5.0" .
4332Adding new directories to the dynamic loader cache has been
4333deprecated.
4334It is often better to let libraries be visible as a link
4335under ${LOCALBASE}.
4336Having a separate directory is enough to trick
4337.Xr ld 1
4338into grabbing the right version.
4339Libraries used only for
4340.Xr dlopen 3
4341do not need to be visible.
4342Some programs will prefer to use rpath to find their own libraries.
4343.Pp
4344The special
4345.Cm update-plist
4346target does a fairly good job of automatically generating the packing-list
4347information.
4348.Pp
4349If
4350.Ev PLIST_REPOSITORY
4351points to a directory, all packing-lists from packages generated by
4352.Xr pkg_create 1
4353during the
4354.Cm package
4355stage are saved in
4356.Pa ${PLIST_REPOSITORY}/${MACHINE_ARCH}
4357by a script:
4358.Pa ${PORTSDIR}/infrastructure/bin/register-plist .
4359This script strips some irrelevant information and normalizes the
4360packing-list somehow, and compares it to existing information, looking
4361for relevant changes.
4362Since a package name must always be changed when the packing-list changes,
4363any attempt to replace a packing-list of a given name with a different
4364packing-list will be flagged as an error.
4365.Pp
4366In
4367.Ev MULTI_PACKAGES
4368mode, there must be separate COMMENT, DESCR, and PLIST
4369templates for each SUBPACKAGE (and optional distinct MESSAGE, UNMESSAGE
4370files in a similar way).
4371This contrasts with the
4372.Ev FLAVORS
4373situation, where all these files will automatically default to the
4374non-flavor version if there is no flavor-specific file around.
4375.Sh OBSOLETE TARGETS
4376.Bl -tag -width Ds
4377.It Cm {build,run,lib}-depends
4378The dependency mechanism now meshes
4379.Ev BUILD_DEPENDS , LIB_DEPENDS , RUN_DEPENDS, WANTLIB
4380and
4381.Ev MULTI_PACKAGES .
4382Refer to
4383.Cm prepare , install-depends , test-depends .
4384.El
4385.Sh OBSOLETE VARIABLES
4386.Bl -tag -width Ds
4387.It Ev FETCH_BEFORE_ARGS , FETCH_AFTER_ARGS
4388Set
4389.Ev FETCH_CMD
4390to point to a script that does any required special treatment instead.
4391.It Ev FETCH_DEPENDS
4392Used to specify dependencies that were needed to fetch files.
4393It is much easier to mirror locally weird distribution files.
4394.It Ev NO_EXTRACT
4395Set EXTRACT_ONLY= instead.
4396.It Ev NO_WRKDIR
4397All ports should have a working directory, as this is necessary to store
4398cookies and keep state.
4399.It Ev NO_WRKSUBDIR
4400The same functionality is obtained by setting WRKDIST=${WRKDIR}.
4401.It Ev OPSYS_VER
4402Use
4403.Ev OSREV
4404instead.
4405.It Ev PKGNAME
4406Used to refer to the full package name, has been superseded by
4407.Ev FULLPKGNAME-foo ,
4408for
4409.Ev SUBPACKAGE
4410-foo.
4411.Ev PKGNAME
4412now holds the package name, not taking multi-packages or flavors
4413into account.
4414Most ports are not concerned by this change.
4415.It Ev PLIST_SUBST
4416From
4417.Nx
4418and
4419.Fx .
4420Use SUBST_VARS instead.
4421.Ox
4422does not allow general substitutions of the form VAR=value, but uses
4423only a list of variables instead.
4424Most package files gets transformed, instead of only the packing-list.
4425.It Ev SCRIPTDIR
4426Old location for scripts related to the current port.
4427There is no reason for the semantic distinction, use
4428.Ev FILESDIR
4429for those.
4430.It Ev SITES0 , ... , SITES9
4431Supplementary locations from which distribution files and patchfiles were
4432retrieved, superseded by the more generic
4433.Ev SITES.sufx
4434matching
4435.Ev DISTFILES.sufx
4436construct.
4437.It Ev USE_BZIP2
4438The framework will automatically detect the presence of
4439.Pa .tar.bz2
4440files to extract.
4441See also
4442.Ev BZIP2 , EXTRACT_CASES ,
4443and
4444.Ev EXTRACT_SUFX .
4445.It Ev USE_ZIP
4446The framework will automatically detect the presence of
4447.Pa .zip
4448files to extract.
4449See also
4450.Ev ZIP , EXTRACT_CASES ,
4451and
4452.Ev EXTRACT_SUFX .
4453.El
4454.Sh FILES
4455.Bl -tag -width Ds
4456.It Pa ../Makefile.inc
4457Common Makefile fragment for a set of ports, included automatically.
4458.It Pa ${PORTSDIR}/distfiles
4459Default setup of ${DISTDIR}.
4460.It Pa ${DISTDIR}
4461Cache of all distribution files.
4462.It Pa distinfo
4463Checksum file.
4464Holds the output of
4465.Xr cksum 1 ,
4466using
4467.Xr sha256 1
4468for the port's ${DISTFILES*}, ${SUPDISTFILES*} and ${PATCHFILES*},
4469as well as the sizes of these files.
4470.It Pa ${DISTDIR}/${CHECKSUMFILES}
4471Cache of normal distribution files for a given port.
4472.It Pa ${DISTDIR}/${MAKESUMFILES}
4473Cache of all distribution files for a given port.
4474.It Pa ${PORTSDIR}/infrastructure/mk/*.mk
4475Actual location of the
4476.Xr make 1
4477glue for the ports tree.
4478.Xr make 1
4479looks for
4480.Pa bsd.port.mk
4481.Po
4482and
4483.Pa bsd.port.subdir.mk
4484.Pc
4485under
4486.Pa /usr/share/mk/bsd.port.mk ,
4487but that file is just a stub that redirects to the real location.
4488.It Pa ${PKGDIR}/DESCR
4489Description for the port.
4490Variables such as ${HOMEPAGE} and ${MAINTAINER} will be expanded
4491(see SUBST_VARS).
4492Multi-package ports will use DESCR${SUBPACKAGE}.
4493.It Pa ${PKGDIR}/README
4494.Ox
4495specific documentation for a port, that will be installed as
4496.Pa ${LOCALBASE}/share/doc/pkg-readmes/${PKGSTEM}
4497at the end of
4498.Cm fake .
4499Variables from
4500.Ev SUBST_VARS
4501will be expanded.
4502Multi-package ports will use
4503.Pa README${SUBPACKAGE} .
4504.It Pa ${PKGDIR}/<foo>.login
4505login.conf.d file for class <foo>.
4506Will be installed as
4507.Ar ${PREFIX}/share/examples/login.conf.d/foo
4508at the end of
4509.Cm fake .
4510When a port provides a daemon started by
4511.Xr rc.d 8
4512requiring non-default
4513.Xr login.conf 5
4514attributes, a sample file should be provided
4515and used as a template by adding
4516.Cm @sample /etc/login.conf.d/${ Ns Va class Ns }
4517to the packing list.
4518.It Pa ${PKGDIR}/<foo>.rc
4519Startup script for <foo>.
4520Will be installed as
4521.Ar ${RCDIR}/<foo>
4522at the end of
4523.Cm fake .
4524Variables from
4525.Ev SUBST_VARS
4526will be expanded.
4527.It Pa ${PORTSDIR}/plist
4528Default setup of ${PLIST_REPOSITORY}.
4529.It Pa ${PORTSDIR}/packages
4530Default setup of ${PACKAGE_REPOSITORY}.
4531.It Pa ${PACKAGE_REPOSITORY}/no-arch
4532Location of arch-independent packages.
4533.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all
4534Location of all built packages.
4535.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cache
4536Location of packages retrieved through the network.
4537.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cksums
4538Location of checksums, see
4539.Ev CHECKSUM_PACKAGES .
4540.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/cdrom
4541Location of packages suitable for the CD.
4542.It Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/ftp
4543Location of packages suitable for FTP.
4544.It Pa ${PORTSDIR}/bulk/${MACHINE_ARCH}
4545Default setup of ${BULK_COOKIES_DIR}.
4546.It Pa ${PORTSDIR}/update/${MACHINE_ARCH}
4547Default setup of ${UPDATE_COOKIES_DIR}.
4548.It Pa ${PORTSDIR}/mystuff
4549Extra directory used to store local ports before committing them.
4550All depend targets will normally look there after the normal lookup fails.
4551See
4552.Ev PORTSDIR_PATH .
4553.El
4554.Sh DIAGNOSTICS
4555Note that some of these messages are actually emitted by some other external
4556commands, but grouped here for convenience: easier to look for in
4557.Xr dpb 1 Ns 's
4558logs.
4559.Pp
4560See
4561.Ev ERRORS
4562for more details about internal diagnostics.
4563.Bl -diag
4564.It "/bin/sh: cd .../pkg - No such file or directory"
4565Emitted during
4566.Cm generate-readmes .
4567.Pa ${PKGDIR}
4568must point to an existing directory, so that
4569.Nm
4570can be certain there are no
4571.Pa MESSAGEs
4572or
4573other files pertinent to the package.
4574.It "===> Building from scratch in ..."
4575Emitted when a build creates the
4576.Pa ${WRKDIR}
4577for a port.
4578Used by
4579.Xr dpb 1
4580to separate clean builds from builds restarted after a crash
4581for statistics collection.
4582.It "Discovered old directory in ..."
4583This message comes from
4584.Xr update-plist 1 .
4585A directory was found in the packing-list file mentioned in the diagnostic.
4586That directory line used to be needed but is no longer,
4587because it's now accounted for through dependencies.
4588Indicates the old directory has been removed.
4589.It "Error: change in plist between ..."
4590Error message comes from
4591.Xr register-plist 1 .
4592.It "Error: duplicate item in packing-list"
4593Error message comes from
4594.Xr pkg_create 1 ,
4595and will result from incorrect packing-lists, such as including several
4596fragments with the same file, or having incorrect
4597.Ev PKG_ARGS-sub .
4598.It "Error: Libraries in packing-lists...and libraries from installed packages don't match"
4599The ports tree and the installed packages are out-of-sync.
4600Mixing library information from both sources might produce packages that can't
4601be installed elsewhere.
4602Cleanest fix is to update the out-of-date source (e.g., update the ports tree,
4603or build and install new packages).
4604Developers may use
4605.Ev PKG_CREATE_NO_CHECKS
4606instead, assuming they understand the implications.
4607See
4608.Cm print-package-args Pq Cm wantlib-args
4609for details.
4610.It "Fatal: can't flavor a SUBDIR"
4611A dependency mentions top_subdir,flavor.
4612Flavor would then be ignored, as it is only applied to individual ports.
4613.It "Fatal: can't subpackage a SUBDIR"
4614A dependency mentions top_subdir,-sub.
4615Subpackage would then be ignored, as it is only applied to individual ports.
4616.It "Fatal: flavor should never start with a digit"
4617This would utterly confuse
4618.Xr pkg_add 1 .
4619See
4620.Xr packages-specs 7 .
4621.It "Fatal: inclusion of <file> from <file>"
4622.Pa bsd.port.mk
4623or
4624.Pa bsd.port.subdir.mk
4625has been included from a
4626.Ev MODULE
4627or from
4628.Pa Makefile.inc ,
4629resulting in a double inclusion.
4630This would lead to weird results, such as
4631.Ev PKG_ARGS
4632being defined twice.
4633.It "Fatal: SITES* is not defined but referenced by <file> in <DISTFILES*/PATCHFILES*/SUPDISTFILES*>"
4634Pretty much self-explanatory.
4635.It "Fatal: SUBPACKAGES should always begin with -: <offending list>"
4636That is the only way to differentiate between
4637.Ev FLAVOR
4638and
4639.Ev SUBPACKAGE
4640in
4641.Xr pkgpath 7
4642specifications.
4643.It "Fatal: building ports requires correctly installed X11"
4644All file sets of the base OS, including xenocara, must be installed
4645before building ports.
4646.It "Fatal: /usr/local/lib/X11/app-defaults should exist and be a symlink"
4647.Pa /usr/local/lib/X11/app-defaults
4648is distributed as a symlink in the
4649.Pa xshare*.tgz
4650file set.
4651If xenocara was not fully installed before packages were added, it may
4652have been created as a directory instead.
4653.It "Fatal: the licensing info for <pkgname> is incomplete..."
4654Every port must have explicit defines of all
4655.Ev PERMIT_*
4656values.
4657.It "Fatal: Use 'env FLAVOR=flavor make' instead"
4658Arguments specified after
4659.Xr make 1
4660are hardcoded for all recursive sub-makes, and very difficult to override.
4661Thus,
4662.Ev FLAVOR
4663must be specified in the environment instead.
4664.It "Fatal: Use 'env SUBPACKAGE=-sub make' instead"
4665Arguments specified after
4666.Xr make 1
4667are hardcoded for all recursive sub-makes, and very difficult to override.
4668Thus,
4669.Ev SUBPACKAGE
4670must be specified in the environment instead.
4671.It "ldconfig: <dir>: No such file or directory"
4672Usually produced by
4673.Xr pkg_add 1
4674running
4675.Xr ldconfig 8 .
4676Some tools such as GNU libtool will add directories living under
4677.Pa ${WRKINST}
4678to the shared library path during the
4679.Cm fake
4680stage.
4681Of course,
4682.Xr ldconfig 8
4683will later complain after the directory no longer exists.
4684The bogus tool should be fixed to conform to
4685.Ox
4686usage.
4687.It LIB_DEPENDS <spec> not needed for <FULLPKGPATH>
4688There doesn't seem to be any WANTLIB to match the given LIB_DEPENDS.
4689Thus, the LIB_DEPENDS won't turn into a @depends line in the created package.
4690This is often because of confusion between LIB_DEPENDS and RUN_DEPENDS:
4691RUN_DEPENDS is needed for dlopen'd libraries.
4692.Pp
4693Might be intentional sometimes, if some compile flavors create static binaries,
4694for instance.
4695Also, will happen for multi-packages, where one sets LIB_DEPENDS to have
4696a given build dependency (and corresponding WANTLIB for a given SUBPACKAGE).
4697.Pp
4698See
4699.Cm print-package-args Pq Cm lib-depends-args
4700for details.
4701.It "Not built because unlinked (<tag>)"
4702See
4703.Ev UNLINKED .
4704.It "Warning: FULLPKGNAME-sub defined but not FULLPKGPATH-sub"
4705.Ev FULLPKGNAME-sub
4706has been explicitly defined by the port, instead of relying on the default,
4707but no value of
4708.Ev FULLPKGPATH-sub
4709has been given.
4710This is often an error.
4711.It "Warning: no debug-info in ..."
4712Port uses
4713.Ev DEBUG_PACKAGES
4714so the
4715.Xr build-debug-info 1
4716script expects debug information on all binaries and libraries.
4717Most probably, the build machinery for that specific port omitted -g
4718somewhere, or it runs strips during fake anyway.
4719It can also occur if
4720.Ev DEBUG_PACKAGES
4721includes subpackages with no files holding debug info.
4722.It "Warning: old style distfiles <files>... found"
4723See
4724.Cm fetch
4725for the newer way.
4726.It "Warning: symlink(s) point to non existent file."
4727Warning message comes from
4728.Xr pkg_create 1 .
4729The symlink resides in the fake area, under
4730.Pa ${WRKINST} .
4731This is only a warning because the symlink may point to a run-time dependency,
4732which obviously won't exist under
4733.Pa ${WRKINST}
4734at the time
4735.Ql make package
4736is run.
4737.It "Warning: @option no-default-conflict with no @conflict"
4738Warning message comes from
4739.Xr pkg_create 1 .
4740Most packages that waive "default-conflict" will have explicit conflict markers
4741instead.
4742Otherwise, the package will only conflict with the exact same version, with
4743some possible
4744.Ev REVISION
4745bumps.
4746Any other version or
4747.Ev FLAVOR
4748won't conflict.
4749This is generally an error, apart from very few ports like
4750.Pa devel/autoconf/* .
4751.It "groff produced empty result for <manpage>..."
4752Warning message comes from
4753.Xr pkg_create 1 .
4754Manpages are automatically formatted with
4755.Xr groff 1
4756if
4757.Ev USE_GROFF
4758is set.
4759The above message denotes an actual problem while formatting the page,
4760which should be addressed.
4761In the meantime,
4762.Xr pkg_create 1
4763still produces a package, but leaves the manpage unformatted, in the hope
4764that something will be able to make sense of it.
4765.El
4766.Sh SEE ALSO
4767.Xr clean-old-distfiles 1 ,
4768.Xr ftp 1 ,
4769.Xr pkg_add 1 ,
4770.Xr pkg_create 1 ,
4771.Xr OpenBSD::Intro 3p ,
4772.Xr bsd.port.arch.mk 5 ,
4773.Xr mk.conf 5 ,
4774.Xr port-modules 5 ,
4775.Xr library-specs 7 ,
4776.Xr mirroring-ports 7 ,
4777.Xr packages-specs 7 ,
4778.Xr pkgpath 7 ,
4779.Xr ports 7
4780.Sh HISTORY
4781The ports mechanism originally came from
4782.Fx .
4783A lot of additions were taken from
4784.Nx
4785over the seminal years.
4786.Pp
4787Since 1998, the framework has been systematically cleaned-up and reorganized
4788to remove bugs.
4789New features have been carefully introduced, trying hard to avoid
4790inconsistencies.
4791.Pp
4792.Ev FLAVORS ,
4793.Ev MULTI_PACKAGES ,
4794.Ev SEPARATE_BUILD
4795and FAKE are
4796.Ox
4797improvements.
4798Most recent additions do not come from another
4799.Bx .
4800.\" Voluntarily undocumented:
4801.\" AUTOCONF_ENV: probably not needed anyway, should be internal.
4802.Sh BUGS
4803.Ev LOCALBASE ,
4804.Ev X11BASE ,
4805.Ev BASESYSCONFDIR ,
4806.Ev VARBASE
4807and
4808.Ev PREFIX
4809are not heeded consistently.
4810Using anything but the default values has not been heavily tested.
4811Some ports may not build if you change them.
4812