Sat Jun 11 15:00:45 2016 UTC ()
regen


(rillig)
diff -r1.218 -r1.219 pkgsrc/doc/pkgsrc.html
diff -r1.218 -r1.219 pkgsrc/doc/pkgsrc.txt

cvs diff -r1.218 -r1.219 pkgsrc/doc/pkgsrc.html (expand / switch to unified diff)

--- pkgsrc/doc/pkgsrc.html 2016/06/11 12:57:20 1.218
+++ pkgsrc/doc/pkgsrc.html 2016/06/11 15:00:45 1.219
@@ -92,27 +92,26 @@ @@ -92,27 +92,26 @@
92</dl></dd> 92</dl></dd>
93</dl></dd> 93</dl></dd>
94<dt><span class="chapter"><a href="#using">4. Using pkgsrc</a></span></dt> 94<dt><span class="chapter"><a href="#using">4. Using pkgsrc</a></span></dt>
95<dd><dl> 95<dd><dl>
96<dt><span class="sect1"><a href="#using-pkg">4.1. Using binary packages</a></span></dt> 96<dt><span class="sect1"><a href="#using-pkg">4.1. Using binary packages</a></span></dt>
97<dd><dl> 97<dd><dl>
98<dt><span class="sect2"><a href="#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt> 98<dt><span class="sect2"><a href="#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt>
99<dt><span class="sect2"><a href="#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt> 99<dt><span class="sect2"><a href="#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt>
100<dt><span class="sect2"><a href="#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt> 100<dt><span class="sect2"><a href="#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt>
101<dt><span class="sect2"><a href="#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt> 101<dt><span class="sect2"><a href="#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt>
102<dt><span class="sect2"><a href="#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt> 102<dt><span class="sect2"><a href="#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
103<dt><span class="sect2"><a href="#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt> 103<dt><span class="sect2"><a href="#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
104<dt><span class="sect2"><a href="#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt> 104<dt><span class="sect2"><a href="#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt>
105<dt><span class="sect2"><a href="#a-word-of-warning">4.1.8. A word of warning</a></span></dt> 
106</dl></dd> 105</dl></dd>
107<dt><span class="sect1"><a href="#building-packages-from-source">4.2. Building packages from source</a></span></dt> 106<dt><span class="sect1"><a href="#building-packages-from-source">4.2. Building packages from source</a></span></dt>
108<dd><dl> 107<dd><dl>
109<dt><span class="sect2"><a href="#requirements">4.2.1. Requirements</a></span></dt> 108<dt><span class="sect2"><a href="#requirements">4.2.1. Requirements</a></span></dt>
110<dt><span class="sect2"><a href="#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt> 109<dt><span class="sect2"><a href="#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt>
111<dt><span class="sect2"><a href="#how-to-build-and-install">4.2.3. How to build and install</a></span></dt> 110<dt><span class="sect2"><a href="#how-to-build-and-install">4.2.3. How to build and install</a></span></dt>
112</dl></dd> 111</dl></dd>
113</dl></dd> 112</dl></dd>
114<dt><span class="chapter"><a href="#configuring">5. Configuring pkgsrc</a></span></dt> 113<dt><span class="chapter"><a href="#configuring">5. Configuring pkgsrc</a></span></dt>
115<dd><dl> 114<dd><dl>
116<dt><span class="sect1"><a href="#general-configuration">5.1. General configuration</a></span></dt> 115<dt><span class="sect1"><a href="#general-configuration">5.1. General configuration</a></span></dt>
117<dt><span class="sect1"><a href="#variables-affecting-build">5.2. Variables affecting the build process</a></span></dt> 116<dt><span class="sect1"><a href="#variables-affecting-build">5.2. Variables affecting the build process</a></span></dt>
118<dt><span class="sect1"><a href="#variables-affecting-installation">5.3. Variables affecting the installation process</a></span></dt> 117<dt><span class="sect1"><a href="#variables-affecting-installation">5.3. Variables affecting the installation process</a></span></dt>
@@ -174,56 +173,54 @@ builds) @@ -174,56 +173,54 @@ builds)
174<dt><span class="sect1"><a href="#creating.common">10.1. Common types of packages</a></span></dt> 173<dt><span class="sect1"><a href="#creating.common">10.1. Common types of packages</a></span></dt>
175<dd><dl> 174<dd><dl>
176<dt><span class="sect2"><a href="#creating.perl-module">10.1.1. Perl modules</a></span></dt> 175<dt><span class="sect2"><a href="#creating.perl-module">10.1.1. Perl modules</a></span></dt>
177<dt><span class="sect2"><a href="#creating.kde-app">10.1.2. KDE3 applications</a></span></dt> 176<dt><span class="sect2"><a href="#creating.kde-app">10.1.2. KDE3 applications</a></span></dt>
178<dt><span class="sect2"><a href="#creating.python-module">10.1.3. Python modules and programs</a></span></dt> 177<dt><span class="sect2"><a href="#creating.python-module">10.1.3. Python modules and programs</a></span></dt>
179</dl></dd> 178</dl></dd>
180<dt><span class="sect1"><a href="#creating.examples">10.2. Examples</a></span></dt> 179<dt><span class="sect1"><a href="#creating.examples">10.2. Examples</a></span></dt>
181<dd><dl><dt><span class="sect2"><a href="#creating.nvu">10.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd> 180<dd><dl><dt><span class="sect2"><a href="#creating.nvu">10.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
182</dl></dd> 181</dl></dd>
183<dt><span class="chapter"><a href="#components">11. Package components - files, directories and contents</a></span></dt> 182<dt><span class="chapter"><a href="#components">11. Package components - files, directories and contents</a></span></dt>
184<dd><dl> 183<dd><dl>
185<dt><span class="sect1"><a href="#components.Makefile">11.1. <code class="filename">Makefile</code></a></span></dt> 184<dt><span class="sect1"><a href="#components.Makefile">11.1. <code class="filename">Makefile</code></a></span></dt>
186<dt><span class="sect1"><a href="#components.distinfo">11.2. <code class="filename">distinfo</code></a></span></dt> 185<dt><span class="sect1"><a href="#components.distinfo">11.2. <code class="filename">distinfo</code></a></span></dt>
187<dt><span class="sect1"><a href="#components.patches">11.3. patches/*</a></span></dt> 186<dt><span class="sect1"><a href="#components.patches">11.3. <code class="filename">patches/*</code></a></span></dt>
188<dd><dl> 187<dd><dl>
189<dt><span class="sect2"><a href="#components.patch.structure">11.3.1. Structure of a single patch file</a></span></dt> 188<dt><span class="sect2"><a href="#components.patch.structure">11.3.1. Structure of a single patch file</a></span></dt>
190<dt><span class="sect2"><a href="#components.patches.caveats">11.3.2. Creating patch files</a></span></dt> 189<dt><span class="sect2"><a href="#components.patches.caveats">11.3.2. Creating patch files</a></span></dt>
191<dt><span class="sect2"><a href="#components.patches.sources">11.3.3. Sources where the patch files come from</a></span></dt> 190<dt><span class="sect2"><a href="#components.patches.sources">11.3.3. Sources where the patch files come from</a></span></dt>
192<dt><span class="sect2"><a href="#components.patches.guidelines">11.3.4. Patching guidelines</a></span></dt> 191<dt><span class="sect2"><a href="#components.patches.guidelines">11.3.4. Patching guidelines</a></span></dt>
193<dt><span class="sect2"><a href="#components.patches.feedback">11.3.5. Feedback to the author</a></span></dt> 192<dt><span class="sect2"><a href="#components.patches.feedback">11.3.5. Feedback to the author</a></span></dt>
194</dl></dd> 193</dl></dd>
195<dt><span class="sect1"><a href="#other-mandatory-files">11.4. Other mandatory files</a></span></dt> 194<dt><span class="sect1"><a href="#other-mandatory-files">11.4. Other mandatory files</a></span></dt>
196<dt><span class="sect1"><a href="#components.optional">11.5. Optional files</a></span></dt> 195<dt><span class="sect1"><a href="#components.optional">11.5. Optional files</a></span></dt>
197<dd><dl> 196<dd><dl>
198<dt><span class="sect2"><a href="#components.optional.bin">11.5.1. Files affecting the binary package</a></span></dt> 197<dt><span class="sect2"><a href="#components.optional.bin">11.5.1. Files affecting the binary package</a></span></dt>
199<dt><span class="sect2"><a href="#components.optional.build">11.5.2. Files affecting the build process</a></span></dt> 198<dt><span class="sect2"><a href="#components.optional.build">11.5.2. Files affecting the build process</a></span></dt>
200<dt><span class="sect2"><a href="#components.optional.none">11.5.3. Files affecting nothing at all</a></span></dt> 199<dt><span class="sect2"><a href="#components.optional.none">11.5.3. Files affecting nothing at all</a></span></dt>
201</dl></dd> 200</dl></dd>
202<dt><span class="sect1"><a href="#work-dir">11.6. <code class="filename">work*</code></a></span></dt> 201<dt><span class="sect1"><a href="#work-dir">11.6. <code class="filename">work*</code></a></span></dt>
203<dt><span class="sect1"><a href="#files-dir">11.7. <code class="filename">files/*</code></a></span></dt> 202<dt><span class="sect1"><a href="#files-dir">11.7. <code class="filename">files/*</code></a></span></dt>
204</dl></dd> 203</dl></dd>
205<dt><span class="chapter"><a href="#makefile">12. Programming in <code class="filename">Makefile</code>s</a></span></dt> 204<dt><span class="chapter"><a href="#makefile">12. Programming in <code class="filename">Makefile</code>s</a></span></dt>
206<dd><dl> 205<dd><dl>
207<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt> 206<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt>
208<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt> 207<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt>
209<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd> 208<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd>
210<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt> 209<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt>
211<dd><dl> 210<dd><dl>
212<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt> 211<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt>
213<dt><span class="sect2"><a href="#converting-internal-to-external">12.3.2. Converting an internal list into an external list</a></span></dt> 212<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.2. Passing variables to a shell command</a></span></dt>
214<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.3. Passing variables to a shell command</a></span></dt> 213<dt><span class="sect2"><a href="#quoting-guideline">12.3.3. Quoting guideline</a></span></dt>
215<dt><span class="sect2"><a href="#quoting-guideline">12.3.4. Quoting guideline</a></span></dt> 
216<dt><span class="sect2"><a href="#bsd-make-bug-workaround">12.3.5. Workaround for a bug in BSD Make</a></span></dt> 
217</dl></dd> 214</dl></dd>
218</dl></dd> 215</dl></dd>
219<dt><span class="chapter"><a href="#plist">13. PLIST issues</a></span></dt> 216<dt><span class="chapter"><a href="#plist">13. PLIST issues</a></span></dt>
220<dd><dl> 217<dd><dl>
221<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt> 218<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt>
222<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt> 219<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
223<dt><span class="sect1"><a href="#print-PLIST">13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt> 220<dt><span class="sect1"><a href="#print-PLIST">13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
224<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt> 221<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt>
225<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt> 222<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt>
226<dt><span class="sect1"><a href="#using-PLIST_SRC">13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt> 223<dt><span class="sect1"><a href="#using-PLIST_SRC">13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
227<dt><span class="sect1"><a href="#platform-specific-plist">13.7. Platform-specific and differing PLISTs</a></span></dt> 224<dt><span class="sect1"><a href="#platform-specific-plist">13.7. Platform-specific and differing PLISTs</a></span></dt>
228<dt><span class="sect1"><a href="#build-plist">13.8. Build-specific PLISTs</a></span></dt> 225<dt><span class="sect1"><a href="#build-plist">13.8. Build-specific PLISTs</a></span></dt>
229<dt><span class="sect1"><a href="#faq.common-dirs">13.9. Sharing directories between packages</a></span></dt> 226<dt><span class="sect1"><a href="#faq.common-dirs">13.9. Sharing directories between packages</a></span></dt>
@@ -410,39 +407,35 @@ builds) @@ -410,39 +407,35 @@ builds)
410<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt> 407<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt>
411<dd><dl> 408<dd><dl>
412<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt> 409<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt>
413<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt> 410<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt>
414</dl></dd> 411</dl></dd>
415<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt> 412<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt>
416<dd><dl> 413<dd><dl>
417<dt><span class="sect2"><a href="#infr.order.prefs">24.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt> 414<dt><span class="sect2"><a href="#infr.order.prefs">24.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
418<dt><span class="sect2"><a href="#infr.order.pkg">24.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt> 415<dt><span class="sect2"><a href="#infr.order.pkg">24.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
419</dl></dd> 416</dl></dd>
420</dl></dd> 417</dl></dd>
421<dt><span class="chapter"><a href="#regression">25. Regression tests</a></span></dt> 418<dt><span class="chapter"><a href="#regression">25. Regression tests</a></span></dt>
422<dd><dl> 419<dd><dl>
423<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt> 420<dt><span class="sect1"><a href="#regression.run">25.1. Running the regression tests</a></span></dt>
424<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt> 421<dt><span class="sect1"><a href="#regression.new">25.2. Adding a new regression test</a></span></dt>
425<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt> 
426<dd><dl> 422<dd><dl>
427<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt> 423<dt><span class="sect2"><a href="#regression.fun.override">25.2.1. Overridable functions</a></span></dt>
428<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt> 424<dt><span class="sect2"><a href="#regression.fun.helper">25.2.2. Helper functions</a></span></dt>
429</dl></dd> 425</dl></dd>
430</dl></dd> 426</dl></dd>
431<dt><span class="chapter"><a href="#porting">26. Porting pkgsrc</a></span></dt> 427<dt><span class="chapter"><a href="#porting">26. Porting pkgsrc</a></span></dt>
432<dd><dl> 428<dd><dl><dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
433<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt> 
434<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt> 
435</dl></dd> 
436</dl></dd> 429</dl></dd>
437<dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt> 430<dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt>
438<dd><dl> 431<dd><dl>
439<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt> 432<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
440<dd><dl> 433<dd><dl>
441<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt> 434<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
442<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt> 435<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
443<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt> 436<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
444<dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span></a></span></dt> 437<dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span></a></span></dt>
445</dl></dd> 438</dl></dd>
446<dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt> 439<dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
447</dl></dd> 440</dl></dd>
448<dt><span class="appendix"><a href="#logs">B. Build logs</a></span></dt> 441<dt><span class="appendix"><a href="#logs">B. Build logs</a></span></dt>
@@ -507,27 +500,27 @@ to handle binary packages, so that not e @@ -507,27 +500,27 @@ to handle binary packages, so that not e
507packages for himself, which is a time-costly task.</p> 500packages for himself, which is a time-costly task.</p>
508<p>pkgsrc currently contains several thousand packages, 501<p>pkgsrc currently contains several thousand packages,
509 including:</p> 502 including:</p>
510<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 503<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
511<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/README.html" target="_top"><code class="filename">www/apache24</code></a> - The Apache 504<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/README.html" target="_top"><code class="filename">www/apache24</code></a> - The Apache
512 web server</p></li> 505 web server</p></li>
513<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> - The Firefox 506<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> - The Firefox
514 web browser</p></li> 507 web browser</p></li>
515<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/README.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a> - The GNOME 508<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/README.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a> - The GNOME
516 Desktop Environment</p></li> 509 Desktop Environment</p></li>
517<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a> - The K 510<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a> - The K
518 Desktop Environment</p></li> 511 Desktop Environment</p></li>
519</ul></div> 512</ul></div>
520<p>...just to name a few.</p> 513<p>&#8230; just to name a few.</p>
521<p>pkgsrc has built-in support for handling varying dependencies, 514<p>pkgsrc has built-in support for handling varying dependencies,
522 such as pthreads and X11, and extended features such as IPv6 support on 515 such as pthreads and X11, and extended features such as IPv6 support on
523 a range of platforms.</p> 516 a range of platforms.</p>
524<div class="sect2"> 517<div class="sect2">
525<div class="titlepage"><div><div><h3 class="title"> 518<div class="titlepage"><div><div><h3 class="title">
526<a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div> 519<a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div>
527<p> 520<p>
528pkgsrc provides the following key features: 521pkgsrc provides the following key features:
529</p> 522</p>
530<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 523<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
531<li class="listitem"><p>Easy building of software from source as well as the creation 524<li class="listitem"><p>Easy building of software from source as well as the creation
532 and installation of binary packages. The source and latest 525 and installation of binary packages. The source and latest
533 patches are retrieved from a master or mirror download site, checksum 526 patches are retrieved from a master or mirror download site, checksum
@@ -848,27 +841,26 @@ minutes!

 @@ -848,27 +841,26 @@ minutes!

848</dl></dd> 841</dl></dd>
849</dl></dd> 842</dl></dd>
850<dt><span class="chapter"><a href="#using">4. Using pkgsrc</a></span></dt> 843<dt><span class="chapter"><a href="#using">4. Using pkgsrc</a></span></dt>
851<dd><dl> 844<dd><dl>
852<dt><span class="sect1"><a href="#using-pkg">4.1. Using binary packages</a></span></dt> 845<dt><span class="sect1"><a href="#using-pkg">4.1. Using binary packages</a></span></dt>
853<dd><dl> 846<dd><dl>
854<dt><span class="sect2"><a href="#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt> 847<dt><span class="sect2"><a href="#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt>
855<dt><span class="sect2"><a href="#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt> 848<dt><span class="sect2"><a href="#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt>
856<dt><span class="sect2"><a href="#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt> 849<dt><span class="sect2"><a href="#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt>
857<dt><span class="sect2"><a href="#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt> 850<dt><span class="sect2"><a href="#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt>
858<dt><span class="sect2"><a href="#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt> 851<dt><span class="sect2"><a href="#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
859<dt><span class="sect2"><a href="#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt> 852<dt><span class="sect2"><a href="#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
860<dt><span class="sect2"><a href="#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt> 853<dt><span class="sect2"><a href="#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt>
861<dt><span class="sect2"><a href="#a-word-of-warning">4.1.8. A word of warning</a></span></dt> 
862</dl></dd> 854</dl></dd>
863<dt><span class="sect1"><a href="#building-packages-from-source">4.2. Building packages from source</a></span></dt> 855<dt><span class="sect1"><a href="#building-packages-from-source">4.2. Building packages from source</a></span></dt>
864<dd><dl> 856<dd><dl>
865<dt><span class="sect2"><a href="#requirements">4.2.1. Requirements</a></span></dt> 857<dt><span class="sect2"><a href="#requirements">4.2.1. Requirements</a></span></dt>
866<dt><span class="sect2"><a href="#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt> 858<dt><span class="sect2"><a href="#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt>
867<dt><span class="sect2"><a href="#how-to-build-and-install">4.2.3. How to build and install</a></span></dt> 859<dt><span class="sect2"><a href="#how-to-build-and-install">4.2.3. How to build and install</a></span></dt>
868</dl></dd> 860</dl></dd>
869</dl></dd> 861</dl></dd>
870<dt><span class="chapter"><a href="#configuring">5. Configuring pkgsrc</a></span></dt> 862<dt><span class="chapter"><a href="#configuring">5. Configuring pkgsrc</a></span></dt>
871<dd><dl> 863<dd><dl>
872<dt><span class="sect1"><a href="#general-configuration">5.1. General configuration</a></span></dt> 864<dt><span class="sect1"><a href="#general-configuration">5.1. General configuration</a></span></dt>
873<dt><span class="sect1"><a href="#variables-affecting-build">5.2. Variables affecting the build process</a></span></dt> 865<dt><span class="sect1"><a href="#variables-affecting-build">5.2. Variables affecting the build process</a></span></dt>
874<dt><span class="sect1"><a href="#variables-affecting-installation">5.3. Variables affecting the installation process</a></span></dt> 866<dt><span class="sect1"><a href="#variables-affecting-installation">5.3. Variables affecting the installation process</a></span></dt>
@@ -1178,27 +1170,26 @@ release -d @@ -1178,27 +1170,26 @@ release -d
1178</div> 1170</div>
1179<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 1171<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1180<h3 class="title">Note</h3> 1172<h3 class="title">Note</h3>
1181<p>It is possible to bootstrap multiple instances of pkgsrc 1173<p>It is possible to bootstrap multiple instances of pkgsrc
1182 using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span> 1174 using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span>
1183 corresponding to the installation you're working with to build 1175 corresponding to the installation you're working with to build
1184 and install packages. 1176 and install packages.
1185 </p> 1177 </p>
1186</div> 1178</div>
1187</div> 1179</div>
1188<div class="sect1"> 1180<div class="sect1">
1189<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1181<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1190<a name="platform-specific-notes"></a>3.3. Platform-specific notes</h2></div></div></div> 1182<a name="platform-specific-notes"></a>3.3. Platform-specific notes</h2></div></div></div>
1191<p>Here are some platform-specific notes you should be aware of.</p> 
1192<div class="sect2"> 1183<div class="sect2">
1193<div class="titlepage"><div><div><h3 class="title"> 1184<div class="titlepage"><div><div><h3 class="title">
1194<a name="cygwin"></a>3.3.1. Cygwin</h3></div></div></div> 1185<a name="cygwin"></a>3.3.1. Cygwin</h3></div></div></div>
1195<p>Cygwin 1.7.x and later are supported.</p> 1186<p>Cygwin 1.7.x and later are supported.</p>
1196<p>You need to install minimal base packages in `Base' category 1187<p>You need to install minimal base packages in `Base' category
1197 plus any of compiler, gcc, gcc4, and/or clang. 1188 plus any of compiler, gcc, gcc4, and/or clang.
1198 For gcc and gcc4, C and C++ compiler will be installed by default, 1189 For gcc and gcc4, C and C++ compiler will be installed by default,
1199 but you can install Fortran compiler additionally 1190 but you can install Fortran compiler additionally
1200 because it will be required to use libtool. 1191 because it will be required to use libtool.
1201 If it is not installed (or too old), Fortran compiler will be 1192 If it is not installed (or too old), Fortran compiler will be
1202 installed with pkgsrc automatically.</p> 1193 installed with pkgsrc automatically.</p>
1203<p>As noted in 1194<p>As noted in
1204 <a class="ulink" href="http://cygwin.com/faq-nochunks.html#faq.using.su" target="_top">Cygwin FAQ: `Why doesn't su work?'</a>, 1195 <a class="ulink" href="http://cygwin.com/faq-nochunks.html#faq.using.su" target="_top">Cygwin FAQ: `Why doesn't su work?'</a>,
@@ -1692,27 +1683,26 @@ WRAPPER_SHELL= ${LOCALBASE}/bin/bash @@ -1692,27 +1683,26 @@ WRAPPER_SHELL= ${LOCALBASE}/bin/bash
1692<a name="using"></a>Chapter 4. Using pkgsrc</h2></div></div></div> 1683<a name="using"></a>Chapter 4. Using pkgsrc</h2></div></div></div>
1693<div class="toc"> 1684<div class="toc">
1694<p><b>Table of Contents</b></p> 1685<p><b>Table of Contents</b></p>
1695<dl class="toc"> 1686<dl class="toc">
1696<dt><span class="sect1"><a href="#using-pkg">4.1. Using binary packages</a></span></dt> 1687<dt><span class="sect1"><a href="#using-pkg">4.1. Using binary packages</a></span></dt>
1697<dd><dl> 1688<dd><dl>
1698<dt><span class="sect2"><a href="#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt> 1689<dt><span class="sect2"><a href="#finding-binary-packages">4.1.1. Finding binary packages</a></span></dt>
1699<dt><span class="sect2"><a href="#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt> 1690<dt><span class="sect2"><a href="#installing-binary-packages">4.1.2. Installing binary packages</a></span></dt>
1700<dt><span class="sect2"><a href="#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt> 1691<dt><span class="sect2"><a href="#using.pkg_delete">4.1.3. Deinstalling packages</a></span></dt>
1701<dt><span class="sect2"><a href="#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt> 1692<dt><span class="sect2"><a href="#using.pkg_info">4.1.4. Getting information about installed packages</a></span></dt>
1702<dt><span class="sect2"><a href="#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt> 1693<dt><span class="sect2"><a href="#vulnerabilities">4.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
1703<dt><span class="sect2"><a href="#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt> 1694<dt><span class="sect2"><a href="#pkg_versions">4.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
1704<dt><span class="sect2"><a href="#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt> 1695<dt><span class="sect2"><a href="#using.pkg_admin">4.1.7. Other administrative functions</a></span></dt>
1705<dt><span class="sect2"><a href="#a-word-of-warning">4.1.8. A word of warning</a></span></dt> 
1706</dl></dd> 1696</dl></dd>
1707<dt><span class="sect1"><a href="#building-packages-from-source">4.2. Building packages from source</a></span></dt> 1697<dt><span class="sect1"><a href="#building-packages-from-source">4.2. Building packages from source</a></span></dt>
1708<dd><dl> 1698<dd><dl>
1709<dt><span class="sect2"><a href="#requirements">4.2.1. Requirements</a></span></dt> 1699<dt><span class="sect2"><a href="#requirements">4.2.1. Requirements</a></span></dt>
1710<dt><span class="sect2"><a href="#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt> 1700<dt><span class="sect2"><a href="#fetching-distfiles">4.2.2. Fetching distfiles</a></span></dt>
1711<dt><span class="sect2"><a href="#how-to-build-and-install">4.2.3. How to build and install</a></span></dt> 1701<dt><span class="sect2"><a href="#how-to-build-and-install">4.2.3. How to build and install</a></span></dt>
1712</dl></dd> 1702</dl></dd>
1713</dl> 1703</dl>
1714</div> 1704</div>
1715<p>Basically, there are two ways of using pkgsrc. The first 1705<p>Basically, there are two ways of using pkgsrc. The first
1716is to only install the package tools and to use binary packages 1706is to only install the package tools and to use binary packages
1717that someone else has prepared. This is the <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span> 1707that someone else has prepared. This is the <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>
1718in pkgsrc. The second way is to install the <span class="quote">&#8220;<span class="quote">src</span>&#8221;</span> 1708in pkgsrc. The second way is to install the <span class="quote">&#8220;<span class="quote">src</span>&#8221;</span>
@@ -1889,41 +1879,26 @@ and you can still use binary packages fr @@ -1889,41 +1879,26 @@ and you can still use binary packages fr
1889... 1879...
1890Version mismatch: 'tcsh' 6.09.00 vs 6.10.00 1880Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1891 </pre> 1881 </pre>
1892<p>You can then use <span class="command"><strong>make update</strong></span> to update the 1882<p>You can then use <span class="command"><strong>make update</strong></span> to update the
1893 package on your system and rebuild any dependencies. 1883 package on your system and rebuild any dependencies.
1894 </p> 1884 </p>
1895</div> 1885</div>
1896<div class="sect2"> 1886<div class="sect2">
1897<div class="titlepage"><div><div><h3 class="title"> 1887<div class="titlepage"><div><div><h3 class="title">
1898<a name="using.pkg_admin"></a>4.1.7. Other administrative functions</h3></div></div></div> 1888<a name="using.pkg_admin"></a>4.1.7. Other administrative functions</h3></div></div></div>
1899<p>The <span class="command"><strong>pkg_admin</strong></span> executes various 1889<p>The <span class="command"><strong>pkg_admin</strong></span> executes various
1900 administrative functions on the package system.</p> 1890 administrative functions on the package system.</p>
1901</div> 1891</div>
1902<div class="sect2"> 
1903<div class="titlepage"><div><div><h3 class="title"> 
1904<a name="a-word-of-warning"></a>4.1.8. A word of warning</h3></div></div></div> 
1905<p>Please pay very careful attention to the warnings 
1906 expressed in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> manual page about the 
1907 inherent dangers of installing binary packages which you did 
1908 not create yourself, and the security holes that can be 
1909 introduced onto your system by indiscriminate adding of such 
1910 files.</p> 
1911<p>The same warning of course applies to every package you 
1912 install from source when you haven't completely read and 
1913 understood the source code of the package, the compiler that 
1914 is used to build the package and all the other tools that are 
1915 involved.</p> 
1916</div> 
1917</div> 1892</div>
1918<div class="sect1"> 1893<div class="sect1">
1919<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 1894<div class="titlepage"><div><div><h2 class="title" style="clear: both">
1920<a name="building-packages-from-source"></a>4.2. Building packages from source</h2></div></div></div> 1895<a name="building-packages-from-source"></a>4.2. Building packages from source</h2></div></div></div>
1921<p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code> 1896<p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code>
1922 directory now contains a set of packages, organized into 1897 directory now contains a set of packages, organized into
1923 categories. You can browse the online index of packages, or run 1898 categories. You can browse the online index of packages, or run
1924 <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code> 1899 <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code>
1925 directory to build local <code class="filename">README.html</code> files for 1900 directory to build local <code class="filename">README.html</code> files for
1926 all packages, viewable with any web browser such as <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/README.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a>.</p> 1901 all packages, viewable with any web browser such as <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/README.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a>.</p>
1927<p>The default <span class="emphasis"><em>prefix</em></span> for installed packages 1902<p>The default <span class="emphasis"><em>prefix</em></span> for installed packages
1928 is <code class="filename">/usr/pkg</code>. If you wish to change this, you 1903 is <code class="filename">/usr/pkg</code>. If you wish to change this, you
1929 should do so by setting <code class="varname">LOCALBASE</code> in 1904 should do so by setting <code class="varname">LOCALBASE</code> in
@@ -2205,47 +2180,47 @@ works.

 @@ -2205,47 +2180,47 @@ works.

2205 release (<span class="quote">&#8220;<span class="quote">2.0</span>&#8221;</span>, etc.) and architecture 2180 release (<span class="quote">&#8220;<span class="quote">2.0</span>&#8221;</span>, etc.) and architecture
2206 (<span class="quote">&#8220;<span class="quote">mipsel</span>&#8221;</span>, etc.).</p></li> 2181 (<span class="quote">&#8220;<span class="quote">mipsel</span>&#8221;</span>, etc.).</p></li>
2207<li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>: 2182<li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
2208 List of acceptable licenses. License names are case-sensitive. 2183 List of acceptable licenses. License names are case-sensitive.
2209 Whenever you try to build a package whose license is not in this 2184 Whenever you try to build a package whose license is not in this
2210 list, you will get an error message. If the license condition is 2185 list, you will get an error message. If the license condition is
2211 simple enough, the error message will include specific 2186 simple enough, the error message will include specific
2212 instructions on how to change this variable.</p></li> 2187 instructions on how to change this variable.</p></li>
2213</ul></div> 2188</ul></div>
2214</div> 2189</div>
2215<div class="sect1"> 2190<div class="sect1">
2216<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2191<div class="titlepage"><div><div><h2 class="title" style="clear: both">
2217<a name="variables-affecting-build"></a>5.2. Variables affecting the build process</h2></div></div></div> 2192<a name="variables-affecting-build"></a>5.2. Variables affecting the build process</h2></div></div></div>
2218<p>XXX 2193<p>
2219 </p> 2194 </p>
2220<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2195<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2221<li class="listitem"><p><code class="varname">PACKAGES</code>: The top level 2196<li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
2222 directory for the binary packages. The default is 2197 directory for the binary packages. The default is
2223 <code class="filename">${PKGSRCDIR}/packages</code>.</p></li> 2198 <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
2224<li class="listitem"><p><code class="varname">WRKOBJDIR</code>: 2199<li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
2225 The top level directory where, if defined, the separate 2200 The top level directory where, if defined, the separate
2226 working directories will get created, and symbolically 2201 working directories will get created, and symbolically
2227 linked to from <code class="filename">${WRKDIR}</code> (see below). 2202 linked to from <code class="filename">${WRKDIR}</code> (see below).
2228 This is useful for building packages on several 2203 This is useful for building packages on several
2229 architectures, then <code class="filename">${PKGSRCDIR}</code> 2204 architectures, then <code class="filename">${PKGSRCDIR}</code>
2230 can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code> 2205 can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
2231 is local to every architecture. (It should be noted that 2206 is local to every architecture. (It should be noted that
2232 <code class="varname">PKGSRCDIR</code> should not be set by the user 2207 <code class="varname">PKGSRCDIR</code> should not be set by the user
2233 &mdash; it is an internal definition which refers to the 2208 &mdash; it is an internal definition which refers to the
2234 root of the pkgsrc tree. It is possible to have many 2209 root of the pkgsrc tree. It is possible to have many
2235 pkgsrc tree instances.)</p></li> 2210 pkgsrc tree instances.)</p></li>
2236<li class="listitem"><p><code class="varname">LOCALPATCHES</code>: 2211<li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
2237 Directory for local patches that aren't part of pkgsrc. 2212 Directory for local patches that aren't part of pkgsrc.
2238 See <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;patches/*&#8221;</a> for more 2213 See <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more
2239 information.</p></li> 2214 information.</p></li>
2240<li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of 2215<li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
2241 the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's 2216 the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
2242 BSD-style Makefile. If this is not set, 2217 BSD-style Makefile. If this is not set,
2243 <code class="varname">MAKECONF</code> is set to 2218 <code class="varname">MAKECONF</code> is set to
2244 <code class="filename">/dev/null</code> to avoid picking up 2219 <code class="filename">/dev/null</code> to avoid picking up
2245 settings used by builds in <code class="filename">/usr/src</code>.</p></li> 2220 settings used by builds in <code class="filename">/usr/src</code>.</p></li>
2246<li class="listitem"><p><code class="varname">DEPENDS_TARGET</code>: 2221<li class="listitem"><p><code class="varname">DEPENDS_TARGET</code>:
2247 By default, dependencies are only installed, and no binary 2222 By default, dependencies are only installed, and no binary
2248 package is created for them. You can set this variable to 2223 package is created for them. You can set this variable to
2249 <code class="literal">package-install</code> to automatically create binary 2224 <code class="literal">package-install</code> to automatically create binary
2250 packages after installing dependencies. Please note that the 2225 packages after installing dependencies. Please note that the
2251 <code class="varname">PKGSRC_KEEP_BIN_PKGS</code> can be set to 2226 <code class="varname">PKGSRC_KEEP_BIN_PKGS</code> can be set to
@@ -3006,43 +2981,34 @@ etc:

 @@ -3006,43 +2981,34 @@ etc:

3006</ul></div> 2981</ul></div>
3007<p>Utilities for people maintaining pkgsrc (or: more obscure pkg 2982<p>Utilities for people maintaining pkgsrc (or: more obscure pkg
3008utilities)</p> 2983utilities)</p>
3009<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 2984<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3010<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_comp/README.html" target="_top"><code class="filename">pkgtools/pkg_comp</code></a>: Build 2985<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_comp/README.html" target="_top"><code class="filename">pkgtools/pkg_comp</code></a>: Build
3011 packages in a chrooted area.</p></li> 2986 packages in a chrooted area.</p></li>
3012<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libkver/README.html" target="_top"><code class="filename">pkgtools/libkver</code></a>: Spoof 2987<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libkver/README.html" target="_top"><code class="filename">pkgtools/libkver</code></a>: Spoof
3013 kernel version for chrooted cross builds.</p></li> 2988 kernel version for chrooted cross builds.</p></li>
3014</ul></div> 2989</ul></div>
3015</div> 2990</div>
3016<div class="sect1"> 2991<div class="sect1">
3017<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 2992<div class="titlepage"><div><div><h2 class="title" style="clear: both">
3018<a name="non-root-pkgsrc"></a>9.3. How to use pkgsrc as non-root</h2></div></div></div> 2993<a name="non-root-pkgsrc"></a>9.3. How to use pkgsrc as non-root</h2></div></div></div>
3019<p>If you want to use pkgsrc as non-root user, you can set some 2994<p>To install packages from source as a non-root user, download
3020variables to make pkgsrc work under these conditions. At the very least, 2995pkgsrc as described in <a class="xref" href="#getting" title="Chapter 2. Where to get pkgsrc and how to keep it up-to-date">Chapter 2, <i>Where to get pkgsrc and how to keep it up-to-date</i></a>, cd into that
3021you need to set <code class="varname">UNPRIVILEGED</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>; this 2996directory and run the command <span class="command"><strong>./bootstrap/bootstrap
3022will turn on unprivileged mode and set multiple related variables to allow 2997--unprivileged</strong></span>.</p>
3023installation of packages as non-root.</p> 2998<p>This will install the binary part of pkgsrc to
3024<p>In case the defaults are not enough, you may want to tune some other 2999<code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
3025variables used. For example, if the automatic user/group detection leads 3000into <code class="filename">~/pkg/etc</code>.</p>
3026to incorrect values (or not the ones you would like to use), you can change 3001<p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p>
3027them by setting <code class="varname">UNPRIVILEGED_USER</code> and 
3028<code class="varname">UNPRIVILEGED_GROUP</code> respectively.</p> 
3029<p>As regards bootstrapping, please note that the 
3030<span class="command"><strong>bootstrap</strong></span> script will ease non-root configuration when 
3031given the <span class="quote">&#8220;<span class="quote">--ignore-user-check</span>&#8221;</span> flag, as it will choose and 
3032use multiple default directories under <code class="filename">~/pkg</code> as the 
3033installation targets. These directories can be overridden by the 
3034<span class="quote">&#8220;<span class="quote">--prefix</span>&#8221;</span> flag provided by the script, as well as some others 
3035that allow finer tuning of the tree layout.</p> 
3036</div> 3002</div>
3037<div class="sect1"> 3003<div class="sect1">
3038<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 3004<div class="titlepage"><div><div><h2 class="title" style="clear: both">
3039<a name="resume-transfers"></a>9.4. How to resume transfers when fetching distfiles?</h2></div></div></div> 3005<a name="resume-transfers"></a>9.4. How to resume transfers when fetching distfiles?</h2></div></div></div>
3040<p>By default, resuming transfers in pkgsrc is disabled, but you can 3006<p>By default, resuming transfers in pkgsrc is disabled, but you can
3041enable this feature by adding the option 3007enable this feature by adding the option
3042<code class="varname">PKG_RESUME_TRANSFERS=YES</code> into 3008<code class="varname">PKG_RESUME_TRANSFERS=YES</code> into
3043<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. If, during a fetch step, an incomplete 3009<a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. If, during a fetch step, an incomplete
3044distfile is found, pkgsrc will try to resume it.</p> 3010distfile is found, pkgsrc will try to resume it.</p>
3045<p>You can also 3011<p>You can also
3046use a different program than the platform default program by changing the 3012use a different program than the platform default program by changing the
3047<code class="varname">FETCH_USING</code> variable. You can specify the program by 3013<code class="varname">FETCH_USING</code> variable. You can specify the program by
3048using of ftp, fetch, wget or curl. Alternatively, fetching can be disabled 3014using of ftp, fetch, wget or curl. Alternatively, fetching can be disabled
@@ -3332,56 +3298,54 @@ anymore, you can remove that file and ru @@ -3332,56 +3298,54 @@ anymore, you can remove that file and ru
3332<dt><span class="sect1"><a href="#creating.common">10.1. Common types of packages</a></span></dt> 3298<dt><span class="sect1"><a href="#creating.common">10.1. Common types of packages</a></span></dt>
3333<dd><dl> 3299<dd><dl>
3334<dt><span class="sect2"><a href="#creating.perl-module">10.1.1. Perl modules</a></span></dt> 3300<dt><span class="sect2"><a href="#creating.perl-module">10.1.1. Perl modules</a></span></dt>
3335<dt><span class="sect2"><a href="#creating.kde-app">10.1.2. KDE3 applications</a></span></dt> 3301<dt><span class="sect2"><a href="#creating.kde-app">10.1.2. KDE3 applications</a></span></dt>
3336<dt><span class="sect2"><a href="#creating.python-module">10.1.3. Python modules and programs</a></span></dt> 3302<dt><span class="sect2"><a href="#creating.python-module">10.1.3. Python modules and programs</a></span></dt>
3337</dl></dd> 3303</dl></dd>
3338<dt><span class="sect1"><a href="#creating.examples">10.2. Examples</a></span></dt> 3304<dt><span class="sect1"><a href="#creating.examples">10.2. Examples</a></span></dt>
3339<dd><dl><dt><span class="sect2"><a href="#creating.nvu">10.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd> 3305<dd><dl><dt><span class="sect2"><a href="#creating.nvu">10.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
3340</dl></dd> 3306</dl></dd>
3341<dt><span class="chapter"><a href="#components">11. Package components - files, directories and contents</a></span></dt> 3307<dt><span class="chapter"><a href="#components">11. Package components - files, directories and contents</a></span></dt>
3342<dd><dl> 3308<dd><dl>
3343<dt><span class="sect1"><a href="#components.Makefile">11.1. <code class="filename">Makefile</code></a></span></dt> 3309<dt><span class="sect1"><a href="#components.Makefile">11.1. <code class="filename">Makefile</code></a></span></dt>
3344<dt><span class="sect1"><a href="#components.distinfo">11.2. <code class="filename">distinfo</code></a></span></dt> 3310<dt><span class="sect1"><a href="#components.distinfo">11.2. <code class="filename">distinfo</code></a></span></dt>
3345<dt><span class="sect1"><a href="#components.patches">11.3. patches/*</a></span></dt> 3311<dt><span class="sect1"><a href="#components.patches">11.3. <code class="filename">patches/*</code></a></span></dt>
3346<dd><dl> 3312<dd><dl>
3347<dt><span class="sect2"><a href="#components.patch.structure">11.3.1. Structure of a single patch file</a></span></dt> 3313<dt><span class="sect2"><a href="#components.patch.structure">11.3.1. Structure of a single patch file</a></span></dt>
3348<dt><span class="sect2"><a href="#components.patches.caveats">11.3.2. Creating patch files</a></span></dt> 3314<dt><span class="sect2"><a href="#components.patches.caveats">11.3.2. Creating patch files</a></span></dt>
3349<dt><span class="sect2"><a href="#components.patches.sources">11.3.3. Sources where the patch files come from</a></span></dt> 3315<dt><span class="sect2"><a href="#components.patches.sources">11.3.3. Sources where the patch files come from</a></span></dt>
3350<dt><span class="sect2"><a href="#components.patches.guidelines">11.3.4. Patching guidelines</a></span></dt> 3316<dt><span class="sect2"><a href="#components.patches.guidelines">11.3.4. Patching guidelines</a></span></dt>
3351<dt><span class="sect2"><a href="#components.patches.feedback">11.3.5. Feedback to the author</a></span></dt> 3317<dt><span class="sect2"><a href="#components.patches.feedback">11.3.5. Feedback to the author</a></span></dt>
3352</dl></dd> 3318</dl></dd>
3353<dt><span class="sect1"><a href="#other-mandatory-files">11.4. Other mandatory files</a></span></dt> 3319<dt><span class="sect1"><a href="#other-mandatory-files">11.4. Other mandatory files</a></span></dt>
3354<dt><span class="sect1"><a href="#components.optional">11.5. Optional files</a></span></dt> 3320<dt><span class="sect1"><a href="#components.optional">11.5. Optional files</a></span></dt>
3355<dd><dl> 3321<dd><dl>
3356<dt><span class="sect2"><a href="#components.optional.bin">11.5.1. Files affecting the binary package</a></span></dt> 3322<dt><span class="sect2"><a href="#components.optional.bin">11.5.1. Files affecting the binary package</a></span></dt>
3357<dt><span class="sect2"><a href="#components.optional.build">11.5.2. Files affecting the build process</a></span></dt> 3323<dt><span class="sect2"><a href="#components.optional.build">11.5.2. Files affecting the build process</a></span></dt>
3358<dt><span class="sect2"><a href="#components.optional.none">11.5.3. Files affecting nothing at all</a></span></dt> 3324<dt><span class="sect2"><a href="#components.optional.none">11.5.3. Files affecting nothing at all</a></span></dt>
3359</dl></dd> 3325</dl></dd>
3360<dt><span class="sect1"><a href="#work-dir">11.6. <code class="filename">work*</code></a></span></dt> 3326<dt><span class="sect1"><a href="#work-dir">11.6. <code class="filename">work*</code></a></span></dt>
3361<dt><span class="sect1"><a href="#files-dir">11.7. <code class="filename">files/*</code></a></span></dt> 3327<dt><span class="sect1"><a href="#files-dir">11.7. <code class="filename">files/*</code></a></span></dt>
3362</dl></dd> 3328</dl></dd>
3363<dt><span class="chapter"><a href="#makefile">12. Programming in <code class="filename">Makefile</code>s</a></span></dt> 3329<dt><span class="chapter"><a href="#makefile">12. Programming in <code class="filename">Makefile</code>s</a></span></dt>
3364<dd><dl> 3330<dd><dl>
3365<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt> 3331<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt>
3366<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt> 3332<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt>
3367<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd> 3333<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd>
3368<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt> 3334<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt>
3369<dd><dl> 3335<dd><dl>
3370<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt> 3336<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt>
3371<dt><span class="sect2"><a href="#converting-internal-to-external">12.3.2. Converting an internal list into an external list</a></span></dt> 3337<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.2. Passing variables to a shell command</a></span></dt>
3372<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.3. Passing variables to a shell command</a></span></dt> 3338<dt><span class="sect2"><a href="#quoting-guideline">12.3.3. Quoting guideline</a></span></dt>
3373<dt><span class="sect2"><a href="#quoting-guideline">12.3.4. Quoting guideline</a></span></dt> 
3374<dt><span class="sect2"><a href="#bsd-make-bug-workaround">12.3.5. Workaround for a bug in BSD Make</a></span></dt> 
3375</dl></dd> 3339</dl></dd>
3376</dl></dd> 3340</dl></dd>
3377<dt><span class="chapter"><a href="#plist">13. PLIST issues</a></span></dt> 3341<dt><span class="chapter"><a href="#plist">13. PLIST issues</a></span></dt>
3378<dd><dl> 3342<dd><dl>
3379<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt> 3343<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt>
3380<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt> 3344<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
3381<dt><span class="sect1"><a href="#print-PLIST">13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt> 3345<dt><span class="sect1"><a href="#print-PLIST">13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
3382<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt> 3346<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt>
3383<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt> 3347<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt>
3384<dt><span class="sect1"><a href="#using-PLIST_SRC">13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt> 3348<dt><span class="sect1"><a href="#using-PLIST_SRC">13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
3385<dt><span class="sect1"><a href="#platform-specific-plist">13.7. Platform-specific and differing PLISTs</a></span></dt> 3349<dt><span class="sect1"><a href="#platform-specific-plist">13.7. Platform-specific and differing PLISTs</a></span></dt>
3386<dt><span class="sect1"><a href="#build-plist">13.8. Build-specific PLISTs</a></span></dt> 3350<dt><span class="sect1"><a href="#build-plist">13.8. Build-specific PLISTs</a></span></dt>
3387<dt><span class="sect1"><a href="#faq.common-dirs">13.9. Sharing directories between packages</a></span></dt> 3351<dt><span class="sect1"><a href="#faq.common-dirs">13.9. Sharing directories between packages</a></span></dt>
@@ -3953,27 +3917,27 @@ everything worked.

 @@ -3953,27 +3917,27 @@ everything worked.

3953</pre> 3917</pre>
3954</div> 3918</div>
3955</div> 3919</div>
3956</div> 3920</div>
3957</div> 3921</div>
3958<div class="chapter"> 3922<div class="chapter">
3959<div class="titlepage"><div><div><h2 class="title"> 3923<div class="titlepage"><div><div><h2 class="title">
3960<a name="components"></a>Chapter 11. Package components - files, directories and contents</h2></div></div></div> 3924<a name="components"></a>Chapter 11. Package components - files, directories and contents</h2></div></div></div>
3961<div class="toc"> 3925<div class="toc">
3962<p><b>Table of Contents</b></p> 3926<p><b>Table of Contents</b></p>
3963<dl class="toc"> 3927<dl class="toc">
3964<dt><span class="sect1"><a href="#components.Makefile">11.1. <code class="filename">Makefile</code></a></span></dt> 3928<dt><span class="sect1"><a href="#components.Makefile">11.1. <code class="filename">Makefile</code></a></span></dt>
3965<dt><span class="sect1"><a href="#components.distinfo">11.2. <code class="filename">distinfo</code></a></span></dt> 3929<dt><span class="sect1"><a href="#components.distinfo">11.2. <code class="filename">distinfo</code></a></span></dt>
3966<dt><span class="sect1"><a href="#components.patches">11.3. patches/*</a></span></dt> 3930<dt><span class="sect1"><a href="#components.patches">11.3. <code class="filename">patches/*</code></a></span></dt>
3967<dd><dl> 3931<dd><dl>
3968<dt><span class="sect2"><a href="#components.patch.structure">11.3.1. Structure of a single patch file</a></span></dt> 3932<dt><span class="sect2"><a href="#components.patch.structure">11.3.1. Structure of a single patch file</a></span></dt>
3969<dt><span class="sect2"><a href="#components.patches.caveats">11.3.2. Creating patch files</a></span></dt> 3933<dt><span class="sect2"><a href="#components.patches.caveats">11.3.2. Creating patch files</a></span></dt>
3970<dt><span class="sect2"><a href="#components.patches.sources">11.3.3. Sources where the patch files come from</a></span></dt> 3934<dt><span class="sect2"><a href="#components.patches.sources">11.3.3. Sources where the patch files come from</a></span></dt>
3971<dt><span class="sect2"><a href="#components.patches.guidelines">11.3.4. Patching guidelines</a></span></dt> 3935<dt><span class="sect2"><a href="#components.patches.guidelines">11.3.4. Patching guidelines</a></span></dt>
3972<dt><span class="sect2"><a href="#components.patches.feedback">11.3.5. Feedback to the author</a></span></dt> 3936<dt><span class="sect2"><a href="#components.patches.feedback">11.3.5. Feedback to the author</a></span></dt>
3973</dl></dd> 3937</dl></dd>
3974<dt><span class="sect1"><a href="#other-mandatory-files">11.4. Other mandatory files</a></span></dt> 3938<dt><span class="sect1"><a href="#other-mandatory-files">11.4. Other mandatory files</a></span></dt>
3975<dt><span class="sect1"><a href="#components.optional">11.5. Optional files</a></span></dt> 3939<dt><span class="sect1"><a href="#components.optional">11.5. Optional files</a></span></dt>
3976<dd><dl> 3940<dd><dl>
3977<dt><span class="sect2"><a href="#components.optional.bin">11.5.1. Files affecting the binary package</a></span></dt> 3941<dt><span class="sect2"><a href="#components.optional.bin">11.5.1. Files affecting the binary package</a></span></dt>
3978<dt><span class="sect2"><a href="#components.optional.build">11.5.2. Files affecting the build process</a></span></dt> 3942<dt><span class="sect2"><a href="#components.optional.build">11.5.2. Files affecting the build process</a></span></dt>
3979<dt><span class="sect2"><a href="#components.optional.none">11.5.3. Files affecting nothing at all</a></span></dt> 3943<dt><span class="sect2"><a href="#components.optional.none">11.5.3. Files affecting nothing at all</a></span></dt>
@@ -4125,75 +4089,74 @@ converters games mbone  @@ -4125,75 +4089,74 @@ converters games mbone
4125 <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span> in all files (see patches, 4089 <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span> in all files (see patches,
4126 below).</p></li> 4090 below).</p></li>
4127<li class="listitem"><p>If the package installs any info files, see <a class="xref" href="#faq.info-files" title="19.6.7. Packages installing info files">Section 19.6.7, &#8220;Packages installing info files&#8221;</a>.</p></li> 4091<li class="listitem"><p>If the package installs any info files, see <a class="xref" href="#faq.info-files" title="19.6.7. Packages installing info files">Section 19.6.7, &#8220;Packages installing info files&#8221;</a>.</p></li>
4128</ul></div> 4092</ul></div>
4129</div> 4093</div>
4130<div class="sect1"> 4094<div class="sect1">
4131<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4095<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4132<a name="components.distinfo"></a>11.2. <code class="filename">distinfo</code> 4096<a name="components.distinfo"></a>11.2. <code class="filename">distinfo</code>
4133</h2></div></div></div> 4097</h2></div></div></div>
4134<p>The <code class="filename">distinfo</code> file contains the message 4098<p>The <code class="filename">distinfo</code> file contains the message
4135 digest, or checksum, of each distfile needed for the package. This 4099 digest, or checksum, of each distfile needed for the package. This
4136 ensures that the distfiles retrieved from the Internet have not been 4100 ensures that the distfiles retrieved from the Internet have not been
4137 corrupted during transfer or altered by a malign force to introduce 4101 corrupted during transfer or altered by a malign force to introduce
4138 a security hole. Due to recent rumor about weaknesses of digest 4102 a security hole. To provide maximum security, all distfiles are
4139 algorithms, all distfiles are protected using both SHA1 and RMD160 4103 protected using three different message digest algorithms (SHA1,
4140 message digests, as well as the file size.</p> 4104 RMD160, SHA512), as well as the file size.</p>
4141<p>The <code class="filename">distinfo</code> file also contains the 4105<p>The <code class="filename">distinfo</code> file also contains the
4142 checksums for all the patches found in the 4106 checksums for all the patches found in the
4143 <code class="filename">patches</code> directory (see <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;patches/*&#8221;</a>).</p> 4107 <code class="filename">patches</code> directory (see <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;<code class="filename">patches/*</code>&#8221;</a>).</p>
4144<p>To regenerate the <code class="filename">distinfo</code> file, use the 4108<p>To regenerate the <code class="filename">distinfo</code> file, use the
4145 <span class="command"><strong>make makedistinfo</strong></span> or <span class="command"><strong>make mdi</strong></span> 4109 <span class="command"><strong>make distinfo</strong></span> command.</p>
4146 command.</p> 
4147<p>Some packages have different sets of distfiles depending on 4110<p>Some packages have different sets of distfiles depending on
4148 the platform, for example <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/openjdk7/README.html" target="_top"><code class="filename">lang/openjdk7</code></a>. These are kept in the same 4111 the platform, for example <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/openjdk7/README.html" target="_top"><code class="filename">lang/openjdk7</code></a>. These are kept in the same
4149 <code class="filename">distinfo</code> file and care should be taken when 4112 <code class="filename">distinfo</code> file and care should be taken when
4150 upgrading such a package to ensure distfile information is not 4113 upgrading such a package to ensure distfile information is not
4151 lost.</p> 4114 lost.</p>
4152</div> 4115</div>
4153<div class="sect1"> 4116<div class="sect1">
4154<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4117<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4155<a name="components.patches"></a>11.3. patches/*</h2></div></div></div> 4118<a name="components.patches"></a>11.3. <code class="filename">patches/*</code>
4156<p>Many packages still don't work out-of-the box on the various 4119</h2></div></div></div>
4157 platforms that are supported by pkgsrc. Therefore, a number of custom 4120<p>Some packages don't work out-of-the box on the various
4158 patch files are needed to make the package work. These patch files are 4121 platforms that are supported by pkgsrc. These packages need
 4122 to be patched to make them work. The patch files can be
4159 found in the <code class="filename">patches/</code> directory.</p> 4123 found in the <code class="filename">patches/</code> directory.</p>
4160<p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are 4124<p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are
4161 applied to the files in <code class="varname">WRKSRC</code> directory after 4125 applied to the files in <code class="varname">WRKSRC</code> directory after
4162 extracting them, in <a class="ulink" href="http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13_03" target="_top">alphabetic 4126 extracting them, in alphabetic order.</p>
4163 order</a>.</p> 
4164<div class="sect2"> 4127<div class="sect2">
4165<div class="titlepage"><div><div><h3 class="title"> 4128<div class="titlepage"><div><div><h3 class="title">
4166<a name="components.patch.structure"></a>11.3.1. Structure of a single patch file</h3></div></div></div> 4129<a name="components.patch.structure"></a>11.3.1. Structure of a single patch file</h3></div></div></div>
4167<p>The <code class="filename">patch-*</code> files should be in 4130<p>The <code class="filename">patch-*</code> files should be in
4168 <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid 4131 <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid
4169 problems. (To force patches to apply with fuzz you can set 4132 problems. (To force patches to apply with fuzz you can set
4170 <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch 4133 <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch
4171 should contain only changes for a single file, and no file should be 4134 should contain only changes for a single file, and no file should be
4172 patched by more than one patch file. This helps to keep future 4135 patched by more than one patch file. This helps to keep future
4173 modifications simple.</p> 4136 modifications simple.</p>
4174<p>Each patch file is structured as follows: In the first line, 4137<p>Each patch file is structured as follows: In the first line,
4175 there is the RCS Id of the patch itself. The second line should be 4138 there is the RCS Id of the patch itself. The second line should be
4176 empty for aesthetic reasons. After that, there should be a comment for 4139 empty for aesthetic reasons. After that, there should be a comment for
4177 each change that the patch does. There are a number of standard 4140 each change that the patch does. There are a number of standard
4178 cases:</p> 4141 cases:</p>
4179<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 4142<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4180<li class="listitem"><p>Patches for commonly known vulnerabilities should 4143<li class="listitem"><p>Patches for commonly known vulnerabilities should
4181 mention the vulnerability ID (CAN, CVE).</p></li> 4144 mention the vulnerability ID (CAN, CVE).</p></li>
4182<li class="listitem"><p>Patches that change source code should mention the 4145<li class="listitem"><p>Patches that change source code should mention the
4183 platform and other environment (for example, the compiler) that the 4146 platform and other environment (for example, the compiler) that the
4184 patch is needed for.</p></li> 4147 patch is needed for.</p></li>
4185</ul></div> 4148</ul></div>
4186<p>In all, the patch should be commented so that any 4149<p>The patch should be commented so that any
4187 developer who knows the code of the application can make some use of 4150 developer who knows the code of the application can make some use of
4188 the patch. Special care should be taken for the upstream developers, 4151 the patch. Special care should be taken for the upstream developers,
4189 since we generally want that they accept our patches, so we have less 4152 since we generally want that they accept our patches, so we have less
4190 work in the future.</p> 4153 work in the future.</p>
4191</div> 4154</div>
4192<div class="sect2"> 4155<div class="sect2">
4193<div class="titlepage"><div><div><h3 class="title"> 4156<div class="titlepage"><div><div><h3 class="title">
4194<a name="components.patches.caveats"></a>11.3.2. Creating patch files</h3></div></div></div> 4157<a name="components.patches.caveats"></a>11.3.2. Creating patch files</h3></div></div></div>
4195<p>One important thing to mention is to pay attention that no RCS 4158<p>One important thing to mention is to pay attention that no RCS
4196 IDs get stored in the patch files, as these will cause problems when 4159 IDs get stored in the patch files, as these will cause problems when
4197 later checked into the NetBSD CVS tree. Use the 4160 later checked into the NetBSD CVS tree. Use the
4198 <span class="command"><strong>pkgdiff</strong></span> command from the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package to avoid these 4161 <span class="command"><strong>pkgdiff</strong></span> command from the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package to avoid these
4199 problems.</p> 4162 problems.</p>
@@ -4564,30 +4527,28 @@ FILESDIR=${.CURDIR}/../xemacs/files @@ -4564,30 +4527,28 @@ FILESDIR=${.CURDIR}/../xemacs/files
4564</div> 4527</div>
4565<div class="chapter"> 4528<div class="chapter">
4566<div class="titlepage"><div><div><h2 class="title"> 4529<div class="titlepage"><div><div><h2 class="title">
4567<a name="makefile"></a>Chapter 12. Programming in <code class="filename">Makefile</code>s</h2></div></div></div> 4530<a name="makefile"></a>Chapter 12. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
4568<div class="toc"> 4531<div class="toc">
4569<p><b>Table of Contents</b></p> 4532<p><b>Table of Contents</b></p>
4570<dl class="toc"> 4533<dl class="toc">
4571<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt> 4534<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt>
4572<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt> 4535<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt>
4573<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd> 4536<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd>
4574<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt> 4537<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt>
4575<dd><dl> 4538<dd><dl>
4576<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt> 4539<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt>
4577<dt><span class="sect2"><a href="#converting-internal-to-external">12.3.2. Converting an internal list into an external list</a></span></dt> 4540<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.2. Passing variables to a shell command</a></span></dt>
4578<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.3. Passing variables to a shell command</a></span></dt> 4541<dt><span class="sect2"><a href="#quoting-guideline">12.3.3. Quoting guideline</a></span></dt>
4579<dt><span class="sect2"><a href="#quoting-guideline">12.3.4. Quoting guideline</a></span></dt> 
4580<dt><span class="sect2"><a href="#bsd-make-bug-workaround">12.3.5. Workaround for a bug in BSD Make</a></span></dt> 
4581</dl></dd> 4542</dl></dd>
4582</dl> 4543</dl>
4583</div> 4544</div>
4584<p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments, 4545<p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
4585 each of which forms a well-defined part of the pkgsrc system. Using 4546 each of which forms a well-defined part of the pkgsrc system. Using
4586 the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> system as a programming language for a big system 4547 the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> system as a programming language for a big system
4587 like pkgsrc requires some discipline to keep the code correct and 4548 like pkgsrc requires some discipline to keep the code correct and
4588 understandable.</p> 4549 understandable.</p>
4589<p>The basic ingredients for <code class="filename">Makefile</code> 4550<p>The basic ingredients for <code class="filename">Makefile</code>
4590 programming are variables (which are actually macros) and shell 4551 programming are variables (which are actually macros) and shell
4591 commands. Among these shell commands may even be more complex ones 4552 commands. Among these shell commands may even be more complex ones
4592 like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span></a> programs. To make sure that every shell command runs 4553 like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span></a> programs. To make sure that every shell command runs
4593 as intended it is necessary to quote all variables correctly when they 4554 as intended it is necessary to quote all variables correctly when they
@@ -4636,44 +4597,34 @@ correct: @@ -4636,44 +4597,34 @@ correct:
4636 ``:='', and ``!='', which are described in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man 4597 ``:='', and ``!='', which are described in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man
4637 page.</p> 4598 page.</p>
4638<p>When a variable's value is parsed from a 4599<p>When a variable's value is parsed from a
4639 <code class="filename">Makefile</code>, the hash character ``#'' and the 4600 <code class="filename">Makefile</code>, the hash character ``#'' and the
4640 backslash character ``\'' are handled specially. If a backslash is 4601 backslash character ``\'' are handled specially. If a backslash is
4641 followed by a newline, any whitespace immediately in front of the 4602 followed by a newline, any whitespace immediately in front of the
4642 backslash, the backslash, the newline, and any whitespace 4603 backslash, the backslash, the newline, and any whitespace
4643 immediately behind the newline are replaced with a single space. A 4604 immediately behind the newline are replaced with a single space. A
4644 backslash character and an immediately following hash character are 4605 backslash character and an immediately following hash character are
4645 replaced with a single hash character. Otherwise, the backslash is 4606 replaced with a single hash character. Otherwise, the backslash is
4646 passed as is. In a variable assignment, any hash character that is 4607 passed as is. In a variable assignment, any hash character that is
4647 not preceded by a backslash starts a comment that continues upto the 4608 not preceded by a backslash starts a comment that continues upto the
4648 end of the logical line.</p> 4609 end of the logical line.</p>
4649<p><span class="emphasis"><em>Note:</em></span> Because of this parsing algorithm 4610<p>The evaluation of variables either happens immediately or lazy.
4650 the only way to create a variable consisting of a single backslash 4611 It happens immediately when the variable occurs
4651 is using the ``!='' operator, for example: <code class="varname">BACKSLASH!=echo "\\"</code>.</p> 4612 on the right-hand side of the ``:='' or the ``!='' operator, in a
4652<p>So far for defining variables. The other thing you can do with 4613 <code class="varname">.if</code> condition or a <code class="varname">.for</code> loop.
4653 variables is evaluating them. A variable is evaluated when it is 4614 In the other cases, it is evaluated lazily.</p>
4654 part of the right side of the ``:='' or the ``!='' operator, or 
4655 directly before executing a shell command which the variable is part 
4656 of. In all other cases, <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> performs lazy evaluation, that 
4657 is, variables are not evaluated until there's no other way. The 
4658 ``modifiers'' mentioned in the man page also evaluate the 
4659 variable.</p> 
4660<p>Some of the modifiers split the string into words and then 4615<p>Some of the modifiers split the string into words and then
4661 operate on the words, others operate on the string as a whole. When 4616 operate on the words, others operate on the string as a whole. When
4662 a string is split into words, it is split as you would expect 4617 a string is split into words, it is split like in <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">sh</span>(1)</span></a>.</p>
4663 it from <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">sh</span>(1)</span></a>.</p> 
4664<p>No rule without exception&mdash;the <span class="command"><strong>.for</strong></span> 
4665 loop does not follow the shell quoting rules but splits at sequences 
4666 of whitespace.</p> 
4667<p>There are several types of variables that should be handled 4618<p>There are several types of variables that should be handled
4668 differently. Strings and two types of lists.</p> 4619 differently. Strings and two types of lists.</p>
4669<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 4620<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4670<li class="listitem"><p><span class="emphasis"><em>Strings</em></span> can contain arbitrary 4621<li class="listitem"><p><span class="emphasis"><em>Strings</em></span> can contain arbitrary
4671 characters. Nevertheless, you should restrict yourself to only 4622 characters. Nevertheless, you should restrict yourself to only
4672 using printable characters. Examples are 4623 using printable characters. Examples are
4673 <code class="varname">PREFIX</code> and 4624 <code class="varname">PREFIX</code> and
4674 <code class="varname">COMMENT</code>.</p></li> 4625 <code class="varname">COMMENT</code>.</p></li>
4675<li class="listitem"><p><span class="emphasis"><em>Internal lists</em></span> are lists that 4626<li class="listitem"><p><span class="emphasis"><em>Internal lists</em></span> are lists that
4676 are never exported to any shell command. Their elements are 4627 are never exported to any shell command. Their elements are
4677 separated by whitespace. Therefore, the elements themselves cannot 4628 separated by whitespace. Therefore, the elements themselves cannot
4678 have embedded whitespace. Any other characters are allowed. 4629 have embedded whitespace. Any other characters are allowed.
4679 Internal lists can be used in <span class="command"><strong>.for</strong></span> loops. 4630 Internal lists can be used in <span class="command"><strong>.for</strong></span> loops.
@@ -4722,86 +4673,52 @@ ANOTHER_EXT_LIST= a=b c=d @@ -4722,86 +4673,52 @@ ANOTHER_EXT_LIST= a=b c=d
4722INT_LIST+= ${STRING} # 1 4673INT_LIST+= ${STRING} # 1
4723INT_LIST+= ${ANOTHER_INT_LIST} # 2 4674INT_LIST+= ${ANOTHER_INT_LIST} # 2
4724EXT_LIST+= ${STRING:Q} # 3 4675EXT_LIST+= ${STRING:Q} # 3
4725EXT_LIST+= ${ANOTHER_EXT_LIST} # 4 4676EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
4726</pre> 4677</pre>
4727<p>When you add a string to an external list (example 3), it 4678<p>When you add a string to an external list (example 3), it
4728 must be quoted. In all other cases, you must not add a quoting 4679 must be quoted. In all other cases, you must not add a quoting
4729 level. You must not merge internal and external lists, unless you 4680 level. You must not merge internal and external lists, unless you
4730 are sure that all entries are correctly interpreted in both 4681 are sure that all entries are correctly interpreted in both
4731 lists.</p> 4682 lists.</p>
4732</div> 4683</div>
4733<div class="sect2"> 4684<div class="sect2">
4734<div class="titlepage"><div><div><h3 class="title"> 4685<div class="titlepage"><div><div><h3 class="title">
4735<a name="converting-internal-to-external"></a>12.3.2. Converting an internal list into an external list</h3></div></div></div> 4686<a name="passing-variable-to-shell"></a>12.3.2. Passing variables to a shell command</h3></div></div></div>
4736<pre class="programlisting"> 
4737EXT_LIST= # empty 
4738.for i in ${INT_LIST} 
4739EXT_LIST+= ${i:Q}"" 
4740.endfor 
4741</pre> 
4742<p>This code converts the internal list 
4743 <code class="varname">INT_LIST</code> into the external list 
4744 <code class="varname">EXT_LIST</code>. As the elements of an internal list 
4745 are unquoted they must be quoted here. The reason for appending 
4746 <code class="varname">""</code> is explained below.</p> 
4747</div> 
4748<div class="sect2"> 
4749<div class="titlepage"><div><div><h3 class="title"> 
4750<a name="passing-variable-to-shell"></a>12.3.3. Passing variables to a shell command</h3></div></div></div> 
4751<p>Sometimes you may want to print an arbitrary string. There 4687<p>Sometimes you may want to print an arbitrary string. There
4752 are many ways to get it wrong and only few that can handle every 4688 are many ways to get it wrong and only few that can handle every
4753 nastiness.</p> 4689 nastiness.</p>
4754<pre class="programlisting"> 4690<pre class="programlisting">
4755STRING= foo bar &lt; &gt; * `date` $$HOME ' " 4691STRING= foo bar &lt; &gt; * `date` $$HOME ' "
4756EXT_LIST= string=${STRING:Q} x=second\ item 4692EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
4757 4693
4758all: 4694all:
4759 echo ${STRING} # 1 4695 echo ${STRING} # 1
4760 echo "${STRING}" # 2 4696 echo ${STRING:Q} # 2
4761 echo "${STRING:Q}" # 3 4697 printf '%s\n' ${STRING:Q}'' # 3
4762 echo ${STRING:Q} # 4 4698 env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
4763 echo x${STRING:Q} | sed 1s,.,, # 5 
4764 printf "%s\\n" ${STRING:Q}"" # 6 
4765 env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"' 
4766</pre> 4699</pre>
4767<p>Example 1 leads to a syntax error in the shell, as the 4700<p>Example 1 leads to a syntax error in the shell, as the
4768 characters are just copied.</p> 4701 characters are just copied.</p>
4769<p>Example 2 leads to a syntax error too, and if you leave out 4702<p>Example 2 can handle all strings, except those starting
4770 the last " character from <code class="varname">${STRING}</code>, 4703 with a dash or those containing backslashes.</p>
4771 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">date</span>(1)</span></a> will be executed. The <code class="varname">$HOME</code> shell 4704<p>Example 3 can handle arbitrary strings.</p>
4772 variable would be evaluated, too.</p> 4705<p>In example 4, the <code class="varname">EXT_LIST</code> does not
4773<p>Example 3 outputs each space character preceded by a 4706 need to be quoted because the quoting has already been done
4774 backslash (or not), depending on the implementation of the 4707 when adding elements to the list.</p>
4775 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">echo</span>(1)</span></a> command.</p> 
4776<p>Example 4 handles correctly every string that does not start 
4777 with a dash. In that case, the result depends on the 
4778 implementation of the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">echo</span>(1)</span></a> command. As long as you can 
4779 guarantee that your input does not start with a dash, this form is 
4780 appropriate.</p> 
4781<p>Example 5 handles even the case of a leading dash 
4782 correctly.</p> 
4783<p>Example 6 also works with every string and is the 
4784 light-weight solution, since it does not involve a pipe, which has 
4785 its own problems.</p> 
4786<p>The <code class="varname">EXT_LIST</code> does not need to be quoted 
4787 because the quoting has already been done when adding elements to 
4788 the list.</p> 
4789<p>As internal lists shall not be passed to the shell, there is 
4790 no example for it.</p> 
4791</div> 4708</div>
4792<div class="sect2"> 4709<div class="sect2">
4793<div class="titlepage"><div><div><h3 class="title"> 4710<div class="titlepage"><div><div><h3 class="title">
4794<a name="quoting-guideline"></a>12.3.4. Quoting guideline</h3></div></div></div> 4711<a name="quoting-guideline"></a>12.3.3. Quoting guideline</h3></div></div></div>
4795<p>There are many possible sources of wrongly quoted variables. 4712<p>There are many possible sources of wrongly quoted variables.
4796 This section lists some of the commonly known ones.</p> 4713 This section lists some of the commonly known ones.</p>
4797<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 4714<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4798<li class="listitem"> 4715<li class="listitem">
4799<p>Whenever you use the value of a list, think 4716<p>Whenever you use the value of a list, think
4800 about what happens to leading or trailing whitespace. If the 4717 about what happens to leading or trailing whitespace. If the
4801 list is a well-formed shell expression, you can apply the 4718 list is a well-formed shell expression, you can apply the
4802 <code class="varname">:M*</code> modifier to strip leading and trailing 4719 <code class="varname">:M*</code> modifier to strip leading and trailing
4803 whitespace from each word. The <code class="varname">:M</code> operator 4720 whitespace from each word. The <code class="varname">:M</code> operator
4804 first splits its argument according to the rules of the shell, 4721 first splits its argument according to the rules of the shell,
4805 and then creates a new list consisting of all words that match 4722 and then creates a new list consisting of all words that match
4806 the shell glob expression <code class="varname">*</code>, that is: all. 4723 the shell glob expression <code class="varname">*</code>, that is: all.
4807 One class of situations where this is needed is when adding a 4724 One class of situations where this is needed is when adding a
@@ -4862,40 +4779,26 @@ for_test: @@ -4862,40 +4779,26 @@ for_test:
4862 <code class="varname">${EMPTY:Q}""</code>. This pattern can be often found 4779 <code class="varname">${EMPTY:Q}""</code>. This pattern can be often found
4863 as <code class="varname">${TEST} -z ${VAR:Q}</code> or as <code class="varname">${TEST} 4780 as <code class="varname">${TEST} -z ${VAR:Q}</code> or as <code class="varname">${TEST}
4864 -f ${FNAME:Q}</code> (both of these are wrong).</p> 4781 -f ${FNAME:Q}</code> (both of these are wrong).</p>
4865<p>The second example will only print three lines instead of 4782<p>The second example will only print three lines instead of
4866 four. The first line looks like <code class="varname">a:\ echo foo</code>. 4783 four. The first line looks like <code class="varname">a:\ echo foo</code>.
4867 This is because the backslash of the value 4784 This is because the backslash of the value
4868 <code class="varname">a:\</code> is interpreted as a line-continuation by 4785 <code class="varname">a:\</code> is interpreted as a line-continuation by
4869 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, which makes the second line the arguments of the 4786 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, which makes the second line the arguments of the
4870 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">echo</span>(1)</span></a> command from the first line. To avoid this, write 4787 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">echo</span>(1)</span></a> command from the first line. To avoid this, write
4871 <code class="varname">${i:Q}""</code>.</p> 4788 <code class="varname">${i:Q}""</code>.</p>
4872</li> 4789</li>
4873</ul></div> 4790</ul></div>
4874</div> 4791</div>
4875<div class="sect2"> 
4876<div class="titlepage"><div><div><h3 class="title"> 
4877<a name="bsd-make-bug-workaround"></a>12.3.5. Workaround for a bug in BSD Make</h3></div></div></div> 
4878<p>The pkgsrc bmake program does not handle the following 
4879 assignment correctly. In case <code class="varname">_othervar_</code> 
4880 contains a ``-'' character, one of the closing braces is included 
4881 in <code class="varname">${VAR}</code> after this code executes.</p> 
4882<pre class="programlisting"> 
4883VAR:= ${VAR:N${_othervar_:C/-//}} 
4884</pre> 
4885<p>For a more complex code snippet and a workaround, see the 
4886 package <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/regress/make-quoting/README.html" target="_top"><code class="filename">regress/make-quoting</code></a>, testcase 
4887 <code class="varname">bug1</code>.</p> 
4888</div> 
4889</div> 4792</div>
4890</div> 4793</div>
4891<div class="chapter"> 4794<div class="chapter">
4892<div class="titlepage"><div><div><h2 class="title"> 4795<div class="titlepage"><div><div><h2 class="title">
4893<a name="plist"></a>Chapter 13. PLIST issues</h2></div></div></div> 4796<a name="plist"></a>Chapter 13. PLIST issues</h2></div></div></div>
4894<div class="toc"> 4797<div class="toc">
4895<p><b>Table of Contents</b></p> 4798<p><b>Table of Contents</b></p>
4896<dl class="toc"> 4799<dl class="toc">
4897<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt> 4800<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt>
4898<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt> 4801<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
4899<dt><span class="sect1"><a href="#print-PLIST">13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt> 4802<dt><span class="sect1"><a href="#print-PLIST">13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
4900<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt> 4803<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt>
4901<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt> 4804<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt>
@@ -6306,27 +6209,27 @@ details.

 @@ -6306,27 +6209,27 @@ details.

6306<div class="sect1"> 6209<div class="sect1">
6307<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6210<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6308<a name="build.prefix"></a>17.2. Program location</h2></div></div></div> 6211<a name="build.prefix"></a>17.2. Program location</h2></div></div></div>
6309<p>Before outlining the process performed by the NetBSD package system in 6212<p>Before outlining the process performed by the NetBSD package system in
6310 the next section, here's a brief discussion on where programs are 6213 the next section, here's a brief discussion on where programs are
6311 installed, and which variables influence this.</p> 6214 installed, and which variables influence this.</p>
6312<p>The automatic variable <code class="varname">PREFIX</code> indicates 6215<p>The automatic variable <code class="varname">PREFIX</code> indicates
6313 where all files of the final program shall be installed. It is 6216 where all files of the final program shall be installed. It is
6314 usually set to <code class="varname">LOCALBASE</code> 6217 usually set to <code class="varname">LOCALBASE</code>
6315 (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code> 6218 (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code>
6316 for pkgs in the <code class="filename">cross</code> category. The value of 6219 for pkgs in the <code class="filename">cross</code> category. The value of
6317 <code class="varname">PREFIX</code> needs to be put 6220 <code class="varname">PREFIX</code> needs to be put
6318 into the various places in the program's source where paths to 6221 into the various places in the program's source where paths to
6319 these files are encoded. See <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;patches/*&#8221;</a> and <a class="xref" href="#fixes.libtool" title="19.3.1. Shared libraries - libtool">Section 19.3.1, &#8220;Shared libraries - libtool&#8221;</a> for more details.</p> 6222 these files are encoded. See <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> and <a class="xref" href="#fixes.libtool" title="19.3.1. Shared libraries - libtool">Section 19.3.1, &#8220;Shared libraries - libtool&#8221;</a> for more details.</p>
6320<p>When choosing which of these variables to use, 6223<p>When choosing which of these variables to use,
6321 follow the following rules:</p> 6224 follow the following rules:</p>
6322<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 6225<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6323<li class="listitem"><p><code class="varname">PREFIX</code> always points to the location 6226<li class="listitem"><p><code class="varname">PREFIX</code> always points to the location
6324 where the current pkg will be installed. When referring to a 6227 where the current pkg will be installed. When referring to a
6325 pkg's own installation path, use 6228 pkg's own installation path, use
6326 <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span>.</p></li> 6229 <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span>.</p></li>
6327<li class="listitem"><p><code class="varname">LOCALBASE</code> is where all non-X11 pkgs 6230<li class="listitem"><p><code class="varname">LOCALBASE</code> is where all non-X11 pkgs
6328 are installed. If you need to construct a -I or -L argument 6231 are installed. If you need to construct a -I or -L argument
6329 to the compiler to find includes and libraries installed by 6232 to the compiler to find includes and libraries installed by
6330 another non-X11 pkg, use <span class="quote">&#8220;<span class="quote">${LOCALBASE}</span>&#8221;</span>. The name 6233 another non-X11 pkg, use <span class="quote">&#8220;<span class="quote">${LOCALBASE}</span>&#8221;</span>. The name
6331 <code class="varname">LOCALBASE</code> stems from FreeBSD, which 6234 <code class="varname">LOCALBASE</code> stems from FreeBSD, which
6332 installed all packages in <code class="filename">/usr/local</code>. As 6235 installed all packages in <code class="filename">/usr/local</code>. As
@@ -6640,27 +6543,27 @@ ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site @@ -6640,27 +6543,27 @@ ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site
6640<div class="sect1"> 6543<div class="sect1">
6641<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6544<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6642<a name="build.patch"></a>17.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div> 6545<a name="build.patch"></a>17.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
6643<p>After extraction, all the patches named by the 6546<p>After extraction, all the patches named by the
6644 <code class="varname">PATCHFILES</code>, those present in the patches 6547 <code class="varname">PATCHFILES</code>, those present in the patches
6645 subdirectory of the package as well as in 6548 subdirectory of the package as well as in
6646 $LOCALPATCHES/$PKGPATH (e.g. 6549 $LOCALPATCHES/$PKGPATH (e.g.
6647 <code class="filename">/usr/local/patches/graphics/png</code>) are 6550 <code class="filename">/usr/local/patches/graphics/png</code>) are
6648 applied. Patchfiles ending in <code class="filename">.Z</code> or 6551 applied. Patchfiles ending in <code class="filename">.Z</code> or
6649 <code class="filename">.gz</code> are uncompressed before they are 6552 <code class="filename">.gz</code> are uncompressed before they are
6650 applied, files ending in <code class="filename">.orig</code> or 6553 applied, files ending in <code class="filename">.orig</code> or
6651 <code class="filename">.rej</code> are ignored. Any special options to 6554 <code class="filename">.rej</code> are ignored. Any special options to
6652 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> can be handed in 6555 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> can be handed in
6653 <code class="varname">PATCH_DIST_ARGS</code>. See <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;patches/*&#8221;</a> for more details.</p> 6556 <code class="varname">PATCH_DIST_ARGS</code>. See <a class="xref" href="#components.patches" title="11.3. patches/*">Section 11.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more details.</p>
6654<p>By default <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> is given special args to make 6557<p>By default <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> is given special args to make
6655 it fail if the patches apply with some lines of fuzz. Please 6558 it fail if the patches apply with some lines of fuzz. Please
6656 fix (regen) the patches so that they apply cleanly. The 6559 fix (regen) the patches so that they apply cleanly. The
6657 rationale behind this is that patches that don't apply cleanly 6560 rationale behind this is that patches that don't apply cleanly
6658 may end up being applied in the wrong place, and cause severe 6561 may end up being applied in the wrong place, and cause severe
6659 harm there.</p> 6562 harm there.</p>
6660</div> 6563</div>
6661<div class="sect1"> 6564<div class="sect1">
6662<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6565<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6663<a name="build.tools"></a>17.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div> 6566<a name="build.tools"></a>17.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
6664<p>This is covered in <a class="xref" href="#tools" title="Chapter 18. Tools needed for building or running">Chapter 18, <i>Tools needed for building or running</i></a>. 6567<p>This is covered in <a class="xref" href="#tools" title="Chapter 18. Tools needed for building or running">Chapter 18, <i>Tools needed for building or running</i></a>.
6665 </p> 6568 </p>
6666</div> 6569</div>
@@ -7357,67 +7260,67 @@ the name of the common tools. For exampl @@ -7357,67 +7260,67 @@ the name of the common tools. For exampl
7357.if exists(/usr/bin/bzcat) 7260.if exists(/usr/bin/bzcat)
7358TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat 7261TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
7359.elif exists(/usr/bin/bzip2) 7262.elif exists(/usr/bin/bzip2)
7360TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd 7263TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
7361.endif 7264.endif
7362 7265
7363TOOLS_PLATFORM.true?= true # shell builtin 7266TOOLS_PLATFORM.true?= true # shell builtin
7364</pre> 7267</pre>
7365</div> 7268</div>
7366<div class="sect1"> 7269<div class="sect1">
7367<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7270<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7368<a name="tools.questions"></a>18.4. Questions regarding the tools</h2></div></div></div> 7271<a name="tools.questions"></a>18.4. Questions regarding the tools</h2></div></div></div>
7369<div class="qandaset"> 7272<div class="qandaset">
7370<a name="idm83805728"></a><dl> 7273<a name="idm83808672"></a><dl>
7371<dt>18.4.1. <a href="#tools.new">How do I add a new tool?</a> 7274<dt>18.4.1. <a href="#tools.new">How do I add a new tool?</a>
7372</dt> 7275</dt>
7373<dt>18.4.2. <a href="#tools.listall">How do I get a list of all available 7276<dt>18.4.2. <a href="#tools.listall">How do I get a list of all available
7374 tools?</a> 7277 tools?</a>
7375</dt> 7278</dt>
7376<dt>18.4.3. <a href="#tools.used">How can I get a list of all the tools that a 7279<dt>18.4.3. <a href="#tools.used">How can I get a list of all the tools that a
7377 package is using while being built? I want to know whether it 7280 package is using while being built? I want to know whether it
7378 uses sed or not.</a> 7281 uses sed or not.</a>
7379</dt> 7282</dt>
7380</dl> 7283</dl>
7381<table border="0" style="width: 100%;"> 7284<table border="0" style="width: 100%;">
7382<colgroup> 7285<colgroup>
7383<col align="left" width="1%"> 7286<col align="left" width="1%">
7384<col> 7287<col>
7385</colgroup> 7288</colgroup>
7386<tbody> 7289<tbody>
7387<tr class="question"> 7290<tr class="question">
7388<td align="left" valign="top"> 7291<td align="left" valign="top">
7389<a name="tools.new"></a><a name="idm83805344"></a><p><b>18.4.1.</b></p> 7292<a name="tools.new"></a><a name="idm83808288"></a><p><b>18.4.1.</b></p>
7390</td> 7293</td>
7391<td align="left" valign="top"><p>How do I add a new tool?</p></td> 7294<td align="left" valign="top"><p>How do I add a new tool?</p></td>
7392</tr> 7295</tr>
7393<tr class="answer"> 7296<tr class="answer">
7394<td align="left" valign="top"></td> 7297<td align="left" valign="top"></td>
7395<td align="left" valign="top"><p>TODO</p></td> 7298<td align="left" valign="top"><p>TODO</p></td>
7396</tr> 7299</tr>
7397<tr class="question"> 7300<tr class="question">
7398<td align="left" valign="top"> 7301<td align="left" valign="top">
7399<a name="tools.listall"></a><a name="idm83804320"></a><p><b>18.4.2.</b></p> 7302<a name="tools.listall"></a><a name="idm83807264"></a><p><b>18.4.2.</b></p>
7400</td> 7303</td>
7401<td align="left" valign="top"><p>How do I get a list of all available 7304<td align="left" valign="top"><p>How do I get a list of all available
7402 tools?</p></td> 7305 tools?</p></td>
7403</tr> 7306</tr>
7404<tr class="answer"> 7307<tr class="answer">
7405<td align="left" valign="top"></td> 7308<td align="left" valign="top"></td>
7406<td align="left" valign="top"><p>TODO</p></td> 7309<td align="left" valign="top"><p>TODO</p></td>
7407</tr> 7310</tr>
7408<tr class="question"> 7311<tr class="question">
7409<td align="left" valign="top"> 7312<td align="left" valign="top">
7410<a name="tools.used"></a><a name="idm83803296"></a><p><b>18.4.3.</b></p> 7313<a name="tools.used"></a><a name="idm83806240"></a><p><b>18.4.3.</b></p>
7411</td> 7314</td>
7412<td align="left" valign="top"><p>How can I get a list of all the tools that a 7315<td align="left" valign="top"><p>How can I get a list of all the tools that a
7413 package is using while being built? I want to know whether it 7316 package is using while being built? I want to know whether it
7414 uses sed or not.</p></td> 7317 uses sed or not.</p></td>
7415</tr> 7318</tr>
7416<tr class="answer"> 7319<tr class="answer">
7417<td align="left" valign="top"></td> 7320<td align="left" valign="top"></td>
7418<td align="left" valign="top"><p>Currently, you can't. (TODO: But I want to be able 7321<td align="left" valign="top"><p>Currently, you can't. (TODO: But I want to be able
7419 to do it.)</p></td> 7322 to do it.)</p></td>
7420</tr> 7323</tr>
7421</tbody> 7324</tbody>
7422</table> 7325</table>
7423</div> 7326</div>
@@ -7508,34 +7411,35 @@ TOOLS_PLATFORM.true?= true  @@ -7508,34 +7411,35 @@ TOOLS_PLATFORM.true?= true
7508<div class="sect2"> 7411<div class="sect2">
7509<div class="titlepage"><div><div><h3 class="title"> 7412<div class="titlepage"><div><div><h3 class="title">
7510<a name="pulling-vars-from-etc-mk.conf"></a>19.1.1. How to pull in user-settable variables from <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> 7413<a name="pulling-vars-from-etc-mk.conf"></a>19.1.1. How to pull in user-settable variables from <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
7511</h3></div></div></div> 7414</h3></div></div></div>
7512<p>The pkgsrc user can configure pkgsrc by overriding several 7415<p>The pkgsrc user can configure pkgsrc by overriding several
7513 variables in the file pointed to by <code class="varname">MAKECONF</code>, 7416 variables in the file pointed to by <code class="varname">MAKECONF</code>,
7514 which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you 7417 which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
7515 want to use those variables in the preprocessor directives of 7418 want to use those variables in the preprocessor directives of
7516 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> (for example <code class="literal">.if</code> or 7419 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> (for example <code class="literal">.if</code> or
7517 <code class="literal">.for</code>), you need to include the file 7420 <code class="literal">.for</code>), you need to include the file
7518 <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn 7421 <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
7519 loads the user preferences.</p> 7422 loads the user preferences.</p>
7520<p>But note that some variables may not be completely defined 7423<p>But note that some variables may not be completely defined
7521 after <code class="filename">../../mk/bsd.prefs.mk</code> has been included, 7424 after <code class="filename">../../mk/bsd.prefs.mk</code> has been
7522 as they may contain references to variables that are not yet 7425 included, as they may contain references to variables that are
7523 defined. In shell commands (the lines in 7426 not yet defined. In shell commands (the lines in
7524 <code class="filename">Makefile</code> that are indented with a tab) this is 7427 <code class="filename">Makefile</code> that are indented with a tab) this
7525 no problem, since variables are only expanded when they are used. 7428 is no problem, since variables are only expanded when they are
7526 But in the preprocessor directives mentioned above and in dependency 7429 used. But in the preprocessor directives mentioned above and in
7527 lines (of the form <code class="literal">target: dependencies</code>) the 7430 dependency lines (of the form <code class="literal">target:
7528 variables are expanded at load time.</p> 7431 dependencies</code>) the variables are expanded at load
 7432 time.</p>
7529<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 7433<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
7530<h3 class="title">Note</h3> 7434<h3 class="title">Note</h3>
7531<p>To check whether a variable can be used at load time, 7435<p>To check whether a variable can be used at load time,
7532 run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p> 7436 run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p>
7533</div> 7437</div>
7534</div> 7438</div>
7535<div class="sect2"> 7439<div class="sect2">
7536<div class="titlepage"><div><div><h3 class="title"> 7440<div class="titlepage"><div><div><h3 class="title">
7537<a name="user-interaction"></a>19.1.2. User interaction</h3></div></div></div> 7441<a name="user-interaction"></a>19.1.2. User interaction</h3></div></div></div>
7538<p>Occasionally, packages require interaction from the user, 7442<p>Occasionally, packages require interaction from the user,
7539 and this can be in a number of ways:</p> 7443 and this can be in a number of ways:</p>
7540<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 7444<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
7541<li class="listitem"><p>When fetching the distfiles, some packages require user 7445<li class="listitem"><p>When fetching the distfiles, some packages require user
@@ -7557,28 +7461,32 @@ INTERACTIVE_STAGE= configure instal @@ -7557,28 +7461,32 @@ INTERACTIVE_STAGE= configure instal
7557 <code class="varname">BATCH</code> variable. Packages that require interaction 7461 <code class="varname">BATCH</code> variable. Packages that require interaction
7558 are also excluded from bulk builds.</p> 7462 are also excluded from bulk builds.</p>
7559</div> 7463</div>
7560<div class="sect2"> 7464<div class="sect2">
7561<div class="titlepage"><div><div><h3 class="title"> 7465<div class="titlepage"><div><div><h3 class="title">
7562<a name="handling-licenses"></a>19.1.3. Handling licenses</h3></div></div></div> 7466<a name="handling-licenses"></a>19.1.3. Handling licenses</h3></div></div></div>
7563<p>Authors of software can choose the licence under which 7467<p>Authors of software can choose the licence under which
7564 software can be copied. This is due to copyright law, and reasons 7468 software can be copied. This is due to copyright law, and reasons
7565 for license choices are outside the scope of pkgsrc. The pkgsrc 7469 for license choices are outside the scope of pkgsrc. The pkgsrc
7566 system recognizes that there are a number of licenses which some 7470 system recognizes that there are a number of licenses which some
7567 users may find objectionable or difficult or impossible to comply 7471 users may find objectionable or difficult or impossible to comply
7568 with. The Free Software Foundation has declared some licenses 7472 with. The Free Software Foundation has declared some licenses
7569 "Free", and the Open Source Initiative has a definition of "Open 7473 "Free", and the Open Source Initiative has a definition of "Open
7570 Source". Note that a package whose license forbids to copy does 7474 Source". The pkgsrc system, as a policy choice, does not label
7571 not meet either the Free or Open Source test.</p> 7475 packages which have licenses that are Free or Open Source.
 7476 However, packages without a license meeting either of those tests
 7477 are labeled with a license tag denoting the license. Note that a
 7478 package with no license to copy trivially does not meet either the
 7479 Free or Open Source test.</p>
7572<p>For packages which are not Free or Open Source, pkgsrc will 7480<p>For packages which are not Free or Open Source, pkgsrc will
7573 not build the package unless the user has indicated to pkgsrc that 7481 not build the package unless the user has indicated to pkgsrc that
7574 packages with that particular license may be built. Note that 7482 packages with that particular license may be built. Note that
7575 this documentation avoids the term "accepted the license". The 7483 this documentation avoids the term "accepted the license". The
7576 pkgsrc system is merely providing a mechanism to avoid 7484 pkgsrc system is merely providing a mechanism to avoid
7577 accidentally building a package with a non-free license; 7485 accidentally building a package with a non-free license;
7578 judgement and responsibility remain with the user. (Installation 7486 judgement and responsibility remain with the user. (Installation
7579 of binary packages are not currently subject to this mechanism; 7487 of binary packages are not currently subject to this mechanism;
7580 this is a bug.)</p> 7488 this is a bug.)</p>
7581<p>One might want to only install packages with a BSD license, 7489<p>One might want to only install packages with a BSD license,
7582 or the GPL, and not the other. The free licenses are added to the 7490 or the GPL, and not the other. The free licenses are added to the
7583 default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The 7491 default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The
7584 user can override the default by setting the 7492 user can override the default by setting the
@@ -9544,27 +9452,27 @@ place.

 @@ -9544,27 +9452,27 @@ place.

9544</li> 9452</li>
9545</ol></div> 9453</ol></div>
9546</div> 9454</div>
9547</div> 9455</div>
9548<div class="chapter"> 9456<div class="chapter">
9549<div class="titlepage"><div><div><h2 class="title"> 9457<div class="titlepage"><div><div><h2 class="title">
9550<a name="devfaq"></a>Chapter 22. Frequently Asked Questions</h2></div></div></div> 9458<a name="devfaq"></a>Chapter 22. Frequently Asked Questions</h2></div></div></div>
9551<p>This section contains the answers to questions that may 9459<p>This section contains the answers to questions that may
9552 arise when you are writing a package. If you don't find your 9460 arise when you are writing a package. If you don't find your
9553 question answered here, first have a look in the other chapters, 9461 question answered here, first have a look in the other chapters,
9554 and if you still don't have the answer, ask on the 9462 and if you still don't have the answer, ask on the
9555 <code class="literal">pkgsrc-users</code> mailing list.</p> 9463 <code class="literal">pkgsrc-users</code> mailing list.</p>
9556<div class="qandaset"> 9464<div class="qandaset">
9557<a name="idm83229600"></a><dl> 9465<a name="idm83207968"></a><dl>
9558<dt>22.1. <a href="#devfaq.makeflags">What is the difference between 9466<dt>22.1. <a href="#devfaq.makeflags">What is the difference between
9559 MAKEFLAGS, .MAKEFLAGS and 9467 MAKEFLAGS, .MAKEFLAGS and
9560 MAKE_FLAGS?</a> 9468 MAKE_FLAGS?</a>
9561</dt> 9469</dt>
9562<dt>22.2. <a href="#devfaq.make">What is the difference between 9470<dt>22.2. <a href="#devfaq.make">What is the difference between
9563 MAKE, GMAKE and 9471 MAKE, GMAKE and
9564 MAKE_PROGRAM?</a> 9472 MAKE_PROGRAM?</a>
9565</dt> 9473</dt>
9566<dt>22.3. <a href="#devfaq.cc">What is the difference between 9474<dt>22.3. <a href="#devfaq.cc">What is the difference between
9567 CC, PKG_CC and 9475 CC, PKG_CC and
9568 PKGSRC_COMPILER?</a> 9476 PKGSRC_COMPILER?</a>
9569</dt> 9477</dt>
9570<dt>22.4. <a href="#devfaq.bl3flags">What is the difference between 9478<dt>22.4. <a href="#devfaq.bl3flags">What is the difference between
@@ -9589,157 +9497,157 @@ place.

 @@ -9589,157 +9497,157 @@ place.

9589</dt> 9497</dt>
9590<dt>22.9. <a href="#devfaq.too-much-time">I have a little time to kill. What shall I 9498<dt>22.9. <a href="#devfaq.too-much-time">I have a little time to kill. What shall I
9591do?</a> 9499do?</a>
9592</dt> 9500</dt>
9593</dl> 9501</dl>
9594<table border="0" style="width: 100%;"> 9502<table border="0" style="width: 100%;">
9595<colgroup> 9503<colgroup>
9596<col align="left" width="1%"> 9504<col align="left" width="1%">
9597<col> 9505<col>
9598</colgroup> 9506</colgroup>
9599<tbody> 9507<tbody>
9600<tr class="question"> 9508<tr class="question">
9601<td align="left" valign="top"> 9509<td align="left" valign="top">
9602<a name="devfaq.makeflags"></a><a name="idm83229216"></a><p><b>22.1.</b></p> 9510<a name="devfaq.makeflags"></a><a name="idm83207584"></a><p><b>22.1.</b></p>
9603</td> 9511</td>
9604<td align="left" valign="top"><p>What is the difference between 9512<td align="left" valign="top"><p>What is the difference between
9605 <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and 9513 <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
9606 <code class="varname">MAKE_FLAGS</code>?</p></td> 9514 <code class="varname">MAKE_FLAGS</code>?</p></td>
9607</tr> 9515</tr>
9608<tr class="answer"> 9516<tr class="answer">
9609<td align="left" valign="top"></td> 9517<td align="left" valign="top"></td>
9610<td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed 9518<td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed
9611 to the pkgsrc-internal invocations of <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, while 9519 to the pkgsrc-internal invocations of <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, while
9612 <code class="varname">MAKE_FLAGS</code> are the flags that are passed to 9520 <code class="varname">MAKE_FLAGS</code> are the flags that are passed to
9613 the <code class="varname">MAKE_PROGRAM</code> when building the 9521 the <code class="varname">MAKE_PROGRAM</code> when building the
9614 package. [FIXME: What is .MAKEFLAGS for?]</p></td> 9522 package. [FIXME: What is .MAKEFLAGS for?]</p></td>
9615</tr> 9523</tr>
9616<tr class="question"> 9524<tr class="question">
9617<td align="left" valign="top"> 9525<td align="left" valign="top">
9618<a name="devfaq.make"></a><a name="idm83225248"></a><p><b>22.2.</b></p> 9526<a name="devfaq.make"></a><a name="idm83203488"></a><p><b>22.2.</b></p>
9619</td> 9527</td>
9620<td align="left" valign="top"><p>What is the difference between 9528<td align="left" valign="top"><p>What is the difference between
9621 <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and 9529 <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
9622 <code class="varname">MAKE_PROGRAM</code>?</p></td> 9530 <code class="varname">MAKE_PROGRAM</code>?</p></td>
9623</tr> 9531</tr>
9624<tr class="answer"> 9532<tr class="answer">
9625<td align="left" valign="top"></td> 9533<td align="left" valign="top"></td>
9626<td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the 9534<td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the
9627 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> program that is used in the pkgsrc 9535 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> program that is used in the pkgsrc
9628 infrastructure. <code class="varname">GMAKE</code> is the path to GNU 9536 infrastructure. <code class="varname">GMAKE</code> is the path to GNU
9629 Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to 9537 Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to
9630 use that. <code class="varname">MAKE_PROGRAM</code> is the path to the 9538 use that. <code class="varname">MAKE_PROGRAM</code> is the path to the
9631 Make program that is used for building the 9539 Make program that is used for building the
9632 package.</p></td> 9540 package.</p></td>
9633</tr> 9541</tr>
9634<tr class="question"> 9542<tr class="question">
9635<td align="left" valign="top"> 9543<td align="left" valign="top">
9636<a name="devfaq.cc"></a><a name="idm83220768"></a><p><b>22.3.</b></p> 9544<a name="devfaq.cc"></a><a name="idm83199136"></a><p><b>22.3.</b></p>
9637</td> 9545</td>
9638<td align="left" valign="top"><p>What is the difference between 9546<td align="left" valign="top"><p>What is the difference between
9639 <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and 9547 <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
9640 <code class="varname">PKGSRC_COMPILER</code>?</p></td> 9548 <code class="varname">PKGSRC_COMPILER</code>?</p></td>
9641</tr> 9549</tr>
9642<tr class="answer"> 9550<tr class="answer">
9643<td align="left" valign="top"></td> 9551<td align="left" valign="top"></td>
9644<td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C 9552<td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C
9645 compiler, which can be configured by the pkgsrc user. 9553 compiler, which can be configured by the pkgsrc user.
9646 <code class="varname">PKG_CC</code> is the path to the compiler wrapper. 9554 <code class="varname">PKG_CC</code> is the path to the compiler wrapper.
9647 <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a 9555 <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a
9648 path to a compiler, but the type of compiler that should be 9556 path to a compiler, but the type of compiler that should be
9649 used. See <code class="filename">mk/compiler.mk</code> for more 9557 used. See <code class="filename">mk/compiler.mk</code> for more
9650 information about the latter variable.</p></td> 9558 information about the latter variable.</p></td>
9651</tr> 9559</tr>
9652<tr class="question"> 9560<tr class="question">
9653<td align="left" valign="top"> 9561<td align="left" valign="top">
9654<a name="devfaq.bl3flags"></a><a name="idm83216672"></a><p><b>22.4.</b></p> 9562<a name="devfaq.bl3flags"></a><a name="idm83194912"></a><p><b>22.4.</b></p>
9655</td> 9563</td>
9656<td align="left" valign="top"><p>What is the difference between 9564<td align="left" valign="top"><p>What is the difference between
9657 <code class="varname">BUILDLINK_LDFLAGS</code>, 9565 <code class="varname">BUILDLINK_LDFLAGS</code>,
9658 <code class="varname">BUILDLINK_LDADD</code> and 9566 <code class="varname">BUILDLINK_LDADD</code> and
9659 <code class="varname">BUILDLINK_LIBS</code>?</p></td> 9567 <code class="varname">BUILDLINK_LIBS</code>?</p></td>
9660</tr> 9568</tr>
9661<tr class="answer"> 9569<tr class="answer">
9662<td align="left" valign="top"></td> 9570<td align="left" valign="top"></td>
9663<td align="left" valign="top"><p>[FIXME]</p></td> 9571<td align="left" valign="top"><p>[FIXME]</p></td>
9664</tr> 9572</tr>
9665<tr class="question"> 9573<tr class="question">
9666<td align="left" valign="top"> 9574<td align="left" valign="top">
9667<a name="devfaq.bl3prefix"></a><a name="idm83214368"></a><p><b>22.5.</b></p> 9575<a name="devfaq.bl3prefix"></a><a name="idm83192736"></a><p><b>22.5.</b></p>
9668</td> 9576</td>
9669<td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var 9577<td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
9670 VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span> 9578 VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
9671 say it's empty?</p></td> 9579 say it's empty?</p></td>
9672</tr> 9580</tr>
9673<tr class="answer"> 9581<tr class="answer">
9674<td align="left" valign="top"></td> 9582<td align="left" valign="top"></td>
9675<td align="left" valign="top"><p>For optimization reasons, some variables are only 9583<td align="left" valign="top"><p>For optimization reasons, some variables are only
9676 available in the <span class="quote">&#8220;<span class="quote">wrapper</span>&#8221;</span> phase and later. To 9584 available in the <span class="quote">&#8220;<span class="quote">wrapper</span>&#8221;</span> phase and later. To
9677 <span class="quote">&#8220;<span class="quote">simulate</span>&#8221;</span> the wrapper phase, append 9585 <span class="quote">&#8220;<span class="quote">simulate</span>&#8221;</span> the wrapper phase, append
9678 <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above 9586 <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
9679 command.</p></td> 9587 command.</p></td>
9680</tr> 9588</tr>
9681<tr class="question"> 9589<tr class="question">
9682<td align="left" valign="top"> 9590<td align="left" valign="top">
9683<a name="devfaq.master_sites"></a><a name="idm83211296"></a><p><b>22.6.</b></p> 9591<a name="devfaq.master_sites"></a><a name="idm83189664"></a><p><b>22.6.</b></p>
9684</td> 9592</td>
9685<td align="left" valign="top"><p>What does 9593<td align="left" valign="top"><p>What does
9686 <code class="literal">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I 9594 <code class="literal">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
9687 don't understand the <code class="literal">:=</code> inside 9595 don't understand the <code class="literal">:=</code> inside
9688 it.</p></td> 9596 it.</p></td>
9689</tr> 9597</tr>
9690<tr class="answer"> 9598<tr class="answer">
9691<td align="left" valign="top"></td> 9599<td align="left" valign="top"></td>
9692<td align="left" valign="top"><p>The <code class="literal">:=</code> is not really an 9600<td align="left" valign="top"><p>The <code class="literal">:=</code> is not really an
9693 assignment operator, like you might expect at first sight. 9601 assignment operator, like you might expect at first sight.
9694 Instead, it is a degenerate form of 9602 Instead, it is a degenerate form of
9695 <code class="literal">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>, 9603 <code class="literal">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
9696 which is documented in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man page and which you 9604 which is documented in the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man page and which you
9697 may have seen as in <code class="literal">${SRCS:.c=.o}</code>. In the 9605 may have seen as in <code class="literal">${SRCS:.c=.o}</code>. In the
9698 case of <code class="varname">MASTER_SITE_*</code>, 9606 case of <code class="varname">MASTER_SITE_*</code>,
9699 <em class="replaceable"><code>old_string</code></em> is the empty string and 9607 <em class="replaceable"><code>old_string</code></em> is the empty string and
9700 <em class="replaceable"><code>new_string</code></em> is 9608 <em class="replaceable"><code>new_string</code></em> is
9701 <code class="literal">package/</code>. That's where the 9609 <code class="literal">package/</code>. That's where the
9702 <code class="literal">:</code> and the <code class="literal">=</code> fall 9610 <code class="literal">:</code> and the <code class="literal">=</code> fall
9703 together.</p></td> 9611 together.</p></td>
9704</tr> 9612</tr>
9705<tr class="question"> 9613<tr class="question">
9706<td align="left" valign="top"> 9614<td align="left" valign="top">
9707<a name="devfaq.mailinglists"></a><a name="idm83203232"></a><p><b>22.7.</b></p> 9615<a name="devfaq.mailinglists"></a><a name="idm83173408"></a><p><b>22.7.</b></p>
9708</td> 9616</td>
9709<td align="left" valign="top"><p>Which mailing lists are there for package 9617<td align="left" valign="top"><p>Which mailing lists are there for package
9710 developers?</p></td> 9618 developers?</p></td>
9711</tr> 9619</tr>
9712<tr class="answer"> 9620<tr class="answer">
9713<td align="left" valign="top"></td> 9621<td align="left" valign="top"></td>
9714<td align="left" valign="top"><div class="variablelist"><dl class="variablelist"> 9622<td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
9715<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a></span></dt> 9623<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a></span></dt>
9716<dd><p>This is a list for technical discussions related 9624<dd><p>This is a list for technical discussions related
9717 to pkgsrc development, e.g. soliciting feedback for changes to 9625 to pkgsrc development, e.g. soliciting feedback for changes to
9718 pkgsrc infrastructure, proposed new features, questions related 9626 pkgsrc infrastructure, proposed new features, questions related
9719 to porting pkgsrc to a new platform, advice for maintaining a 9627 to porting pkgsrc to a new platform, advice for maintaining a
9720 package, patches that affect many packages, help requests moved 9628 package, patches that affect many packages, help requests moved
9721 from pkgsrc-users when an infrastructure bug is found, 9629 from pkgsrc-users when an infrastructure bug is found,
9722 etc.</p></dd> 9630 etc.</p></dd>
9723<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-bugs" target="_top">pkgsrc-bugs</a></span></dt> 9631<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-bugs" target="_top">pkgsrc-bugs</a></span></dt>
9724<dd><p>All bug reports in category "pkg" sent with 9632<dd><p>All bug reports in category "pkg" sent with
9725 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> appear here. Please do not report your bugs here 9633 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> appear here. Please do not report your bugs here
9726 directly; use one of the other mailing 9634 directly; use one of the other mailing
9727 lists.</p></dd> 9635 lists.</p></dd>
9728</dl></div></td> 9636</dl></div></td>
9729</tr> 9637</tr>
9730<tr class="question"> 9638<tr class="question">
9731<td align="left" valign="top"> 9639<td align="left" valign="top">
9732<a name="devfaq.documentation"></a><a name="idm83199392"></a><p><b>22.8.</b></p> 9640<a name="devfaq.documentation"></a><a name="idm83169568"></a><p><b>22.8.</b></p>
9733</td> 9641</td>
9734<td align="left" valign="top"><p>Where is the pkgsrc 9642<td align="left" valign="top"><p>Where is the pkgsrc
9735 documentation?</p></td> 9643 documentation?</p></td>
9736</tr> 9644</tr>
9737<tr class="answer"> 9645<tr class="answer">
9738<td align="left" valign="top"></td> 9646<td align="left" valign="top"></td>
9739<td align="left" valign="top"> 9647<td align="left" valign="top">
9740<p>There are many places where you can find 9648<p>There are many places where you can find
9741 documentation about pkgsrc:</p> 9649 documentation about pkgsrc:</p>
9742<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9650<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9743<li class="listitem"><p>The pkgsrc guide (this document) is a collection 9651<li class="listitem"><p>The pkgsrc guide (this document) is a collection
9744 of chapters that explain large parts of pkgsrc, but some 9652 of chapters that explain large parts of pkgsrc, but some
9745 chapters tend to be outdated. Which ones they are is hard to 9653 chapters tend to be outdated. Which ones they are is hard to
@@ -9767,27 +9675,27 @@ do? @@ -9767,27 +9675,27 @@ do?
9767 documented</span>&#8221;</span>, that is the documentation exists only in the 9675 documented</span>&#8221;</span>, that is the documentation exists only in the
9768 mind of the developer who wrote the code. To get this 9676 mind of the developer who wrote the code. To get this
9769 information, use the <span class="command"><strong>cvs annotate</strong></span> command 9677 information, use the <span class="command"><strong>cvs annotate</strong></span> command
9770 to see who has written it and ask on the 9678 to see who has written it and ask on the
9771 <code class="literal">tech-pkg</code> mailing list, so that others can 9679 <code class="literal">tech-pkg</code> mailing list, so that others can
9772 find your questions later (see above). To be sure that the 9680 find your questions later (see above). To be sure that the
9773 developer in charge reads the mail, you may CC him or 9681 developer in charge reads the mail, you may CC him or
9774 her.</p></li> 9682 her.</p></li>
9775</ul></div> 9683</ul></div>
9776</td> 9684</td>
9777</tr> 9685</tr>
9778<tr class="question"> 9686<tr class="question">
9779<td align="left" valign="top"> 9687<td align="left" valign="top">
9780<a name="devfaq.too-much-time"></a><a name="idm83192992"></a><p><b>22.9.</b></p> 9688<a name="devfaq.too-much-time"></a><a name="idm83163168"></a><p><b>22.9.</b></p>
9781</td> 9689</td>
9782<td align="left" valign="top"><p>I have a little time to kill. What shall I 9690<td align="left" valign="top"><p>I have a little time to kill. What shall I
9783do?</p></td> 9691do?</p></td>
9784</tr> 9692</tr>
9785<tr class="answer"> 9693<tr class="answer">
9786<td align="left" valign="top"></td> 9694<td align="left" valign="top"></td>
9787<td align="left" valign="top"> 9695<td align="left" valign="top">
9788<p>This is not really an FAQ yet, but here's the answer 9696<p>This is not really an FAQ yet, but here's the answer
9789anyway.</p> 9697anyway.</p>
9790<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9698<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9791<li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the 9699<li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
9792 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/README.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a> package). It 9700 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/README.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a> package). It
9793 will tell you about newer versions of installed packages that are 9701 will tell you about newer versions of installed packages that are
@@ -10126,39 +10034,35 @@ details.

 @@ -10126,39 +10034,35 @@ details.

10126<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt> 10034<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt>
10127<dd><dl> 10035<dd><dl>
10128<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt> 10036<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt>
10129<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt> 10037<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt>
10130</dl></dd> 10038</dl></dd>
10131<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt> 10039<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt>
10132<dd><dl> 10040<dd><dl>
10133<dt><span class="sect2"><a href="#infr.order.prefs">24.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt> 10041<dt><span class="sect2"><a href="#infr.order.prefs">24.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
10134<dt><span class="sect2"><a href="#infr.order.pkg">24.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt> 10042<dt><span class="sect2"><a href="#infr.order.pkg">24.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
10135</dl></dd> 10043</dl></dd>
10136</dl></dd> 10044</dl></dd>
10137<dt><span class="chapter"><a href="#regression">25. Regression tests</a></span></dt> 10045<dt><span class="chapter"><a href="#regression">25. Regression tests</a></span></dt>
10138<dd><dl> 10046<dd><dl>
10139<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt> 10047<dt><span class="sect1"><a href="#regression.run">25.1. Running the regression tests</a></span></dt>
10140<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt> 10048<dt><span class="sect1"><a href="#regression.new">25.2. Adding a new regression test</a></span></dt>
10141<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt> 
10142<dd><dl> 10049<dd><dl>
10143<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt> 10050<dt><span class="sect2"><a href="#regression.fun.override">25.2.1. Overridable functions</a></span></dt>
10144<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt> 10051<dt><span class="sect2"><a href="#regression.fun.helper">25.2.2. Helper functions</a></span></dt>
10145</dl></dd> 10052</dl></dd>
10146</dl></dd> 10053</dl></dd>
10147<dt><span class="chapter"><a href="#porting">26. Porting pkgsrc</a></span></dt> 10054<dt><span class="chapter"><a href="#porting">26. Porting pkgsrc</a></span></dt>
10148<dd><dl> 10055<dd><dl><dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
10149<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt> 
10150<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt> 
10151</dl></dd> 
10152</dl> 10056</dl>
10153</div> 10057</div>
10154</div> 10058</div>
10155<div class="chapter"> 10059<div class="chapter">
10156<div class="titlepage"><div><div><h2 class="title"> 10060<div class="titlepage"><div><div><h2 class="title">
10157<a name="infr.design"></a>Chapter 24. Design of the pkgsrc infrastructure</h2></div></div></div> 10061<a name="infr.design"></a>Chapter 24. Design of the pkgsrc infrastructure</h2></div></div></div>
10158<div class="toc"> 10062<div class="toc">
10159<p><b>Table of Contents</b></p> 10063<p><b>Table of Contents</b></p>
10160<dl class="toc"> 10064<dl class="toc">
10161<dt><span class="sect1"><a href="#infr.vardef">24.1. The meaning of variable definitions</a></span></dt> 10065<dt><span class="sect1"><a href="#infr.vardef">24.1. The meaning of variable definitions</a></span></dt>
10162<dt><span class="sect1"><a href="#infr.vardef.problems">24.2. Avoiding problems before they arise</a></span></dt> 10066<dt><span class="sect1"><a href="#infr.vardef.problems">24.2. Avoiding problems before they arise</a></span></dt>
10163<dt><span class="sect1"><a href="#infr.var">24.3. Variable evaluation</a></span></dt> 10067<dt><span class="sect1"><a href="#infr.var">24.3. Variable evaluation</a></span></dt>
10164<dd><dl> 10068<dd><dl>
@@ -10421,68 +10325,62 @@ CFLAGS+= -Wall @@ -10421,68 +10325,62 @@ CFLAGS+= -Wall
10421 matter.</p> 10325 matter.</p>
10422<p>At last, some more files are included that don't set any 10326<p>At last, some more files are included that don't set any
10423 interesting variables but rather just define make targets to be 10327 interesting variables but rather just define make targets to be
10424 executed.</p> 10328 executed.</p>
10425</div> 10329</div>
10426</div> 10330</div>
10427</div> 10331</div>
10428<div class="chapter"> 10332<div class="chapter">
10429<div class="titlepage"><div><div><h2 class="title"> 10333<div class="titlepage"><div><div><h2 class="title">
10430<a name="regression"></a>Chapter 25. Regression tests</h2></div></div></div> 10334<a name="regression"></a>Chapter 25. Regression tests</h2></div></div></div>
10431<div class="toc"> 10335<div class="toc">
10432<p><b>Table of Contents</b></p> 10336<p><b>Table of Contents</b></p>
10433<dl class="toc"> 10337<dl class="toc">
10434<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt> 10338<dt><span class="sect1"><a href="#regression.run">25.1. Running the regression tests</a></span></dt>
10435<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt> 10339<dt><span class="sect1"><a href="#regression.new">25.2. Adding a new regression test</a></span></dt>
10436<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt> 
10437<dd><dl> 10340<dd><dl>
10438<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt> 10341<dt><span class="sect2"><a href="#regression.fun.override">25.2.1. Overridable functions</a></span></dt>
10439<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt> 10342<dt><span class="sect2"><a href="#regression.fun.helper">25.2.2. Helper functions</a></span></dt>
10440</dl></dd> 10343</dl></dd>
10441</dl> 10344</dl>
10442</div> 10345</div>
10443<p>The pkgsrc infrastructure consists of a large codebase, 10346<p>The pkgsrc infrastructure consists of a large codebase,
10444 and there are many corners where every little bit of a file is 10347 and there are many corners where every little bit of a file is
10445 well thought out, making pkgsrc likely to fail as soon as 10348 well thought out, making pkgsrc likely to fail as soon as
10446 anything is changed near those parts. To prevent most changes 10349 anything is changed near those parts. To prevent most changes
10447 from breaking anything, a suite of regression tests should go 10350 from breaking anything, a suite of regression tests should go
10448 along with every important part of the pkgsrc infrastructure. 10351 along with every important part of the pkgsrc infrastructure.
10449 This chapter describes how regression tests work in pkgsrc and 10352 This chapter describes how regression tests work in pkgsrc and
10450 how you can add new tests.</p> 10353 how you can add new tests.</p>
10451<div class="sect1"> 10354<div class="sect1">
10452<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10355<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10453<a name="regression.descr"></a>25.1. The regression tests framework</h2></div></div></div> 10356<a name="regression.run"></a>25.1. Running the regression tests</h2></div></div></div>
10454<p></p> 
10455</div> 
10456<div class="sect1"> 
10457<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 
10458<a name="regression.run"></a>25.2. Running the regression tests</h2></div></div></div> 
10459<p>You first need to install the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_regress/README.html" target="_top"><code class="filename">pkgtools/pkg_regress</code></a> package, which 10357<p>You first need to install the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_regress/README.html" target="_top"><code class="filename">pkgtools/pkg_regress</code></a> package, which
10460 provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you 10358 provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
10461 can simply run that command, which will run all tests in the 10359 can simply run that command, which will run all tests in the
10462 <code class="filename">regress</code> category.</p> 10360 <code class="filename">regress</code> category.</p>
10463</div> 10361</div>
10464<div class="sect1"> 10362<div class="sect1">
10465<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10363<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10466<a name="regression.new"></a>25.3. Adding a new regression test</h2></div></div></div> 10364<a name="regression.new"></a>25.2. Adding a new regression test</h2></div></div></div>
10467<p>Every directory in the <code class="filename">regress</code> 10365<p>Every directory in the <code class="filename">regress</code>
10468 category that contains a file called <code class="filename">spec</code> 10366 category that contains a file called <code class="filename">spec</code>
10469 is considered a regression test. This file is a shell program 10367 is considered a regression test. This file is a shell program
10470 that is included by the <span class="command"><strong>pkg_regress</strong></span> command. 10368 that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
10471 The following functions can be overridden to suit your 10369 The following functions can be overridden to suit your
10472 needs.</p> 10370 needs.</p>
10473<div class="sect2"> 10371<div class="sect2">
10474<div class="titlepage"><div><div><h3 class="title"> 10372<div class="titlepage"><div><div><h3 class="title">
10475<a name="regression.fun.override"></a>25.3.1. Overridable functions</h3></div></div></div> 10373<a name="regression.fun.override"></a>25.2.1. Overridable functions</h3></div></div></div>
10476<p>These functions do not take any parameters. Although they 10374<p>These functions do not take any parameters. Although they
10477 are called in <span class="quote">&#8220;<span class="quote">set -e</span>&#8221;</span> mode, they don't stop at the 10375 are called in <span class="quote">&#8220;<span class="quote">set -e</span>&#8221;</span> mode, they don't stop at the
10478 first failing command. See <a class="ulink" href="http://stackoverflow.com/q/4072984" target="_top">this StackOverflow 10376 first failing command. See <a class="ulink" href="http://stackoverflow.com/q/4072984" target="_top">this StackOverflow
10479 question</a> for details.</p> 10377 question</a> for details.</p>
10480<div class="variablelist"><dl class="variablelist"> 10378<div class="variablelist"><dl class="variablelist">
10481<dt><span class="term"><code class="varname">do_setup</code></span></dt> 10379<dt><span class="term"><code class="varname">do_setup</code></span></dt>
10482<dd><p>This function prepares the environment for the 10380<dd><p>This function prepares the environment for the
10483 test. By default it does nothing.</p></dd> 10381 test. By default it does nothing.</p></dd>
10484<dt><span class="term"><code class="varname">do_test</code></span></dt> 10382<dt><span class="term"><code class="varname">do_test</code></span></dt>
10485<dd> 10383<dd>
10486<p>This function runs the actual test. By default, 10384<p>This function runs the actual test. By default,
10487 it calls <code class="varname">TEST_MAKE</code> with the arguments 10385 it calls <code class="varname">TEST_MAKE</code> with the arguments
10488 <code class="varname">MAKEARGS_TEST</code> and writes its output including 10386 <code class="varname">MAKEARGS_TEST</code> and writes its output including
@@ -10509,61 +10407,59 @@ check_result() { @@ -10509,61 +10407,59 @@ check_result() {
10509 output_require "Example" 10407 output_require "Example"
10510 output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$" 10408 output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
10511 output_prohibit "no such file or directory" 10409 output_prohibit "no such file or directory"
10512} 10410}
10513</pre> 10411</pre>
10514</dd> 10412</dd>
10515<dt><span class="term"><code class="varname">do_cleanup</code></span></dt> 10413<dt><span class="term"><code class="varname">do_cleanup</code></span></dt>
10516<dd><p>This function cleans everything up after the 10414<dd><p>This function cleans everything up after the
10517 test has been run. By default it does nothing.</p></dd> 10415 test has been run. By default it does nothing.</p></dd>
10518</dl></div> 10416</dl></div>
10519</div> 10417</div>
10520<div class="sect2"> 10418<div class="sect2">
10521<div class="titlepage"><div><div><h3 class="title"> 10419<div class="titlepage"><div><div><h3 class="title">
10522<a name="regression.fun.helper"></a>25.3.2. Helper functions</h3></div></div></div> 10420<a name="regression.fun.helper"></a>25.2.2. Helper functions</h3></div></div></div>
10523<div class="variablelist"><dl class="variablelist"> 10421<div class="variablelist"><dl class="variablelist">
10524<dt><span class="term"><code class="varname">exit_status expected</code></span></dt> 10422<dt><span class="term"><code class="varname">exit_status expected</code></span></dt>
10525<dd><p>This function compares the exitcode of the 10423<dd><p>This function compares the exitcode of the
10526 <span class="command"><strong>do_test</strong></span> function with its first parameter. 10424 <span class="command"><strong>do_test</strong></span> function with its first parameter.
10527 If they differ, the test will fail.</p></dd> 10425 If they differ, the test will fail.</p></dd>
10528<dt><span class="term"><code class="varname">output_require regex...</code></span></dt> 10426<dt><span class="term"><code class="varname">output_require regex...</code></span></dt>
10529<dd> 10427<dd>
10530<p>This function checks for each of its parameters 10428<p>This function checks for each of its parameters
10531 if the output from <span class="command"><strong>do_test</strong></span> matches the 10429 if the output from <span class="command"><strong>do_test</strong></span> matches the
10532 extended regular expression. If it does not, the test will 10430 extended regular expression. If it does not, the test will
10533 fail. Example:</p> 10431 fail. Example:</p>
10534<pre class="programlisting"> 10432<pre class="programlisting">
10535output_require  10433output_require "looks fine"
 10434output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
10536</pre> 10435</pre>
10537</dd> 10436</dd>
10538<dt><span class="term"><code class="varname">output_prohibit(regex...)</code></span></dt> 10437<dt><span class="term"><code class="varname">output_prohibit(regex...)</code></span></dt>
10539<dd><p>This function checks for each of its parameters 10438<dd><p>This function checks for each of its parameters
10540 if the output from <span class="command"><strong>do_test()</strong></span> does 10439 if the output from <span class="command"><strong>do_test()</strong></span> does
10541 <span class="emphasis"><em>not</em></span> match the extended regular expression. 10440 <span class="emphasis"><em>not</em></span> match the extended regular expression.
10542 If any of the regular expressions matches, the test will 10441 If any of the regular expressions matches, the test will
10543 fail.</p></dd> 10442 fail.</p></dd>
10544</dl></div> 10443</dl></div>
10545</div> 10444</div>
10546</div> 10445</div>
10547</div> 10446</div>
10548<div class="chapter"> 10447<div class="chapter">
10549<div class="titlepage"><div><div><h2 class="title"> 10448<div class="titlepage"><div><div><h2 class="title">
10550<a name="porting"></a>Chapter 26. Porting pkgsrc</h2></div></div></div> 10449<a name="porting"></a>Chapter 26. Porting pkgsrc</h2></div></div></div>
10551<div class="toc"> 10450<div class="toc">
10552<p><b>Table of Contents</b></p> 10451<p><b>Table of Contents</b></p>
10553<dl class="toc"> 10452<dl class="toc"><dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt></dl>
10554<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt> 
10555<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt> 
10556</dl> 
10557</div> 10453</div>
10558<p>The pkgsrc system has already been ported to many 10454<p>The pkgsrc system has already been ported to many
10559 operating systems, hardware architectures and compilers. This 10455 operating systems, hardware architectures and compilers. This
10560 chapter explains the necessary steps to make pkgsrc even more 10456 chapter explains the necessary steps to make pkgsrc even more
10561 portable.</p> 10457 portable.</p>
10562<div class="sect1"> 10458<div class="sect1">
10563<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10459<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10564<a name="porting.opsys"></a>26.1. Porting pkgsrc to a new operating system</h2></div></div></div> 10460<a name="porting.opsys"></a>26.1. Porting pkgsrc to a new operating system</h2></div></div></div>
10565<p>To port pkgsrc to a new operating system (called 10461<p>To port pkgsrc to a new operating system (called
10566 <code class="literal">MyOS</code> in this example), you need to touch the 10462 <code class="literal">MyOS</code> in this example), you need to touch the
10567 following files:</p> 10463 following files:</p>
10568<div class="variablelist"><dl class="variablelist"> 10464<div class="variablelist"><dl class="variablelist">
10569<dt><span class="term"><code class="filename">pkgtools/bootstrap-mk-files/files/mods/<em class="replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt> 10465<dt><span class="term"><code class="filename">pkgtools/bootstrap-mk-files/files/mods/<em class="replaceable"><code>MyOS</code></em>.sys.mk</code></span></dt>
@@ -10582,31 +10478,26 @@ output_require  @@ -10582,31 +10478,26 @@ output_require
10582<dd><p>This file contains the platform-specific 10478<dd><p>This file contains the platform-specific
10583 definitions that are used by pkgsrc. Start by copying one of the 10479 definitions that are used by pkgsrc. Start by copying one of the
10584 other files and edit it to your 10480 other files and edit it to your
10585 needs.</p></dd> 10481 needs.</p></dd>
10586<dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt> 10482<dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
10587<dd><p>This file defines the paths to all the tools 10483<dd><p>This file defines the paths to all the tools
10588 that are needed by one or the other package in pkgsrc, as well 10484 that are needed by one or the other package in pkgsrc, as well
10589 as by pkgsrc itself. Find out where these tools are on your 10485 as by pkgsrc itself. Find out where these tools are on your
10590 platform and add them.</p></dd> 10486 platform and add them.</p></dd>
10591</dl></div> 10487</dl></div>
10592<p>Now, you should be able to build some basic packages, like 10488<p>Now, you should be able to build some basic packages, like
10593 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/perl5/README.html" target="_top"><code class="filename">lang/perl5</code></a>, <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/bash/README.html" target="_top"><code class="filename">shells/bash</code></a>.</p> 10489 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/perl5/README.html" target="_top"><code class="filename">lang/perl5</code></a>, <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/bash/README.html" target="_top"><code class="filename">shells/bash</code></a>.</p>
10594</div> 10490</div>
10595<div class="sect1"> 
10596<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 
10597<a name="porting.compiler"></a>26.2. Adding support for a new compiler</h2></div></div></div> 
10598<p>TODO</p> 
10599</div> 
10600</div> 10491</div>
10601</div> 10492</div>
10602<div class="appendix"> 10493<div class="appendix">
10603<div class="titlepage"><div><div><h1 class="title"> 10494<div class="titlepage"><div><div><h1 class="title">
10604<a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div> 10495<a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
10605<div class="toc"> 10496<div class="toc">
10606<p><b>Table of Contents</b></p> 10497<p><b>Table of Contents</b></p>
10607<dl class="toc"> 10498<dl class="toc">
10608<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt> 10499<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
10609<dd><dl> 10500<dd><dl>
10610<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt> 10501<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
10611<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt> 10502<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
10612<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt> 10503<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>

cvs diff -r1.218 -r1.219 pkgsrc/doc/pkgsrc.txt (expand / switch to unified diff)

--- pkgsrc/doc/pkgsrc.txt 2016/06/11 12:57:20 1.218
+++ pkgsrc/doc/pkgsrc.txt 2016/06/11 15:00:45 1.219
@@ -74,27 +74,26 @@ I. The pkgsrc user's guide @@ -74,27 +74,26 @@ I. The pkgsrc user's guide
74 74
75 4. Using pkgsrc 75 4. Using pkgsrc
76 76
77 4.1. Using binary packages 77 4.1. Using binary packages
78 78
79 4.1.1. Finding binary packages 79 4.1.1. Finding binary packages
80 4.1.2. Installing binary packages 80 4.1.2. Installing binary packages
81 4.1.3. Deinstalling packages 81 4.1.3. Deinstalling packages
82 4.1.4. Getting information about installed packages 82 4.1.4. Getting information about installed packages
83 4.1.5. Checking for security vulnerabilities in installed packages 83 4.1.5. Checking for security vulnerabilities in installed packages
84 4.1.6. Finding if newer versions of your installed packages are in 84 4.1.6. Finding if newer versions of your installed packages are in
85 pkgsrc 85 pkgsrc
86 4.1.7. Other administrative functions 86 4.1.7. Other administrative functions
87 4.1.8. A word of warning 
88 87
89 4.2. Building packages from source 88 4.2. Building packages from source
90 89
91 4.2.1. Requirements 90 4.2.1. Requirements
92 4.2.2. Fetching distfiles 91 4.2.2. Fetching distfiles
93 4.2.3. How to build and install 92 4.2.3. How to build and install
94 93
95 5. Configuring pkgsrc 94 5. Configuring pkgsrc
96 95
97 5.1. General configuration 96 5.1. General configuration
98 5.2. Variables affecting the build process 97 5.2. Variables affecting the build process
99 5.3. Variables affecting the installation process 98 5.3. Variables affecting the installation process
100 5.4. Selecting and configuring the compiler 99 5.4. Selecting and configuring the compiler
@@ -186,30 +185,28 @@ II. The pkgsrc developer's guide @@ -186,30 +185,28 @@ II. The pkgsrc developer's guide
186 11.6. work* 185 11.6. work*
187 11.7. files/* 186 11.7. files/*
188 187
189 12. Programming in Makefiles 188 12. Programming in Makefiles
190 189
191 12.1. Caveats 190 12.1. Caveats
192 12.2. Makefile variables 191 12.2. Makefile variables
193 192
194 12.2.1. Naming conventions 193 12.2.1. Naming conventions
195 194
196 12.3. Code snippets 195 12.3. Code snippets
197 196
198 12.3.1. Adding things to a list 197 12.3.1. Adding things to a list
199 12.3.2. Converting an internal list into an external list 198 12.3.2. Passing variables to a shell command
200 12.3.3. Passing variables to a shell command 199 12.3.3. Quoting guideline
201 12.3.4. Quoting guideline 
202 12.3.5. Workaround for a bug in BSD Make 
203 200
204 13. PLIST issues 201 13. PLIST issues
205 202
206 13.1. RCS ID 203 13.1. RCS ID
207 13.2. Semi-automatic PLIST generation 204 13.2. Semi-automatic PLIST generation
208 13.3. Tweaking output of make print-PLIST 205 13.3. Tweaking output of make print-PLIST
209 13.4. Variable substitution in PLIST 206 13.4. Variable substitution in PLIST
210 13.5. Man page compression 207 13.5. Man page compression
211 13.6. Changing PLIST source with PLIST_SRC 208 13.6. Changing PLIST source with PLIST_SRC
212 13.7. Platform-specific and differing PLISTs 209 13.7. Platform-specific and differing PLISTs
213 13.8. Build-specific PLISTs 210 13.8. Build-specific PLISTs
214 13.9. Sharing directories between packages 211 13.9. Sharing directories between packages
215 212
@@ -396,37 +393,35 @@ III. The pkgsrc infrastructure internals @@ -396,37 +393,35 @@ III. The pkgsrc infrastructure internals
396 24.4. How can variables be specified? 393 24.4. How can variables be specified?
397 24.5. Designing interfaces for Makefile fragments 394 24.5. Designing interfaces for Makefile fragments
398 395
399 24.5.1. Procedures with parameters 396 24.5.1. Procedures with parameters
400 24.5.2. Actions taken on behalf of parameters 397 24.5.2. Actions taken on behalf of parameters
401 398
402 24.6. The order in which files are loaded 399 24.6. The order in which files are loaded
403 400
404 24.6.1. The order in bsd.prefs.mk 401 24.6.1. The order in bsd.prefs.mk
405 24.6.2. The order in bsd.pkg.mk 402 24.6.2. The order in bsd.pkg.mk
406 403
407 25. Regression tests 404 25. Regression tests
408 405
409 25.1. The regression tests framework 406 25.1. Running the regression tests
410 25.2. Running the regression tests 407 25.2. Adding a new regression test
411 25.3. Adding a new regression test 
412 408
413 25.3.1. Overridable functions 409 25.2.1. Overridable functions
414 25.3.2. Helper functions 410 25.2.2. Helper functions
415 411
416 26. Porting pkgsrc 412 26. Porting pkgsrc
417 413
418 26.1. Porting pkgsrc to a new operating system 414 26.1. Porting pkgsrc to a new operating system
419 26.2. Adding support for a new compiler 
420 415
421A. A simple example package: bison 416A. A simple example package: bison
422 417
423 A.1. files 418 A.1. files
424 419
425 A.1.1. Makefile 420 A.1.1. Makefile
426 A.1.2. DESCR 421 A.1.2. DESCR
427 A.1.3. PLIST 422 A.1.3. PLIST
428 A.1.4. Checking a package with pkglint 423 A.1.4. Checking a package with pkglint
429 424
430 A.2. Steps for building, installing, packaging 425 A.2. Steps for building, installing, packaging
431 426
432B. Build logs 427B. Build logs
@@ -478,27 +473,27 @@ is exactly what The NetBSD Packages Coll @@ -478,27 +473,27 @@ is exactly what The NetBSD Packages Coll
478some basic commands to handle binary packages, so that not every user has to 473some basic commands to handle binary packages, so that not every user has to
479build the packages for himself, which is a time-costly task. 474build the packages for himself, which is a time-costly task.
480 475
481pkgsrc currently contains several thousand packages, including: 476pkgsrc currently contains several thousand packages, including:
482 477
483 * www/apache24 - The Apache web server 478 * www/apache24 - The Apache web server
484 479
485 * www/firefox - The Firefox web browser 480 * www/firefox - The Firefox web browser
486 481
487 * meta-pkgs/gnome - The GNOME Desktop Environment 482 * meta-pkgs/gnome - The GNOME Desktop Environment
488 483
489 * meta-pkgs/kde4 - The K Desktop Environment 484 * meta-pkgs/kde4 - The K Desktop Environment
490 485
491...just to name a few. 486? just to name a few.
492 487
493pkgsrc has built-in support for handling varying dependencies, such as pthreads 488pkgsrc has built-in support for handling varying dependencies, such as pthreads
494and X11, and extended features such as IPv6 support on a range of platforms. 489and X11, and extended features such as IPv6 support on a range of platforms.
495 490
4961.1.1. Why pkgsrc? 4911.1.1. Why pkgsrc?
497 492
498pkgsrc provides the following key features: 493pkgsrc provides the following key features:
499 494
500 * Easy building of software from source as well as the creation and 495 * Easy building of software from source as well as the creation and
501 installation of binary packages. The source and latest patches are 496 installation of binary packages. The source and latest patches are
502 retrieved from a master or mirror download site, checksum verified, then 497 retrieved from a master or mirror download site, checksum verified, then
503 built on your system. Support for binary-only distributions is available 498 built on your system. Support for binary-only distributions is available
504 for both native platforms and NetBSD emulated platforms. 499 for both native platforms and NetBSD emulated platforms.
@@ -725,27 +720,26 @@ Table of Contents @@ -725,27 +720,26 @@ Table of Contents
725 720
7264. Using pkgsrc 7214. Using pkgsrc
727 722
728 4.1. Using binary packages 723 4.1. Using binary packages
729 724
730 4.1.1. Finding binary packages 725 4.1.1. Finding binary packages
731 4.1.2. Installing binary packages 726 4.1.2. Installing binary packages
732 4.1.3. Deinstalling packages 727 4.1.3. Deinstalling packages
733 4.1.4. Getting information about installed packages 728 4.1.4. Getting information about installed packages
734 4.1.5. Checking for security vulnerabilities in installed packages 729 4.1.5. Checking for security vulnerabilities in installed packages
735 4.1.6. Finding if newer versions of your installed packages are in 730 4.1.6. Finding if newer versions of your installed packages are in
736 pkgsrc 731 pkgsrc
737 4.1.7. Other administrative functions 732 4.1.7. Other administrative functions
738 4.1.8. A word of warning 
739 733
740 4.2. Building packages from source 734 4.2. Building packages from source
741 735
742 4.2.1. Requirements 736 4.2.1. Requirements
743 4.2.2. Fetching distfiles 737 4.2.2. Fetching distfiles
744 4.2.3. How to build and install 738 4.2.3. How to build and install
745 739
7465. Configuring pkgsrc 7405. Configuring pkgsrc
747 741
748 5.1. General configuration 742 5.1. General configuration
749 5.2. Variables affecting the build process 743 5.2. Variables affecting the build process
750 5.3. Variables affecting the installation process 744 5.3. Variables affecting the installation process
751 5.4. Selecting and configuring the compiler 745 5.4. Selecting and configuring the compiler
@@ -1026,28 +1020,26 @@ You can change default layout using comm @@ -1026,28 +1020,26 @@ You can change default layout using comm
1026Note 1020Note
1027 1021
1028The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc. 1022The bootstrap installs a bmake tool. Use this bmake when building via pkgsrc.
1029For examples in this guide, use bmake instead of "make". 1023For examples in this guide, use bmake instead of "make".
1030 1024
1031Note 1025Note
1032 1026
1033It is possible to bootstrap multiple instances of pkgsrc using non-intersecting 1027It is possible to bootstrap multiple instances of pkgsrc using non-intersecting
1034directories. Use bmake corresponding to the installation you're working with to 1028directories. Use bmake corresponding to the installation you're working with to
1035build and install packages. 1029build and install packages.
1036 1030
10373.3. Platform-specific notes 10313.3. Platform-specific notes
1038 1032
1039Here are some platform-specific notes you should be aware of. 
1040 
10413.3.1. Cygwin 10333.3.1. Cygwin
1042 1034
1043Cygwin 1.7.x and later are supported. 1035Cygwin 1.7.x and later are supported.
1044 1036
1045You need to install minimal base packages in `Base' category plus any of 1037You need to install minimal base packages in `Base' category plus any of
1046compiler, gcc, gcc4, and/or clang. For gcc and gcc4, C and C++ compiler will be 1038compiler, gcc, gcc4, and/or clang. For gcc and gcc4, C and C++ compiler will be
1047installed by default, but you can install Fortran compiler additionally because 1039installed by default, but you can install Fortran compiler additionally because
1048it will be required to use libtool. If it is not installed (or too old), 1040it will be required to use libtool. If it is not installed (or too old),
1049Fortran compiler will be installed with pkgsrc automatically. 1041Fortran compiler will be installed with pkgsrc automatically.
1050 1042
1051As noted in Cygwin FAQ: `Why doesn't su work?', su(1) command has been in 1043As noted in Cygwin FAQ: `Why doesn't su work?', su(1) command has been in
1052Cygwin distribution, but it has never worked. Unless you bootstrap pkgsrc with 1044Cygwin distribution, but it has never worked. Unless you bootstrap pkgsrc with
1053the --unprivileged option, workaround is: 1045the --unprivileged option, workaround is:
@@ -1494,27 +1486,26 @@ Then, rebuild the devel/libtool-base pac @@ -1494,27 +1486,26 @@ Then, rebuild the devel/libtool-base pac
1494Chapter 4. Using pkgsrc 1486Chapter 4. Using pkgsrc
1495 1487
1496Table of Contents 1488Table of Contents
1497 1489
14984.1. Using binary packages 14904.1. Using binary packages
1499 1491
1500 4.1.1. Finding binary packages 1492 4.1.1. Finding binary packages
1501 4.1.2. Installing binary packages 1493 4.1.2. Installing binary packages
1502 4.1.3. Deinstalling packages 1494 4.1.3. Deinstalling packages
1503 4.1.4. Getting information about installed packages 1495 4.1.4. Getting information about installed packages
1504 4.1.5. Checking for security vulnerabilities in installed packages 1496 4.1.5. Checking for security vulnerabilities in installed packages
1505 4.1.6. Finding if newer versions of your installed packages are in pkgsrc 1497 4.1.6. Finding if newer versions of your installed packages are in pkgsrc
1506 4.1.7. Other administrative functions 1498 4.1.7. Other administrative functions
1507 4.1.8. A word of warning 
1508 1499
15094.2. Building packages from source 15004.2. Building packages from source
1510 1501
1511 4.2.1. Requirements 1502 4.2.1. Requirements
1512 4.2.2. Fetching distfiles 1503 4.2.2. Fetching distfiles
1513 4.2.3. How to build and install 1504 4.2.3. How to build and install
1514 1505
1515Basically, there are two ways of using pkgsrc. The first is to only install the 1506Basically, there are two ways of using pkgsrc. The first is to only install the
1516package tools and to use binary packages that someone else has prepared. This 1507package tools and to use binary packages that someone else has prepared. This
1517is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too. 1508is the "pkg" in pkgsrc. The second way is to install the "src" of pkgsrc, too.
1518Then you are able to build your own packages, and you can still use binary 1509Then you are able to build your own packages, and you can still use binary
1519packages from someone else. 1510packages from someone else.
1520 1511
@@ -1655,38 +1646,26 @@ if your packages are up-to-date, e.g. @@ -1655,38 +1646,26 @@ if your packages are up-to-date, e.g.
1655 1646
1656% lintpkgsrc -i 1647% lintpkgsrc -i
1657... 1648...
1658Version mismatch: 'tcsh' 6.09.00 vs 6.10.00 1649Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
1659 1650
1660 1651
1661You can then use make update to update the package on your system and rebuild 1652You can then use make update to update the package on your system and rebuild
1662any dependencies. 1653any dependencies.
1663 1654
16644.1.7. Other administrative functions 16554.1.7. Other administrative functions
1665 1656
1666The pkg_admin executes various administrative functions on the package system. 1657The pkg_admin executes various administrative functions on the package system.
1667 1658
16684.1.8. A word of warning 
1669 
1670Please pay very careful attention to the warnings expressed in the pkg_add(1) 
1671manual page about the inherent dangers of installing binary packages which you 
1672did not create yourself, and the security holes that can be introduced onto 
1673your system by indiscriminate adding of such files. 
1674 
1675The same warning of course applies to every package you install from source 
1676when you haven't completely read and understood the source code of the package, 
1677the compiler that is used to build the package and all the other tools that are 
1678involved. 
1679 
16804.2. Building packages from source 16594.2. Building packages from source
1681 1660
1682After obtaining pkgsrc, the pkgsrc directory now contains a set of packages, 1661After obtaining pkgsrc, the pkgsrc directory now contains a set of packages,
1683organized into categories. You can browse the online index of packages, or run  1662organized into categories. You can browse the online index of packages, or run
1684make readme from the pkgsrc directory to build local README.html files for all 1663make readme from the pkgsrc directory to build local README.html files for all
1685packages, viewable with any web browser such as www/lynx or www/firefox. 1664packages, viewable with any web browser such as www/lynx or www/firefox.
1686 1665
1687The default prefix for installed packages is /usr/pkg. If you wish to change 1666The default prefix for installed packages is /usr/pkg. If you wish to change
1688this, you should do so by setting LOCALBASE in mk.conf. You should not try to 1667this, you should do so by setting LOCALBASE in mk.conf. You should not try to
1689use multiple different LOCALBASE definitions on the same system (inside a 1668use multiple different LOCALBASE definitions on the same system (inside a
1690chroot is an exception). 1669chroot is an exception).
1691 1670
1692The rest of this chapter assumes that the package is already in pkgsrc. If it 1671The rest of this chapter assumes that the package is already in pkgsrc. If it
@@ -1909,28 +1888,26 @@ each variable's intent. @@ -1909,28 +1888,26 @@ each variable's intent.
1909 {DIST_SUBDIR}/. 1888 {DIST_SUBDIR}/.
1910 1889
1911 * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced 1890 * BINPKG_SITES: List of sites carrying binary pkgs. rel and arch are replaced
1912 with OS release ("2.0", etc.) and architecture ("mipsel", etc.). 1891 with OS release ("2.0", etc.) and architecture ("mipsel", etc.).
1913 1892
1914 * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are 1893 * ACCEPTABLE_LICENSES: List of acceptable licenses. License names are
1915 case-sensitive. Whenever you try to build a package whose license is not in 1894 case-sensitive. Whenever you try to build a package whose license is not in
1916 this list, you will get an error message. If the license condition is 1895 this list, you will get an error message. If the license condition is
1917 simple enough, the error message will include specific instructions on how 1896 simple enough, the error message will include specific instructions on how
1918 to change this variable. 1897 to change this variable.
1919 1898
19205.2. Variables affecting the build process 18995.2. Variables affecting the build process
1921 1900
1922XXX 
1923 
1924 * PACKAGES: The top level directory for the binary packages. The default is $ 1901 * PACKAGES: The top level directory for the binary packages. The default is $
1925 {PKGSRCDIR}/packages. 1902 {PKGSRCDIR}/packages.
1926 1903
1927 * WRKOBJDIR: The top level directory where, if defined, the separate working 1904 * WRKOBJDIR: The top level directory where, if defined, the separate working
1928 directories will get created, and symbolically linked to from ${WRKDIR} 1905 directories will get created, and symbolically linked to from ${WRKDIR}
1929 (see below). This is useful for building packages on several architectures, 1906 (see below). This is useful for building packages on several architectures,
1930 then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every 1907 then ${PKGSRCDIR} can be NFS-mounted while ${WRKOBJDIR} is local to every
1931 architecture. (It should be noted that PKGSRCDIR should not be set by the 1908 architecture. (It should be noted that PKGSRCDIR should not be set by the
1932 user ? it is an internal definition which refers to the root of the pkgsrc 1909 user ? it is an internal definition which refers to the root of the pkgsrc
1933 tree. It is possible to have many pkgsrc tree instances.) 1910 tree. It is possible to have many pkgsrc tree instances.)
1934 1911
1935 * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See 1912 * LOCALPATCHES: Directory for local patches that aren't part of pkgsrc. See
1936 Section 11.3, "patches/*" for more information. 1913 Section 11.3, "patches/*" for more information.
@@ -2591,41 +2568,34 @@ Utilities for people maintaining or crea @@ -2591,41 +2568,34 @@ Utilities for people maintaining or crea
2591 * pkgtools/pkgdiff: Automate making and maintaining patches for a package 2568 * pkgtools/pkgdiff: Automate making and maintaining patches for a package
2592 (includes pkgdiff, pkgvi, mkpatches, etc.). 2569 (includes pkgdiff, pkgvi, mkpatches, etc.).
2593 2570
2594 * pkgtools/url2pkg: Aids in converting to pkgsrc. 2571 * pkgtools/url2pkg: Aids in converting to pkgsrc.
2595 2572
2596Utilities for people maintaining pkgsrc (or: more obscure pkg utilities) 2573Utilities for people maintaining pkgsrc (or: more obscure pkg utilities)
2597 2574
2598 * pkgtools/pkg_comp: Build packages in a chrooted area. 2575 * pkgtools/pkg_comp: Build packages in a chrooted area.
2599 2576
2600 * pkgtools/libkver: Spoof kernel version for chrooted cross builds. 2577 * pkgtools/libkver: Spoof kernel version for chrooted cross builds.
2601 2578
26029.3. How to use pkgsrc as non-root 25799.3. How to use pkgsrc as non-root
2603 2580
2604If you want to use pkgsrc as non-root user, you can set some variables to make 2581To install packages from source as a non-root user, download pkgsrc as
2605pkgsrc work under these conditions. At the very least, you need to set 2582described in Chapter 2, Where to get pkgsrc and how to keep it up-to-date, cd
2606UNPRIVILEGED to "yes"; this will turn on unprivileged mode and set multiple 2583into that directory and run the command ./bootstrap/bootstrap --unprivileged.
2607related variables to allow installation of packages as non-root. 2584
2608 2585This will install the binary part of pkgsrc to ~/pkg and put the pkgsrc
2609In case the defaults are not enough, you may want to tune some other variables 2586configuration mk.conf into ~/pkg/etc.
2610used. For example, if the automatic user/group detection leads to incorrect 2587
2611values (or not the ones you would like to use), you can change them by setting 2588For more details, see mk/unprivileged.mk.
2612UNPRIVILEGED_USER and UNPRIVILEGED_GROUP respectively. 
2613 
2614As regards bootstrapping, please note that the bootstrap script will ease 
2615non-root configuration when given the "--ignore-user-check" flag, as it will 
2616choose and use multiple default directories under ~/pkg as the installation 
2617targets. These directories can be overridden by the "--prefix" flag provided by 
2618the script, as well as some others that allow finer tuning of the tree layout. 
2619 2589
26209.4. How to resume transfers when fetching distfiles? 25909.4. How to resume transfers when fetching distfiles?
2621 2591
2622By default, resuming transfers in pkgsrc is disabled, but you can enable this 2592By default, resuming transfers in pkgsrc is disabled, but you can enable this
2623feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during 2593feature by adding the option PKG_RESUME_TRANSFERS=YES into mk.conf. If, during
2624a fetch step, an incomplete distfile is found, pkgsrc will try to resume it. 2594a fetch step, an incomplete distfile is found, pkgsrc will try to resume it.
2625 2595
2626You can also use a different program than the platform default program by 2596You can also use a different program than the platform default program by
2627changing the FETCH_USING variable. You can specify the program by using of ftp, 2597changing the FETCH_USING variable. You can specify the program by using of ftp,
2628fetch, wget or curl. Alternatively, fetching can be disabled by using the value 2598fetch, wget or curl. Alternatively, fetching can be disabled by using the value
2629manual. A value of custom disables the system defaults and dependency tracking 2599manual. A value of custom disables the system defaults and dependency tracking
2630for the fetch program. In that case you have to provide FETCH_CMD, 2600for the fetch program. In that case you have to provide FETCH_CMD,
2631FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS. 2601FETCH_BEFORE_ARGS, FETCH_RESUME_ARGS, FETCH_OUTPUT_ARGS, FETCH_AFTER_ARGS.
@@ -2893,30 +2863,28 @@ Table of Contents @@ -2893,30 +2863,28 @@ Table of Contents
2893 11.6. work* 2863 11.6. work*
2894 11.7. files/* 2864 11.7. files/*
2895 2865
289612. Programming in Makefiles 286612. Programming in Makefiles
2897 2867
2898 12.1. Caveats 2868 12.1. Caveats
2899 12.2. Makefile variables 2869 12.2. Makefile variables
2900 2870
2901 12.2.1. Naming conventions 2871 12.2.1. Naming conventions
2902 2872
2903 12.3. Code snippets 2873 12.3. Code snippets
2904 2874
2905 12.3.1. Adding things to a list 2875 12.3.1. Adding things to a list
2906 12.3.2. Converting an internal list into an external list 2876 12.3.2. Passing variables to a shell command
2907 12.3.3. Passing variables to a shell command 2877 12.3.3. Quoting guideline
2908 12.3.4. Quoting guideline 
2909 12.3.5. Workaround for a bug in BSD Make 
2910 2878
291113. PLIST issues 287913. PLIST issues
2912 2880
2913 13.1. RCS ID 2881 13.1. RCS ID
2914 13.2. Semi-automatic PLIST generation 2882 13.2. Semi-automatic PLIST generation
2915 13.3. Tweaking output of make print-PLIST 2883 13.3. Tweaking output of make print-PLIST
2916 13.4. Variable substitution in PLIST 2884 13.4. Variable substitution in PLIST
2917 13.5. Man page compression 2885 13.5. Man page compression
2918 13.6. Changing PLIST source with PLIST_SRC 2886 13.6. Changing PLIST source with PLIST_SRC
2919 13.7. Platform-specific and differing PLISTs 2887 13.7. Platform-specific and differing PLISTs
2920 13.8. Build-specific PLISTs 2888 13.8. Build-specific PLISTs
2921 13.9. Sharing directories between packages 2889 13.9. Sharing directories between packages
2922 2890
@@ -3560,72 +3528,72 @@ Please pay attention to the following go @@ -3560,72 +3528,72 @@ Please pay attention to the following go
3560 package. For packages using BSD-style makefiles which honor MANZ, there is 3528 package. For packages using BSD-style makefiles which honor MANZ, there is
3561 MANCOMPRESSED_IF_MANZ. 3529 MANCOMPRESSED_IF_MANZ.
3562 3530
3563 * Replace /usr/local with "${PREFIX}" in all files (see patches, below). 3531 * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
3564 3532
3565 * If the package installs any info files, see Section 19.6.7, "Packages 3533 * If the package installs any info files, see Section 19.6.7, "Packages
3566 installing info files". 3534 installing info files".
3567 3535
356811.2. distinfo 353611.2. distinfo
3569 3537
3570The distinfo file contains the message digest, or checksum, of each distfile 3538The distinfo file contains the message digest, or checksum, of each distfile
3571needed for the package. This ensures that the distfiles retrieved from the 3539needed for the package. This ensures that the distfiles retrieved from the
3572Internet have not been corrupted during transfer or altered by a malign force 3540Internet have not been corrupted during transfer or altered by a malign force
3573to introduce a security hole. Due to recent rumor about weaknesses of digest 3541to introduce a security hole. To provide maximum security, all distfiles are
3574algorithms, all distfiles are protected using both SHA1 and RMD160 message 3542protected using three different message digest algorithms (SHA1, RMD160,
3575digests, as well as the file size. 3543SHA512), as well as the file size.
3576 3544
3577The distinfo file also contains the checksums for all the patches found in the 3545The distinfo file also contains the checksums for all the patches found in the
3578patches directory (see Section 11.3, "patches/*"). 3546patches directory (see Section 11.3, "patches/*").
3579 3547
3580To regenerate the distinfo file, use the make makedistinfo or make mdi command. 3548To regenerate the distinfo file, use the make distinfo command.
3581 3549
3582Some packages have different sets of distfiles depending on the platform, for 3550Some packages have different sets of distfiles depending on the platform, for
3583example lang/openjdk7. These are kept in the same distinfo file and care should 3551example lang/openjdk7. These are kept in the same distinfo file and care should
3584be taken when upgrading such a package to ensure distfile information is not 3552be taken when upgrading such a package to ensure distfile information is not
3585lost. 3553lost.
3586 3554
358711.3. patches/* 355511.3. patches/*
3588 3556
3589Many packages still don't work out-of-the box on the various platforms that are 3557Some packages don't work out-of-the box on the various platforms that are
3590supported by pkgsrc. Therefore, a number of custom patch files are needed to 3558supported by pkgsrc. These packages need to be patched to make them work. The
3591make the package work. These patch files are found in the patches/ directory. 3559patch files can be found in the patches/ directory.
3592 3560
3593In the patch phase, these patches are applied to the files in WRKSRC directory 3561In the patch phase, these patches are applied to the files in WRKSRC directory
3594after extracting them, in alphabetic order. 3562after extracting them, in alphabetic order.
3595 3563
359611.3.1. Structure of a single patch file 356411.3.1. Structure of a single patch file
3597 3565
3598The patch-* files should be in diff -bu format, and apply without a fuzz to 3566The patch-* files should be in diff -bu format, and apply without a fuzz to
3599avoid problems. (To force patches to apply with fuzz you can set 3567avoid problems. (To force patches to apply with fuzz you can set
3600PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for 3568PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3601a single file, and no file should be patched by more than one patch file. This 3569a single file, and no file should be patched by more than one patch file. This
3602helps to keep future modifications simple. 3570helps to keep future modifications simple.
3603 3571
3604Each patch file is structured as follows: In the first line, there is the RCS 3572Each patch file is structured as follows: In the first line, there is the RCS
3605Id of the patch itself. The second line should be empty for aesthetic reasons. 3573Id of the patch itself. The second line should be empty for aesthetic reasons.
3606After that, there should be a comment for each change that the patch does. 3574After that, there should be a comment for each change that the patch does.
3607There are a number of standard cases: 3575There are a number of standard cases:
3608 3576
3609 * Patches for commonly known vulnerabilities should mention the vulnerability 3577 * Patches for commonly known vulnerabilities should mention the vulnerability
3610 ID (CAN, CVE). 3578 ID (CAN, CVE).
3611 3579
3612 * Patches that change source code should mention the platform and other 3580 * Patches that change source code should mention the platform and other
3613 environment (for example, the compiler) that the patch is needed for. 3581 environment (for example, the compiler) that the patch is needed for.
3614 3582
3615In all, the patch should be commented so that any developer who knows the code 3583The patch should be commented so that any developer who knows the code of the
3616of the application can make some use of the patch. Special care should be taken 3584application can make some use of the patch. Special care should be taken for
3617for the upstream developers, since we generally want that they accept our 3585the upstream developers, since we generally want that they accept our patches,
3618patches, so we have less work in the future. 3586so we have less work in the future.
3619 3587
362011.3.2. Creating patch files 358811.3.2. Creating patch files
3621 3589
3622One important thing to mention is to pay attention that no RCS IDs get stored 3590One important thing to mention is to pay attention that no RCS IDs get stored
3623in the patch files, as these will cause problems when later checked into the 3591in the patch files, as these will cause problems when later checked into the
3624NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to 3592NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3625avoid these problems. 3593avoid these problems.
3626 3594
3627For even more automation, we recommend using mkpatches from the same package to 3595For even more automation, we recommend using mkpatches from the same package to
3628make a whole set of patches. You just have to backup files before you edit them 3596make a whole set of patches. You just have to backup files before you edit them
3629to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using  3597to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
3630pkgvi again from the same package. If you upgrade a package this way, you can 3598pkgvi again from the same package. If you upgrade a package this way, you can
3631easily compare the new set of patches with the previously existing one with  3599easily compare the new set of patches with the previously existing one with
@@ -3880,30 +3848,28 @@ FILESDIR=${.CURDIR}/../xemacs/files @@ -3880,30 +3848,28 @@ FILESDIR=${.CURDIR}/../xemacs/files
3880 3848
3881Chapter 12. Programming in Makefiles 3849Chapter 12. Programming in Makefiles
3882 3850
3883Table of Contents 3851Table of Contents
3884 3852
388512.1. Caveats 385312.1. Caveats
388612.2. Makefile variables 385412.2. Makefile variables
3887 3855
3888 12.2.1. Naming conventions 3856 12.2.1. Naming conventions
3889 3857
389012.3. Code snippets 385812.3. Code snippets
3891 3859
3892 12.3.1. Adding things to a list 3860 12.3.1. Adding things to a list
3893 12.3.2. Converting an internal list into an external list 3861 12.3.2. Passing variables to a shell command
3894 12.3.3. Passing variables to a shell command 3862 12.3.3. Quoting guideline
3895 12.3.4. Quoting guideline 
3896 12.3.5. Workaround for a bug in BSD Make 
3897 3863
3898Pkgsrc consists of many Makefile fragments, each of which forms a well-defined 3864Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
3899part of the pkgsrc system. Using the make(1) system as a programming language 3865part of the pkgsrc system. Using the make(1) system as a programming language
3900for a big system like pkgsrc requires some discipline to keep the code correct 3866for a big system like pkgsrc requires some discipline to keep the code correct
3901and understandable. 3867and understandable.
3902 3868
3903The basic ingredients for Makefile programming are variables (which are 3869The basic ingredients for Makefile programming are variables (which are
3904actually macros) and shell commands. Among these shell commands may even be 3870actually macros) and shell commands. Among these shell commands may even be
3905more complex ones like awk(1) programs. To make sure that every shell command 3871more complex ones like awk(1) programs. To make sure that every shell command
3906runs as intended it is necessary to quote all variables correctly when they are 3872runs as intended it is necessary to quote all variables correctly when they are
3907used. 3873used.
3908 3874
3909This chapter describes some patterns, that appear quite often in Makefiles, 3875This chapter describes some patterns, that appear quite often in Makefiles,
@@ -3943,43 +3909,34 @@ Makefile variables contain strings that  @@ -3943,43 +3909,34 @@ Makefile variables contain strings that
3943operators ``='', ``+='', ``?='', ``:='', and ``!='', which are described in the 3909operators ``='', ``+='', ``?='', ``:='', and ``!='', which are described in the
3944make(1) man page. 3910make(1) man page.
3945 3911
3946When a variable's value is parsed from a Makefile, the hash character ``#'' and 3912When a variable's value is parsed from a Makefile, the hash character ``#'' and
3947the backslash character ``\'' are handled specially. If a backslash is followed 3913the backslash character ``\'' are handled specially. If a backslash is followed
3948by a newline, any whitespace immediately in front of the backslash, the 3914by a newline, any whitespace immediately in front of the backslash, the
3949backslash, the newline, and any whitespace immediately behind the newline are 3915backslash, the newline, and any whitespace immediately behind the newline are
3950replaced with a single space. A backslash character and an immediately 3916replaced with a single space. A backslash character and an immediately
3951following hash character are replaced with a single hash character. Otherwise, 3917following hash character are replaced with a single hash character. Otherwise,
3952the backslash is passed as is. In a variable assignment, any hash character 3918the backslash is passed as is. In a variable assignment, any hash character
3953that is not preceded by a backslash starts a comment that continues upto the 3919that is not preceded by a backslash starts a comment that continues upto the
3954end of the logical line. 3920end of the logical line.
3955 3921
3956Note: Because of this parsing algorithm the only way to create a variable 3922The evaluation of variables either happens immediately or lazy. It happens
3957consisting of a single backslash is using the ``!='' operator, for example: 3923immediately when the variable occurs on the right-hand side of the ``:='' or
3958BACKSLASH!=echo "\\". 3924the ``!='' operator, in a .if condition or a .for loop. In the other cases, it
3959 3925is evaluated lazily.
3960So far for defining variables. The other thing you can do with variables is 
3961evaluating them. A variable is evaluated when it is part of the right side of 
3962the ``:='' or the ``!='' operator, or directly before executing a shell command 
3963which the variable is part of. In all other cases, make(1) performs lazy 
3964evaluation, that is, variables are not evaluated until there's no other way. 
3965The ``modifiers'' mentioned in the man page also evaluate the variable. 
3966 3926
3967Some of the modifiers split the string into words and then operate on the 3927Some of the modifiers split the string into words and then operate on the
3968words, others operate on the string as a whole. When a string is split into 3928words, others operate on the string as a whole. When a string is split into
3969words, it is split as you would expect it from sh(1). 3929words, it is split like in sh(1).
3970 
3971No rule without exception?the .for loop does not follow the shell quoting rules 
3972but splits at sequences of whitespace. 
3973 3930
3974There are several types of variables that should be handled differently. 3931There are several types of variables that should be handled differently.
3975Strings and two types of lists. 3932Strings and two types of lists.
3976 3933
3977 * Strings can contain arbitrary characters. Nevertheless, you should restrict 3934 * Strings can contain arbitrary characters. Nevertheless, you should restrict
3978 yourself to only using printable characters. Examples are PREFIX and 3935 yourself to only using printable characters. Examples are PREFIX and
3979 COMMENT. 3936 COMMENT.
3980 3937
3981 * Internal lists are lists that are never exported to any shell command. 3938 * Internal lists are lists that are never exported to any shell command.
3982 Their elements are separated by whitespace. Therefore, the elements 3939 Their elements are separated by whitespace. Therefore, the elements
3983 themselves cannot have embedded whitespace. Any other characters are 3940 themselves cannot have embedded whitespace. Any other characters are
3984 allowed. Internal lists can be used in .for loops. Examples are DEPENDS and 3941 allowed. Internal lists can be used in .for loops. Examples are DEPENDS and
3985 BUILD_DEPENDS. 3942 BUILD_DEPENDS.
@@ -4013,80 +3970,52 @@ ANOTHER_INT_LIST= apache-[0-9]*:.. @@ -4013,80 +3970,52 @@ ANOTHER_INT_LIST= apache-[0-9]*:..
4013EXT_LIST= # empty 3970EXT_LIST= # empty
4014ANOTHER_EXT_LIST= a=b c=d 3971ANOTHER_EXT_LIST= a=b c=d
4015 3972
4016INT_LIST+= ${STRING} # 1 3973INT_LIST+= ${STRING} # 1
4017INT_LIST+= ${ANOTHER_INT_LIST} # 2 3974INT_LIST+= ${ANOTHER_INT_LIST} # 2
4018EXT_LIST+= ${STRING:Q} # 3 3975EXT_LIST+= ${STRING:Q} # 3
4019EXT_LIST+= ${ANOTHER_EXT_LIST} # 4 3976EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
4020 3977
4021When you add a string to an external list (example 3), it must be quoted. In 3978When you add a string to an external list (example 3), it must be quoted. In
4022all other cases, you must not add a quoting level. You must not merge internal 3979all other cases, you must not add a quoting level. You must not merge internal
4023and external lists, unless you are sure that all entries are correctly 3980and external lists, unless you are sure that all entries are correctly
4024interpreted in both lists. 3981interpreted in both lists.
4025 3982
402612.3.2. Converting an internal list into an external list 398312.3.2. Passing variables to a shell command
4027 
4028EXT_LIST= # empty 
4029.for i in ${INT_LIST} 
4030EXT_LIST+= ${i:Q}"" 
4031.endfor 
4032 
4033This code converts the internal list INT_LIST into the external list EXT_LIST. 
4034As the elements of an internal list are unquoted they must be quoted here. The 
4035reason for appending "" is explained below. 
4036 
403712.3.3. Passing variables to a shell command 
4038 3984
4039Sometimes you may want to print an arbitrary string. There are many ways to get 3985Sometimes you may want to print an arbitrary string. There are many ways to get
4040it wrong and only few that can handle every nastiness. 3986it wrong and only few that can handle every nastiness.
4041 3987
4042STRING= foo bar < > * `date` $$HOME ' " 3988STRING= foo bar < > * `date` $$HOME ' "
4043EXT_LIST= string=${STRING:Q} x=second\ item 3989EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
4044 3990
4045all: 3991all:
4046 echo ${STRING} # 1 3992 echo ${STRING} # 1
4047 echo "${STRING}" # 2 3993 echo ${STRING:Q} # 2
4048 echo "${STRING:Q}" # 3 3994 printf '%s\n' ${STRING:Q}'' # 3
4049 echo ${STRING:Q} # 4 3995 env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
4050 echo x${STRING:Q} | sed 1s,.,, # 5 
4051 printf "%s\\n" ${STRING:Q}"" # 6 
4052 env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"' 
4053 3996
4054Example 1 leads to a syntax error in the shell, as the characters are just 3997Example 1 leads to a syntax error in the shell, as the characters are just
4055copied. 3998copied.
4056 3999
4057Example 2 leads to a syntax error too, and if you leave out the last " 4000Example 2 can handle all strings, except those starting with a dash or those
4058character from ${STRING}, date(1) will be executed. The $HOME shell variable 4001containing backslashes.
4059would be evaluated, too. 
4060 
4061Example 3 outputs each space character preceded by a backslash (or not), 
4062depending on the implementation of the echo(1) command. 
4063 4002
4064Example 4 handles correctly every string that does not start with a dash. In 4003Example 3 can handle arbitrary strings.
4065that case, the result depends on the implementation of the echo(1) command. As 
4066long as you can guarantee that your input does not start with a dash, this form 
4067is appropriate. 
4068 4004
4069Example 5 handles even the case of a leading dash correctly. 4005In example 4, the EXT_LIST does not need to be quoted because the quoting has
 4006already been done when adding elements to the list.
4070 4007
4071Example 6 also works with every string and is the light-weight solution, since 400812.3.3. Quoting guideline
4072it does not involve a pipe, which has its own problems. 
4073 
4074The EXT_LIST does not need to be quoted because the quoting has already been 
4075done when adding elements to the list. 
4076 
4077As internal lists shall not be passed to the shell, there is no example for it. 
4078 
407912.3.4. Quoting guideline 
4080 4009
4081There are many possible sources of wrongly quoted variables. This section lists 4010There are many possible sources of wrongly quoted variables. This section lists
4082some of the commonly known ones. 4011some of the commonly known ones.
4083 4012
4084 * Whenever you use the value of a list, think about what happens to leading 4013 * Whenever you use the value of a list, think about what happens to leading
4085 or trailing whitespace. If the list is a well-formed shell expression, you 4014 or trailing whitespace. If the list is a well-formed shell expression, you
4086 can apply the :M* modifier to strip leading and trailing whitespace from 4015 can apply the :M* modifier to strip leading and trailing whitespace from
4087 each word. The :M operator first splits its argument according to the rules 4016 each word. The :M operator first splits its argument according to the rules
4088 of the shell, and then creates a new list consisting of all words that 4017 of the shell, and then creates a new list consisting of all words that
4089 match the shell glob expression *, that is: all. One class of situations 4018 match the shell glob expression *, that is: all. One class of situations
4090 where this is needed is when adding a variable like CPPFLAGS to 4019 where this is needed is when adding a variable like CPPFLAGS to
4091 CONFIGURE_ARGS. If the configure script invokes other configure scripts, it 4020 CONFIGURE_ARGS. If the configure script invokes other configure scripts, it
4092 strips the leading and trailing whitespace from the variable and then 4021 strips the leading and trailing whitespace from the variable and then
@@ -4131,37 +4060,26 @@ some of the commonly known ones. @@ -4131,37 +4060,26 @@ some of the commonly known ones.
4131 4060
4132 The first example will only print two of the three lines we might have 4061 The first example will only print two of the three lines we might have
4133 expected. This is because ${EMPTY:Q} expands to the empty string, which the 4062 expected. This is because ${EMPTY:Q} expands to the empty string, which the
4134 shell cannot see. The workaround is to write ${EMPTY:Q}"". This pattern can 4063 shell cannot see. The workaround is to write ${EMPTY:Q}"". This pattern can
4135 be often found as ${TEST} -z ${VAR:Q} or as ${TEST} -f ${FNAME:Q} (both of 4064 be often found as ${TEST} -z ${VAR:Q} or as ${TEST} -f ${FNAME:Q} (both of
4136 these are wrong). 4065 these are wrong).
4137 4066
4138 The second example will only print three lines instead of four. The first 4067 The second example will only print three lines instead of four. The first
4139 line looks like a:\ echo foo. This is because the backslash of the value a: 4068 line looks like a:\ echo foo. This is because the backslash of the value a:
4140 \ is interpreted as a line-continuation by make(1), which makes the second 4069 \ is interpreted as a line-continuation by make(1), which makes the second
4141 line the arguments of the echo(1) command from the first line. To avoid 4070 line the arguments of the echo(1) command from the first line. To avoid
4142 this, write ${i:Q}"". 4071 this, write ${i:Q}"".
4143 4072
414412.3.5. Workaround for a bug in BSD Make 
4145 
4146The pkgsrc bmake program does not handle the following assignment correctly. In 
4147case _othervar_ contains a ``-'' character, one of the closing braces is 
4148included in ${VAR} after this code executes. 
4149 
4150VAR:= ${VAR:N${_othervar_:C/-//}} 
4151 
4152For a more complex code snippet and a workaround, see the package regress/ 
4153make-quoting, testcase bug1. 
4154 
4155Chapter 13. PLIST issues 4073Chapter 13. PLIST issues
4156 4074
4157Table of Contents 4075Table of Contents
4158 4076
415913.1. RCS ID 407713.1. RCS ID
416013.2. Semi-automatic PLIST generation 407813.2. Semi-automatic PLIST generation
416113.3. Tweaking output of make print-PLIST 407913.3. Tweaking output of make print-PLIST
416213.4. Variable substitution in PLIST 408013.4. Variable substitution in PLIST
416313.5. Man page compression 408113.5. Man page compression
416413.6. Changing PLIST source with PLIST_SRC 408213.6. Changing PLIST source with PLIST_SRC
416513.7. Platform-specific and differing PLISTs 408313.7. Platform-specific and differing PLISTs
416613.8. Build-specific PLISTs 408413.8. Build-specific PLISTs
416713.9. Sharing directories between packages 408513.9. Sharing directories between packages
@@ -6317,28 +6235,31 @@ interaction. This should be done in the  @@ -6317,28 +6235,31 @@ interaction. This should be done in the
6317INTERACTIVE_STAGE= configure install 6235INTERACTIVE_STAGE= configure install
6318 6236
6319 6237
6320The user can then decide to skip this package by setting the BATCH variable. 6238The user can then decide to skip this package by setting the BATCH variable.
6321Packages that require interaction are also excluded from bulk builds. 6239Packages that require interaction are also excluded from bulk builds.
6322 6240
632319.1.3. Handling licenses 624119.1.3. Handling licenses
6324 6242
6325Authors of software can choose the licence under which software can be copied. 6243Authors of software can choose the licence under which software can be copied.
6326This is due to copyright law, and reasons for license choices are outside the 6244This is due to copyright law, and reasons for license choices are outside the
6327scope of pkgsrc. The pkgsrc system recognizes that there are a number of 6245scope of pkgsrc. The pkgsrc system recognizes that there are a number of
6328licenses which some users may find objectionable or difficult or impossible to 6246licenses which some users may find objectionable or difficult or impossible to
6329comply with. The Free Software Foundation has declared some licenses "Free", 6247comply with. The Free Software Foundation has declared some licenses "Free",
6330and the Open Source Initiative has a definition of "Open Source". Note that a 6248and the Open Source Initiative has a definition of "Open Source". The pkgsrc
6331package whose license forbids to copy does not meet either the Free or Open 6249system, as a policy choice, does not label packages which have licenses that
 6250are Free or Open Source. However, packages without a license meeting either of
 6251those tests are labeled with a license tag denoting the license. Note that a
 6252package with no license to copy trivially does not meet either the Free or Open
6332Source test. 6253Source test.
6333 6254
6334For packages which are not Free or Open Source, pkgsrc will not build the 6255For packages which are not Free or Open Source, pkgsrc will not build the
6335package unless the user has indicated to pkgsrc that packages with that 6256package unless the user has indicated to pkgsrc that packages with that
6336particular license may be built. Note that this documentation avoids the term 6257particular license may be built. Note that this documentation avoids the term
6337"accepted the license". The pkgsrc system is merely providing a mechanism to 6258"accepted the license". The pkgsrc system is merely providing a mechanism to
6338avoid accidentally building a package with a non-free license; judgement and 6259avoid accidentally building a package with a non-free license; judgement and
6339responsibility remain with the user. (Installation of binary packages are not 6260responsibility remain with the user. (Installation of binary packages are not
6340currently subject to this mechanism; this is a bug.) 6261currently subject to this mechanism; this is a bug.)
6341 6262
6342One might want to only install packages with a BSD license, or the GPL, and not 6263One might want to only install packages with a BSD license, or the GPL, and not
6343the other. The free licenses are added to the default ACCEPTABLE_LICENSES 6264the other. The free licenses are added to the default ACCEPTABLE_LICENSES
6344variable. The user can override the default by setting the ACCEPTABLE_LICENSES 6265variable. The user can override the default by setting the ACCEPTABLE_LICENSES
@@ -8338,37 +8259,35 @@ Table of Contents @@ -8338,37 +8259,35 @@ Table of Contents
8338 24.4. How can variables be specified? 8259 24.4. How can variables be specified?
8339 24.5. Designing interfaces for Makefile fragments 8260 24.5. Designing interfaces for Makefile fragments
8340 8261
8341 24.5.1. Procedures with parameters 8262 24.5.1. Procedures with parameters
8342 24.5.2. Actions taken on behalf of parameters 8263 24.5.2. Actions taken on behalf of parameters
8343 8264
8344 24.6. The order in which files are loaded 8265 24.6. The order in which files are loaded
8345 8266
8346 24.6.1. The order in bsd.prefs.mk 8267 24.6.1. The order in bsd.prefs.mk
8347 24.6.2. The order in bsd.pkg.mk 8268 24.6.2. The order in bsd.pkg.mk
8348 8269
834925. Regression tests 827025. Regression tests
8350 8271
8351 25.1. The regression tests framework 8272 25.1. Running the regression tests
8352 25.2. Running the regression tests 8273 25.2. Adding a new regression test
8353 25.3. Adding a new regression test 
8354 8274
8355 25.3.1. Overridable functions 8275 25.2.1. Overridable functions
8356 25.3.2. Helper functions 8276 25.2.2. Helper functions
8357 8277
835826. Porting pkgsrc 827826. Porting pkgsrc
8359 8279
8360 26.1. Porting pkgsrc to a new operating system 8280 26.1. Porting pkgsrc to a new operating system
8361 26.2. Adding support for a new compiler 
8362 8281
8363Chapter 24. Design of the pkgsrc infrastructure 8282Chapter 24. Design of the pkgsrc infrastructure
8364 8283
8365Table of Contents 8284Table of Contents
8366 8285
836724.1. The meaning of variable definitions 828624.1. The meaning of variable definitions
836824.2. Avoiding problems before they arise 828724.2. Avoiding problems before they arise
836924.3. Variable evaluation 828824.3. Variable evaluation
8370 8289
8371 24.3.1. At load time 8290 24.3.1. At load time
8372 24.3.2. At runtime 8291 24.3.2. At runtime
8373 8292
837424.4. How can variables be specified? 829324.4. How can variables be specified?
@@ -8577,56 +8496,53 @@ The code to check PKG_FAIL_REASON and PK @@ -8577,56 +8496,53 @@ The code to check PKG_FAIL_REASON and PK
8577restricts the use of these variables to all the files that have been included 8496restricts the use of these variables to all the files that have been included
8578before. Appearances in later files will be silently ignored. 8497before. Appearances in later files will be silently ignored.
8579 8498
8580Then, the files for the main targets are included, in the order of later 8499Then, the files for the main targets are included, in the order of later
8581execution, though the actual order should not matter. 8500execution, though the actual order should not matter.
8582 8501
8583At last, some more files are included that don't set any interesting variables 8502At last, some more files are included that don't set any interesting variables
8584but rather just define make targets to be executed. 8503but rather just define make targets to be executed.
8585 8504
8586Chapter 25. Regression tests 8505Chapter 25. Regression tests
8587 8506
8588Table of Contents 8507Table of Contents
8589 8508
859025.1. The regression tests framework 850925.1. Running the regression tests
859125.2. Running the regression tests 851025.2. Adding a new regression test
859225.3. Adding a new regression test 
8593 8511
8594 25.3.1. Overridable functions 8512 25.2.1. Overridable functions
8595 25.3.2. Helper functions 8513 25.2.2. Helper functions
8596 8514
8597The pkgsrc infrastructure consists of a large codebase, and there are many 8515The pkgsrc infrastructure consists of a large codebase, and there are many
8598corners where every little bit of a file is well thought out, making pkgsrc 8516corners where every little bit of a file is well thought out, making pkgsrc
8599likely to fail as soon as anything is changed near those parts. To prevent most 8517likely to fail as soon as anything is changed near those parts. To prevent most
8600changes from breaking anything, a suite of regression tests should go along 8518changes from breaking anything, a suite of regression tests should go along
8601with every important part of the pkgsrc infrastructure. This chapter describes 8519with every important part of the pkgsrc infrastructure. This chapter describes
8602how regression tests work in pkgsrc and how you can add new tests. 8520how regression tests work in pkgsrc and how you can add new tests.
8603 8521
860425.1. The regression tests framework 852225.1. Running the regression tests
8605 
860625.2. Running the regression tests 
8607 8523
8608You first need to install the pkgtools/pkg_regress package, which provides the  8524You first need to install the pkgtools/pkg_regress package, which provides the
8609pkg_regress command. Then you can simply run that command, which will run all 8525pkg_regress command. Then you can simply run that command, which will run all
8610tests in the regress category. 8526tests in the regress category.
8611 8527
861225.3. Adding a new regression test 852825.2. Adding a new regression test
8613 8529
8614Every directory in the regress category that contains a file called spec is 8530Every directory in the regress category that contains a file called spec is
8615considered a regression test. This file is a shell program that is included by 8531considered a regression test. This file is a shell program that is included by
8616the pkg_regress command. The following functions can be overridden to suit your 8532the pkg_regress command. The following functions can be overridden to suit your
8617needs. 8533needs.
8618 8534
861925.3.1. Overridable functions 853525.2.1. Overridable functions
8620 8536
8621These functions do not take any parameters. Although they are called in "set -e 8537These functions do not take any parameters. Although they are called in "set -e
8622" mode, they don't stop at the first failing command. See this StackOverflow 8538" mode, they don't stop at the first failing command. See this StackOverflow
8623question for details. 8539question for details.
8624 8540
8625do_setup 8541do_setup
8626 8542
8627 This function prepares the environment for the test. By default it does 8543 This function prepares the environment for the test. By default it does
8628 nothing. 8544 nothing.
8629 8545
8630do_test 8546do_test
8631 8547
8632 This function runs the actual test. By default, it calls TEST_MAKE with the 8548 This function runs the actual test. By default, it calls TEST_MAKE with the
@@ -8648,53 +8564,53 @@ check_result @@ -8648,53 +8564,53 @@ check_result
8648 8564
8649 check_result() { 8565 check_result() {
8650 exit_status 0 8566 exit_status 0
8651 output_require "Example" 8567 output_require "Example"
8652 output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$" 8568 output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8653 output_prohibit "no such file or directory" 8569 output_prohibit "no such file or directory"
8654 } 8570 }
8655 8571
8656do_cleanup 8572do_cleanup
8657 8573
8658 This function cleans everything up after the test has been run. By default 8574 This function cleans everything up after the test has been run. By default
8659 it does nothing. 8575 it does nothing.
8660 8576
866125.3.2. Helper functions 857725.2.2. Helper functions
8662 8578
8663exit_status expected 8579exit_status expected
8664 8580
8665 This function compares the exitcode of the do_test function with its first 8581 This function compares the exitcode of the do_test function with its first
8666 parameter. If they differ, the test will fail. 8582 parameter. If they differ, the test will fail.
8667 8583
8668output_require regex... 8584output_require regex...
8669 8585
8670 This function checks for each of its parameters if the output from do_test 8586 This function checks for each of its parameters if the output from do_test
8671 matches the extended regular expression. If it does not, the test will 8587 matches the extended regular expression. If it does not, the test will
8672 fail. Example: 8588 fail. Example:
8673 8589
8674 output_require 8590 output_require "looks fine"
 8591 output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
8675 8592
8676output_prohibit(regex...) 8593output_prohibit(regex...)
8677 8594
8678 This function checks for each of its parameters if the output from do_test 8595 This function checks for each of its parameters if the output from do_test
8679 () does not match the extended regular expression. If any of the regular 8596 () does not match the extended regular expression. If any of the regular
8680 expressions matches, the test will fail. 8597 expressions matches, the test will fail.
8681 8598
8682Chapter 26. Porting pkgsrc 8599Chapter 26. Porting pkgsrc
8683 8600
8684Table of Contents 8601Table of Contents
8685 8602
868626.1. Porting pkgsrc to a new operating system 860326.1. Porting pkgsrc to a new operating system
868726.2. Adding support for a new compiler 
8688 8604
8689The pkgsrc system has already been ported to many operating systems, hardware 8605The pkgsrc system has already been ported to many operating systems, hardware
8690architectures and compilers. This chapter explains the necessary steps to make 8606architectures and compilers. This chapter explains the necessary steps to make
8691pkgsrc even more portable. 8607pkgsrc even more portable.
8692 8608
869326.1. Porting pkgsrc to a new operating system 860926.1. Porting pkgsrc to a new operating system
8694 8610
8695To port pkgsrc to a new operating system (called MyOS in this example), you 8611To port pkgsrc to a new operating system (called MyOS in this example), you
8696need to touch the following files: 8612need to touch the following files:
8697 8613
8698pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk 8614pkgtools/bootstrap-mk-files/files/mods/MyOS.sys.mk
8699 8615
8700 This file contains some basic definitions, for example the name of the C 8616 This file contains some basic definitions, for example the name of the C
@@ -8710,30 +8626,26 @@ mk/platform/MyOS.mk @@ -8710,30 +8626,26 @@ mk/platform/MyOS.mk
8710 8626
8711 This file contains the platform-specific definitions that are used by 8627 This file contains the platform-specific definitions that are used by
8712 pkgsrc. Start by copying one of the other files and edit it to your needs. 8628 pkgsrc. Start by copying one of the other files and edit it to your needs.
8713 8629
8714mk/tools/tools.MyOS.mk 8630mk/tools/tools.MyOS.mk
8715 8631
8716 This file defines the paths to all the tools that are needed by one or the 8632 This file defines the paths to all the tools that are needed by one or the
8717 other package in pkgsrc, as well as by pkgsrc itself. Find out where these 8633 other package in pkgsrc, as well as by pkgsrc itself. Find out where these
8718 tools are on your platform and add them. 8634 tools are on your platform and add them.
8719 8635
8720Now, you should be able to build some basic packages, like lang/perl5, shells/ 8636Now, you should be able to build some basic packages, like lang/perl5, shells/
8721bash. 8637bash.
8722 8638
872326.2. Adding support for a new compiler 
8724 
8725TODO 
8726 
8727Appendix A. A simple example package: bison 8639Appendix A. A simple example package: bison
8728 8640
8729Table of Contents 8641Table of Contents
8730 8642
8731A.1. files 8643A.1. files
8732 8644
8733 A.1.1. Makefile 8645 A.1.1. Makefile
8734 A.1.2. DESCR 8646 A.1.2. DESCR
8735 A.1.3. PLIST 8647 A.1.3. PLIST
8736 A.1.4. Checking a package with pkglint 8648 A.1.4. Checking a package with pkglint
8737 8649
8738A.2. Steps for building, installing, packaging 8650A.2. Steps for building, installing, packaging
8739 8651