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