Sun Jun 7 23:11:29 2020 UTC ()
doc/pkgsrc.*: regen


(rillig)
diff -r1.295 -r1.296 pkgsrc/doc/pkgsrc.html
diff -r1.293 -r1.294 pkgsrc/doc/pkgsrc.txt

cvs diff -r1.295 -r1.296 pkgsrc/doc/pkgsrc.html (expand / switch to unified diff)

--- pkgsrc/doc/pkgsrc.html 2020/06/05 07:34:49 1.295
+++ pkgsrc/doc/pkgsrc.html 2020/06/07 23:11:29 1.296
@@ -118,33 +118,34 @@ @@ -118,33 +118,34 @@
118<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt> 118<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
119</dl></dd> 119</dl></dd>
120<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk 120<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
121builds)</a></span></dt> 121builds)</a></span></dt>
122<dd><dl> 122<dd><dl>
123<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt> 123<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
124<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt> 124<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
125<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd> 125<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
126<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt> 126<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
127<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt> 127<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
128<dd><dl> 128<dd><dl>
129<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt> 129<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
130<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt> 130<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
131<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.3. Use custom directories</a></span></dt> 131<dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
132<dt><span class="sect2"><a href="#bulk.var.warn">8.4.4. Turn warnings into errors</a></span></dt> 132<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
133<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.5. Reject packages for which pkglint reports errors</a></span></dt> 133<dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
134<dt><span class="sect2"><a href="#bulk.var.strings">8.4.6. Reject packages that contain forbidden strings</a></span></dt> 134<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
135<dt><span class="sect2"><a href="#bulk.var.test">8.4.7. Reject packages whose self-test fails</a></span></dt> 135<dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
136<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.8. Reject packages that use undefined shell variables</a></span></dt> 136<dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
137<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.9. Turn off verbose logging</a></span></dt> 137<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
 138<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
138</dl></dd> 139</dl></dd>
139<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt> 140<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
140<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd> 141<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
141</dl></dd> 142</dl></dd>
142<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt> 143<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
143<dd><dl> 144<dd><dl>
144<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt> 145<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
145<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt> 146<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
146</dl></dd> 147</dl></dd>
147<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt> 148<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
148<dd><dl> 149<dd><dl>
149<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt> 150<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
150<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt> 151<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
@@ -875,33 +876,34 @@ minutes!

 @@ -875,33 +876,34 @@ minutes!

875<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt> 876<dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
876</dl></dd> 877</dl></dd>
877<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk 878<dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
878builds)</a></span></dt> 879builds)</a></span></dt>
879<dd><dl> 880<dd><dl>
880<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt> 881<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
881<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt> 882<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
882<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd> 883<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
883<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt> 884<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
884<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt> 885<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
885<dd><dl> 886<dd><dl>
886<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt> 887<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
887<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt> 888<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
888<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.3. Use custom directories</a></span></dt> 889<dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
889<dt><span class="sect2"><a href="#bulk.var.warn">8.4.4. Turn warnings into errors</a></span></dt> 890<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
890<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.5. Reject packages for which pkglint reports errors</a></span></dt> 891<dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
891<dt><span class="sect2"><a href="#bulk.var.strings">8.4.6. Reject packages that contain forbidden strings</a></span></dt> 892<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
892<dt><span class="sect2"><a href="#bulk.var.test">8.4.7. Reject packages whose self-test fails</a></span></dt> 893<dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
893<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.8. Reject packages that use undefined shell variables</a></span></dt> 894<dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
894<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.9. Turn off verbose logging</a></span></dt> 895<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
 896<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
895</dl></dd> 897</dl></dd>
896<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt> 898<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
897<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd> 899<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
898</dl></dd> 900</dl></dd>
899<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt> 901<dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
900<dd><dl> 902<dd><dl>
901<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt> 903<dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
902<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt> 904<dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
903</dl></dd> 905</dl></dd>
904<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt> 906<dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
905<dd><dl> 907<dd><dl>
906<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt> 908<dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
907<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt> 909<dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
@@ -2083,33 +2085,34 @@ PKG_OPTIONS.apache= suexec  @@ -2083,33 +2085,34 @@ PKG_OPTIONS.apache= suexec
2083<a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk 2085<a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk
2084builds)</h2></div></div></div> 2086builds)</h2></div></div></div>
2085<div class="toc"> 2087<div class="toc">
2086<p><b>Table of Contents</b></p> 2088<p><b>Table of Contents</b></p>
2087<dl class="toc"> 2089<dl class="toc">
2088<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt> 2090<dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
2089<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt> 2091<dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
2090<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd> 2092<dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
2091<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt> 2093<dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
2092<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt> 2094<dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
2093<dd><dl> 2095<dd><dl>
2094<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt> 2096<dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
2095<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt> 2097<dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
2096<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.3. Use custom directories</a></span></dt> 2098<dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
2097<dt><span class="sect2"><a href="#bulk.var.warn">8.4.4. Turn warnings into errors</a></span></dt> 2099<dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
2098<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.5. Reject packages for which pkglint reports errors</a></span></dt> 2100<dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
2099<dt><span class="sect2"><a href="#bulk.var.strings">8.4.6. Reject packages that contain forbidden strings</a></span></dt> 2101<dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
2100<dt><span class="sect2"><a href="#bulk.var.test">8.4.7. Reject packages whose self-test fails</a></span></dt> 2102<dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
2101<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.8. Reject packages that use undefined shell variables</a></span></dt> 2103<dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
2102<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.9. Turn off verbose logging</a></span></dt> 2104<dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
 2105<dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
2103</dl></dd> 2106</dl></dd>
2104<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt> 2107<dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
2105<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd> 2108<dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
2106</dl> 2109</dl>
2107</div> 2110</div>
2108<p>For a number of reasons, you may want to build binary packages 2111<p>For a number of reasons, you may want to build binary packages
2109for a large selected set of packages in pkgsrc, or even for all pkgsrc packages. 2112for a large selected set of packages in pkgsrc, or even for all pkgsrc packages.
2110For instance, when you have multiple machines that should run the same software, 2113For instance, when you have multiple machines that should run the same software,
2111it is wasted time if they all build their packages themselves from source. 2114it is wasted time if they all build their packages themselves from source.
2112Or you may want to build a list of packages you want and check them before 2115Or you may want to build a list of packages you want and check them before
2113deploying onto production systems. 2116deploying onto production systems.
2114There is a way of getting a set of binary packages: 2117There is a way of getting a set of binary packages:
2115the bulk build system, or pbulk ("p" stands for "parallel"). 2118the bulk build system, or pbulk ("p" stands for "parallel").
@@ -2280,111 +2283,194 @@ BUILDLINK_TRANSFORM+= rm:-Werror=char- @@ -2280,111 +2283,194 @@ BUILDLINK_TRANSFORM+= rm:-Werror=char-
2280.endif 2283.endif
2281</pre> 2284</pre>
2282<p>If the error messages from the compiler are valid and the code 2285<p>If the error messages from the compiler are valid and the code
2283needs to be fixed, prepare a local patch (see 2286needs to be fixed, prepare a local patch (see
2284<code class="varname">LOCALPATCHES</code>) and report the bug to the upstream 2287<code class="varname">LOCALPATCHES</code>) and report the bug to the upstream
2285authors of the package, providing them with the information you collected 2288authors of the package, providing them with the information you collected
2286above.</p> 2289above.</p>
2287<p>Patches that are not essential for the package to work should only 2290<p>Patches that are not essential for the package to work should only
2288be reported upstream but not committed to pkgsrc, to make future updates 2291be reported upstream but not committed to pkgsrc, to make future updates
2289easier.</p> 2292easier.</p>
2290</div> 2293</div>
2291<div class="sect2"> 2294<div class="sect2">
2292<div class="titlepage"><div><div><h3 class="title"> 2295<div class="titlepage"><div><div><h3 class="title">
2293<a name="bulk.var.dirs"></a>8.4.3. Use custom directories</h3></div></div></div> 2296<a name="bulk.var.builderr"></a>8.4.3. Force compiler options only in the build phase</h3></div></div></div>
 2297<p>When adding custom compiler flags via <code class="varname">CFLAGS</code>,
 2298these apply to all phases of the package build process. Especially in the
 2299configure phase, adding <code class="literal">-Werror</code> leads to wrong
 2300decisions. The GNU configure scripts feed many small test programs to the
 2301C compiler to see whether certain headers are available, functions are
 2302defined in a library and programs can be run. In many cases these
 2303programs would not survive a strict compiler run with <code class="literal">-Wall
 2304-Wextra -Werror</code>.</p>
 2305<p>The pkgsrc infrastructure is flexible enough to support compiler
 2306options being added between the <code class="literal">configure</code> and
 2307<code class="literal">build</code> phases. It's a little more complicated than the
 2308other examples in this section but still easy enough.</p>
 2309<p>The basic idea is to use the pkgsrc compiler wrapper to inject the
 2310desired compiler options. The compiler wrapper's original task is to hide
 2311unwanted directories of include files and to normalize compiler options.
 2312It does this by wrapping the compiler command and rewriting the command
 2313line. To see this in action, run <span class="command"><strong>bmake patch</strong></span> in a
 2314package directory and examine the
 2315<code class="filename">work/.cwrappers/config</code> directory. It contains
 2316individual configurations for the C compiler and the related tools. The
 2317plan is to find a hook between the configure and build phases, and to
 2318modify these configuration files at that point.</p>
 2319<p>To find this hook, have a look at
 2320<code class="filename">mk/build/build.mk</code>, which contains among others the
 2321<code class="literal">pre-build-checks-hook</code>. The word
 2322<code class="literal">checks</code> doesn't quite fit, but the
 2323<code class="literal">pre-build-hook</code> sounds good enough.</p>
 2324<p>The code to be included in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> is:</p>
 2325<pre class="programlisting">
 2326# Just a few example options.
 2327BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
 2328
 2329.if ${BUILD_ONLY_CFLAGS:U:M*}
 2330pre-build-checks-hook: add-build-only-cflags
 2331
 2332add-build-only-cflags: .PHONY
 2333 ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
 2334 ${TEST} ! -f ${.TARGET} || exit 0; \
 2335 for flag in ${BUILD_ONLY_CFLAGS}; do \
 2336 ${ECHO} "append=$$flag" &gt;&gt; cc; \
 2337 done; \
 2338 &gt; ${.TARGET}
 2339.endif
 2340</pre>
 2341<p>(When editing the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, make sure that the commands of the
 2342<code class="literal">add-build-only-cflags</code> target are indented with a tab,
 2343not with spaces.)</p>
 2344<p>The condition in the <code class="literal">.if</code> statement contains the
 2345<code class="literal">:U</code> modifier to prevent parse errors if the variable
 2346should be undefined, possibly because it is only defined for a subset of
 2347the packages. The <code class="literal">:M*</code> modifier ensures that there is
 2348at least one compiler option, to prevent a syntax error in the shell
 2349parser.</p>
 2350<p>The code around the <code class="literal">${.TARGET}</code> variable ensures
 2351that the additional compiler options are only appended once, even if
 2352<span class="command"><strong>bmake build</strong></span> is run multiple times. To do this, it
 2353creates a marker file.</p>
 2354<p>To verify that this setup works, run <span class="command"><strong>bmake
 2355configure</strong></span> in a package directory. Up to now, everything works
 2356as usual. Examine the directory
 2357<code class="filename">work/.cwrappers/config</code> to see that the compiler
 2358options from <code class="varname">BUILD_ONLY_CFLAGS</code> are not yet added to
 2359the file <code class="filename">cc</code>. Examine the tail of the
 2360<code class="filename">work/.work.log</code> file to see that the normal compiler
 2361options are used.</p>
 2362<p>Now run <span class="command"><strong>bmake build</strong></span>. This will append the
 2363options to the file <code class="filename">cc</code> and will create the marker
 2364file in the same directory. After that, the build starts as usual, but
 2365with the added compiler options. Examine the tail of the file
 2366<code class="filename">work/.work.log</code> to see that the lines starting with
 2367<code class="literal">[*]</code> don't contain the compiler options, but the
 2368corresponding lines starting with <code class="literal">&lt;.&gt;</code> do end
 2369with these options.</p>
 2370<p>Building packages using this setup variant and fixing the resulting
 2371bugs is the same as in <a class="xref" href="#bulk.var.comperr" title="8.4.2. Detect classes of bugs by forcing compiler warnings">Section 8.4.2, &#8220;Detect classes of bugs by forcing compiler warnings&#8221;</a>.</p>
 2372</div>
 2373<div class="sect2">
 2374<div class="titlepage"><div><div><h3 class="title">
 2375<a name="bulk.var.dirs"></a>8.4.4. Use custom directories</h3></div></div></div>
2294<p>Some directories like <code class="varname">PREFIX</code>, 2376<p>Some directories like <code class="varname">PREFIX</code>,
2295<code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>, 2377<code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>,
2296<code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be 2378<code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be
2297configured in pkgsrc. Set these to arbitrary paths during bootstrap or 2379configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2298afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2380afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2299<pre class="programlisting"> 2381<pre class="programlisting">
2300PREFIX= /a-random-uuid 2382PREFIX= /a-random-uuid
2301PKG_SYSCONFDIR= /a-random-uuid 2383PKG_SYSCONFDIR= /a-random-uuid
2302VARBASE= /a-random-uuid 2384VARBASE= /a-random-uuid
2303PKGMANDIR= a-random-uuid 2385PKGMANDIR= a-random-uuid
2304PKG_INFODIR= a-random-uuid 2386PKG_INFODIR= a-random-uuid
2305</pre> 2387</pre>
2306</div> 2388</div>
2307<div class="sect2"> 2389<div class="sect2">
2308<div class="titlepage"><div><div><h3 class="title"> 2390<div class="titlepage"><div><div><h3 class="title">
2309<a name="bulk.var.warn"></a>8.4.4. Turn warnings into errors</h3></div></div></div> 2391<a name="bulk.var.warn"></a>8.4.5. Turn warnings into errors</h3></div></div></div>
2310<p>When building a package, warnings are typically ignored since they 2392<p>When building a package, warnings are typically ignored since they
2311just flow by and do not cause the build to fail immediately. To find 2393just flow by and do not cause the build to fail immediately. To find
2312these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2394these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2313<pre class="programlisting"> 2395<pre class="programlisting">
2314DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)" 2396DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2315WARNING_MSG= ${FAIL_MSG} "(was warning)" 2397WARNING_MSG= ${FAIL_MSG} "(was warning)"
2316</pre> 2398</pre>
2317<p>(There are many more classes of warnings in pkgsrc, and most of 2399<p>(There are many more classes of warnings in pkgsrc, and most of
2318them can be redefined with a simple definition like above.</p> 2400them can be redefined with a simple definition like above.</p>
2319<p>If a package suggests to add <code class="varname">USE_TOOLS+=perl</code> to 2401<p>If a package suggests to add <code class="varname">USE_TOOLS+=perl</code> to
2320the package Makefile, research whether the package actually needs Perl. 2402the package Makefile, research whether the package actually needs Perl.
2321If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package 2403If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package
2322Makefile, and if it doesn't, add 2404Makefile, and if it doesn't, add
2323<code class="varname">TOOLS_BROKEN+=perl</code>.</p> 2405<code class="varname">TOOLS_BROKEN+=perl</code>.</p>
2324</div> 2406</div>
2325<div class="sect2"> 2407<div class="sect2">
2326<div class="titlepage"><div><div><h3 class="title"> 2408<div class="titlepage"><div><div><h3 class="title">
2327<a name="bulk.var.pkglint"></a>8.4.5. Reject packages for which pkglint reports errors</h3></div></div></div> 2409<a name="bulk.var.pkglint"></a>8.4.6. Reject packages for which pkglint reports errors</h3></div></div></div>
2328<p>Using pkglint as part of the regular build process is mostly a 2410<p>Using pkglint as part of the regular build process is mostly a
2329waste of time. If you want to fix some of the warnings, just run pkglint 2411waste of time. If you want to fix some of the warnings, just run pkglint
2330recursively on the whole pkgsrc tree. This will take a few minutes (up to 2412recursively on the whole pkgsrc tree. This will take a few minutes (up to
233110), which is much faster than a complete bulk build.</p> 241310), which is much faster than a complete bulk build.</p>
2332</div> 2414</div>
2333<div class="sect2"> 2415<div class="sect2">
2334<div class="titlepage"><div><div><h3 class="title"> 2416<div class="titlepage"><div><div><h3 class="title">
2335<a name="bulk.var.strings"></a>8.4.6. Reject packages that contain forbidden strings</h3></div></div></div> 2417<a name="bulk.var.strings"></a>8.4.7. Reject packages that contain forbidden strings</h3></div></div></div>
2336<p>To ensure that the binary packages don't contain references to the 2418<p>To ensure that the binary packages don't contain references to the
2337build directory, there is already <code class="varname">CHECK_WRKREF</code>. If 2419build directory, there is already <code class="varname">CHECK_WRKREF</code>. If
2338that variable includes the item <code class="literal">extra</code>, it is 2420that variable includes the item <code class="literal">extra</code>, it is
2339possible to define additional patterns that must not appear in any 2421possible to define additional patterns that must not appear in any
2340installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2422installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2341<pre class="programlisting"> 2423<pre class="programlisting">
2342CHECK_WRKREF= extra 2424CHECK_WRKREF= extra
2343CHECK_WRKREF_EXTRA_DIRS+= /usr/local 2425CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2344CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg 2426CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2345CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@ 2427CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2346</pre> 2428</pre>
2347<p>The above patterns will probably generate many false positives, 2429<p>The above patterns will probably generate many false positives,
2348therefore the results need to be taken with a grain of salt.</p> 2430therefore the results need to be taken with a grain of salt.</p>
2349</div> 2431</div>
2350<div class="sect2"> 2432<div class="sect2">
2351<div class="titlepage"><div><div><h3 class="title"> 2433<div class="titlepage"><div><div><h3 class="title">
2352<a name="bulk.var.test"></a>8.4.7. Reject packages whose self-test fails</h3></div></div></div> 2434<a name="bulk.var.test"></a>8.4.8. Reject packages whose self-test fails</h3></div></div></div>
2353<p>To run the test suites that come with each package, add this line 2435<p>To run the test suites that come with each package, add this line
2354to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2436to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2355<pre class="programlisting"> 2437<pre class="programlisting">
2356PKGSRC_RUN_TEST= yes 2438PKGSRC_RUN_TEST= yes
2357</pre> 2439</pre>
2358<p>Be prepared that even the most basic packages fail this test. When 2440<p>Be prepared that even the most basic packages fail this test. When
2359doing a bulk build with this, it will often abort in the early phase 2441doing a bulk build with this, it will often abort in the early phase
2360where the packages are scanned for their dependencies since there are 2442where the packages are scanned for their dependencies since there are
2361cyclic dependencies. There is still a lot to do in this area.</p> 2443cyclic dependencies. There is still a lot to do in this area.</p>
2362</div> 2444</div>
2363<div class="sect2"> 2445<div class="sect2">
2364<div class="titlepage"><div><div><h3 class="title"> 2446<div class="titlepage"><div><div><h3 class="title">
2365<a name="bulk.var.shvar"></a>8.4.8. Reject packages that use undefined shell variables</h3></div></div></div> 2447<a name="bulk.var.shvar"></a>8.4.9. Reject packages that use undefined shell variables</h3></div></div></div>
2366<p>To catch typos in the shell snippets from the Makefile fragments, 2448<p>To catch typos in the shell snippets from the Makefile fragments,
2367add the <code class="literal">-u</code> flag to most of the commands by adding this 2449add the <code class="literal">-u</code> flag to most of the commands by adding this
2368line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2450line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2369<pre class="programlisting"> 2451<pre class="programlisting">
2370RUN= @set -eu; 2452RUN= @set -eu;
2371</pre> 2453</pre>
 2454<p>After that, ensure that none of the bulk build log files (even
 2455those for successfully built packages) contains the string
 2456<code class="literal">parameter not set</code> or whatever error message the
 2457command <span class="command"><strong>sh -ceu '$undefined'</strong></span> outputs.</p>
2372<p>See <code class="filename">mk/misc/common.mk</code> for the existing 2458<p>See <code class="filename">mk/misc/common.mk</code> for the existing
2373definition.</p> 2459definition.</p>
2374</div> 2460</div>
2375<div class="sect2"> 2461<div class="sect2">
2376<div class="titlepage"><div><div><h3 class="title"> 2462<div class="titlepage"><div><div><h3 class="title">
2377<a name="bulk.var.quiet"></a>8.4.9. Turn off verbose logging</h3></div></div></div> 2463<a name="bulk.var.quiet"></a>8.4.10. Turn off verbose logging</h3></div></div></div>
2378<p>The build logs of a package are often quite long. This allows error 2464<p>The build logs of a package are often quite long. This allows error
2379messages or other interesting details to hide between the noise. To make 2465messages or other interesting details to hide between the noise. To make
2380the actual error message stand out more, add these lines to 2466the actual error message stand out more, add these lines to
2381<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 2467<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2382<pre class="programlisting"> 2468<pre class="programlisting">
2383GNU_CONFIGURE_QUIET= yes 2469GNU_CONFIGURE_QUIET= yes
2384MAKE_FLAGS+= -s 2470MAKE_FLAGS+= -s
2385</pre> 2471</pre>
2386<p>The <code class="literal">-s</code> option works for both GNU Make and BSD 2472<p>The <code class="literal">-s</code> option works for both GNU Make and BSD
2387Make. On exotic platforms with their own make, it may be a little 2473Make. On exotic platforms with their own make, it may be a little
2388different.</p> 2474different.</p>
2389</div> 2475</div>
2390</div> 2476</div>
@@ -6952,60 +7038,26 @@ ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site @@ -6952,60 +7038,26 @@ ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site
6952 result before putting it into 7038 result before putting it into
6953 <code class="filename">PLIST</code>. On upgrades, it's useful to 7039 <code class="filename">PLIST</code>. On upgrades, it's useful to
6954 diff the output of this command against an already 7040 diff the output of this command against an already
6955 existing <code class="filename">PLIST</code> file.</p> 7041 existing <code class="filename">PLIST</code> file.</p>
6956<p>If the package installs files via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or 7042<p>If the package installs files via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or
6957 other methods that don't update file access times, be 7043 other methods that don't update file access times, be
6958 sure to add these files manually to your 7044 sure to add these files manually to your
6959 <code class="filename">PLIST</code>, as the <span class="quote">&#8220;<span class="quote">find 7045 <code class="filename">PLIST</code>, as the <span class="quote">&#8220;<span class="quote">find
6960 -newer</span>&#8221;</span> command used by this target won't catch 7046 -newer</span>&#8221;</span> command used by this target won't catch
6961 them!</p> 7047 them!</p>
6962<p>See <a class="xref" href="#print-PLIST" title="15.3. Tweaking output of make print-PLIST">Section 15.3, &#8220;Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>&#8221;</a> for more 7048<p>See <a class="xref" href="#print-PLIST" title="15.3. Tweaking output of make print-PLIST">Section 15.3, &#8220;Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>&#8221;</a> for more
6963 information on this target.</p> 7049 information on this target.</p>
6964</dd> 7050</dd>
6965<dt><span class="term">bulk-package</span></dt> 
6966<dd> 
6967<p>Used to do bulk builds. If an appropriate binary 
6968 package already exists, no action is taken. If not, this 
6969 target will compile, install and package it (and its 
6970 depends, if <code class="varname">PKG_DEPENDS</code> is set 
6971 properly. See <a class="xref" href="#bulk" title="Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)">Chapter 8, <i>Creating binary packages for everything in pkgsrc (bulk 
6972builds)</i></a>). 
6973 After creating the binary package, the sources, the 
6974 just-installed package and its required packages are 
6975 removed, preserving free disk space.</p> 
6976<p><span class="emphasis"><em>Beware that this target may deinstall 
6977 all packages installed on a system!</em></span></p> 
6978</dd> 
6979<dt><span class="term">bulk-install</span></dt> 
6980<dd> 
6981<p>Used during bulk-installs to install required 
6982 packages. If an up-to-date binary package is available, 
6983 it will be installed via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. If not, 
6984 <span class="command"><strong>make bulk-package</strong></span> will be executed, 
6985 but the installed binary won't be removed.</p> 
6986<p>A binary package is considered 
6987 <span class="quote">&#8220;<span class="quote">up-to-date</span>&#8221;</span> to be installed via 
6988 <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> if:</p> 
6989<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 
6990<li class="listitem"><p>None of the package's files 
6991 (<code class="filename">Makefile</code>, ...) were modified 
6992 since it was built.</p></li> 
6993<li class="listitem"><p>None of the package's required (binary) 
6994 packages were modified since it was built.</p></li> 
6995</ul></div> 
6996<p><span class="emphasis"><em>Beware that this target may deinstall 
6997 all packages installed on a system!</em></span></p> 
6998</dd> 
6999</dl></div> 7051</dl></div>
7000</div> 7052</div>
7001</div> 7053</div>
7002<div class="chapter"> 7054<div class="chapter">
7003<div class="titlepage"><div><div><h2 class="title"> 7055<div class="titlepage"><div><div><h2 class="title">
7004<a name="tools"></a>Chapter 20. Tools needed for building or running</h2></div></div></div> 7056<a name="tools"></a>Chapter 20. Tools needed for building or running</h2></div></div></div>
7005<div class="toc"> 7057<div class="toc">
7006<p><b>Table of Contents</b></p> 7058<p><b>Table of Contents</b></p>
7007<dl class="toc"> 7059<dl class="toc">
7008<dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt> 7060<dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
7009<dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt> 7061<dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
7010<dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt> 7062<dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
7011</dl> 7063</dl>
@@ -7796,49 +7848,49 @@ pre-configure or post-configure instead. @@ -7796,49 +7848,49 @@ pre-configure or post-configure instead.
7796<p>A typical use is to update pkg-config files to include the rpath 7848<p>A typical use is to update pkg-config files to include the rpath
7797compiler options.</p> 7849compiler options.</p>
7798</dd> 7850</dd>
7799<dt><span class="term"><code class="literal">pre-install</code></span></dt> 7851<dt><span class="term"><code class="literal">pre-install</code></span></dt>
7800<dd><p>In general, the install phase should be as simple as 7852<dd><p>In general, the install phase should be as simple as
7801possible. As with the pre-build and post-build stages, it should not be 7853possible. As with the pre-build and post-build stages, it should not be
7802used to fix pathnames or user names, these belong in pre-configure 7854used to fix pathnames or user names, these belong in pre-configure
7803instead. There are only few legitimate use cases for applying 7855instead. There are only few legitimate use cases for applying
7804substitutions in this stage.</p></dd> 7856substitutions in this stage.</p></dd>
7805</dl></div> 7857</dl></div>
7806</div> 7858</div>
7807<div class="sect3"> 7859<div class="sect3">
7808<div class="titlepage"><div><div><h4 class="title"> 7860<div class="titlepage"><div><div><h4 class="title">
7809<a name="fixes.subst.where"></a>21.1.11.2. Choosing the time where the substitutions happen</h4></div></div></div> 7861<a name="fixes.subst.where"></a>21.1.11.2. Choosing the files where the substitutions happen</h4></div></div></div>
7810<p>The <code class="varname">SUBST_FILES.*</code> variable contains a list of 7862<p>The <code class="varname">SUBST_FILES.*</code> variable contains a list of
7811filename patterns. These patterns are relative to 7863filename patterns. These patterns are relative to
7812<code class="varname">WRKSRC</code> since that is where most substitutions happen. 7864<code class="varname">WRKSRC</code> since that is where most substitutions happen.
7813A typical example is:</p> 7865A typical example is:</p>
7814<pre class="programlisting"> 7866<pre class="programlisting">
7815SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch] 7867SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
7816</pre> 7868</pre>
7817<p>The above patterns, especially the last, are quite broad. The SUBST 7869<p>The above patterns, especially the last, are quite broad. The SUBST
7818implementation checks that each filename pattern that is mentioned here 7870implementation checks that each filename pattern that is mentioned here
7819has an effect. For example, if none of the 7871has an effect. For example, if none of the
7820<code class="filename">*/*/Makefile</code> files contains the patterns to be found 7872<code class="filename">*/*/Makefile</code> files contains the patterns to be found
7821and substituted, that filename pattern is redundant and should be left 7873and substituted, that filename pattern is redundant and should be left
7822out. If the text to be substituted occurs in some of the files from a 7874out. By default, the SUBST framework will complain with an error message.
7823single pattern, but not in all of them, that is totally ok, and the SUBST 7875If the text to be substituted occurs in some of the files from a single
 7876pattern, but not in all of them, that is totally ok, and the SUBST
7824framework will only print an INFO message for those files.</p> 7877framework will only print an INFO message for those files.</p>
7825<p>If there is a good reason for having redundant filename patterns, 7878<p>If there is a good reason for having redundant filename patterns,
7826set <code class="varname">SUBST_NOOP_OK.path=yes</code> in the above 7879set <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
7827example.</p> 
7828<p>Another popular way of choosing the files for the substitutions is 7880<p>Another popular way of choosing the files for the substitutions is
7829via a shell command, like this:</p> 7881via a shell command, like this:</p>
7830<pre class="programlisting"> 7882<pre class="programlisting">
7831C_FILES_CMD= cd ${WRKSRC} &amp;&amp; ${FIND} -name '*.c' 7883C_FILES_CMD= cd ${WRKSRC} &amp;&amp; ${FIND} . -name '*.c'
7832SUBST_FILES.path= ${C_FILES_CMD:sh} 7884SUBST_FILES.path= ${C_FILES_CMD:sh}
7833</pre> 7885</pre>
7834<p>The variable name <code class="varname">C_FILES_CMD</code> in this example is 7886<p>The variable name <code class="varname">C_FILES_CMD</code> in this example is
7835freely chosen and independent of the SUBST framework.</p> 7887freely chosen and independent of the SUBST framework.</p>
7836<p>In this variant, the <code class="varname">SUBST_FILES.*</code> variable 7888<p>In this variant, the <code class="varname">SUBST_FILES.*</code> variable
7837lists each file individually. Thereby chances are higher that there are 7889lists each file individually. Thereby chances are higher that there are
7838filename patterns in which no substitution happens. Since the SUBST 7890filename patterns in which no substitution happens. Since the SUBST
7839framework cannot know whether the filename patterns in 7891framework cannot know whether the filename patterns in
7840<code class="varname">SUBST_FILES.*</code> have been explicitly listed in the 7892<code class="varname">SUBST_FILES.*</code> have been explicitly listed in the
7841Makefile (where any redundant filename pattern would be suspicious) or 7893Makefile (where any redundant filename pattern would be suspicious) or
7842been generated by a shell command (in which redundant filename patterns 7894been generated by a shell command (in which redundant filename patterns
7843are more likely and to be expected), it will complain about these 7895are more likely and to be expected), it will complain about these
7844redundant filename patterns. Therefore, SUBST blocks that use a shell 7896redundant filename patterns. Therefore, SUBST blocks that use a shell
@@ -7856,35 +7908,35 @@ SUBST_SED.path= -e 's|/usr/local @@ -7856,35 +7908,35 @@ SUBST_SED.path= -e 's|/usr/local
7856<p>Each of the sed commands needs to be preceded by the 7908<p>Each of the sed commands needs to be preceded by the
7857<code class="literal">-e</code> option and should be specified on a line of its 7909<code class="literal">-e</code> option and should be specified on a line of its
7858own, to avoid hiding short sed commands at the end of a line.</p> 7910own, to avoid hiding short sed commands at the end of a line.</p>
7859<p>Since the sed commands often contain shell metacharacters as the 7911<p>Since the sed commands often contain shell metacharacters as the
7860separator (the <code class="literal">|</code> in the above example), it is common 7912separator (the <code class="literal">|</code> in the above example), it is common
7861to enclose them in single quotes.</p> 7913to enclose them in single quotes.</p>
7862<p>A common substitution is to replace placeholders of the form 7914<p>A common substitution is to replace placeholders of the form
7863<code class="literal">@VARNAME@</code> with their pkgsrc counterpart variable 7915<code class="literal">@VARNAME@</code> with their pkgsrc counterpart variable
7864<code class="literal">${VARNAME}</code>. A typical example is:</p> 7916<code class="literal">${VARNAME}</code>. A typical example is:</p>
7865<pre class="programlisting"> 7917<pre class="programlisting">
7866SUBST_VARS.path= PREFIX 7918SUBST_VARS.path= PREFIX
7867</pre> 7919</pre>
7868<p>This type of substitutions is typically done by the GNU configure 7920<p>This type of substitutions is typically done by the GNU configure
7869scripts, but in some cases these need to be overridden. The same pattern 7921scripts during the do-configure stage, but in some cases these need to be
7870is also used when a package defines patches that replace previously 7922overridden. The same pattern is also used when a package defines patches
7871hard-coded paths like <code class="literal">/usr/local</code> with a 7923that replace previously hard-coded paths like
7872<code class="literal">@PREFIX@</code> placeholder first, which then gets 7924<code class="literal">/usr/local</code> with a <code class="literal">@PREFIX@</code>
7873substituted by the actual <code class="literal">${PREFIX}</code> in the 7925placeholder first, which then gets substituted by the actual
7874pre-configure stage. In many of these cases, it works equally well to 7926<code class="literal">${PREFIX}</code> in the pre-configure stage. In many of these
7875just use the SUBST framework to directly replace 7927cases, it works equally well to just use the SUBST framework to directly
7876<code class="literal">/usr/local</code> with <code class="literal">${PREFIX}</code>, thereby 7928replace <code class="literal">/usr/local</code> with <code class="literal">${PREFIX}</code>,
7877omitting the intermediate patch file.</p> 7929thereby omitting the intermediate patch file.</p>
7878<p>If the above is not flexible enough, it is possible to not use sed 7930<p>If the above is not flexible enough, it is possible to not use sed
7879at all for the substitution but to specify an entirely different command, 7931at all for the substitution but to specify an entirely different command,
7880like this:</p> 7932like this:</p>
7881<pre class="programlisting"> 7933<pre class="programlisting">
7882SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r' 7934SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
7883</pre> 7935</pre>
7884<p>This is used for the few remaining packages in which the 7936<p>This is used for the few remaining packages in which the
7885distributed files use Windows-style line endings that need to be 7937distributed files use Windows-style line endings that need to be
7886converted to UNIX-style line endings.</p> 7938converted to UNIX-style line endings.</p>
7887</div> 7939</div>
7888<div class="sect3"> 7940<div class="sect3">
7889<div class="titlepage"><div><div><h4 class="title"> 7941<div class="titlepage"><div><div><h4 class="title">
7890<a name="fixes.subst.other"></a>21.1.11.4. Other SUBST variables</h4></div></div></div> 7942<a name="fixes.subst.other"></a>21.1.11.4. Other SUBST variables</h4></div></div></div>
@@ -13756,152 +13808,156 @@ source packages @@ -13756,152 +13808,156 @@ source packages
13756<tr> 13808<tr>
13757<td>sendto</td> 13809<td>sendto</td>
13758<td>setenv</td> 13810<td>setenv</td>
13759</tr> 13811</tr>
13760<tr> 13812<tr>
13761<td>setgid</td> 13813<td>setgid</td>
13762<td>setprogname</td> 13814<td>setprogname</td>
13763</tr> 13815</tr>
13764<tr> 13816<tr>
13765<td>setuid</td> 13817<td>setuid</td>
13766<td>sh</td> 13818<td>sh</td>
13767</tr> 13819</tr>
13768<tr> 13820<tr>
 13821<td>shebang</td>
13769<td>show</td> 13822<td>show</td>
13770<td>show-all</td> 
13771</tr> 13823</tr>
13772<tr> 13824<tr>
 13825<td>show-all</td>
13773<td>show-build-defs</td> 13826<td>show-build-defs</td>
13774<td>show-depends</td> 
13775</tr> 13827</tr>
13776<tr> 13828<tr>
 13829<td>show-depends</td>
13777<td>show-deps</td> 13830<td>show-deps</td>
13778<td>show-distfiles</td> 
13779</tr> 13831</tr>
13780<tr> 13832<tr>
 13833<td>show-distfiles</td>
13781<td>show-downlevel</td> 13834<td>show-downlevel</td>
13782<td>show-subdir-var</td> 
13783</tr> 13835</tr>
13784<tr> 13836<tr>
 13837<td>show-subdir-var</td>
13785<td>show-tools</td> 13838<td>show-tools</td>
13786<td>show-var</td> 
13787</tr> 13839</tr>
13788<tr> 13840<tr>
 13841<td>show-var</td>
13789<td>show-vars</td> 13842<td>show-vars</td>
13790<td>snprintf</td> 
13791</tr> 13843</tr>
13792<tr> 13844<tr>
 13845<td>snprintf</td>
13793<td>socket</td> 13846<td>socket</td>
13794<td>ssp</td> 
13795</tr> 13847</tr>
13796<tr> 13848<tr>
 13849<td>ssp</td>
13797<td>st_mode</td> 13850<td>st_mode</td>
13798<td>stage-install</td> 
13799</tr> 13851</tr>
13800<tr> 13852<tr>
 13853<td>stage-install</td>
13801<td>strcasestr</td> 13854<td>strcasestr</td>
13802<td>strict</td> 
13803</tr> 13855</tr>
13804<tr> 13856<tr>
 13857<td>strict</td>
13805<td>strip</td> 13858<td>strip</td>
13806<td>strndup</td> 
13807</tr> 13859</tr>
13808<tr> 13860<tr>
 13861<td>strndup</td>
13809<td>strnlen</td> 13862<td>strnlen</td>
13810<td>strsep</td> 
13811</tr> 13863</tr>
13812<tr> 13864<tr>
 13865<td>strsep</td>
13813<td>subst</td> 13866<td>subst</td>
13814<td>substitutions</td> 
13815</tr> 13867</tr>
13816<tr> 13868<tr>
 13869<td>substitutions</td>
13817<td>subversion</td> 13870<td>subversion</td>
13818<td>sun</td> 
13819</tr> 13871</tr>
13820<tr> 13872<tr>
 13873<td>sun</td>
13821<td>sunpro</td> 13874<td>sunpro</td>
13822<td>sunwspro</td> 
13823</tr> 13875</tr>
13824<tr> 13876<tr>
 13877<td>sunwspro</td>
13825<td>svn</td> 13878<td>svn</td>
13826<td>symlink</td> 
13827</tr> 13879</tr>
13828<tr> 13880<tr>
 13881<td>symlink</td>
13829<td>test</td> 13882<td>test</td>
13830<td>test-env</td> 
13831</tr> 13883</tr>
13832<tr> 13884<tr>
 13885<td>test-env</td>
13833<td>tex</td> 13886<td>tex</td>
13834<td>texlive</td> 
13835</tr> 13887</tr>
13836<tr> 13888<tr>
 13889<td>texlive</td>
13837<td>tmp</td> 13890<td>tmp</td>
13838<td>tool</td> 
13839</tr> 13891</tr>
13840<tr> 13892<tr>
 13893<td>tool</td>
13841<td>tools</td> 13894<td>tools</td>
13842<td>tools-libtool-m4-override</td> 
13843</tr> 13895</tr>
13844<tr> 13896<tr>
 13897<td>tools-libtool-m4-override</td>
13845<td>type</td> 13898<td>type</td>
13846<td>ulimit</td> 
13847</tr> 13899</tr>
13848<tr> 13900<tr>
 13901<td>ulimit</td>
13849<td>undefined</td> 13902<td>undefined</td>
13850<td>undo-replace</td> 
13851</tr> 13903</tr>
13852<tr> 13904<tr>
 13905<td>undo-replace</td>
13853<td>unlimit</td> 13906<td>unlimit</td>
13854<td>unprivileged</td> 
13855</tr> 13907</tr>
13856<tr> 13908<tr>
 13909<td>unprivileged</td>
13857<td>unprivileged-install-hook</td> 13910<td>unprivileged-install-hook</td>
13858<td>unstripped</td> 
13859</tr> 13911</tr>
13860<tr> 13912<tr>
 13913<td>unstripped</td>
13861<td>update</td> 13914<td>update</td>
13862<td>upload</td> 
13863</tr> 13915</tr>
13864<tr> 13916<tr>
 13917<td>upload</td>
13865<td>upload-distfiles</td> 13918<td>upload-distfiles</td>
13866<td>use_tools</td> 
13867</tr> 13919</tr>
13868<tr> 13920<tr>
 13921<td>use_tools</td>
13869<td>user</td> 13922<td>user</td>
13870<td>utimes</td> 
13871</tr> 13923</tr>
13872<tr> 13924<tr>
 13925<td>utimes</td>
13873<td>vasprintf</td> 13926<td>vasprintf</td>
13874<td>verbose</td> 
13875</tr> 13927</tr>
13876<tr> 13928<tr>
 13929<td>verbose</td>
13877<td>vsnprintf</td> 13930<td>vsnprintf</td>
13878<td>warn</td> 
13879</tr> 13931</tr>
13880<tr> 13932<tr>
 13933<td>warn</td>
13881<td>warning</td> 13934<td>warning</td>
13882<td>warnings</td> 
13883</tr> 13935</tr>
13884<tr> 13936<tr>
 13937<td>warnings</td>
13885<td>warnx</td> 13938<td>warnx</td>
13886<td>wattr_off</td> 
13887</tr> 13939</tr>
13888<tr> 13940<tr>
 13941<td>wattr_off</td>
13889<td>wattr_on</td> 13942<td>wattr_on</td>
13890<td>work</td> 
13891</tr> 13943</tr>
13892<tr> 13944<tr>
 13945<td>work</td>
13893<td>wrapper</td> 13946<td>wrapper</td>
 13947</tr>
 13948<tr>
13894<td>wrkdir</td> 13949<td>wrkdir</td>
 13950<td> </td>
13895</tr> 13951</tr>
13896</table> 13952</table>
13897</div> 13953</div>
13898<div class="appendix"> 13954<div class="appendix">
13899<div class="titlepage"><div><div><h1 class="title"> 13955<div class="titlepage"><div><div><h1 class="title">
13900<a name="editing"></a>Appendix E. Editing guidelines for the pkgsrc guide</h1></div></div></div> 13956<a name="editing"></a>Appendix E. Editing guidelines for the pkgsrc guide</h1></div></div></div>
13901<div class="toc"> 13957<div class="toc">
13902<p><b>Table of Contents</b></p> 13958<p><b>Table of Contents</b></p>
13903<dl class="toc"> 13959<dl class="toc">
13904<dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt> 13960<dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
13905<dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt> 13961<dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
13906</dl> 13962</dl>
13907</div> 13963</div>

cvs diff -r1.293 -r1.294 pkgsrc/doc/pkgsrc.txt (expand / switch to unified diff)

--- pkgsrc/doc/pkgsrc.txt 2020/06/05 07:34:49 1.293
+++ pkgsrc/doc/pkgsrc.txt 2020/06/07 23:11:29 1.294
@@ -101,33 +101,34 @@ I. The pkgsrc user's guide @@ -101,33 +101,34 @@ I. The pkgsrc user's guide
101 101
102 8. Creating binary packages for everything in pkgsrc (bulk builds) 102 8. Creating binary packages for everything in pkgsrc (bulk builds)
103 103
104 8.1. Preparations 104 8.1. Preparations
105 8.2. Running a bulk build 105 8.2. Running a bulk build
106 106
107 8.2.1. Configuration 107 8.2.1. Configuration
108 108
109 8.3. Requirements of a full bulk build 109 8.3. Requirements of a full bulk build
110 8.4. Bulk build variants 110 8.4. Bulk build variants
111 111
112 8.4.1. Detect unknown configure options 112 8.4.1. Detect unknown configure options
113 8.4.2. Detect classes of bugs by forcing compiler warnings 113 8.4.2. Detect classes of bugs by forcing compiler warnings
114 8.4.3. Use custom directories 114 8.4.3. Force compiler options only in the build phase
115 8.4.4. Turn warnings into errors 115 8.4.4. Use custom directories
116 8.4.5. Reject packages for which pkglint reports errors 116 8.4.5. Turn warnings into errors
117 8.4.6. Reject packages that contain forbidden strings 117 8.4.6. Reject packages for which pkglint reports errors
118 8.4.7. Reject packages whose self-test fails 118 8.4.7. Reject packages that contain forbidden strings
119 8.4.8. Reject packages that use undefined shell variables 119 8.4.8. Reject packages whose self-test fails
120 8.4.9. Turn off verbose logging 120 8.4.9. Reject packages that use undefined shell variables
 121 8.4.10. Turn off verbose logging
121 122
122 8.5. Creating a multiple CD-ROM packages collection 123 8.5. Creating a multiple CD-ROM packages collection
123 124
124 8.5.1. Example of cdpack 125 8.5.1. Example of cdpack
125 126
126 9. Directory layout of the installed files 127 9. Directory layout of the installed files
127 128
128 9.1. File system layout in ${LOCALBASE} 129 9.1. File system layout in ${LOCALBASE}
129 9.2. File system layout in ${VARBASE} 130 9.2. File system layout in ${VARBASE}
130 131
131 10. Frequently Asked Questions 132 10. Frequently Asked Questions
132 133
133 10.1. Are there any mailing lists for pkg-related discussion? 134 10.1. Are there any mailing lists for pkg-related discussion?
@@ -754,33 +755,34 @@ Table of Contents @@ -754,33 +755,34 @@ Table of Contents
754 755
7558. Creating binary packages for everything in pkgsrc (bulk builds) 7568. Creating binary packages for everything in pkgsrc (bulk builds)
756 757
757 8.1. Preparations 758 8.1. Preparations
758 8.2. Running a bulk build 759 8.2. Running a bulk build
759 760
760 8.2.1. Configuration 761 8.2.1. Configuration
761 762
762 8.3. Requirements of a full bulk build 763 8.3. Requirements of a full bulk build
763 8.4. Bulk build variants 764 8.4. Bulk build variants
764 765
765 8.4.1. Detect unknown configure options 766 8.4.1. Detect unknown configure options
766 8.4.2. Detect classes of bugs by forcing compiler warnings 767 8.4.2. Detect classes of bugs by forcing compiler warnings
767 8.4.3. Use custom directories 768 8.4.3. Force compiler options only in the build phase
768 8.4.4. Turn warnings into errors 769 8.4.4. Use custom directories
769 8.4.5. Reject packages for which pkglint reports errors 770 8.4.5. Turn warnings into errors
770 8.4.6. Reject packages that contain forbidden strings 771 8.4.6. Reject packages for which pkglint reports errors
771 8.4.7. Reject packages whose self-test fails 772 8.4.7. Reject packages that contain forbidden strings
772 8.4.8. Reject packages that use undefined shell variables 773 8.4.8. Reject packages whose self-test fails
773 8.4.9. Turn off verbose logging 774 8.4.9. Reject packages that use undefined shell variables
 775 8.4.10. Turn off verbose logging
774 776
775 8.5. Creating a multiple CD-ROM packages collection 777 8.5. Creating a multiple CD-ROM packages collection
776 778
777 8.5.1. Example of cdpack 779 8.5.1. Example of cdpack
778 780
7799. Directory layout of the installed files 7819. Directory layout of the installed files
780 782
781 9.1. File system layout in ${LOCALBASE} 783 9.1. File system layout in ${LOCALBASE}
782 9.2. File system layout in ${VARBASE} 784 9.2. File system layout in ${VARBASE}
783 785
78410. Frequently Asked Questions 78610. Frequently Asked Questions
785 787
786 10.1. Are there any mailing lists for pkg-related discussion? 788 10.1. Are there any mailing lists for pkg-related discussion?
@@ -1724,33 +1726,34 @@ Chapter 8. Creating binary packages for  @@ -1724,33 +1726,34 @@ Chapter 8. Creating binary packages for
1724 1726
1725Table of Contents 1727Table of Contents
1726 1728
17278.1. Preparations 17298.1. Preparations
17288.2. Running a bulk build 17308.2. Running a bulk build
1729 1731
1730 8.2.1. Configuration 1732 8.2.1. Configuration
1731 1733
17328.3. Requirements of a full bulk build 17348.3. Requirements of a full bulk build
17338.4. Bulk build variants 17358.4. Bulk build variants
1734 1736
1735 8.4.1. Detect unknown configure options 1737 8.4.1. Detect unknown configure options
1736 8.4.2. Detect classes of bugs by forcing compiler warnings 1738 8.4.2. Detect classes of bugs by forcing compiler warnings
1737 8.4.3. Use custom directories 1739 8.4.3. Force compiler options only in the build phase
1738 8.4.4. Turn warnings into errors 1740 8.4.4. Use custom directories
1739 8.4.5. Reject packages for which pkglint reports errors 1741 8.4.5. Turn warnings into errors
1740 8.4.6. Reject packages that contain forbidden strings 1742 8.4.6. Reject packages for which pkglint reports errors
1741 8.4.7. Reject packages whose self-test fails 1743 8.4.7. Reject packages that contain forbidden strings
1742 8.4.8. Reject packages that use undefined shell variables 1744 8.4.8. Reject packages whose self-test fails
1743 8.4.9. Turn off verbose logging 1745 8.4.9. Reject packages that use undefined shell variables
 1746 8.4.10. Turn off verbose logging
1744 1747
17458.5. Creating a multiple CD-ROM packages collection 17488.5. Creating a multiple CD-ROM packages collection
1746 1749
1747 8.5.1. Example of cdpack 1750 8.5.1. Example of cdpack
1748 1751
1749For a number of reasons, you may want to build binary packages for a large 1752For a number of reasons, you may want to build binary packages for a large
1750selected set of packages in pkgsrc, or even for all pkgsrc packages. For 1753selected set of packages in pkgsrc, or even for all pkgsrc packages. For
1751instance, when you have multiple machines that should run the same software, it 1754instance, when you have multiple machines that should run the same software, it
1752is wasted time if they all build their packages themselves from source. Or you 1755is wasted time if they all build their packages themselves from source. Or you
1753may want to build a list of packages you want and check them before deploying 1756may want to build a list of packages you want and check them before deploying
1754onto production systems. There is a way of getting a set of binary packages: 1757onto production systems. There is a way of getting a set of binary packages:
1755the bulk build system, or pbulk ("p" stands for "parallel"). This chapter 1758the bulk build system, or pbulk ("p" stands for "parallel"). This chapter
1756describes how to set it up. 1759describes how to set it up.
@@ -1916,97 +1919,173 @@ this in your local mk.conf, like this, t @@ -1916,97 +1919,173 @@ this in your local mk.conf, like this, t
1916# code 1919# code
1917# Reason why the code does not need to be fixed. 1920# Reason why the code does not need to be fixed.
1918BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts 1921BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1919.endif 1922.endif
1920 1923
1921If the error messages from the compiler are valid and the code needs to be 1924If the error messages from the compiler are valid and the code needs to be
1922fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the 1925fixed, prepare a local patch (see LOCALPATCHES) and report the bug to the
1923upstream authors of the package, providing them with the information you 1926upstream authors of the package, providing them with the information you
1924collected above. 1927collected above.
1925 1928
1926Patches that are not essential for the package to work should only be reported 1929Patches that are not essential for the package to work should only be reported
1927upstream but not committed to pkgsrc, to make future updates easier. 1930upstream but not committed to pkgsrc, to make future updates easier.
1928 1931
19298.4.3. Use custom directories 19328.4.3. Force compiler options only in the build phase
 1933
 1934When adding custom compiler flags via CFLAGS, these apply to all phases of the
 1935package build process. Especially in the configure phase, adding -Werror leads
 1936to wrong decisions. The GNU configure scripts feed many small test programs to
 1937the C compiler to see whether certain headers are available, functions are
 1938defined in a library and programs can be run. In many cases these programs
 1939would not survive a strict compiler run with -Wall -Wextra -Werror.
 1940
 1941The pkgsrc infrastructure is flexible enough to support compiler options being
 1942added between the configure and build phases. It's a little more complicated
 1943than the other examples in this section but still easy enough.
 1944
 1945The basic idea is to use the pkgsrc compiler wrapper to inject the desired
 1946compiler options. The compiler wrapper's original task is to hide unwanted
 1947directories of include files and to normalize compiler options. It does this by
 1948wrapping the compiler command and rewriting the command line. To see this in
 1949action, run bmake patch in a package directory and examine the work/.cwrappers/
 1950config directory. It contains individual configurations for the C compiler and
 1951the related tools. The plan is to find a hook between the configure and build
 1952phases, and to modify these configuration files at that point.
 1953
 1954To find this hook, have a look at mk/build/build.mk, which contains among
 1955others the pre-build-checks-hook. The word checks doesn't quite fit, but the
 1956pre-build-hook sounds good enough.
 1957
 1958The code to be included in mk.conf is:
 1959
 1960# Just a few example options.
 1961BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
 1962
 1963.if ${BUILD_ONLY_CFLAGS:U:M*}
 1964pre-build-checks-hook: add-build-only-cflags
 1965
 1966add-build-only-cflags: .PHONY
 1967 ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
 1968 ${TEST} ! -f ${.TARGET} || exit 0; \
 1969 for flag in ${BUILD_ONLY_CFLAGS}; do \
 1970 ${ECHO} "append=$$flag" >> cc; \
 1971 done; \
 1972 > ${.TARGET}
 1973.endif
 1974
 1975(When editing the mk.conf, make sure that the commands of the
 1976add-build-only-cflags target are indented with a tab, not with spaces.)
 1977
 1978The condition in the .if statement contains the :U modifier to prevent parse
 1979errors if the variable should be undefined, possibly because it is only defined
 1980for a subset of the packages. The :M* modifier ensures that there is at least
 1981one compiler option, to prevent a syntax error in the shell parser.
 1982
 1983The code around the ${.TARGET} variable ensures that the additional compiler
 1984options are only appended once, even if bmake build is run multiple times. To
 1985do this, it creates a marker file.
 1986
 1987To verify that this setup works, run bmake configure in a package directory. Up
 1988to now, everything works as usual. Examine the directory work/.cwrappers/config
 1989to see that the compiler options from BUILD_ONLY_CFLAGS are not yet added to
 1990the file cc. Examine the tail of the work/.work.log file to see that the normal
 1991compiler options are used.
 1992
 1993Now run bmake build. This will append the options to the file cc and will
 1994create the marker file in the same directory. After that, the build starts as
 1995usual, but with the added compiler options. Examine the tail of the file work
 1996/.work.log to see that the lines starting with [*] don't contain the compiler
 1997options, but the corresponding lines starting with <.> do end with these
 1998options.
 1999
 2000Building packages using this setup variant and fixing the resulting bugs is the
 2001same as in Section 8.4.2, "Detect classes of bugs by forcing compiler warnings"
 2002.
 2003
 20048.4.4. Use custom directories
1930 2005
1931Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR 2006Some directories like PREFIX, VARBASE, PKG_SYSCONFDIR, PKGMANDIR, PKG_INFODIR
1932can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or 2007can be configured in pkgsrc. Set these to arbitrary paths during bootstrap or
1933afterwards in mk.conf. 2008afterwards in mk.conf.
1934 2009
1935PREFIX= /a-random-uuid 2010PREFIX= /a-random-uuid
1936PKG_SYSCONFDIR= /a-random-uuid 2011PKG_SYSCONFDIR= /a-random-uuid
1937VARBASE= /a-random-uuid 2012VARBASE= /a-random-uuid
1938PKGMANDIR= a-random-uuid 2013PKGMANDIR= a-random-uuid
1939PKG_INFODIR= a-random-uuid 2014PKG_INFODIR= a-random-uuid
1940 2015
19418.4.4. Turn warnings into errors 20168.4.5. Turn warnings into errors
1942 2017
1943When building a package, warnings are typically ignored since they just flow by 2018When building a package, warnings are typically ignored since they just flow by
1944and do not cause the build to fail immediately. To find these warnings, 2019and do not cause the build to fail immediately. To find these warnings,
1945redefine them to errors in mk.conf. 2020redefine them to errors in mk.conf.
1946 2021
1947DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)" 2022DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
1948WARNING_MSG= ${FAIL_MSG} "(was warning)" 2023WARNING_MSG= ${FAIL_MSG} "(was warning)"
1949 2024
1950(There are many more classes of warnings in pkgsrc, and most of them can be 2025(There are many more classes of warnings in pkgsrc, and most of them can be
1951redefined with a simple definition like above. 2026redefined with a simple definition like above.
1952 2027
1953If a package suggests to add USE_TOOLS+=perl to the package Makefile, research 2028If a package suggests to add USE_TOOLS+=perl to the package Makefile, research
1954whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the 2029whether the package actually needs Perl. If it does, add USE_TOOLS+=perl to the
1955package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl. 2030package Makefile, and if it doesn't, add TOOLS_BROKEN+=perl.
1956 2031
19578.4.5. Reject packages for which pkglint reports errors 20328.4.6. Reject packages for which pkglint reports errors
1958 2033
1959Using pkglint as part of the regular build process is mostly a waste of time. 2034Using pkglint as part of the regular build process is mostly a waste of time.
1960If you want to fix some of the warnings, just run pkglint recursively on the 2035If you want to fix some of the warnings, just run pkglint recursively on the
1961whole pkgsrc tree. This will take a few minutes (up to 10), which is much 2036whole pkgsrc tree. This will take a few minutes (up to 10), which is much
1962faster than a complete bulk build. 2037faster than a complete bulk build.
1963 2038
19648.4.6. Reject packages that contain forbidden strings 20398.4.7. Reject packages that contain forbidden strings
1965 2040
1966To ensure that the binary packages don't contain references to the build 2041To ensure that the binary packages don't contain references to the build
1967directory, there is already CHECK_WRKREF. If that variable includes the item 2042directory, there is already CHECK_WRKREF. If that variable includes the item
1968extra, it is possible to define additional patterns that must not appear in any 2043extra, it is possible to define additional patterns that must not appear in any
1969installed file. This is specified in mk.conf. 2044installed file. This is specified in mk.conf.
1970 2045
1971CHECK_WRKREF= extra 2046CHECK_WRKREF= extra
1972CHECK_WRKREF_EXTRA_DIRS+= /usr/local 2047CHECK_WRKREF_EXTRA_DIRS+= /usr/local
1973CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg 2048CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
1974CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@ 2049CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
1975 2050
1976The above patterns will probably generate many false positives, therefore the 2051The above patterns will probably generate many false positives, therefore the
1977results need to be taken with a grain of salt. 2052results need to be taken with a grain of salt.
1978 2053
19798.4.7. Reject packages whose self-test fails 20548.4.8. Reject packages whose self-test fails
1980 2055
1981To run the test suites that come with each package, add this line to mk.conf. 2056To run the test suites that come with each package, add this line to mk.conf.
1982 2057
1983PKGSRC_RUN_TEST= yes 2058PKGSRC_RUN_TEST= yes
1984 2059
1985Be prepared that even the most basic packages fail this test. When doing a bulk 2060Be prepared that even the most basic packages fail this test. When doing a bulk
1986build with this, it will often abort in the early phase where the packages are 2061build with this, it will often abort in the early phase where the packages are
1987scanned for their dependencies since there are cyclic dependencies. There is 2062scanned for their dependencies since there are cyclic dependencies. There is
1988still a lot to do in this area. 2063still a lot to do in this area.
1989 2064
19908.4.8. Reject packages that use undefined shell variables 20658.4.9. Reject packages that use undefined shell variables
1991 2066
1992To catch typos in the shell snippets from the Makefile fragments, add the -u 2067To catch typos in the shell snippets from the Makefile fragments, add the -u
1993flag to most of the commands by adding this line to mk.conf. 2068flag to most of the commands by adding this line to mk.conf.
1994 2069
1995RUN= @set -eu; 2070RUN= @set -eu;
1996 2071
 2072After that, ensure that none of the bulk build log files (even those for
 2073successfully built packages) contains the string parameter not set or whatever
 2074error message the command sh -ceu '$undefined' outputs.
 2075
1997See mk/misc/common.mk for the existing definition. 2076See mk/misc/common.mk for the existing definition.
1998 2077
19998.4.9. Turn off verbose logging 20788.4.10. Turn off verbose logging
2000 2079
2001The build logs of a package are often quite long. This allows error messages or 2080The build logs of a package are often quite long. This allows error messages or
2002other interesting details to hide between the noise. To make the actual error 2081other interesting details to hide between the noise. To make the actual error
2003message stand out more, add these lines to mk.conf. 2082message stand out more, add these lines to mk.conf.
2004 2083
2005GNU_CONFIGURE_QUIET= yes 2084GNU_CONFIGURE_QUIET= yes
2006MAKE_FLAGS+= -s 2085MAKE_FLAGS+= -s
2007 2086
2008The -s option works for both GNU Make and BSD Make. On exotic platforms with 2087The -s option works for both GNU Make and BSD Make. On exotic platforms with
2009their own make, it may be a little different. 2088their own make, it may be a little different.
2010 2089
20118.5. Creating a multiple CD-ROM packages collection 20908.5. Creating a multiple CD-ROM packages collection
2012 2091
@@ -5749,55 +5828,26 @@ print-PLIST @@ -5749,55 +5828,26 @@ print-PLIST
5749 attempt to generate a new PLIST from a find -newer work/.extract_done. An 5828 attempt to generate a new PLIST from a find -newer work/.extract_done. An
5750 attempt is made to care for shared libs etc., but it is strongly 5829 attempt is made to care for shared libs etc., but it is strongly
5751 recommended to review the result before putting it into PLIST. On upgrades, 5830 recommended to review the result before putting it into PLIST. On upgrades,
5752 it's useful to diff the output of this command against an already existing 5831 it's useful to diff the output of this command against an already existing
5753 PLIST file. 5832 PLIST file.
5754 5833
5755 If the package installs files via tar(1) or other methods that don't update 5834 If the package installs files via tar(1) or other methods that don't update
5756 file access times, be sure to add these files manually to your PLIST, as 5835 file access times, be sure to add these files manually to your PLIST, as
5757 the "find -newer" command used by this target won't catch them! 5836 the "find -newer" command used by this target won't catch them!
5758 5837
5759 See Section 15.3, "Tweaking output of make print-PLIST" for more 5838 See Section 15.3, "Tweaking output of make print-PLIST" for more
5760 information on this target. 5839 information on this target.
5761 5840
5762bulk-package 
5763 
5764 Used to do bulk builds. If an appropriate binary package already exists, no 
5765 action is taken. If not, this target will compile, install and package it 
5766 (and its depends, if PKG_DEPENDS is set properly. See Chapter 8, Creating 
5767 binary packages for everything in pkgsrc (bulk builds)). After creating the 
5768 binary package, the sources, the just-installed package and its required 
5769 packages are removed, preserving free disk space. 
5770 
5771 Beware that this target may deinstall all packages installed on a system! 
5772 
5773bulk-install 
5774 
5775 Used during bulk-installs to install required packages. If an up-to-date 
5776 binary package is available, it will be installed via pkg_add(1). If not,  
5777 make bulk-package will be executed, but the installed binary won't be 
5778 removed. 
5779 
5780 A binary package is considered "up-to-date" to be installed via pkg_add(1) 
5781 if: 
5782 
5783 + None of the package's files (Makefile, ...) were modified since it was 
5784 built. 
5785 
5786 + None of the package's required (binary) packages were modified since it 
5787 was built. 
5788 
5789 Beware that this target may deinstall all packages installed on a system! 
5790 
5791Chapter 20. Tools needed for building or running 5841Chapter 20. Tools needed for building or running
5792 5842
5793Table of Contents 5843Table of Contents
5794 5844
579520.1. Tools for pkgsrc builds 584520.1. Tools for pkgsrc builds
579620.2. Tools needed by packages 584620.2. Tools needed by packages
579720.3. Tools provided by platforms 584720.3. Tools provided by platforms
5798 5848
5799The USE_TOOLS definition is used both internally by pkgsrc and also for 5849The USE_TOOLS definition is used both internally by pkgsrc and also for
5800individual packages to define what commands are needed for building a package 5850individual packages to define what commands are needed for building a package
5801(like TOOL_DEPENDS) or for later run-time of an installed packaged (such as 5851(like TOOL_DEPENDS) or for later run-time of an installed packaged (such as
5802DEPENDS). If the native system provides an adequate tool, then in many cases, a 5852DEPENDS). If the native system provides an adequate tool, then in many cases, a
5803pkgsrc package will not be used. 5853pkgsrc package will not be used.
@@ -6453,49 +6503,50 @@ post-build @@ -6453,49 +6503,50 @@ post-build
6453 with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual 6503 with ${PREFIX}) or user names (such as replacing @MY_USER@ with the actual
6454 username) belong in pre-configure or post-configure instead. 6504 username) belong in pre-configure or post-configure instead.
6455 6505
6456 A typical use is to update pkg-config files to include the rpath compiler 6506 A typical use is to update pkg-config files to include the rpath compiler
6457 options. 6507 options.
6458 6508
6459pre-install 6509pre-install
6460 6510
6461 In general, the install phase should be as simple as possible. As with the 6511 In general, the install phase should be as simple as possible. As with the
6462 pre-build and post-build stages, it should not be used to fix pathnames or 6512 pre-build and post-build stages, it should not be used to fix pathnames or
6463 user names, these belong in pre-configure instead. There are only few 6513 user names, these belong in pre-configure instead. There are only few
6464 legitimate use cases for applying substitutions in this stage. 6514 legitimate use cases for applying substitutions in this stage.
6465 6515
646621.1.11.2. Choosing the time where the substitutions happen 651621.1.11.2. Choosing the files where the substitutions happen
6467 6517
6468The SUBST_FILES.* variable contains a list of filename patterns. These patterns 6518The SUBST_FILES.* variable contains a list of filename patterns. These patterns
6469are relative to WRKSRC since that is where most substitutions happen. A typical 6519are relative to WRKSRC since that is where most substitutions happen. A typical
6470example is: 6520example is:
6471 6521
6472SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch] 6522SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
6473 6523
6474The above patterns, especially the last, are quite broad. The SUBST 6524The above patterns, especially the last, are quite broad. The SUBST
6475implementation checks that each filename pattern that is mentioned here has an 6525implementation checks that each filename pattern that is mentioned here has an
6476effect. For example, if none of the */*/Makefile files contains the patterns to 6526effect. For example, if none of the */*/Makefile files contains the patterns to
6477be found and substituted, that filename pattern is redundant and should be left 6527be found and substituted, that filename pattern is redundant and should be left
6478out. If the text to be substituted occurs in some of the files from a single 6528out. By default, the SUBST framework will complain with an error message. If
6479pattern, but not in all of them, that is totally ok, and the SUBST framework 6529the text to be substituted occurs in some of the files from a single pattern,
6480will only print an INFO message for those files. 6530but not in all of them, that is totally ok, and the SUBST framework will only
 6531print an INFO message for those files.
6481 6532
6482If there is a good reason for having redundant filename patterns, set 6533If there is a good reason for having redundant filename patterns, set
6483SUBST_NOOP_OK.path=yes in the above example. 6534SUBST_NOOP_OK.* to yes.
6484 6535
6485Another popular way of choosing the files for the substitutions is via a shell 6536Another popular way of choosing the files for the substitutions is via a shell
6486command, like this: 6537command, like this:
6487 6538
6488C_FILES_CMD= cd ${WRKSRC} && ${FIND} -name '*.c' 6539C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
6489SUBST_FILES.path= ${C_FILES_CMD:sh} 6540SUBST_FILES.path= ${C_FILES_CMD:sh}
6490 6541
6491The variable name C_FILES_CMD in this example is freely chosen and independent 6542The variable name C_FILES_CMD in this example is freely chosen and independent
6492of the SUBST framework. 6543of the SUBST framework.
6493 6544
6494In this variant, the SUBST_FILES.* variable lists each file individually. 6545In this variant, the SUBST_FILES.* variable lists each file individually.
6495Thereby chances are higher that there are filename patterns in which no 6546Thereby chances are higher that there are filename patterns in which no
6496substitution happens. Since the SUBST framework cannot know whether the 6547substitution happens. Since the SUBST framework cannot know whether the
6497filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile 6548filename patterns in SUBST_FILES.* have been explicitly listed in the Makefile
6498(where any redundant filename pattern would be suspicious) or been generated by 6549(where any redundant filename pattern would be suspicious) or been generated by
6499a shell command (in which redundant filename patterns are more likely and to be 6550a shell command (in which redundant filename patterns are more likely and to be
6500expected), it will complain about these redundant filename patterns. Therefore, 6551expected), it will complain about these redundant filename patterns. Therefore,
6501SUBST blocks that use a shell command to generate the list of filename patterns 6552SUBST blocks that use a shell command to generate the list of filename patterns
@@ -6510,33 +6561,34 @@ SUBST_SED.path= -e 's|/usr/local @@ -6510,33 +6561,34 @@ SUBST_SED.path= -e 's|/usr/local
6510 6561
6511Each of the sed commands needs to be preceded by the -e option and should be 6562Each of the sed commands needs to be preceded by the -e option and should be
6512specified on a line of its own, to avoid hiding short sed commands at the end 6563specified on a line of its own, to avoid hiding short sed commands at the end
6513of a line. 6564of a line.
6514 6565
6515Since the sed commands often contain shell metacharacters as the separator (the 6566Since the sed commands often contain shell metacharacters as the separator (the
6516| in the above example), it is common to enclose them in single quotes. 6567| in the above example), it is common to enclose them in single quotes.
6517 6568
6518A common substitution is to replace placeholders of the form @VARNAME@ with 6569A common substitution is to replace placeholders of the form @VARNAME@ with
6519their pkgsrc counterpart variable ${VARNAME}. A typical example is: 6570their pkgsrc counterpart variable ${VARNAME}. A typical example is:
6520 6571
6521SUBST_VARS.path= PREFIX 6572SUBST_VARS.path= PREFIX
6522 6573
6523This type of substitutions is typically done by the GNU configure scripts, but 6574This type of substitutions is typically done by the GNU configure scripts
6524in some cases these need to be overridden. The same pattern is also used when a 6575during the do-configure stage, but in some cases these need to be overridden.
6525package defines patches that replace previously hard-coded paths like /usr/ 6576The same pattern is also used when a package defines patches that replace
6526local with a @PREFIX@ placeholder first, which then gets substituted by the 6577previously hard-coded paths like /usr/local with a @PREFIX@ placeholder first,
6527actual ${PREFIX} in the pre-configure stage. In many of these cases, it works 6578which then gets substituted by the actual ${PREFIX} in the pre-configure stage.
6528equally well to just use the SUBST framework to directly replace /usr/local 6579In many of these cases, it works equally well to just use the SUBST framework
6529with ${PREFIX}, thereby omitting the intermediate patch file. 6580to directly replace /usr/local with ${PREFIX}, thereby omitting the
 6581intermediate patch file.
6530 6582
6531If the above is not flexible enough, it is possible to not use sed at all for 6583If the above is not flexible enough, it is possible to not use sed at all for
6532the substitution but to specify an entirely different command, like this: 6584the substitution but to specify an entirely different command, like this:
6533 6585
6534SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r' 6586SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
6535 6587
6536This is used for the few remaining packages in which the distributed files use 6588This is used for the few remaining packages in which the distributed files use
6537Windows-style line endings that need to be converted to UNIX-style line 6589Windows-style line endings that need to be converted to UNIX-style line
6538endings. 6590endings.
6539 6591
654021.1.11.4. Other SUBST variables 659221.1.11.4. Other SUBST variables
6541 6593
6542When a SUBST block is applied during a package build, a message is logged. The 6594When a SUBST block is applied during a package build, a message is logged. The
@@ -9700,58 +9752,59 @@ print-plist print-s @@ -9700,58 +9752,59 @@ print-plist print-s
9700privileged-install-hook pypi 9752privileged-install-hook pypi
9701python readme-all 9753python readme-all
9702recv recvfrom 9754recv recvfrom
9703regcomp release-localbase-lock 9755regcomp release-localbase-lock
9704release-lock relro 9756release-lock relro
9705rename reorder 9757rename reorder
9706replace replace_interpreter 9758replace replace_interpreter
9707reproducible resolv 9759reproducible resolv
9708root ruby 9760root ruby
9709send sendfile 9761send sendfile
9710sendto setenv 9762sendto setenv
9711setgid setprogname 9763setgid setprogname
9712setuid sh 9764setuid sh
9713show show-all 9765shebang show
9714show-build-defs show-depends 9766show-all show-build-defs
9715show-deps show-distfiles 9767show-depends show-deps
9716show-downlevel show-subdir-var 9768show-distfiles show-downlevel
9717show-tools show-var 9769show-subdir-var show-tools
9718show-vars snprintf 9770show-var show-vars
9719socket ssp 9771snprintf socket
9720st_mode stage-install 9772ssp st_mode
9721strcasestr strict 9773stage-install strcasestr
9722strip strndup 9774strict strip
9723strnlen strsep 9775strndup strnlen
9724subst substitutions 9776strsep subst
9725subversion sun 9777substitutions subversion
9726sunpro sunwspro 9778sun sunpro
9727svn symlink 9779sunwspro svn
9728test test-env 9780symlink test
9729tex texlive 9781test-env tex
9730tmp tool 9782texlive tmp
9731tools tools-libtool-m4-override 9783tool tools
9732type ulimit 9784tools-libtool-m4-override type
9733undefined undo-replace 9785ulimit undefined
9734unlimit unprivileged 9786undo-replace unlimit
9735unprivileged-install-hook unstripped 9787unprivileged unprivileged-install-hook
9736update upload 9788unstripped update
9737upload-distfiles use_tools 9789upload upload-distfiles
9738user utimes 9790use_tools user
9739vasprintf verbose 9791utimes vasprintf
9740vsnprintf warn 9792verbose vsnprintf
9741warning warnings 9793warn warning
9742warnx wattr_off 9794warnings warnx
9743wattr_on work 9795wattr_off wattr_on
9744wrapper wrkdir 9796work wrapper
 9797wrkdir
9745 9798
9746Appendix E. Editing guidelines for the pkgsrc guide 9799Appendix E. Editing guidelines for the pkgsrc guide
9747 9800
9748Table of Contents 9801Table of Contents
9749 9802
9750E.1. Make targets 9803E.1. Make targets
9751E.2. Procedure 9804E.2. Procedure
9752 9805
9753This section contains information on editing the pkgsrc guide itself. 9806This section contains information on editing the pkgsrc guide itself.
9754 9807
9755E.1. Make targets 9808E.1. Make targets
9756 9809
9757The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several 9810The pkgsrc guide's source code is stored in pkgsrc/doc/guide/files, and several