| @@ -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 |
121 | builds)</a></span></dt> | | 121 | builds)</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 |
878 | builds)</a></span></dt> | | 879 | builds)</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 |
2084 | builds)</h2></div></div></div> | | 2086 | builds)</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 |
2109 | for a large selected set of packages in pkgsrc, or even for all pkgsrc packages. | | 2112 | for a large selected set of packages in pkgsrc, or even for all pkgsrc packages. |
2110 | For instance, when you have multiple machines that should run the same software, | | 2113 | For instance, when you have multiple machines that should run the same software, |
2111 | it is wasted time if they all build their packages themselves from source. | | 2114 | it is wasted time if they all build their packages themselves from source. |
2112 | Or you may want to build a list of packages you want and check them before | | 2115 | Or you may want to build a list of packages you want and check them before |
2113 | deploying onto production systems. | | 2116 | deploying onto production systems. |
2114 | There is a way of getting a set of binary packages: | | 2117 | There is a way of getting a set of binary packages: |
2115 | the bulk build system, or pbulk ("p" stands for "parallel"). | | 2118 | the 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 |
2283 | needs to be fixed, prepare a local patch (see | | 2286 | needs 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 |
2285 | authors of the package, providing them with the information you collected | | 2288 | authors of the package, providing them with the information you collected |
2286 | above.</p> | | 2289 | above.</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 |
2288 | be reported upstream but not committed to pkgsrc, to make future updates | | 2291 | be reported upstream but not committed to pkgsrc, to make future updates |
2289 | easier.</p> | | 2292 | easier.</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>, |
| | | 2298 | these apply to all phases of the package build process. Especially in the |
| | | 2299 | configure phase, adding <code class="literal">-Werror</code> leads to wrong |
| | | 2300 | decisions. The GNU configure scripts feed many small test programs to the |
| | | 2301 | C compiler to see whether certain headers are available, functions are |
| | | 2302 | defined in a library and programs can be run. In many cases these |
| | | 2303 | programs 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 |
| | | 2306 | options 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 |
| | | 2308 | other examples in this section but still easy enough.</p> |
| | | 2309 | <p>The basic idea is to use the pkgsrc compiler wrapper to inject the |
| | | 2310 | desired compiler options. The compiler wrapper's original task is to hide |
| | | 2311 | unwanted directories of include files and to normalize compiler options. |
| | | 2312 | It does this by wrapping the compiler command and rewriting the command |
| | | 2313 | line. To see this in action, run <span class="command"><strong>bmake patch</strong></span> in a |
| | | 2314 | package directory and examine the |
| | | 2315 | <code class="filename">work/.cwrappers/config</code> directory. It contains |
| | | 2316 | individual configurations for the C compiler and the related tools. The |
| | | 2317 | plan is to find a hook between the configure and build phases, and to |
| | | 2318 | modify 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. |
| | | 2327 | BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"' |
| | | 2328 | |
| | | 2329 | .if ${BUILD_ONLY_CFLAGS:U:M*} |
| | | 2330 | pre-build-checks-hook: add-build-only-cflags |
| | | 2331 | |
| | | 2332 | add-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" >> cc; \ |
| | | 2337 | done; \ |
| | | 2338 | > ${.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, |
| | | 2343 | not 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 |
| | | 2346 | should be undefined, possibly because it is only defined for a subset of |
| | | 2347 | the packages. The <code class="literal">:M*</code> modifier ensures that there is |
| | | 2348 | at least one compiler option, to prevent a syntax error in the shell |
| | | 2349 | parser.</p> |
| | | 2350 | <p>The code around the <code class="literal">${.TARGET}</code> variable ensures |
| | | 2351 | that 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 |
| | | 2353 | creates a marker file.</p> |
| | | 2354 | <p>To verify that this setup works, run <span class="command"><strong>bmake |
| | | 2355 | configure</strong></span> in a package directory. Up to now, everything works |
| | | 2356 | as usual. Examine the directory |
| | | 2357 | <code class="filename">work/.cwrappers/config</code> to see that the compiler |
| | | 2358 | options from <code class="varname">BUILD_ONLY_CFLAGS</code> are not yet added to |
| | | 2359 | the 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 |
| | | 2361 | options are used.</p> |
| | | 2362 | <p>Now run <span class="command"><strong>bmake build</strong></span>. This will append the |
| | | 2363 | options to the file <code class="filename">cc</code> and will create the marker |
| | | 2364 | file in the same directory. After that, the build starts as usual, but |
| | | 2365 | with 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 |
| | | 2368 | corresponding lines starting with <code class="literal"><.></code> do end |
| | | 2369 | with these options.</p> |
| | | 2370 | <p>Building packages using this setup variant and fixing the resulting |
| | | 2371 | bugs 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, “Detect classes of bugs by forcing compiler warnings”</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 |
2297 | configured in pkgsrc. Set these to arbitrary paths during bootstrap or | | 2379 | configured in pkgsrc. Set these to arbitrary paths during bootstrap or |
2298 | afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> | | 2380 | afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> |
2299 | <pre class="programlisting"> | | 2381 | <pre class="programlisting"> |
2300 | PREFIX= /a-random-uuid | | 2382 | PREFIX= /a-random-uuid |
2301 | PKG_SYSCONFDIR= /a-random-uuid | | 2383 | PKG_SYSCONFDIR= /a-random-uuid |
2302 | VARBASE= /a-random-uuid | | 2384 | VARBASE= /a-random-uuid |
2303 | PKGMANDIR= a-random-uuid | | 2385 | PKGMANDIR= a-random-uuid |
2304 | PKG_INFODIR= a-random-uuid | | 2386 | PKG_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 |
2311 | just flow by and do not cause the build to fail immediately. To find | | 2393 | just flow by and do not cause the build to fail immediately. To find |
2312 | these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> | | 2394 | these 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"> |
2314 | DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)" | | 2396 | DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)" |
2315 | WARNING_MSG= ${FAIL_MSG} "(was warning)" | | 2397 | WARNING_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 |
2318 | them can be redefined with a simple definition like above.</p> | | 2400 | them 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 |
2320 | the package Makefile, research whether the package actually needs Perl. | | 2402 | the package Makefile, research whether the package actually needs Perl. |
2321 | If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package | | 2403 | If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package |
2322 | Makefile, and if it doesn't, add | | 2404 | Makefile, 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 |
2329 | waste of time. If you want to fix some of the warnings, just run pkglint | | 2411 | waste of time. If you want to fix some of the warnings, just run pkglint |
2330 | recursively on the whole pkgsrc tree. This will take a few minutes (up to | | 2412 | recursively on the whole pkgsrc tree. This will take a few minutes (up to |
2331 | 10), which is much faster than a complete bulk build.</p> | | 2413 | 10), 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 |
2337 | build directory, there is already <code class="varname">CHECK_WRKREF</code>. If | | 2419 | build directory, there is already <code class="varname">CHECK_WRKREF</code>. If |
2338 | that variable includes the item <code class="literal">extra</code>, it is | | 2420 | that variable includes the item <code class="literal">extra</code>, it is |
2339 | possible to define additional patterns that must not appear in any | | 2421 | possible to define additional patterns that must not appear in any |
2340 | installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> | | 2422 | installed 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"> |
2342 | CHECK_WRKREF= extra | | 2424 | CHECK_WRKREF= extra |
2343 | CHECK_WRKREF_EXTRA_DIRS+= /usr/local | | 2425 | CHECK_WRKREF_EXTRA_DIRS+= /usr/local |
2344 | CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg | | 2426 | CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg |
2345 | CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@ | | 2427 | CHECK_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, |
2348 | therefore the results need to be taken with a grain of salt.</p> | | 2430 | therefore 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 |
2354 | to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> | | 2436 | to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> |
2355 | <pre class="programlisting"> | | 2437 | <pre class="programlisting"> |
2356 | PKGSRC_RUN_TEST= yes | | 2438 | PKGSRC_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 |
2359 | doing a bulk build with this, it will often abort in the early phase | | 2441 | doing a bulk build with this, it will often abort in the early phase |
2360 | where the packages are scanned for their dependencies since there are | | 2442 | where the packages are scanned for their dependencies since there are |
2361 | cyclic dependencies. There is still a lot to do in this area.</p> | | 2443 | cyclic 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, |
2367 | add the <code class="literal">-u</code> flag to most of the commands by adding this | | 2449 | add the <code class="literal">-u</code> flag to most of the commands by adding this |
2368 | line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> | | 2450 | line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> |
2369 | <pre class="programlisting"> | | 2451 | <pre class="programlisting"> |
2370 | RUN= @set -eu; | | 2452 | RUN= @set -eu; |
2371 | </pre> | | 2453 | </pre> |
| | | 2454 | <p>After that, ensure that none of the bulk build log files (even |
| | | 2455 | those for successfully built packages) contains the string |
| | | 2456 | <code class="literal">parameter not set</code> or whatever error message the |
| | | 2457 | command <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 |
2373 | definition.</p> | | 2459 | definition.</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 |
2379 | messages or other interesting details to hide between the noise. To make | | 2465 | messages or other interesting details to hide between the noise. To make |
2380 | the actual error message stand out more, add these lines to | | 2466 | the 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"> |
2383 | GNU_CONFIGURE_QUIET= yes | | 2469 | GNU_CONFIGURE_QUIET= yes |
2384 | MAKE_FLAGS+= -s | | 2470 | MAKE_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 |
2387 | Make. On exotic platforms with their own make, it may be a little | | 2473 | Make. On exotic platforms with their own make, it may be a little |
2388 | different.</p> | | 2474 | different.</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">“<span class="quote">find | | 7045 | <code class="filename">PLIST</code>, as the <span class="quote">“<span class="quote">find |
6960 | -newer</span>”</span> command used by this target won't catch | | 7046 | -newer</span>”</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, “Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>”</a> for more | | 7048 | <p>See <a class="xref" href="#print-PLIST" title="15.3. Tweaking output of make print-PLIST">Section 15.3, “Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>”</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 | | | |
6972 | builds)</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">“<span class="quote">up-to-date</span>”</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 |
7797 | compiler options.</p> | | 7849 | compiler 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 |
7801 | possible. As with the pre-build and post-build stages, it should not be | | 7853 | possible. As with the pre-build and post-build stages, it should not be |
7802 | used to fix pathnames or user names, these belong in pre-configure | | 7854 | used to fix pathnames or user names, these belong in pre-configure |
7803 | instead. There are only few legitimate use cases for applying | | 7855 | instead. There are only few legitimate use cases for applying |
7804 | substitutions in this stage.</p></dd> | | 7856 | substitutions 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 |
7811 | filename patterns. These patterns are relative to | | 7863 | filename 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. |
7813 | A typical example is:</p> | | 7865 | A typical example is:</p> |
7814 | <pre class="programlisting"> | | 7866 | <pre class="programlisting"> |
7815 | SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch] | | 7867 | SUBST_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 |
7818 | implementation checks that each filename pattern that is mentioned here | | 7870 | implementation checks that each filename pattern that is mentioned here |
7819 | has an effect. For example, if none of the | | 7871 | has 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 |
7821 | and substituted, that filename pattern is redundant and should be left | | 7873 | and substituted, that filename pattern is redundant and should be left |
7822 | out. If the text to be substituted occurs in some of the files from a | | 7874 | out. By default, the SUBST framework will complain with an error message. |
7823 | single pattern, but not in all of them, that is totally ok, and the SUBST | | 7875 | If the text to be substituted occurs in some of the files from a single |
| | | 7876 | pattern, but not in all of them, that is totally ok, and the SUBST |
7824 | framework will only print an INFO message for those files.</p> | | 7877 | framework 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, |
7826 | set <code class="varname">SUBST_NOOP_OK.path=yes</code> in the above | | 7879 | set <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p> |
7827 | example.</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 |
7829 | via a shell command, like this:</p> | | 7881 | via a shell command, like this:</p> |
7830 | <pre class="programlisting"> | | 7882 | <pre class="programlisting"> |
7831 | C_FILES_CMD= cd ${WRKSRC} && ${FIND} -name '*.c' | | 7883 | C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c' |
7832 | SUBST_FILES.path= ${C_FILES_CMD:sh} | | 7884 | SUBST_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 |
7835 | freely chosen and independent of the SUBST framework.</p> | | 7887 | freely 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 |
7837 | lists each file individually. Thereby chances are higher that there are | | 7889 | lists each file individually. Thereby chances are higher that there are |
7838 | filename patterns in which no substitution happens. Since the SUBST | | 7890 | filename patterns in which no substitution happens. Since the SUBST |
7839 | framework cannot know whether the filename patterns in | | 7891 | framework 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 |
7841 | Makefile (where any redundant filename pattern would be suspicious) or | | 7893 | Makefile (where any redundant filename pattern would be suspicious) or |
7842 | been generated by a shell command (in which redundant filename patterns | | 7894 | been generated by a shell command (in which redundant filename patterns |
7843 | are more likely and to be expected), it will complain about these | | 7895 | are more likely and to be expected), it will complain about these |
7844 | redundant filename patterns. Therefore, SUBST blocks that use a shell | | 7896 | redundant 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 |
7858 | own, to avoid hiding short sed commands at the end of a line.</p> | | 7910 | own, 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 |
7860 | separator (the <code class="literal">|</code> in the above example), it is common | | 7912 | separator (the <code class="literal">|</code> in the above example), it is common |
7861 | to enclose them in single quotes.</p> | | 7913 | to 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"> |
7866 | SUBST_VARS.path= PREFIX | | 7918 | SUBST_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 |
7869 | scripts, but in some cases these need to be overridden. The same pattern | | 7921 | scripts during the do-configure stage, but in some cases these need to be |
7870 | is also used when a package defines patches that replace previously | | 7922 | overridden. The same pattern is also used when a package defines patches |
7871 | hard-coded paths like <code class="literal">/usr/local</code> with a | | 7923 | that 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> |
7873 | substituted by the actual <code class="literal">${PREFIX}</code> in the | | 7925 | placeholder first, which then gets substituted by the actual |
7874 | pre-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 |
7875 | just use the SUBST framework to directly replace | | 7927 | cases, 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 | | 7928 | replace <code class="literal">/usr/local</code> with <code class="literal">${PREFIX}</code>, |
7877 | omitting the intermediate patch file.</p> | | 7929 | thereby 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 |
7879 | at all for the substitution but to specify an entirely different command, | | 7931 | at all for the substitution but to specify an entirely different command, |
7880 | like this:</p> | | 7932 | like this:</p> |
7881 | <pre class="programlisting"> | | 7933 | <pre class="programlisting"> |
7882 | SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r' | | 7934 | SUBST_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 |
7885 | distributed files use Windows-style line endings that need to be | | 7937 | distributed files use Windows-style line endings that need to be |
7886 | converted to UNIX-style line endings.</p> | | 7938 | converted 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> |