Tue Jul 30 07:14:50 2013 UTC ()
regen


(wiz)
diff -r1.161 -r1.162 pkgsrc/doc/pkgsrc.html
diff -r1.164 -r1.165 pkgsrc/doc/pkgsrc.txt

cvs diff -r1.161 -r1.162 pkgsrc/doc/pkgsrc.html (switch to unified diff)

--- pkgsrc/doc/pkgsrc.html 2013/07/30 03:37:12 1.161
+++ pkgsrc/doc/pkgsrc.html 2013/07/30 07:14:50 1.162
@@ -4531,1999 +4531,1999 @@ converters games mbone  @@ -4531,1999 +4531,1999 @@ converters games mbone
4531 using <span class="command"><strong>pkgvi</strong></span> again from the same package. If 4531 using <span class="command"><strong>pkgvi</strong></span> again from the same package. If
4532 you upgrade a package this way, you can easily compare the new 4532 you upgrade a package this way, you can easily compare the new
4533 set of patches with the previously existing one with 4533 set of patches with the previously existing one with
4534 <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code> 4534 <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code>
4535 are replaced by new files, so carefully check if you want to take all 4535 are replaced by new files, so carefully check if you want to take all
4536 the changes.</p> 4536 the changes.</p>
4537<p>When you have finished a package, remember to generate 4537<p>When you have finished a package, remember to generate
4538 the checksums for the patch files by using the <span class="command"><strong>make 4538 the checksums for the patch files by using the <span class="command"><strong>make
4539 makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="11.2. distinfo">Section 11.2, &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p> 4539 makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="11.2. distinfo">Section 11.2, &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
4540<p>When adding a patch that corrects a problem in the 4540<p>When adding a patch that corrects a problem in the
4541 distfile (rather than e.g. enforcing pkgsrc's view of where 4541 distfile (rather than e.g. enforcing pkgsrc's view of where
4542 man pages should go), send the patch as a bug report to the 4542 man pages should go), send the patch as a bug report to the
4543 maintainer. This benefits non-pkgsrc users of the package, 4543 maintainer. This benefits non-pkgsrc users of the package,
4544 and usually makes it possible to remove the patch in future 4544 and usually makes it possible to remove the patch in future
4545 version.</p> 4545 version.</p>
4546<p>The file names of the patch files are usually of the form 4546<p>The file names of the patch files are usually of the form
4547 <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>. 4547 <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>.
4548 Many packages still use the previous convention 4548 Many packages still use the previous convention
4549 <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>, 4549 <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>,
4550 but new patches should be of the form containing the filename. 4550 but new patches should be of the form containing the filename.
4551 <span class="command"><strong>mkpatches</strong></span> included in <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> takes care of the name 4551 <span class="command"><strong>mkpatches</strong></span> included in <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> takes care of the name
4552 automatically.</p> 4552 automatically.</p>
4553</div> 4553</div>
4554<div class="sect2"> 4554<div class="sect2">
4555<div class="titlepage"><div><div><h3 class="title"> 4555<div class="titlepage"><div><div><h3 class="title">
4556<a name="components.patches.sources"></a>11.3.3. Sources where the patch files come from</h3></div></div></div> 4556<a name="components.patches.sources"></a>11.3.3. Sources where the patch files come from</h3></div></div></div>
4557<p>If you want to share patches between multiple packages 4557<p>If you want to share patches between multiple packages
4558 in pkgsrc, e.g. because they use the same distfiles, set 4558 in pkgsrc, e.g. because they use the same distfiles, set
4559 <code class="varname">PATCHDIR</code> to the path where the patch files 4559 <code class="varname">PATCHDIR</code> to the path where the patch files
4560 can be found, e.g.:</p> 4560 can be found, e.g.:</p>
4561<pre class="programlisting"> 4561<pre class="programlisting">
4562PATCHDIR= ${.CURDIR}/../xemacs/patches 4562PATCHDIR= ${.CURDIR}/../xemacs/patches
4563</pre> 4563</pre>
4564<p>Patch files that are distributed by the author or other 4564<p>Patch files that are distributed by the author or other
4565 maintainers can be listed in 4565 maintainers can be listed in
4566 <code class="varname">PATCHFILES</code>.</p> 4566 <code class="varname">PATCHFILES</code>.</p>
4567<p>If it is desired to store any patches that should not be 4567<p>If it is desired to store any patches that should not be
4568 committed into pkgsrc, they can be kept outside the pkgsrc 4568 committed into pkgsrc, they can be kept outside the pkgsrc
4569 tree in the <code class="filename">$LOCALPATCHES</code> directory. The 4569 tree in the <code class="filename">$LOCALPATCHES</code> directory. The
4570 directory tree there is expected to have the same 4570 directory tree there is expected to have the same
4571 <span class="quote">&#8220;<span class="quote">category/package</span>&#8221;</span> structure as pkgsrc, and 4571 <span class="quote">&#8220;<span class="quote">category/package</span>&#8221;</span> structure as pkgsrc, and
4572 patches are expected to be stored inside these dirs (also 4572 patches are expected to be stored inside these dirs (also
4573 known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For 4573 known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For
4574 example, if you want to keep a private patch for 4574 example, if you want to keep a private patch for
4575 <code class="filename">pkgsrc/graphics/png</code>, keep it in 4575 <code class="filename">pkgsrc/graphics/png</code>, keep it in
4576 <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All 4576 <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
4577 files in the named directory are expected to be patch files, 4577 files in the named directory are expected to be patch files,
4578 and <span class="emphasis"><em>they are applied after pkgsrc patches are 4578 and <span class="emphasis"><em>they are applied after pkgsrc patches are
4579 applied</em></span>.</p> 4579 applied</em></span>.</p>
4580</div> 4580</div>
4581<div class="sect2"> 4581<div class="sect2">
4582<div class="titlepage"><div><div><h3 class="title"> 4582<div class="titlepage"><div><div><h3 class="title">
4583<a name="components.patches.guidelines"></a>11.3.4. Patching guidelines</h3></div></div></div> 4583<a name="components.patches.guidelines"></a>11.3.4. Patching guidelines</h3></div></div></div>
4584<p>When fixing a portability issue in the code do not use 4584<p>When fixing a portability issue in the code do not use
4585 preprocessor magic to check for the current operating system nor 4585 preprocessor magic to check for the current operating system nor
4586 platform. Doing so hurts portability to other platforms because 4586 platform. Doing so hurts portability to other platforms because
4587 the OS-specific details are not abstracted appropriately.</p> 4587 the OS-specific details are not abstracted appropriately.</p>
4588<p>The general rule to follow is: instead of checking for the 4588<p>The general rule to follow is: instead of checking for the
4589 operating system the application is being built on, check for the 4589 operating system the application is being built on, check for the
4590 specific <span class="emphasis"><em>features</em></span> you need. For example, 4590 specific <span class="emphasis"><em>features</em></span> you need. For example,
4591 instead of assuming that kqueue is available under NetBSD and 4591 instead of assuming that kqueue is available under NetBSD and
4592 using the <code class="varname">__NetBSD__</code> macro to conditionalize 4592 using the <code class="varname">__NetBSD__</code> macro to conditionalize
4593 kqueue support, add a check that detects kqueue itself &mdash; 4593 kqueue support, add a check that detects kqueue itself &mdash;
4594 yes, this generally involves patching the 4594 yes, this generally involves patching the
4595 <span class="command"><strong>configure</strong></span> script. There is absolutely nothing 4595 <span class="command"><strong>configure</strong></span> script. There is absolutely nothing
4596 that prevents some OSes from adopting interfaces from other OSes 4596 that prevents some OSes from adopting interfaces from other OSes
4597 (e.g. Linux implementing kqueue), something that the above checks 4597 (e.g. Linux implementing kqueue), something that the above checks
4598 cannot take into account.</p> 4598 cannot take into account.</p>
4599<p>Of course, checking for features generally involves more 4599<p>Of course, checking for features generally involves more
4600 work on the developer's side, but the resulting changes are 4600 work on the developer's side, but the resulting changes are
4601 cleaner and there are chances they will work on many other 4601 cleaner and there are chances they will work on many other
4602 platforms. Not to mention that there are higher chances of being 4602 platforms. Not to mention that there are higher chances of being
4603 later integrated into the mainstream sources. Remember: 4603 later integrated into the mainstream sources. Remember:
4604 <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p> 4604 <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p>
4605<p>Some typical examples:</p> 4605<p>Some typical examples:</p>
4606<div class="table"> 4606<div class="table">
4607<a name="patch-examples"></a><p class="title"><b>Table 11.1. Patching examples</b></p> 4607<a name="patch-examples"></a><p class="title"><b>Table 11.1. Patching examples</b></p>
4608<div class="table-contents"><table summary="Patching examples" border="1"> 4608<div class="table-contents"><table summary="Patching examples" border="1">
4609<colgroup> 4609<colgroup>
4610<col> 4610<col>
4611<col> 4611<col>
4612<col> 4612<col>
4613</colgroup> 4613</colgroup>
4614<thead><tr> 4614<thead><tr>
4615<th>Where</th> 4615<th>Where</th>
4616<th>Incorrect</th> 4616<th>Incorrect</th>
4617<th>Correct</th> 4617<th>Correct</th>
4618</tr></thead> 4618</tr></thead>
4619<tbody> 4619<tbody>
4620<tr> 4620<tr>
4621<td>configure script</td> 4621<td>configure script</td>
4622<td> 4622<td>
4623<pre class="programlisting"> 4623<pre class="programlisting">
4624case ${target_os} in 4624case ${target_os} in
4625netbsd*) have_kvm=yes ;; 4625netbsd*) have_kvm=yes ;;
4626*) have_kvm=no ;; 4626*) have_kvm=no ;;
4627esac 4627esac
4628</pre> 4628</pre>
4629 </td> 4629 </td>
4630<td> 4630<td>
4631<pre class="programlisting"> 4631<pre class="programlisting">
4632AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no) 4632AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)
4633</pre> 4633</pre>
4634 </td> 4634 </td>
4635</tr> 4635</tr>
4636<tr> 4636<tr>
4637<td>C source file</td> 4637<td>C source file</td>
4638<td> 4638<td>
4639<pre class="programlisting"> 4639<pre class="programlisting">
4640#if defined(__NetBSD__) 4640#if defined(__NetBSD__)
4641# include &lt;sys/event.h&gt; 4641# include &lt;sys/event.h&gt;
4642#endif 4642#endif
4643</pre> 4643</pre>
4644 </td> 4644 </td>
4645<td> 4645<td>
4646<pre class="programlisting"> 4646<pre class="programlisting">
4647#if defined(HAVE_SYS_EVENT_H) 4647#if defined(HAVE_SYS_EVENT_H)
4648# include &lt;sys/event.h&gt; 4648# include &lt;sys/event.h&gt;
4649#endif 4649#endif
4650</pre> 4650</pre>
4651 </td> 4651 </td>
4652</tr> 4652</tr>
4653<tr> 4653<tr>
4654<td>C source file</td> 4654<td>C source file</td>
4655<td> 4655<td>
4656<pre class="programlisting"> 4656<pre class="programlisting">
4657int 4657int
4658monitor_file(...) 4658monitor_file(...)
4659{ 4659{
4660#if defined(__NetBSD__) 4660#if defined(__NetBSD__)
4661 int fd = kqueue(); 4661 int fd = kqueue();
4662 ... 4662 ...
4663#else 4663#else
4664 ... 4664 ...
4665#endif 4665#endif
4666} 4666}
4667</pre> 4667</pre>
4668 </td> 4668 </td>
4669<td> 4669<td>
4670<pre class="programlisting"> 4670<pre class="programlisting">
4671int 4671int
4672monitor_file(...) 4672monitor_file(...)
4673{ 4673{
4674#if defined(HAVE_KQUEUE) 4674#if defined(HAVE_KQUEUE)
4675 int fd = kqueue(); 4675 int fd = kqueue();
4676 ... 4676 ...
4677#else 4677#else
4678 ... 4678 ...
4679#endif 4679#endif
4680} 4680}
4681</pre> 4681</pre>
4682 </td> 4682 </td>
4683</tr> 4683</tr>
4684</tbody> 4684</tbody>
4685</table></div> 4685</table></div>
4686</div> 4686</div>
4687<br class="table-break"><p>For more information, please read the <span class="emphasis"><em>Making 4687<br class="table-break"><p>For more information, please read the <span class="emphasis"><em>Making
4688 packager-friendly software</em></span> article (<a class="ulink" href="http://www.onlamp.com/pub/a/onlamp/2005/03/31/packaging.html" target="_top">part 4688 packager-friendly software</em></span> article (<a class="ulink" href="http://www.onlamp.com/pub/a/onlamp/2005/03/31/packaging.html" target="_top">part
4689 1</a>, <a class="ulink" href="http://www.oreillynet.com/pub/a/onlamp/2005/04/28/packaging2.html" target="_top">part 4689 1</a>, <a class="ulink" href="http://www.oreillynet.com/pub/a/onlamp/2005/04/28/packaging2.html" target="_top">part
4690 2</a>). It summarizes multiple details on how to make 4690 2</a>). It summarizes multiple details on how to make
4691 software easier to package; all the suggestions in it were 4691 software easier to package; all the suggestions in it were
4692 collected from our experience in pkgsrc work, so they are possibly 4692 collected from our experience in pkgsrc work, so they are possibly
4693 helpful when creating patches too.</p> 4693 helpful when creating patches too.</p>
4694</div> 4694</div>
4695<div class="sect2"> 4695<div class="sect2">
4696<div class="titlepage"><div><div><h3 class="title"> 4696<div class="titlepage"><div><div><h3 class="title">
4697<a name="components.patches.feedback"></a>11.3.5. Feedback to the author</h3></div></div></div> 4697<a name="components.patches.feedback"></a>11.3.5. Feedback to the author</h3></div></div></div>
4698<p>Always, always, <span class="strong"><strong>always</strong></span> 4698<p>Always, always, <span class="strong"><strong>always</strong></span>
4699 feed back any <span class="emphasis"><em>portability fixes</em></span> or 4699 feed back any <span class="emphasis"><em>portability fixes</em></span> or
4700 improvements you do to a package to the mainstream developers. 4700 improvements you do to a package to the mainstream developers.
4701 This is the only way to get their attention on portability issues 4701 This is the only way to get their attention on portability issues
4702 and to ensure that future versions can be built out-of-the box on 4702 and to ensure that future versions can be built out-of-the box on
4703 NetBSD. Furthermore, any user that gets newer distfiles will get 4703 NetBSD. Furthermore, any user that gets newer distfiles will get
4704 the fixes straight from the packaged code.</p> 4704 the fixes straight from the packaged code.</p>
4705<p>This generally involves cleaning up the patches 4705<p>This generally involves cleaning up the patches
4706 (because sometimes the patches that are 4706 (because sometimes the patches that are
4707 added to pkgsrc are quick hacks), filing bug reports in the 4707 added to pkgsrc are quick hacks), filing bug reports in the
4708 appropriate trackers for the projects and working with the 4708 appropriate trackers for the projects and working with the
4709 mainstream authors to accept your changes. It is 4709 mainstream authors to accept your changes. It is
4710 <span class="emphasis"><em>extremely important</em></span> that you do it so that 4710 <span class="emphasis"><em>extremely important</em></span> that you do it so that
4711 the packages in pkgsrc are kept simple and thus further changes 4711 the packages in pkgsrc are kept simple and thus further changes
4712 can be done without much hassle.</p> 4712 can be done without much hassle.</p>
4713<p>When you have done this, please add a URL to the upstream 4713<p>When you have done this, please add a URL to the upstream
4714 bug report to the patch comment.</p> 4714 bug report to the patch comment.</p>
4715<p>Support the idea of free software!</p> 4715<p>Support the idea of free software!</p>
4716</div> 4716</div>
4717</div> 4717</div>
4718<div class="sect1"> 4718<div class="sect1">
4719<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4719<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4720<a name="other-mandatory-files"></a>11.4. Other mandatory files</h2></div></div></div> 4720<a name="other-mandatory-files"></a>11.4. Other mandatory files</h2></div></div></div>
4721<div class="variablelist"><dl class="variablelist"> 4721<div class="variablelist"><dl class="variablelist">
4722<dt><span class="term"><code class="filename">DESCR</code></span></dt> 4722<dt><span class="term"><code class="filename">DESCR</code></span></dt>
4723<dd><p>A multi-line description of the piece of software. This should include 4723<dd><p>A multi-line description of the piece of software. This should include
4724 any credits where they are due. Please bear in mind that others do not 4724 any credits where they are due. Please bear in mind that others do not
4725 share your sense of humour (or spelling idiosyncrasies), and that others 4725 share your sense of humour (or spelling idiosyncrasies), and that others
4726 will read everything that you write here.</p></dd> 4726 will read everything that you write here.</p></dd>
4727<dt><span class="term"><code class="filename">PLIST</code></span></dt> 4727<dt><span class="term"><code class="filename">PLIST</code></span></dt>
4728<dd><p>This file governs the files that are installed on your 4728<dd><p>This file governs the files that are installed on your
4729 system: all the binaries, manual pages, etc. There are other 4729 system: all the binaries, manual pages, etc. There are other
4730 directives which may be entered in this file, to control the 4730 directives which may be entered in this file, to control the
4731 creation and deletion of directories, and the location of 4731 creation and deletion of directories, and the location of
4732 inserted files. See <a class="xref" href="#plist" title="Chapter 13. PLIST issues">Chapter 13, <i>PLIST issues</i></a> for more 4732 inserted files. See <a class="xref" href="#plist" title="Chapter 13. PLIST issues">Chapter 13, <i>PLIST issues</i></a> for more
4733 information.</p></dd> 4733 information.</p></dd>
4734</dl></div> 4734</dl></div>
4735</div> 4735</div>
4736<div class="sect1"> 4736<div class="sect1">
4737<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4737<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4738<a name="components.optional"></a>11.5. Optional files</h2></div></div></div> 4738<a name="components.optional"></a>11.5. Optional files</h2></div></div></div>
4739<div class="sect2"> 4739<div class="sect2">
4740<div class="titlepage"><div><div><h3 class="title"> 4740<div class="titlepage"><div><div><h3 class="title">
4741<a name="components.optional.bin"></a>11.5.1. Files affecting the binary package</h3></div></div></div> 4741<a name="components.optional.bin"></a>11.5.1. Files affecting the binary package</h3></div></div></div>
4742<div class="variablelist"><dl class="variablelist"> 4742<div class="variablelist"><dl class="variablelist">
4743<dt><span class="term"><code class="filename">INSTALL</code></span></dt> 4743<dt><span class="term"><code class="filename">INSTALL</code></span></dt>
4744<dd> 4744<dd>
4745<p>This shell script is invoked twice by <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>. 4745<p>This shell script is invoked twice by <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>.
4746 First time after package extraction and before files are 4746 First time after package extraction and before files are
4747 moved in place, the second time after the files to install 4747 moved in place, the second time after the files to install
4748 are moved in place. This can be used to do any custom 4748 are moved in place. This can be used to do any custom
4749 procedures not possible with @exec commands in 4749 procedures not possible with @exec commands in
4750 <code class="filename">PLIST</code>. See <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> and 4750 <code class="filename">PLIST</code>. See <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> and
4751 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information. See also <a class="xref" href="#files-and-dirs-outside-prefix" title="15.1. Files and directories outside the installation prefix">Section 15.1, &#8220;Files and directories outside the installation prefix&#8221;</a>. 4751 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information. See also <a class="xref" href="#files-and-dirs-outside-prefix" title="15.1. Files and directories outside the installation prefix">Section 15.1, &#8220;Files and directories outside the installation prefix&#8221;</a>.
4752 Please note that you can modify variables in it easily by using 4752 Please note that you can modify variables in it easily by using
4753 <code class="varname">FILES_SUBST</code> in the package's 4753 <code class="varname">FILES_SUBST</code> in the package's
4754 <code class="filename">Makefile</code>:</p> 4754 <code class="filename">Makefile</code>:</p>
4755<pre class="programlisting"> 4755<pre class="programlisting">
4756FILES_SUBST+= SOMEVAR="somevalue" 4756FILES_SUBST+= SOMEVAR="somevalue"
4757</pre> 4757</pre>
4758<p>replaces "@SOMEVAR@" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in the 4758<p>replaces "@SOMEVAR@" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in the
4759 <code class="filename">INSTALL</code>. By default, substitution is 4759 <code class="filename">INSTALL</code>. By default, substitution is
4760 performed for <code class="varname">PREFIX</code>, 4760 performed for <code class="varname">PREFIX</code>,
4761 <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>, 4761 <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
4762 <code class="varname">VARBASE</code>, and a few others, type 4762 <code class="varname">VARBASE</code>, and a few others, type
4763 <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a 4763 <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a
4764 complete list.</p> 4764 complete list.</p>
4765</dd> 4765</dd>
4766<dt><span class="term"><code class="filename">DEINSTALL</code></span></dt> 4766<dt><span class="term"><code class="filename">DEINSTALL</code></span></dt>
4767<dd><p>This script is executed before and after any files are removed. It is 4767<dd><p>This script is executed before and after any files are removed. It is
4768 this script's responsibility to clean up any additional messy details 4768 this script's responsibility to clean up any additional messy details
4769 around the package's installation, since all pkg_delete knows is how to 4769 around the package's installation, since all pkg_delete knows is how to
4770 delete the files created in the original distribution. 4770 delete the files created in the original distribution.
4771 See <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> 4771 See <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
4772 and <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information. 4772 and <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information.
4773 The same methods to replace variables can be used as for 4773 The same methods to replace variables can be used as for
4774 the <code class="filename">INSTALL</code> file.</p></dd> 4774 the <code class="filename">INSTALL</code> file.</p></dd>
4775<dt><span class="term"><code class="filename">MESSAGE</code></span></dt> 4775<dt><span class="term"><code class="filename">MESSAGE</code></span></dt>
4776<dd> 4776<dd>
4777<p>This file is displayed after installation of the package. 4777<p>This file is displayed after installation of the package.
4778 Useful for things like legal notices on almost-free 4778 Useful for things like legal notices on almost-free
4779 software and hints for updating config files after 4779 software and hints for updating config files after
4780 installing modules for apache, PHP etc. 4780 installing modules for apache, PHP etc.
4781 Please note that you can modify variables in it easily by using 4781 Please note that you can modify variables in it easily by using
4782 <code class="varname">MESSAGE_SUBST</code> in the package's 4782 <code class="varname">MESSAGE_SUBST</code> in the package's
4783 <code class="filename">Makefile</code>:</p> 4783 <code class="filename">Makefile</code>:</p>
4784<pre class="programlisting"> 4784<pre class="programlisting">
4785MESSAGE_SUBST+= SOMEVAR="somevalue" 4785MESSAGE_SUBST+= SOMEVAR="somevalue"
4786</pre> 4786</pre>
4787<p>replaces "${SOMEVAR}" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in 4787<p>replaces "${SOMEVAR}" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in
4788 <code class="filename">MESSAGE</code>. By default, substitution is 4788 <code class="filename">MESSAGE</code>. By default, substitution is
4789 performed for <code class="varname">PKGNAME</code>, 4789 performed for <code class="varname">PKGNAME</code>,
4790 <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>, 4790 <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>,
4791 <code class="varname">LOCALBASE</code>, <code class="varname">X11PREFIX</code>, 4791 <code class="varname">LOCALBASE</code>, <code class="varname">X11PREFIX</code>,
4792 <code class="varname">X11BASE</code>, 4792 <code class="varname">X11BASE</code>,
4793 <code class="varname">PKG_SYSCONFDIR</code>, 4793 <code class="varname">PKG_SYSCONFDIR</code>,
4794 <code class="varname">ROOT_GROUP</code>, and 4794 <code class="varname">ROOT_GROUP</code>, and
4795 <code class="varname">ROOT_USER</code>.</p> 4795 <code class="varname">ROOT_USER</code>.</p>
4796<p>You can display a different or additional files by 4796<p>You can display a different or additional files by
4797 setting the <code class="varname">MESSAGE_SRC</code> variable. Its 4797 setting the <code class="varname">MESSAGE_SRC</code> variable. Its
4798 default is <code class="filename">MESSAGE</code>, if the file 4798 default is <code class="filename">MESSAGE</code>, if the file
4799 exists.</p> 4799 exists.</p>
4800</dd> 4800</dd>
4801<dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt> 4801<dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt>
4802<dd><p>FIXME: There is no documentation on the 4802<dd><p>FIXME: There is no documentation on the
4803 alternatives framework.</p></dd> 4803 alternatives framework.</p></dd>
4804</dl></div> 4804</dl></div>
4805</div> 4805</div>
4806<div class="sect2"> 4806<div class="sect2">
4807<div class="titlepage"><div><div><h3 class="title"> 4807<div class="titlepage"><div><div><h3 class="title">
4808<a name="components.optional.build"></a>11.5.2. Files affecting the build process</h3></div></div></div> 4808<a name="components.optional.build"></a>11.5.2. Files affecting the build process</h3></div></div></div>
4809<div class="variablelist"><dl class="variablelist"> 4809<div class="variablelist"><dl class="variablelist">
4810<dt><span class="term"><code class="filename">Makefile.common</code></span></dt> 4810<dt><span class="term"><code class="filename">Makefile.common</code></span></dt>
4811<dd><p>This file contains arbitrary things that could 4811<dd><p>This file contains arbitrary things that could
4812 also go into a <code class="filename">Makefile</code>, but its purpose is 4812 also go into a <code class="filename">Makefile</code>, but its purpose is
4813 to be used by more than one package. This file should only be 4813 to be used by more than one package. This file should only be
4814 used when the packages that will use the file are known in 4814 used when the packages that will use the file are known in
4815 advance. For other purposes it is often better to write a 4815 advance. For other purposes it is often better to write a
4816 <code class="filename">*.mk</code> file and give it a good name that 4816 <code class="filename">*.mk</code> file and give it a good name that
4817 describes what it does.</p></dd> 4817 describes what it does.</p></dd>
4818<dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt> 4818<dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt>
4819<dd><p>This file contains the dependency information 4819<dd><p>This file contains the dependency information
4820 for the buildlink3 framework (see <a class="xref" href="#buildlink" title="Chapter 14. Buildlink methodology">Chapter 14, <i>Buildlink methodology</i></a>).</p></dd> 4820 for the buildlink3 framework (see <a class="xref" href="#buildlink" title="Chapter 14. Buildlink methodology">Chapter 14, <i>Buildlink methodology</i></a>).</p></dd>
4821<dt><span class="term"><code class="filename">hacks.mk</code></span></dt> 4821<dt><span class="term"><code class="filename">hacks.mk</code></span></dt>
4822<dd><p>This file contains workarounds for compiler bugs 4822<dd><p>This file contains workarounds for compiler bugs
4823 and similar things. It is included automatically by the pkgsrc 4823 and similar things. It is included automatically by the pkgsrc
4824 infrastructure, so you don't need an extra 4824 infrastructure, so you don't need an extra
4825 <code class="literal">.include</code> line for 4825 <code class="literal">.include</code> line for
4826 it.</p></dd> 4826 it.</p></dd>
4827<dt><span class="term"><code class="filename">options.mk</code></span></dt> 4827<dt><span class="term"><code class="filename">options.mk</code></span></dt>
4828<dd><p>This file contains the code for the 4828<dd><p>This file contains the code for the
4829 package-specific options (see <a class="xref" href="#options" title="Chapter 16. Options handling">Chapter 16, <i>Options handling</i></a>) that can be 4829 package-specific options (see <a class="xref" href="#options" title="Chapter 16. Options handling">Chapter 16, <i>Options handling</i></a>) that can be
4830 selected by the user. If a package has only one or two options, 4830 selected by the user. If a package has only one or two options,
4831 it is equally acceptable to put the code directly into the 4831 it is equally acceptable to put the code directly into the
4832 <code class="filename">Makefile</code>.</p></dd> 4832 <code class="filename">Makefile</code>.</p></dd>
4833</dl></div> 4833</dl></div>
4834</div> 4834</div>
4835<div class="sect2"> 4835<div class="sect2">
4836<div class="titlepage"><div><div><h3 class="title"> 4836<div class="titlepage"><div><div><h3 class="title">
4837<a name="components.optional.none"></a>11.5.3. Files affecting nothing at all</h3></div></div></div> 4837<a name="components.optional.none"></a>11.5.3. Files affecting nothing at all</h3></div></div></div>
4838<div class="variablelist"><dl class="variablelist"> 4838<div class="variablelist"><dl class="variablelist">
4839<dt><span class="term"><code class="filename">README*</code></span></dt> 4839<dt><span class="term"><code class="filename">README*</code></span></dt>
4840<dd><p>These files do not take place in the creation of 4840<dd><p>These files do not take place in the creation of
4841 a package and thus are purely informative to the package 4841 a package and thus are purely informative to the package
4842 developer.</p></dd> 4842 developer.</p></dd>
4843<dt><span class="term"><code class="filename">TODO</code></span></dt> 4843<dt><span class="term"><code class="filename">TODO</code></span></dt>
4844<dd><p>This file contains things that need to be done 4844<dd><p>This file contains things that need to be done
4845 to make the package even 4845 to make the package even
4846 better.</p></dd> 4846 better.</p></dd>
4847</dl></div> 4847</dl></div>
4848</div> 4848</div>
4849</div> 4849</div>
4850<div class="sect1"> 4850<div class="sect1">
4851<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4851<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4852<a name="work-dir"></a>11.6. <code class="filename">work*</code> 4852<a name="work-dir"></a>11.6. <code class="filename">work*</code>
4853</h2></div></div></div> 4853</h2></div></div></div>
4854<p>When you type <span class="command"><strong>make</strong></span>, the distribution files are 4854<p>When you type <span class="command"><strong>make</strong></span>, the distribution files are
4855 unpacked into the directory denoted by 4855 unpacked into the directory denoted by
4856 <code class="varname">WRKDIR</code>. It can be removed by running 4856 <code class="varname">WRKDIR</code>. It can be removed by running
4857 <span class="command"><strong>make clean</strong></span>. Besides the sources, this 4857 <span class="command"><strong>make clean</strong></span>. Besides the sources, this
4858 directory is also used to keep various timestamp files. 4858 directory is also used to keep various timestamp files.
4859 The directory gets <span class="emphasis"><em>removed completely</em></span> on clean. 4859 The directory gets <span class="emphasis"><em>removed completely</em></span> on clean.
4860 The default is <code class="filename">${.CURDIR}/work</code> 4860 The default is <code class="filename">${.CURDIR}/work</code>
4861 or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code> 4861 or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code>
4862 if <code class="varname">OBJMACHINE</code> is set.</p> 4862 if <code class="varname">OBJMACHINE</code> is set.</p>
4863</div> 4863</div>
4864<div class="sect1"> 4864<div class="sect1">
4865<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4865<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4866<a name="files-dir"></a>11.7. <code class="filename">files/*</code> 4866<a name="files-dir"></a>11.7. <code class="filename">files/*</code>
4867</h2></div></div></div> 4867</h2></div></div></div>
4868<p>If you have any files that you wish to be placed in the package prior 4868<p>If you have any files that you wish to be placed in the package prior
4869 to configuration or building, you could place these files here and use 4869 to configuration or building, you could place these files here and use
4870 a <span class="command"><strong>${CP}</strong></span> command in the 4870 a <span class="command"><strong>${CP}</strong></span> command in the
4871 <span class="quote">&#8220;<span class="quote">pre-configure</span>&#8221;</span> target to achieve 4871 <span class="quote">&#8220;<span class="quote">pre-configure</span>&#8221;</span> target to achieve
4872 this. Alternatively, you could simply diff the file against 4872 this. Alternatively, you could simply diff the file against
4873 <code class="filename">/dev/null</code> and use the patch mechanism to manage 4873 <code class="filename">/dev/null</code> and use the patch mechanism to manage
4874 the creation of this file.</p> 4874 the creation of this file.</p>
4875<p>If you want to share files in this way with other 4875<p>If you want to share files in this way with other
4876 packages, set the <code class="varname">FILESDIR</code> variable to point 4876 packages, set the <code class="varname">FILESDIR</code> variable to point
4877 to the other package's <code class="filename">files</code> directory, 4877 to the other package's <code class="filename">files</code> directory,
4878 e.g.:</p> 4878 e.g.:</p>
4879<pre class="programlisting"> 4879<pre class="programlisting">
4880FILESDIR=${.CURDIR}/../xemacs/files 4880FILESDIR=${.CURDIR}/../xemacs/files
4881</pre> 4881</pre>
4882</div> 4882</div>
4883</div> 4883</div>
4884<div class="chapter"> 4884<div class="chapter">
4885<div class="titlepage"><div><div><h2 class="title"> 4885<div class="titlepage"><div><div><h2 class="title">
4886<a name="makefile"></a>Chapter 12. Programming in <code class="filename">Makefile</code>s</h2></div></div></div> 4886<a name="makefile"></a>Chapter 12. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
4887<div class="toc"> 4887<div class="toc">
4888<p><b>Table of Contents</b></p> 4888<p><b>Table of Contents</b></p>
4889<dl> 4889<dl>
4890<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt> 4890<dt><span class="sect1"><a href="#makefile.style">12.1. Caveats</a></span></dt>
4891<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt> 4891<dt><span class="sect1"><a href="#makefile.variables">12.2. <code class="filename">Makefile</code> variables</a></span></dt>
4892<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd> 4892<dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">12.2.1. Naming conventions</a></span></dt></dl></dd>
4893<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt> 4893<dt><span class="sect1"><a href="#makefile.code">12.3. Code snippets</a></span></dt>
4894<dd><dl> 4894<dd><dl>
4895<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt> 4895<dt><span class="sect2"><a href="#adding-to-list">12.3.1. Adding things to a list</a></span></dt>
4896<dt><span class="sect2"><a href="#converting-internal-to-external">12.3.2. Converting an internal list into an external list</a></span></dt> 4896<dt><span class="sect2"><a href="#converting-internal-to-external">12.3.2. Converting an internal list into an external list</a></span></dt>
4897<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.3. Passing variables to a shell command</a></span></dt> 4897<dt><span class="sect2"><a href="#passing-variable-to-shell">12.3.3. Passing variables to a shell command</a></span></dt>
4898<dt><span class="sect2"><a href="#quoting-guideline">12.3.4. Quoting guideline</a></span></dt> 4898<dt><span class="sect2"><a href="#quoting-guideline">12.3.4. Quoting guideline</a></span></dt>
4899<dt><span class="sect2"><a href="#bsd-make-bug-workaround">12.3.5. Workaround for a bug in BSD Make</a></span></dt> 4899<dt><span class="sect2"><a href="#bsd-make-bug-workaround">12.3.5. Workaround for a bug in BSD Make</a></span></dt>
4900</dl></dd> 4900</dl></dd>
4901</dl> 4901</dl>
4902</div> 4902</div>
4903<p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments, 4903<p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
4904 each of which forms a well-defined part of the pkgsrc system. Using 4904 each of which forms a well-defined part of the pkgsrc system. Using
4905 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 4905 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
4906 like pkgsrc requires some discipline to keep the code correct and 4906 like pkgsrc requires some discipline to keep the code correct and
4907 understandable.</p> 4907 understandable.</p>
4908<p>The basic ingredients for <code class="filename">Makefile</code> 4908<p>The basic ingredients for <code class="filename">Makefile</code>
4909 programming are variables (which are actually macros) and shell 4909 programming are variables (which are actually macros) and shell
4910 commands. Among these shell commands may even be more complex ones 4910 commands. Among these shell commands may even be more complex ones
4911 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 4911 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
4912 as intended it is necessary to quote all variables correctly when they 4912 as intended it is necessary to quote all variables correctly when they
4913 are used.</p> 4913 are used.</p>
4914<p>This chapter describes some patterns, that appear quite often in 4914<p>This chapter describes some patterns, that appear quite often in
4915 <code class="filename">Makefile</code>s, including the pitfalls that come along 4915 <code class="filename">Makefile</code>s, including the pitfalls that come along
4916 with them.</p> 4916 with them.</p>
4917<div class="sect1"> 4917<div class="sect1">
4918<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4918<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4919<a name="makefile.style"></a>12.1. Caveats</h2></div></div></div> 4919<a name="makefile.style"></a>12.1. Caveats</h2></div></div></div>
4920<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 4920<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
4921<p>When you are creating a file as a 4921<p>When you are creating a file as a
4922 target of a rule, always write the data to a temporary file first 4922 target of a rule, always write the data to a temporary file first
4923 and finally rename that file. Otherwise there might occur an error 4923 and finally rename that file. Otherwise there might occur an error
4924 in the middle of generating the file, and when the user runs 4924 in the middle of generating the file, and when the user runs
4925 <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 the second time, the file exists and will not be 4925 <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 the second time, the file exists and will not be
4926 regenerated properly. Example:</p> 4926 regenerated properly. Example:</p>
4927<pre class="programlisting"> 4927<pre class="programlisting">
4928wrong: 4928wrong:
4929 @echo "line 1" &gt; ${.TARGET} 4929 @echo "line 1" &gt; ${.TARGET}
4930 @echo "line 2" &gt;&gt; ${.TARGET} 4930 @echo "line 2" &gt;&gt; ${.TARGET}
4931 @false 4931 @false
4932 4932
4933correct: 4933correct:
4934 @echo "line 1" &gt; ${.TARGET}.tmp 4934 @echo "line 1" &gt; ${.TARGET}.tmp
4935 @echo "line 2" &gt;&gt; ${.TARGET}.tmp 4935 @echo "line 2" &gt;&gt; ${.TARGET}.tmp
4936 @false 4936 @false
4937 @mv ${.TARGET}.tmp ${.TARGET} 4937 @mv ${.TARGET}.tmp ${.TARGET}
4938</pre> 4938</pre>
4939<p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file 4939<p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file
4940 <code class="filename">wrong</code> will exist, although there was an error 4940 <code class="filename">wrong</code> will exist, although there was an error
4941 message in the first run. On the other hand, running <span class="command"><strong>make 4941 message in the first run. On the other hand, running <span class="command"><strong>make
4942 correct</strong></span> gives an error message twice, as expected.</p> 4942 correct</strong></span> gives an error message twice, as expected.</p>
4943<p>You might remember that <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> sometimes removes 4943<p>You might remember that <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> sometimes removes
4944 <code class="literal">${.TARGET}</code> in case of error, but this only 4944 <code class="literal">${.TARGET}</code> in case of error, but this only
4945 happens when it is interrupted, for example by pressing 4945 happens when it is interrupted, for example by pressing
4946 <code class="literal">^C</code>. This does <span class="emphasis"><em>not</em></span> happen 4946 <code class="literal">^C</code>. This does <span class="emphasis"><em>not</em></span> happen
4947 when one of the commands fails (like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?false+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">false</span>(1)</span></a> above).</p> 4947 when one of the commands fails (like <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?false+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">false</span>(1)</span></a> above).</p>
4948</li></ul></div> 4948</li></ul></div>
4949</div> 4949</div>
4950<div class="sect1"> 4950<div class="sect1">
4951<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 4951<div class="titlepage"><div><div><h2 class="title" style="clear: both">
4952<a name="makefile.variables"></a>12.2. <code class="filename">Makefile</code> variables</h2></div></div></div> 4952<a name="makefile.variables"></a>12.2. <code class="filename">Makefile</code> variables</h2></div></div></div>
4953<p><code class="filename">Makefile</code> variables contain strings that 4953<p><code class="filename">Makefile</code> variables contain strings that
4954 can be processed using the five operators ``='', ``+='', ``?='', 4954 can be processed using the five operators ``='', ``+='', ``?='',
4955 ``:='', 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 4955 ``:='', 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
4956 page.</p> 4956 page.</p>
4957<p>When a variable's value is parsed from a 4957<p>When a variable's value is parsed from a
4958 <code class="filename">Makefile</code>, the hash character ``#'' and the 4958 <code class="filename">Makefile</code>, the hash character ``#'' and the
4959 backslash character ``\'' are handled specially. If a backslash is 4959 backslash character ``\'' are handled specially. If a backslash is
4960 followed by a newline, any whitespace immediately in front of the 4960 followed by a newline, any whitespace immediately in front of the
4961 backslash, the backslash, the newline, and any whitespace 4961 backslash, the backslash, the newline, and any whitespace
4962 immediately behind the newline are replaced with a single space. A 4962 immediately behind the newline are replaced with a single space. A
4963 backslash character and an immediately following hash character are 4963 backslash character and an immediately following hash character are
4964 replaced with a single hash character. Otherwise, the backslash is 4964 replaced with a single hash character. Otherwise, the backslash is
4965 passed as is. In a variable assignment, any hash character that is 4965 passed as is. In a variable assignment, any hash character that is
4966 not preceded by a backslash starts a comment that continues upto the 4966 not preceded by a backslash starts a comment that continues upto the
4967 end of the logical line.</p> 4967 end of the logical line.</p>
4968<p><span class="emphasis"><em>Note:</em></span> Because of this parsing algorithm 4968<p><span class="emphasis"><em>Note:</em></span> Because of this parsing algorithm
4969 the only way to create a variable consisting of a single backslash 4969 the only way to create a variable consisting of a single backslash
4970 is using the ``!='' operator, for example: <code class="varname">BACKSLASH!=echo "\\"</code>.</p> 4970 is using the ``!='' operator, for example: <code class="varname">BACKSLASH!=echo "\\"</code>.</p>
4971<p>So far for defining variables. The other thing you can do with 4971<p>So far for defining variables. The other thing you can do with
4972 variables is evaluating them. A variable is evaluated when it is 4972 variables is evaluating them. A variable is evaluated when it is
4973 part of the right side of the ``:='' or the ``!='' operator, or 4973 part of the right side of the ``:='' or the ``!='' operator, or
4974 directly before executing a shell command which the variable is part 4974 directly before executing a shell command which the variable is part
4975 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 4975 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
4976 is, variables are not evaluated until there's no other way. The 4976 is, variables are not evaluated until there's no other way. The
4977 ``modifiers'' mentioned in the man page also evaluate the 4977 ``modifiers'' mentioned in the man page also evaluate the
4978 variable.</p> 4978 variable.</p>
4979<p>Some of the modifiers split the string into words and then 4979<p>Some of the modifiers split the string into words and then
4980 operate on the words, others operate on the string as a whole. When 4980 operate on the words, others operate on the string as a whole. When
4981 a string is split into words, it is split as you would expect 4981 a string is split into words, it is split as you would expect
4982 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> 4982 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>
4983<p>No rule without exception&mdash;the <span class="command"><strong>.for</strong></span> 4983<p>No rule without exception&mdash;the <span class="command"><strong>.for</strong></span>
4984 loop does not follow the shell quoting rules but splits at sequences 4984 loop does not follow the shell quoting rules but splits at sequences
4985 of whitespace.</p> 4985 of whitespace.</p>
4986<p>There are several types of variables that should be handled 4986<p>There are several types of variables that should be handled
4987 differently. Strings and two types of lists.</p> 4987 differently. Strings and two types of lists.</p>
4988<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 4988<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4989<li class="listitem"><p><span class="emphasis"><em>Strings</em></span> can contain arbitrary 4989<li class="listitem"><p><span class="emphasis"><em>Strings</em></span> can contain arbitrary
4990 characters. Nevertheless, you should restrict yourself to only 4990 characters. Nevertheless, you should restrict yourself to only
4991 using printable characters. Examples are 4991 using printable characters. Examples are
4992 <code class="varname">PREFIX</code> and 4992 <code class="varname">PREFIX</code> and
4993 <code class="varname">COMMENT</code>.</p></li> 4993 <code class="varname">COMMENT</code>.</p></li>
4994<li class="listitem"><p><span class="emphasis"><em>Internal lists</em></span> are lists that 4994<li class="listitem"><p><span class="emphasis"><em>Internal lists</em></span> are lists that
4995 are never exported to any shell command. Their elements are 4995 are never exported to any shell command. Their elements are
4996 separated by whitespace. Therefore, the elements themselves cannot 4996 separated by whitespace. Therefore, the elements themselves cannot
4997 have embedded whitespace. Any other characters are allowed. 4997 have embedded whitespace. Any other characters are allowed.
4998 Internal lists can be used in <span class="command"><strong>.for</strong></span> loops. 4998 Internal lists can be used in <span class="command"><strong>.for</strong></span> loops.
4999 Examples are <code class="varname">DEPENDS</code> and 4999 Examples are <code class="varname">DEPENDS</code> and
5000 <code class="varname">BUILD_DEPENDS</code>.</p></li> 5000 <code class="varname">BUILD_DEPENDS</code>.</p></li>
5001<li class="listitem"><p><span class="emphasis"><em>External lists</em></span> are lists that 5001<li class="listitem"><p><span class="emphasis"><em>External lists</em></span> are lists that
5002 may be exported to a shell command. Their elements can contain any 5002 may be exported to a shell command. Their elements can contain any
5003 characters, including whitespace. That's why they cannot be used 5003 characters, including whitespace. That's why they cannot be used
5004 in <span class="command"><strong>.for</strong></span> loops. Examples are 5004 in <span class="command"><strong>.for</strong></span> loops. Examples are
5005 <code class="varname">DISTFILES</code> and 5005 <code class="varname">DISTFILES</code> and
5006 <code class="varname">MASTER_SITES</code>.</p></li> 5006 <code class="varname">MASTER_SITES</code>.</p></li>
5007</ul></div> 5007</ul></div>
5008<div class="sect2"> 5008<div class="sect2">
5009<div class="titlepage"><div><div><h3 class="title"> 5009<div class="titlepage"><div><div><h3 class="title">
5010<a name="makefile.variables.names"></a>12.2.1. Naming conventions</h3></div></div></div> 5010<a name="makefile.variables.names"></a>12.2.1. Naming conventions</h3></div></div></div>
5011<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5011<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5012<li class="listitem"><p>All variable names starting with an underscore 5012<li class="listitem"><p>All variable names starting with an underscore
5013 are reserved for use by the pkgsrc infrastructure. They shall 5013 are reserved for use by the pkgsrc infrastructure. They shall
5014 not be used by package 5014 not be used by package
5015 <code class="filename">Makefile</code>s.</p></li> 5015 <code class="filename">Makefile</code>s.</p></li>
5016<li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use 5016<li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use
5017 lowercase variable names for the iteration 5017 lowercase variable names for the iteration
5018 variables.</p></li> 5018 variables.</p></li>
5019<li class="listitem"><p>All list variables should have a ``plural'' 5019<li class="listitem"><p>All list variables should have a ``plural''
5020 name, e.g. <code class="varname">PKG_OPTIONS</code> or 5020 name, e.g. <code class="varname">PKG_OPTIONS</code> or
5021 <code class="varname">DISTFILES</code>.</p></li> 5021 <code class="varname">DISTFILES</code>.</p></li>
5022</ul></div> 5022</ul></div>
5023</div> 5023</div>
5024</div> 5024</div>
5025<div class="sect1"> 5025<div class="sect1">
5026<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5026<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5027<a name="makefile.code"></a>12.3. Code snippets</h2></div></div></div> 5027<a name="makefile.code"></a>12.3. Code snippets</h2></div></div></div>
5028<p>This section presents you with some code snippets you should 5028<p>This section presents you with some code snippets you should
5029 use in your own code. If you don't find anything appropriate here, 5029 use in your own code. If you don't find anything appropriate here,
5030 you should test your code and add it here.</p> 5030 you should test your code and add it here.</p>
5031<div class="sect2"> 5031<div class="sect2">
5032<div class="titlepage"><div><div><h3 class="title"> 5032<div class="titlepage"><div><div><h3 class="title">
5033<a name="adding-to-list"></a>12.3.1. Adding things to a list</h3></div></div></div> 5033<a name="adding-to-list"></a>12.3.1. Adding things to a list</h3></div></div></div>
5034<pre class="programlisting"> 5034<pre class="programlisting">
5035STRING= foo * bar `date` 5035STRING= foo * bar `date`
5036INT_LIST= # empty 5036INT_LIST= # empty
5037ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache 5037ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
5038EXT_LIST= # empty 5038EXT_LIST= # empty
5039ANOTHER_EXT_LIST= a=b c=d 5039ANOTHER_EXT_LIST= a=b c=d
5040 5040
5041INT_LIST+= ${STRING} # 1 5041INT_LIST+= ${STRING} # 1
5042INT_LIST+= ${ANOTHER_INT_LIST} # 2 5042INT_LIST+= ${ANOTHER_INT_LIST} # 2
5043EXT_LIST+= ${STRING:Q} # 3 5043EXT_LIST+= ${STRING:Q} # 3
5044EXT_LIST+= ${ANOTHER_EXT_LIST} # 4 5044EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
5045</pre> 5045</pre>
5046<p>When you add a string to an external list (example 3), it 5046<p>When you add a string to an external list (example 3), it
5047 must be quoted. In all other cases, you must not add a quoting 5047 must be quoted. In all other cases, you must not add a quoting
5048 level. You must not merge internal and external lists, unless you 5048 level. You must not merge internal and external lists, unless you
5049 are sure that all entries are correctly interpreted in both 5049 are sure that all entries are correctly interpreted in both
5050 lists.</p> 5050 lists.</p>
5051</div> 5051</div>
5052<div class="sect2"> 5052<div class="sect2">
5053<div class="titlepage"><div><div><h3 class="title"> 5053<div class="titlepage"><div><div><h3 class="title">
5054<a name="converting-internal-to-external"></a>12.3.2. Converting an internal list into an external list</h3></div></div></div> 5054<a name="converting-internal-to-external"></a>12.3.2. Converting an internal list into an external list</h3></div></div></div>
5055<pre class="programlisting"> 5055<pre class="programlisting">
5056EXT_LIST= # empty 5056EXT_LIST= # empty
5057.for i in ${INT_LIST} 5057.for i in ${INT_LIST}
5058EXT_LIST+= ${i:Q}"" 5058EXT_LIST+= ${i:Q}""
5059.endfor 5059.endfor
5060</pre> 5060</pre>
5061<p>This code converts the internal list 5061<p>This code converts the internal list
5062 <code class="varname">INT_LIST</code> into the external list 5062 <code class="varname">INT_LIST</code> into the external list
5063 <code class="varname">EXT_LIST</code>. As the elements of an internal list 5063 <code class="varname">EXT_LIST</code>. As the elements of an internal list
5064 are unquoted they must be quoted here. The reason for appending 5064 are unquoted they must be quoted here. The reason for appending
5065 <code class="varname">""</code> is explained below.</p> 5065 <code class="varname">""</code> is explained below.</p>
5066</div> 5066</div>
5067<div class="sect2"> 5067<div class="sect2">
5068<div class="titlepage"><div><div><h3 class="title"> 5068<div class="titlepage"><div><div><h3 class="title">
5069<a name="passing-variable-to-shell"></a>12.3.3. Passing variables to a shell command</h3></div></div></div> 5069<a name="passing-variable-to-shell"></a>12.3.3. Passing variables to a shell command</h3></div></div></div>
5070<p>Sometimes you may want to print an arbitrary string. There 5070<p>Sometimes you may want to print an arbitrary string. There
5071 are many ways to get it wrong and only few that can handle every 5071 are many ways to get it wrong and only few that can handle every
5072 nastiness.</p> 5072 nastiness.</p>
5073<pre class="programlisting"> 5073<pre class="programlisting">
5074STRING= foo bar &lt; &gt; * `date` $$HOME ' " 5074STRING= foo bar &lt; &gt; * `date` $$HOME ' "
5075EXT_LIST= string=${STRING:Q} x=second\ item 5075EXT_LIST= string=${STRING:Q} x=second\ item
5076 5076
5077all: 5077all:
5078 echo ${STRING} # 1 5078 echo ${STRING} # 1
5079 echo "${STRING}" # 2 5079 echo "${STRING}" # 2
5080 echo "${STRING:Q}" # 3 5080 echo "${STRING:Q}" # 3
5081 echo ${STRING:Q} # 4 5081 echo ${STRING:Q} # 4
5082 echo x${STRING:Q} | sed 1s,.,, # 5 5082 echo x${STRING:Q} | sed 1s,.,, # 5
5083 printf "%s\\n" ${STRING:Q}"" # 6 5083 printf "%s\\n" ${STRING:Q}"" # 6
5084 env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"' 5084 env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
5085</pre> 5085</pre>
5086<p>Example 1 leads to a syntax error in the shell, as the 5086<p>Example 1 leads to a syntax error in the shell, as the
5087 characters are just copied.</p> 5087 characters are just copied.</p>
5088<p>Example 2 leads to a syntax error too, and if you leave out 5088<p>Example 2 leads to a syntax error too, and if you leave out
5089 the last " character from <code class="varname">${STRING}</code>, 5089 the last " character from <code class="varname">${STRING}</code>,
5090 <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 5090 <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
5091 variable would be evaluated, too.</p> 5091 variable would be evaluated, too.</p>
5092<p>Example 3 outputs each space character preceded by a 5092<p>Example 3 outputs each space character preceded by a
5093 backslash (or not), depending on the implementation of the 5093 backslash (or not), depending on the implementation of the
5094 <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> 5094 <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>
5095<p>Example 4 handles correctly every string that does not start 5095<p>Example 4 handles correctly every string that does not start
5096 with a dash. In that case, the result depends on the 5096 with a dash. In that case, the result depends on the
5097 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 5097 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
5098 guarantee that your input does not start with a dash, this form is 5098 guarantee that your input does not start with a dash, this form is
5099 appropriate.</p> 5099 appropriate.</p>
5100<p>Example 5 handles even the case of a leading dash 5100<p>Example 5 handles even the case of a leading dash
5101 correctly.</p> 5101 correctly.</p>
5102<p>Example 6 also works with every string and is the 5102<p>Example 6 also works with every string and is the
5103 light-weight solution, since it does not involve a pipe, which has 5103 light-weight solution, since it does not involve a pipe, which has
5104 its own problems.</p> 5104 its own problems.</p>
5105<p>The <code class="varname">EXT_LIST</code> does not need to be quoted 5105<p>The <code class="varname">EXT_LIST</code> does not need to be quoted
5106 because the quoting has already been done when adding elements to 5106 because the quoting has already been done when adding elements to
5107 the list.</p> 5107 the list.</p>
5108<p>As internal lists shall not be passed to the shell, there is 5108<p>As internal lists shall not be passed to the shell, there is
5109 no example for it.</p> 5109 no example for it.</p>
5110</div> 5110</div>
5111<div class="sect2"> 5111<div class="sect2">
5112<div class="titlepage"><div><div><h3 class="title"> 5112<div class="titlepage"><div><div><h3 class="title">
5113<a name="quoting-guideline"></a>12.3.4. Quoting guideline</h3></div></div></div> 5113<a name="quoting-guideline"></a>12.3.4. Quoting guideline</h3></div></div></div>
5114<p>There are many possible sources of wrongly quoted variables. 5114<p>There are many possible sources of wrongly quoted variables.
5115 This section lists some of the commonly known ones.</p> 5115 This section lists some of the commonly known ones.</p>
5116<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5116<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5117<li class="listitem"> 5117<li class="listitem">
5118<p>Whenever you use the value of a list, think 5118<p>Whenever you use the value of a list, think
5119 about what happens to leading or trailing whitespace. If the 5119 about what happens to leading or trailing whitespace. If the
5120 list is a well-formed shell expression, you can apply the 5120 list is a well-formed shell expression, you can apply the
5121 <code class="varname">:M*</code> modifier to strip leading and trailing 5121 <code class="varname">:M*</code> modifier to strip leading and trailing
5122 whitespace from each word. The <code class="varname">:M</code> operator 5122 whitespace from each word. The <code class="varname">:M</code> operator
5123 first splits its argument according to the rules of the shell, 5123 first splits its argument according to the rules of the shell,
5124 and then creates a new list consisting of all words that match 5124 and then creates a new list consisting of all words that match
5125 the shell glob expression <code class="varname">*</code>, that is: all. 5125 the shell glob expression <code class="varname">*</code>, that is: all.
5126 One class of situations where this is needed is when adding a 5126 One class of situations where this is needed is when adding a
5127 variable like <code class="varname">CPPFLAGS</code> to 5127 variable like <code class="varname">CPPFLAGS</code> to
5128 <code class="varname">CONFIGURE_ARGS</code>. If the configure script 5128 <code class="varname">CONFIGURE_ARGS</code>. If the configure script
5129 invokes other configure scripts, it strips the leading and 5129 invokes other configure scripts, it strips the leading and
5130 trailing whitespace from the variable and then passes it to the 5130 trailing whitespace from the variable and then passes it to the
5131 other configure scripts. But these configure scripts expect the 5131 other configure scripts. But these configure scripts expect the
5132 (child) <code class="varname">CPPFLAGS</code> variable to be the same as 5132 (child) <code class="varname">CPPFLAGS</code> variable to be the same as
5133 the parent <code class="varname">CPPFLAGS</code>. That's why we better 5133 the parent <code class="varname">CPPFLAGS</code>. That's why we better
5134 pass the <code class="varname">CPPFLAGS</code> value properly trimmed. And 5134 pass the <code class="varname">CPPFLAGS</code> value properly trimmed. And
5135 here is how we do it:</p> 5135 here is how we do it:</p>
5136<pre class="programlisting"> 5136<pre class="programlisting">
5137CPPFLAGS= # empty 5137CPPFLAGS= # empty
5138CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\" 5138CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
5139CPPFLAGS+= ${MY_CPPFLAGS} 5139CPPFLAGS+= ${MY_CPPFLAGS}
5140 5140
5141CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q} 5141CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
5142 5142
5143all: 5143all:
5144 echo x${CPPFLAGS:Q}x # leading and trailing whitespace 5144 echo x${CPPFLAGS:Q}x # leading and trailing whitespace
5145 echo x${CONFIGURE_ARGS}x # properly trimmed 5145 echo x${CONFIGURE_ARGS}x # properly trimmed
5146</pre> 5146</pre>
5147</li> 5147</li>
5148<li class="listitem"><p>The example above contains one bug: The 5148<li class="listitem"><p>The example above contains one bug: The
5149 <code class="varname">${PREFIX}</code> is a properly quoted shell 5149 <code class="varname">${PREFIX}</code> is a properly quoted shell
5150 expression, but there is the C compiler after it, which also 5150 expression, but there is the C compiler after it, which also
5151 expects a properly quoted string (this time in C syntax). The 5151 expects a properly quoted string (this time in C syntax). The
5152 version above is therefore only correct if 5152 version above is therefore only correct if
5153 <code class="varname">${PREFIX}</code> does not have embedded backslashes 5153 <code class="varname">${PREFIX}</code> does not have embedded backslashes
5154 or double quotes. If you want to allow these, you have to add 5154 or double quotes. If you want to allow these, you have to add
5155 another layer of quoting to each variable that is used as a C 5155 another layer of quoting to each variable that is used as a C
5156 string literal. You cannot use the <code class="varname">:Q</code> 5156 string literal. You cannot use the <code class="varname">:Q</code>
5157 operator for it, as this operator only works for the 5157 operator for it, as this operator only works for the
5158 shell.</p></li> 5158 shell.</p></li>
5159<li class="listitem"> 5159<li class="listitem">
5160<p>Whenever a variable can be empty, the 5160<p>Whenever a variable can be empty, the
5161 <code class="varname">:Q</code> operator can have surprising results. Here 5161 <code class="varname">:Q</code> operator can have surprising results. Here
5162 are two completely different cases which can be solved with the 5162 are two completely different cases which can be solved with the
5163 same trick.</p> 5163 same trick.</p>
5164<pre class="programlisting"> 5164<pre class="programlisting">
5165EMPTY= # empty 5165EMPTY= # empty
5166empty_test: 5166empty_test:
5167 for i in a ${EMPTY:Q} c; do \ 5167 for i in a ${EMPTY:Q} c; do \
5168 echo "$$i"; \ 5168 echo "$$i"; \
5169 done 5169 done
5170 5170
5171for_test: 5171for_test:
5172.for i in a:\ a:\test.txt 5172.for i in a:\ a:\test.txt
5173 echo ${i:Q} 5173 echo ${i:Q}
5174 echo "foo" 5174 echo "foo"
5175.endfor 5175.endfor
5176</pre> 5176</pre>
5177<p>The first example will only print two of the three lines 5177<p>The first example will only print two of the three lines
5178 we might have expected. This is because 5178 we might have expected. This is because
5179 <code class="varname">${EMPTY:Q}</code> expands to the empty string, which 5179 <code class="varname">${EMPTY:Q}</code> expands to the empty string, which
5180 the shell cannot see. The workaround is to write 5180 the shell cannot see. The workaround is to write
5181 <code class="varname">${EMPTY:Q}""</code>. This pattern can be often found 5181 <code class="varname">${EMPTY:Q}""</code>. This pattern can be often found
5182 as <code class="varname">${TEST} -z ${VAR:Q}</code> or as <code class="varname">${TEST} 5182 as <code class="varname">${TEST} -z ${VAR:Q}</code> or as <code class="varname">${TEST}
5183 -f ${FNAME:Q}</code> (both of these are wrong).</p> 5183 -f ${FNAME:Q}</code> (both of these are wrong).</p>
5184<p>The second example will only print three lines instead of 5184<p>The second example will only print three lines instead of
5185 four. The first line looks like <code class="varname">a:\ echo foo</code>. 5185 four. The first line looks like <code class="varname">a:\ echo foo</code>.
5186 This is because the backslash of the value 5186 This is because the backslash of the value
5187 <code class="varname">a:\</code> is interpreted as a line-continuation by 5187 <code class="varname">a:\</code> is interpreted as a line-continuation by
5188 <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 5188 <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
5189 <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 5189 <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
5190 <code class="varname">${i:Q}""</code>.</p> 5190 <code class="varname">${i:Q}""</code>.</p>
5191</li> 5191</li>
5192</ul></div> 5192</ul></div>
5193</div> 5193</div>
5194<div class="sect2"> 5194<div class="sect2">
5195<div class="titlepage"><div><div><h3 class="title"> 5195<div class="titlepage"><div><div><h3 class="title">
5196<a name="bsd-make-bug-workaround"></a>12.3.5. Workaround for a bug in BSD Make</h3></div></div></div> 5196<a name="bsd-make-bug-workaround"></a>12.3.5. Workaround for a bug in BSD Make</h3></div></div></div>
5197<p>The pkgsrc bmake program does not handle the following 5197<p>The pkgsrc bmake program does not handle the following
5198 assignment correctly. In case <code class="varname">_othervar_</code> 5198 assignment correctly. In case <code class="varname">_othervar_</code>
5199 contains a ``-'' character, one of the closing braces is included 5199 contains a ``-'' character, one of the closing braces is included
5200 in <code class="varname">${VAR}</code> after this code executes.</p> 5200 in <code class="varname">${VAR}</code> after this code executes.</p>
5201<pre class="programlisting"> 5201<pre class="programlisting">
5202VAR:= ${VAR:N${_othervar_:C/-//}} 5202VAR:= ${VAR:N${_othervar_:C/-//}}
5203</pre> 5203</pre>
5204<p>For a more complex code snippet and a workaround, see the 5204<p>For a more complex code snippet and a workaround, see the
5205 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 5205 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
5206 <code class="varname">bug1</code>.</p> 5206 <code class="varname">bug1</code>.</p>
5207</div> 5207</div>
5208</div> 5208</div>
5209</div> 5209</div>
5210<div class="chapter"> 5210<div class="chapter">
5211<div class="titlepage"><div><div><h2 class="title"> 5211<div class="titlepage"><div><div><h2 class="title">
5212<a name="plist"></a>Chapter 13. PLIST issues</h2></div></div></div> 5212<a name="plist"></a>Chapter 13. PLIST issues</h2></div></div></div>
5213<div class="toc"> 5213<div class="toc">
5214<p><b>Table of Contents</b></p> 5214<p><b>Table of Contents</b></p>
5215<dl> 5215<dl>
5216<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt> 5216<dt><span class="sect1"><a href="#rcs-id">13.1. RCS ID</a></span></dt>
5217<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt> 5217<dt><span class="sect1"><a href="#automatic-plist-generation">13.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
5218<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> 5218<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>
5219<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt> 5219<dt><span class="sect1"><a href="#plist.misc">13.4. Variable substitution in PLIST</a></span></dt>
5220<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt> 5220<dt><span class="sect1"><a href="#manpage-compression">13.5. Man page compression</a></span></dt>
5221<dt><span class="sect1"><a href="#using-PLIST_SRC">13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt> 5221<dt><span class="sect1"><a href="#using-PLIST_SRC">13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
5222<dt><span class="sect1"><a href="#platform-specific-plist">13.7. Platform-specific and differing PLISTs</a></span></dt> 5222<dt><span class="sect1"><a href="#platform-specific-plist">13.7. Platform-specific and differing PLISTs</a></span></dt>
5223<dt><span class="sect1"><a href="#faq.common-dirs">13.8. Sharing directories between packages</a></span></dt> 5223<dt><span class="sect1"><a href="#faq.common-dirs">13.8. Sharing directories between packages</a></span></dt>
5224</dl> 5224</dl>
5225</div> 5225</div>
5226<p>The <code class="filename">PLIST</code> file contains a package's 5226<p>The <code class="filename">PLIST</code> file contains a package's
5227 <span class="quote">&#8220;<span class="quote">packing list</span>&#8221;</span>, i.e. a list of files that belong to 5227 <span class="quote">&#8220;<span class="quote">packing list</span>&#8221;</span>, i.e. a list of files that belong to
5228 the package (relative to the <code class="filename">${PREFIX}</code> 5228 the package (relative to the <code class="filename">${PREFIX}</code>
5229 directory it's been installed in) plus some additional statements 5229 directory it's been installed in) plus some additional statements
5230 - see the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> man page for a full list. 5230 - see the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> man page for a full list.
5231 This chapter addresses some issues that need attention when 5231 This chapter addresses some issues that need attention when
5232 dealing with the <code class="filename">PLIST</code> file (or files, see 5232 dealing with the <code class="filename">PLIST</code> file (or files, see
5233 below!).</p> 5233 below!).</p>
5234<div class="sect1"> 5234<div class="sect1">
5235<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5235<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5236<a name="rcs-id"></a>13.1. RCS ID</h2></div></div></div> 5236<a name="rcs-id"></a>13.1. RCS ID</h2></div></div></div>
5237<p>Be sure to add a RCS ID line as the first thing in any 5237<p>Be sure to add a RCS ID line as the first thing in any
5238 <code class="filename">PLIST</code> file you write:</p> 5238 <code class="filename">PLIST</code> file you write:</p>
5239<pre class="programlisting"> 5239<pre class="programlisting">
5240@comment $NetBSD$ 5240@comment $NetBSD$
5241 </pre> 5241 </pre>
5242</div> 5242</div>
5243<div class="sect1"> 5243<div class="sect1">
5244<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5244<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5245<a name="automatic-plist-generation"></a>13.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div> 5245<a name="automatic-plist-generation"></a>13.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div>
5246<p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command 5246<p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command
5247 to output a PLIST that matches any new files since the package 5247 to output a PLIST that matches any new files since the package
5248 was extracted. See <a class="xref" href="#build.helpful-targets" title="17.17. Other helpful targets">Section 17.17, &#8220;Other helpful targets&#8221;</a> for 5248 was extracted. See <a class="xref" href="#build.helpful-targets" title="17.17. Other helpful targets">Section 17.17, &#8220;Other helpful targets&#8221;</a> for
5249 more information on this target.</p> 5249 more information on this target.</p>
5250</div> 5250</div>
5251<div class="sect1"> 5251<div class="sect1">
5252<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5252<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5253<a name="print-PLIST"></a>13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span> 5253<a name="print-PLIST"></a>13.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>
5254</h2></div></div></div> 5254</h2></div></div></div>
5255<p>If you have used any of the *-dirs packages, as explained in 5255<p>If you have used any of the *-dirs packages, as explained in
5256 <a class="xref" href="#faq.common-dirs" title="13.8. Sharing directories between packages">Section 13.8, &#8220;Sharing directories between packages&#8221;</a>, you may have noticed that 5256 <a class="xref" href="#faq.common-dirs" title="13.8. Sharing directories between packages">Section 13.8, &#8220;Sharing directories between packages&#8221;</a>, you may have noticed that
5257 <span class="command"><strong>make print-PLIST</strong></span> outputs a set of 5257 <span class="command"><strong>make print-PLIST</strong></span> outputs a set of
5258 <code class="varname">@comment</code>s instead of real 5258 <code class="varname">@comment</code>s instead of real
5259 <code class="varname">@dirrm</code> lines. You can also do this for 5259 <code class="varname">@dirrm</code> lines. You can also do this for
5260 specific directories and files, so that the results of that 5260 specific directories and files, so that the results of that
5261 command are very close to reality. This helps <span class="emphasis"><em>a 5261 command are very close to reality. This helps <span class="emphasis"><em>a
5262 lot</em></span> during the update of packages.</p> 5262 lot</em></span> during the update of packages.</p>
5263<p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set 5263<p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set
5264 of AWK patterns and actions that are used to filter the output of 5264 of AWK patterns and actions that are used to filter the output of
5265 print-PLIST. You can <span class="emphasis"><em>append</em></span> any chunk of AWK 5265 print-PLIST. You can <span class="emphasis"><em>append</em></span> any chunk of AWK
5266 scripting you like to it, but be careful with quoting.</p> 5266 scripting you like to it, but be careful with quoting.</p>
5267<p>For example, to get all files inside the 5267<p>For example, to get all files inside the
5268 <code class="filename">libdata/foo</code> directory removed from the 5268 <code class="filename">libdata/foo</code> directory removed from the
5269 resulting PLIST:</p> 5269 resulting PLIST:</p>
5270<pre class="programlisting"> 5270<pre class="programlisting">
5271PRINT_PLIST_AWK+= /^libdata\/foo/ { next; } 5271PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
5272 </pre> 5272 </pre>
5273<p>And to get all the <code class="varname">@dirrm</code> lines referring 5273<p>And to get all the <code class="varname">@dirrm</code> lines referring
5274 to a specific (shared) directory converted to 5274 to a specific (shared) directory converted to
5275 <code class="varname">@comment</code>s:</p> 5275 <code class="varname">@comment</code>s:</p>
5276<pre class="programlisting"> 5276<pre class="programlisting">
5277PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; } 5277PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
5278 </pre> 5278 </pre>
5279</div> 5279</div>
5280<div class="sect1"> 5280<div class="sect1">
5281<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5281<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5282<a name="plist.misc"></a>13.4. Variable substitution in PLIST</h2></div></div></div> 5282<a name="plist.misc"></a>13.4. Variable substitution in PLIST</h2></div></div></div>
5283<p>A number of variables are substituted automatically in 5283<p>A number of variables are substituted automatically in
5284 PLISTs when a package is installed on a system. This includes the 5284 PLISTs when a package is installed on a system. This includes the
5285 following variables:</p> 5285 following variables:</p>
5286<div class="variablelist"><dl class="variablelist"> 5286<div class="variablelist"><dl class="variablelist">
5287<dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt> 5287<dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt>
5288<dd> 5288<dd>
5289<p>Some packages like emacs and perl embed information 5289<p>Some packages like emacs and perl embed information
5290 about which architecture they were built on into the 5290 about which architecture they were built on into the
5291 pathnames where they install their files. To handle this 5291 pathnames where they install their files. To handle this
5292 case, PLIST will be preprocessed before actually used, and 5292 case, PLIST will be preprocessed before actually used, and
5293 the symbol 5293 the symbol
5294 <span class="quote">&#8220;<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>&#8221;</span> will be 5294 <span class="quote">&#8220;<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>&#8221;</span> will be
5295 replaced by what <span class="command"><strong>uname -p</strong></span> gives. The 5295 replaced by what <span class="command"><strong>uname -p</strong></span> gives. The
5296 same is done if the string 5296 same is done if the string
5297 <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in 5297 <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in
5298 PLIST somewhere - use this on packages that have GNU 5298 PLIST somewhere - use this on packages that have GNU
5299 autoconf-created configure scripts.</p> 5299 autoconf-created configure scripts.</p>
5300<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 5300<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
5301<h3 class="title">Legacy note</h3> 5301<h3 class="title">Legacy note</h3>
5302<p>There used to be a symbol 5302<p>There used to be a symbol
5303 <span class="quote">&#8220;<span class="quote"><code class="varname">$ARCH</code></span>&#8221;</span> that 5303 <span class="quote">&#8220;<span class="quote"><code class="varname">$ARCH</code></span>&#8221;</span> that
5304 was replaced by the output of <span class="command"><strong>uname 5304 was replaced by the output of <span class="command"><strong>uname
5305 -m</strong></span>, but that's no longer supported and has 5305 -m</strong></span>, but that's no longer supported and has
5306 been removed.</p> 5306 been removed.</p>
5307</div> 5307</div>
5308</dd> 5308</dd>
5309<dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt> 5309<dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt>
5310<dd> 5310<dd>
5311<p>Some packages want to embed the OS name and version 5311<p>Some packages want to embed the OS name and version
5312 into some paths. To do this, use these variables in the 5312 into some paths. To do this, use these variables in the
5313 <code class="filename">PLIST</code>: 5313 <code class="filename">PLIST</code>:
5314 </p> 5314 </p>
5315<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5315<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5316<li class="listitem"><p><code class="varname">${OPSYS}</code> - output of <span class="quote">&#8220;<span class="quote"><span class="command"><strong>uname -s</strong></span></span>&#8221;</span></p></li> 5316<li class="listitem"><p><code class="varname">${OPSYS}</code> - output of <span class="quote">&#8220;<span class="quote"><span class="command"><strong>uname -s</strong></span></span>&#8221;</span></p></li>
5317<li class="listitem"><p><code class="varname">${LOWER_OPSYS}</code> - lowercase common name (eg. <span class="quote">&#8220;<span class="quote">solaris</span>&#8221;</span>)</p></li> 5317<li class="listitem"><p><code class="varname">${LOWER_OPSYS}</code> - lowercase common name (eg. <span class="quote">&#8220;<span class="quote">solaris</span>&#8221;</span>)</p></li>
5318<li class="listitem"><p><code class="varname">${OS_VERSION}</code> - <span class="quote">&#8220;<span class="quote"><span class="command"><strong>uname -r</strong></span></span>&#8221;</span></p></li> 5318<li class="listitem"><p><code class="varname">${OS_VERSION}</code> - <span class="quote">&#8220;<span class="quote"><span class="command"><strong>uname -r</strong></span></span>&#8221;</span></p></li>
5319</ul></div> 5319</ul></div>
5320</dd> 5320</dd>
5321</dl></div> 5321</dl></div>
5322<p>For a complete list of values which are replaced by 5322<p>For a complete list of values which are replaced by
5323 default, please look in <code class="filename">bsd.pkg.mk</code> (and 5323 default, please look in <code class="filename">bsd.pkg.mk</code> (and
5324 search for <code class="varname">PLIST_SUBST</code>).</p> 5324 search for <code class="varname">PLIST_SUBST</code>).</p>
5325<p>If you want to change other variables not listed above, you 5325<p>If you want to change other variables not listed above, you
5326 can add variables and their expansions to this variable in the 5326 can add variables and their expansions to this variable in the
5327 following way, similar to <code class="varname">MESSAGE_SUBST</code> (see <a class="xref" href="#components.optional" title="11.5. Optional files">Section 11.5, &#8220;Optional files&#8221;</a>):</p> 5327 following way, similar to <code class="varname">MESSAGE_SUBST</code> (see <a class="xref" href="#components.optional" title="11.5. Optional files">Section 11.5, &#8220;Optional files&#8221;</a>):</p>
5328<pre class="programlisting"> 5328<pre class="programlisting">
5329PLIST_SUBST+= SOMEVAR="somevalue" 5329PLIST_SUBST+= SOMEVAR="somevalue"
5330 </pre> 5330 </pre>
5331<p>This replaces all occurrences of <span class="quote">&#8220;<span class="quote">${SOMEVAR}</span>&#8221;</span> 5331<p>This replaces all occurrences of <span class="quote">&#8220;<span class="quote">${SOMEVAR}</span>&#8221;</span>
5332 in the <code class="filename">PLIST</code> with 5332 in the <code class="filename">PLIST</code> with
5333 <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span>.</p> 5333 <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span>.</p>
5334<p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify 5334<p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify
5335 the common case of conditionally including some 5335 the common case of conditionally including some
5336 <code class="filename">PLIST</code> entries. It can be done by adding 5336 <code class="filename">PLIST</code> entries. It can be done by adding
5337 <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and 5337 <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and
5338 setting the corresponding <code class="varname">PLIST.foo</code> variable 5338 setting the corresponding <code class="varname">PLIST.foo</code> variable
5339 to <code class="literal">yes</code> if the entry should be included. 5339 to <code class="literal">yes</code> if the entry should be included.
5340 This will substitute <span class="quote">&#8220;<span class="quote"><code class="varname">${PLIST.foo}</code></span>&#8221;</span> 5340 This will substitute <span class="quote">&#8220;<span class="quote"><code class="varname">${PLIST.foo}</code></span>&#8221;</span>
5341 in the <code class="filename">PLIST</code> with either 5341 in the <code class="filename">PLIST</code> with either
5342 <span class="quote">&#8220;<span class="quote"><code class="literal">""</code></span>&#8221;</span> or 5342 <span class="quote">&#8220;<span class="quote"><code class="literal">""</code></span>&#8221;</span> or
5343 <span class="quote">&#8220;<span class="quote"><code class="literal">"@comment "</code></span>&#8221;</span>. 5343 <span class="quote">&#8220;<span class="quote"><code class="literal">"@comment "</code></span>&#8221;</span>.
5344 For example, in <code class="filename">Makefile</code>:</p> 5344 For example, in <code class="filename">Makefile</code>:</p>
5345<pre class="programlisting"> 5345<pre class="programlisting">
5346PLIST_VARS+= foo 5346PLIST_VARS+= foo
5347.if <em class="replaceable"><code>condition</code></em> 5347.if <em class="replaceable"><code>condition</code></em>
5348PLIST.foo= yes 5348PLIST.foo= yes
5349.else 5349.else
5350 </pre> 5350 </pre>
5351<p>And then in <code class="filename">PLIST</code>:</p> 5351<p>And then in <code class="filename">PLIST</code>:</p>
5352<pre class="programlisting"> 5352<pre class="programlisting">
5353@comment $NetBSD$ 5353@comment $NetBSD$
5354bin/bar 5354bin/bar
5355man/man1/bar.1 5355man/man1/bar.1
5356${PLIST.foo}bin/foo 5356${PLIST.foo}bin/foo
5357${PLIST.foo}man/man1/foo.1 5357${PLIST.foo}man/man1/foo.1
5358${PLIST.foo}share/bar/foo.data 5358${PLIST.foo}share/bar/foo.data
5359${PLIST.foo}@dirrm share/bar 5359${PLIST.foo}@dirrm share/bar
5360 </pre> 5360 </pre>
5361</div> 5361</div>
5362<div class="sect1"> 5362<div class="sect1">
5363<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5363<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5364<a name="manpage-compression"></a>13.5. Man page compression</h2></div></div></div> 5364<a name="manpage-compression"></a>13.5. Man page compression</h2></div></div></div>
5365<p>Man pages should be installed in compressed form if 5365<p>Man pages should be installed in compressed form if
5366 <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>), 5366 <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>),
5367 and uncompressed otherwise. To handle this in the 5367 and uncompressed otherwise. To handle this in the
5368 <code class="filename">PLIST</code> file, the suffix <span class="quote">&#8220;<span class="quote">.gz</span>&#8221;</span> is 5368 <code class="filename">PLIST</code> file, the suffix <span class="quote">&#8220;<span class="quote">.gz</span>&#8221;</span> is
5369 appended/removed automatically for man pages according to 5369 appended/removed automatically for man pages according to
5370 <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set 5370 <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set
5371 or not, see above for details. This modification of the 5371 or not, see above for details. This modification of the
5372 <code class="filename">PLIST</code> file is done on a copy of it, not 5372 <code class="filename">PLIST</code> file is done on a copy of it, not
5373 <code class="filename">PLIST</code> itself.</p> 5373 <code class="filename">PLIST</code> itself.</p>
5374</div> 5374</div>
5375<div class="sect1"> 5375<div class="sect1">
5376<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5376<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5377<a name="using-PLIST_SRC"></a>13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code> 5377<a name="using-PLIST_SRC"></a>13.6. Changing PLIST source with <code class="varname">PLIST_SRC</code>
5378</h2></div></div></div> 5378</h2></div></div></div>
5379<p>To use one or more files as source for the <code class="filename">PLIST</code> used 5379<p>To use one or more files as source for the <code class="filename">PLIST</code> used
5380 in generating the binary package, set the variable 5380 in generating the binary package, set the variable
5381 <code class="varname">PLIST_SRC</code> to the names of that file(s). 5381 <code class="varname">PLIST_SRC</code> to the names of that file(s).
5382 The files are later concatenated using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span></a>, and the order of things is 5382 The files are later concatenated using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span></a>, and the order of things is
5383 important. The default for <code class="varname">PLIST_SRC</code> is 5383 important. The default for <code class="varname">PLIST_SRC</code> is
5384 <code class="filename">${PKGDIR}/PLIST</code>.</p> 5384 <code class="filename">${PKGDIR}/PLIST</code>.</p>
5385</div> 5385</div>
5386<div class="sect1"> 5386<div class="sect1">
5387<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5387<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5388<a name="platform-specific-plist"></a>13.7. Platform-specific and differing PLISTs</h2></div></div></div> 5388<a name="platform-specific-plist"></a>13.7. Platform-specific and differing PLISTs</h2></div></div></div>
5389<p>Some packages decide to install a different set of files based on 5389<p>Some packages decide to install a different set of files based on
5390 the operating system being used. These differences can be 5390 the operating system being used. These differences can be
5391 automatically handled by using the following files:</p> 5391 automatically handled by using the following files:</p>
5392<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5392<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5393<li class="listitem"><p><code class="filename">PLIST.common</code></p></li> 5393<li class="listitem"><p><code class="filename">PLIST.common</code></p></li>
5394<li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li> 5394<li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li>
5395<li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li> 5395<li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li>
5396<li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li> 5396<li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li>
5397<li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li> 5397<li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li>
5398</ul></div> 5398</ul></div>
5399</div> 5399</div>
5400<div class="sect1"> 5400<div class="sect1">
5401<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5401<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5402<a name="faq.common-dirs"></a>13.8. Sharing directories between packages</h2></div></div></div> 5402<a name="faq.common-dirs"></a>13.8. Sharing directories between packages</h2></div></div></div>
5403<p>A <span class="quote">&#8220;<span class="quote">shared directory</span>&#8221;</span> is a directory where 5403<p>A <span class="quote">&#8220;<span class="quote">shared directory</span>&#8221;</span> is a directory where
5404 multiple (and unrelated) packages install files. These 5404 multiple (and unrelated) packages install files. These
5405 directories were problematic because you had to add special 5405 directories were problematic because you had to add special
5406 tricks in the PLIST to conditionally remove them, or have some 5406 tricks in the PLIST to conditionally remove them, or have some
5407 centralized package handle them.</p> 5407 centralized package handle them.</p>
5408<p>In pkgsrc, it is now easy: Each package should create 5408<p>In pkgsrc, it is now easy: Each package should create
5409 directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span> 5409 directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span>
5410 will remove any directories left empty after uninstalling a 5410 will remove any directories left empty after uninstalling a
5411 package.</p> 5411 package.</p>
5412<p>If a package needs an empty directory to work, create 5412<p>If a package needs an empty directory to work, create
5413 the directory during installation as usual, and also add an 5413 the directory during installation as usual, and also add an
5414 entry to the PLIST: 5414 entry to the PLIST:
5415 </p> 5415 </p>
5416<pre class="programlisting"> 5416<pre class="programlisting">
5417@pkgdir path/to/empty/directory 5417@pkgdir path/to/empty/directory
5418 </pre> 5418 </pre>
5419<p> 5419<p>
5420 </p> 5420 </p>
5421</div> 5421</div>
5422</div> 5422</div>
5423<div class="chapter"> 5423<div class="chapter">
5424<div class="titlepage"><div><div><h2 class="title"> 5424<div class="titlepage"><div><div><h2 class="title">
5425<a name="buildlink"></a>Chapter 14. Buildlink methodology</h2></div></div></div> 5425<a name="buildlink"></a>Chapter 14. Buildlink methodology</h2></div></div></div>
5426<div class="toc"> 5426<div class="toc">
5427<p><b>Table of Contents</b></p> 5427<p><b>Table of Contents</b></p>
5428<dl> 5428<dl>
5429<dt><span class="sect1"><a href="#converting-to-buildlink3">14.1. Converting packages to use buildlink3</a></span></dt> 5429<dt><span class="sect1"><a href="#converting-to-buildlink3">14.1. Converting packages to use buildlink3</a></span></dt>
5430<dt><span class="sect1"><a href="#creating-buildlink3.mk">14.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt> 5430<dt><span class="sect1"><a href="#creating-buildlink3.mk">14.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
5431<dd><dl> 5431<dd><dl>
5432<dt><span class="sect2"><a href="#anatomy-of-bl3">14.2.1. Anatomy of a buildlink3.mk file</a></span></dt> 5432<dt><span class="sect2"><a href="#anatomy-of-bl3">14.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
5433<dt><span class="sect2"><a href="#updating-buildlink-depends">14.2.2. Updating 5433<dt><span class="sect2"><a href="#updating-buildlink-depends">14.2.2. Updating
5434 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5434 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5435 and 5435 and
5436 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5436 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5437 in <code class="filename">buildlink3.mk</code> files</a></span></dt> 5437 in <code class="filename">buildlink3.mk</code> files</a></span></dt>
5438</dl></dd> 5438</dl></dd>
5439<dt><span class="sect1"><a href="#writing-builtin.mk">14.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt> 5439<dt><span class="sect1"><a href="#writing-builtin.mk">14.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
5440<dd><dl> 5440<dd><dl>
5441<dt><span class="sect2"><a href="#anatomy-of-builtin.mk">14.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt> 5441<dt><span class="sect2"><a href="#anatomy-of-builtin.mk">14.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
5442<dt><span class="sect2"><a href="#native-or-pkgsrc-preference">14.3.2. Global preferences for native or pkgsrc software</a></span></dt> 5442<dt><span class="sect2"><a href="#native-or-pkgsrc-preference">14.3.2. Global preferences for native or pkgsrc software</a></span></dt>
5443</dl></dd> 5443</dl></dd>
5444</dl> 5444</dl>
5445</div> 5445</div>
5446<p>Buildlink is a framework in pkgsrc that controls what headers and libraries 5446<p>Buildlink is a framework in pkgsrc that controls what headers and libraries
5447 are seen by a package's configure and build processes. This is implemented 5447 are seen by a package's configure and build processes. This is implemented
5448 in a two step process:</p> 5448 in a two step process:</p>
5449<div class="orderedlist"><ol class="orderedlist" type="1"> 5449<div class="orderedlist"><ol class="orderedlist" type="1">
5450<li class="listitem"><p>Symlink headers and libraries for dependencies into 5450<li class="listitem"><p>Symlink headers and libraries for dependencies into
5451 <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory 5451 <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory
5452 of <code class="varname">WRKDIR</code>.</p></li> 5452 of <code class="varname">WRKDIR</code>.</p></li>
5453<li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler 5453<li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler
5454 tools that translate <code class="option">-I${LOCALBASE}/include</code> and 5454 tools that translate <code class="option">-I${LOCALBASE}/include</code> and
5455 <code class="option">-L${LOCALBASE}/lib</code> into references to 5455 <code class="option">-L${LOCALBASE}/lib</code> into references to
5456 <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make 5456 <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make
5457 native compiler on some operating systems look like GCC, so that 5457 native compiler on some operating systems look like GCC, so that
5458 packages that expect GCC won't require modifications to build with 5458 packages that expect GCC won't require modifications to build with
5459 those native compilers.</p></li> 5459 those native compilers.</p></li>
5460</ol></div> 5460</ol></div>
5461<p>This normalizes the environment in which a package is built so that the 5461<p>This normalizes the environment in which a package is built so that the
5462 package may be built consistently despite what other software may be 5462 package may be built consistently despite what other software may be
5463 installed. Please note that the normal system header and library paths, 5463 installed. Please note that the normal system header and library paths,
5464 e.g. <code class="filename">/usr/include</code>, 5464 e.g. <code class="filename">/usr/include</code>,
5465 <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is 5465 <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is
5466 designed to insulate the package build from non-system-supplied 5466 designed to insulate the package build from non-system-supplied
5467 software.</p> 5467 software.</p>
5468<div class="sect1"> 5468<div class="sect1">
5469<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5469<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5470<a name="converting-to-buildlink3"></a>14.1. Converting packages to use buildlink3</h2></div></div></div> 5470<a name="converting-to-buildlink3"></a>14.1. Converting packages to use buildlink3</h2></div></div></div>
5471<p>The process of converting packages to use the buildlink3 5471<p>The process of converting packages to use the buildlink3
5472 framework (<span class="quote">&#8220;<span class="quote">bl3ifying</span>&#8221;</span>) is fairly straightforward. 5472 framework (<span class="quote">&#8220;<span class="quote">bl3ifying</span>&#8221;</span>) is fairly straightforward.
5473 The things to keep in mind are:</p> 5473 The things to keep in mind are:</p>
5474<div class="orderedlist"><ol class="orderedlist" type="1"> 5474<div class="orderedlist"><ol class="orderedlist" type="1">
5475<li class="listitem"><p>Ensure that the build always calls the wrapper scripts 5475<li class="listitem"><p>Ensure that the build always calls the wrapper scripts
5476 instead of the actual toolchain. Some packages are tricky, 5476 instead of the actual toolchain. Some packages are tricky,
5477 and the only way to know for sure is the check 5477 and the only way to know for sure is the check
5478 <code class="filename">${WRKDIR}/.work.log</code> to see if the 5478 <code class="filename">${WRKDIR}/.work.log</code> to see if the
5479 wrappers are being invoked.</p></li> 5479 wrappers are being invoked.</p></li>
5480<li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within 5480<li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within
5481 the package Makefile, e.g. Java VMs, standalone shells, 5481 the package Makefile, e.g. Java VMs, standalone shells,
5482 etc., because the code to symlink files into 5482 etc., because the code to symlink files into
5483 <code class="filename">${BUILDLINK_DIR}</code> looks for files 5483 <code class="filename">${BUILDLINK_DIR}</code> looks for files
5484 relative to <span class="quote">&#8220;<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>&#8221;</span>. 5484 relative to <span class="quote">&#8220;<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>&#8221;</span>.
5485 </p></li> 5485 </p></li>
5486<li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the 5486<li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the
5487 <code class="filename">buildlink3.mk</code> files that you list in a 5487 <code class="filename">buildlink3.mk</code> files that you list in a
5488 package's Makefile are added as dependencies for that package. 5488 package's Makefile are added as dependencies for that package.
5489 </p></li> 5489 </p></li>
5490</ol></div> 5490</ol></div>
5491<p>If a dependency on a particular package is required for its libraries and 5491<p>If a dependency on a particular package is required for its libraries and
5492 headers, then we replace:</p> 5492 headers, then we replace:</p>
5493<pre class="programlisting"> 5493<pre class="programlisting">
5494DEPENDS+= foo&gt;=1.1.0:../../category/foo 5494DEPENDS+= foo&gt;=1.1.0:../../category/foo
5495</pre> 5495</pre>
5496<p>with</p> 5496<p>with</p>
5497<pre class="programlisting"> 5497<pre class="programlisting">
5498.include "../../category/foo/buildlink3.mk" 5498.include "../../category/foo/buildlink3.mk"
5499</pre> 5499</pre>
5500<p>The buildlink3.mk files usually define the required dependencies. 5500<p>The buildlink3.mk files usually define the required dependencies.
5501 If you need a newer version of the dependency when using buildlink3.mk 5501 If you need a newer version of the dependency when using buildlink3.mk
5502 files, then you can define it in your Makefile; for example:</p> 5502 files, then you can define it in your Makefile; for example:</p>
5503<pre class="programlisting"> 5503<pre class="programlisting">
5504BUILDLINK_API_DEPENDS.foo+= foo&gt;=1.1.0 5504BUILDLINK_API_DEPENDS.foo+= foo&gt;=1.1.0
5505.include "../../category/foo/buildlink3.mk" 5505.include "../../category/foo/buildlink3.mk"
5506</pre> 5506</pre>
5507<p>There are several <code class="filename">buildlink3.mk</code> 5507<p>There are several <code class="filename">buildlink3.mk</code>
5508 files in <code class="filename">pkgsrc/mk</code> 5508 files in <code class="filename">pkgsrc/mk</code>
5509 that handle special package issues:</p> 5509 that handle special package issues:</p>
5510<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5510<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5511<li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either 5511<li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either
5512 the native or a pkgsrc Berkeley DB implementation based on 5512 the native or a pkgsrc Berkeley DB implementation based on
5513 the values of <code class="varname">BDB_ACCEPTED</code> and 5513 the values of <code class="varname">BDB_ACCEPTED</code> and
5514 <code class="varname">BDB_DEFAULT</code>.</p></li> 5514 <code class="varname">BDB_DEFAULT</code>.</p></li>
5515<li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system 5515<li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system
5516 comes with neither Curses nor NCurses, this will take care 5516 comes with neither Curses nor NCurses, this will take care
5517 to install the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/ncurses/README.html" target="_top"><code class="filename">devel/ncurses</code></a> package.</p></li> 5517 to install the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/ncurses/README.html" target="_top"><code class="filename">devel/ncurses</code></a> package.</p></li>
5518<li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value 5518<li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value
5519 of <code class="varname">KRB5_ACCEPTED</code> to choose between 5519 of <code class="varname">KRB5_ACCEPTED</code> to choose between
5520 adding a dependency on Heimdal or MIT-krb5 for packages that 5520 adding a dependency on Heimdal or MIT-krb5 for packages that
5521 require a Kerberos 5 implementation.</p></li> 5521 require a Kerberos 5 implementation.</p></li>
5522<li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a 5522<li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a
5523 system-provided Motif installation or adds a dependency on 5523 system-provided Motif installation or adds a dependency on
5524 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/lesstif/README.html" target="_top"><code class="filename">x11/lesstif</code></a>, <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/motif/README.html" target="_top"><code class="filename">x11/motif</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/openmotif/README.html" target="_top"><code class="filename">x11/openmotif</code></a>. The user can set 5524 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/lesstif/README.html" target="_top"><code class="filename">x11/lesstif</code></a>, <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/motif/README.html" target="_top"><code class="filename">x11/motif</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/openmotif/README.html" target="_top"><code class="filename">x11/openmotif</code></a>. The user can set
5525 <code class="varname">MOTIF_TYPE</code> to <span class="quote">&#8220;<span class="quote">dt</span>&#8221;</span>, 5525 <code class="varname">MOTIF_TYPE</code> to <span class="quote">&#8220;<span class="quote">dt</span>&#8221;</span>,
5526 <span class="quote">&#8220;<span class="quote">lesstif</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">motif</span>&#8221;</span> or 5526 <span class="quote">&#8220;<span class="quote">lesstif</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">motif</span>&#8221;</span> or
5527 <span class="quote">&#8220;<span class="quote">openmotif</span>&#8221;</span> to choose 5527 <span class="quote">&#8220;<span class="quote">openmotif</span>&#8221;</span> to choose
5528 which Motif version will be used.</p></li> 5528 which Motif version will be used.</p></li>
5529<li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a 5529<li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a
5530 system-provided GNU readline or ediline (libedit) installation, 5530 system-provided GNU readline or editline (libedit) installation,
5531 or adds a dependency on <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/readline/README.html" target="_top"><code class="filename">devel/readline</code></a>, 5531 or adds a dependency on <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/readline/README.html" target="_top"><code class="filename">devel/readline</code></a>,
5532 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/editline/README.html" target="_top"><code class="filename">devel/editline</code></a>. The user can set 5532 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/editline/README.html" target="_top"><code class="filename">devel/editline</code></a>. The user can set
5533 <code class="varname">READLINE_DEFAULT</code> to choose readline implementation. 5533 <code class="varname">READLINE_DEFAULT</code> to choose readline implementation.
5534 If your package really needs GNU readline library, its Makefile 5534 If your package really needs GNU readline library, its Makefile
5535 should include <code class="filename">devel/readline/buildlink3.mk</code> 5535 should include <code class="filename">devel/readline/buildlink3.mk</code>
5536 instead of <code class="filename">readline.buildlink3.mk</code>.</p></li> 5536 instead of <code class="filename">readline.buildlink3.mk</code>.</p></li>
5537<li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several 5537<li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several
5538 variables that may be used by packages that use the 5538 variables that may be used by packages that use the
5539 Open Sound System (OSS) API.</p></li> 5539 Open Sound System (OSS) API.</p></li>
5540<li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept 5540<li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept
5541 any of the Postgres versions in the variable 5541 any of the Postgres versions in the variable
5542 <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to 5542 <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to
5543 the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See 5543 the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See
5544 the file for more information.</p></li> 5544 the file for more information.</p></li>
5545<li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of 5545<li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of
5546 <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds 5546 <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds
5547 a dependency on <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pth/README.html" target="_top"><code class="filename">devel/pth</code></a> as needed.</p></li> 5547 a dependency on <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pth/README.html" target="_top"><code class="filename">devel/pth</code></a> as needed.</p></li>
5548<li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of 5548<li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of
5549 <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets 5549 <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets
5550 library.</p></li> 5550 library.</p></li>
5551</ul></div> 5551</ul></div>
5552<p>The comments in those <code class="filename">buildlink3.mk</code> 5552<p>The comments in those <code class="filename">buildlink3.mk</code>
5553 files provide a more complete 5553 files provide a more complete
5554 description of how to use them properly.</p> 5554 description of how to use them properly.</p>
5555</div> 5555</div>
5556<div class="sect1"> 5556<div class="sect1">
5557<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5557<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5558<a name="creating-buildlink3.mk"></a>14.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div> 5558<a name="creating-buildlink3.mk"></a>14.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div>
5559<a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is 5559<a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is
5560 included by Makefiles to indicate the need to compile and link 5560 included by Makefiles to indicate the need to compile and link
5561 against header files and libraries provided by the package. A 5561 against header files and libraries provided by the package. A
5562 <code class="filename">buildlink3.mk</code> file should always provide 5562 <code class="filename">buildlink3.mk</code> file should always provide
5563 enough information to add the correct type of dependency 5563 enough information to add the correct type of dependency
5564 relationship and include any other 5564 relationship and include any other
5565 <code class="filename">buildlink3.mk</code> files that it needs to find 5565 <code class="filename">buildlink3.mk</code> files that it needs to find
5566 headers and libraries that it needs in turn.</p> 5566 headers and libraries that it needs in turn.</p>
5567<p>To generate an initial <code class="filename">buildlink3.mk</code> 5567<p>To generate an initial <code class="filename">buildlink3.mk</code>
5568 file for further editing, Rene Hexel's <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/createbuildlink/README.html" target="_top"><code class="filename">pkgtools/createbuildlink</code></a> 5568 file for further editing, Rene Hexel's <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/createbuildlink/README.html" target="_top"><code class="filename">pkgtools/createbuildlink</code></a>
5569 package is highly recommended. For most packages, the following 5569 package is highly recommended. For most packages, the following
5570 command will generate a good starting point for 5570 command will generate a good starting point for
5571 <code class="filename">buildlink3.mk</code> files:</p> 5571 <code class="filename">buildlink3.mk</code> files:</p>
5572<pre class="screen"> 5572<pre class="screen">
5573<code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em> 5573<code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em>
5574<code class="prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong> 5574<code class="prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
5575 </pre> 5575 </pre>
5576<div class="sect2"> 5576<div class="sect2">
5577<div class="titlepage"><div><div><h3 class="title"> 5577<div class="titlepage"><div><div><h3 class="title">
5578<a name="anatomy-of-bl3"></a>14.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div> 5578<a name="anatomy-of-bl3"></a>14.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div>
5579<p>The following real-life example 5579<p>The following real-life example
5580 <code class="filename">buildlink3.mk</code> is taken 5580 <code class="filename">buildlink3.mk</code> is taken
5581 from <code class="filename">pkgsrc/graphics/tiff</code>:</p> 5581 from <code class="filename">pkgsrc/graphics/tiff</code>:</p>
5582<pre class="programlisting"> 5582<pre class="programlisting">
5583# $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $ 5583# $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
5584 5584
5585BUILDLINK_TREE+= tiff 5585BUILDLINK_TREE+= tiff
5586 5586
5587.if !defined(TIFF_BUILDLINK3_MK) 5587.if !defined(TIFF_BUILDLINK3_MK)
5588TIFF_BUILDLINK3_MK:= 5588TIFF_BUILDLINK3_MK:=
5589 5589
5590BUILDLINK_API_DEPENDS.tiff+= tiff&gt;=3.6.1 5590BUILDLINK_API_DEPENDS.tiff+= tiff&gt;=3.6.1
5591BUILDLINK_ABI_DEPENDS.tiff+= tiff&gt;=3.7.2nb1 5591BUILDLINK_ABI_DEPENDS.tiff+= tiff&gt;=3.7.2nb1
5592BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff 5592BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
5593 5593
5594.include "../../devel/zlib/buildlink3.mk" 5594.include "../../devel/zlib/buildlink3.mk"
5595.include "../../graphics/jpeg/buildlink3.mk" 5595.include "../../graphics/jpeg/buildlink3.mk"
5596.endif # TIFF_BUILDLINK3_MK 5596.endif # TIFF_BUILDLINK3_MK
5597 5597
5598BUILDLINK_TREE+= -tiff 5598BUILDLINK_TREE+= -tiff
5599</pre> 5599</pre>
5600<p>The header and footer manipulate 5600<p>The header and footer manipulate
5601 <code class="varname">BUILDLINK_TREE</code>, which is common across all 5601 <code class="varname">BUILDLINK_TREE</code>, which is common across all
5602 <code class="filename">buildlink3.mk</code> files and is used to track 5602 <code class="filename">buildlink3.mk</code> files and is used to track
5603 the dependency tree.</p> 5603 the dependency tree.</p>
5604<p>The main section is protected from multiple inclusion 5604<p>The main section is protected from multiple inclusion
5605 and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is 5605 and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is
5606 added. Several important variables are set in the section:</p> 5606 added. Several important variables are set in the section:</p>
5607<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5607<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5608<li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5608<li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5609 is the actual dependency recorded in the installed 5609 is the actual dependency recorded in the installed
5610 package; this should always be set using 5610 package; this should always be set using
5611 <span class="command"><strong>+=</strong></span> to ensure that 5611 <span class="command"><strong>+=</strong></span> to ensure that
5612 we're appending to any pre-existing list of values. This 5612 we're appending to any pre-existing list of values. This
5613 variable should be set to the first version of the 5613 variable should be set to the first version of the
5614 package that had an backwards-incompatible API change. 5614 package that had an backwards-incompatible API change.
5615 </p></li> 5615 </p></li>
5616<li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code> 5616<li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code>
5617 is the location of the <em class="replaceable"><code>pkg</code></em> 5617 is the location of the <em class="replaceable"><code>pkg</code></em>
5618 pkgsrc directory.</p></li> 5618 pkgsrc directory.</p></li>
5619<li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code> 5619<li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
5620 (not shown above) controls whether we use 5620 (not shown above) controls whether we use
5621 <code class="varname">BUILD_DEPENDS</code> or 5621 <code class="varname">BUILD_DEPENDS</code> or
5622 <code class="varname">DEPENDS</code> to add the dependency on 5622 <code class="varname">DEPENDS</code> to add the dependency on
5623 <em class="replaceable"><code>pkg</code></em>. The build dependency is 5623 <em class="replaceable"><code>pkg</code></em>. The build dependency is
5624 selected by setting 5624 selected by setting
5625 <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code> 5625 <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
5626 to <span class="quote">&#8220;<span class="quote">build</span>&#8221;</span>. By default, the full dependency is 5626 to <span class="quote">&#8220;<span class="quote">build</span>&#8221;</span>. By default, the full dependency is
5627 used.</p></li> 5627 used.</p></li>
5628<li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> 5628<li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code>
5629 and 5629 and
5630 <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code> 5630 <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
5631 (not shown above) are lists of subdirectories of 5631 (not shown above) are lists of subdirectories of
5632 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code> 5632 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
5633 to add to the header and library search paths. These 5633 to add to the header and library search paths. These
5634 default to <span class="quote">&#8220;<span class="quote">include</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">lib</span>&#8221;</span> 5634 default to <span class="quote">&#8220;<span class="quote">include</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">lib</span>&#8221;</span>
5635 respectively.</p></li> 5635 respectively.</p></li>
5636<li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code> 5636<li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code>
5637 (not shown above) is the list of preprocessor flags to add 5637 (not shown above) is the list of preprocessor flags to add
5638 to <code class="varname">CPPFLAGS</code>, which are passed on to the 5638 to <code class="varname">CPPFLAGS</code>, which are passed on to the
5639 configure and build phases. The <span class="quote">&#8220;<span class="quote">-I</span>&#8221;</span> option 5639 configure and build phases. The <span class="quote">&#8220;<span class="quote">-I</span>&#8221;</span> option
5640 should be avoided and instead be handled using 5640 should be avoided and instead be handled using
5641 <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as 5641 <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as
5642 above.</p></li> 5642 above.</p></li>
5643</ul></div> 5643</ul></div>
5644<p>The following variables are all optionally defined within 5644<p>The following variables are all optionally defined within
5645 this second section (protected against multiple inclusion) and 5645 this second section (protected against multiple inclusion) and
5646 control which package files are symlinked into 5646 control which package files are symlinked into
5647 <code class="filename">${BUILDLINK_DIR}</code> and how their names are 5647 <code class="filename">${BUILDLINK_DIR}</code> and how their names are
5648 transformed during the symlinking:</p> 5648 transformed during the symlinking:</p>
5649<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5649<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5650<li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code> 5650<li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>
5651 (not shown above) is a shell glob pattern relative to 5651 (not shown above) is a shell glob pattern relative to
5652 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code> 5652 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
5653 to be symlinked into 5653 to be symlinked into
5654 <code class="filename">${BUILDLINK_DIR}</code>, 5654 <code class="filename">${BUILDLINK_DIR}</code>,
5655 e.g. <code class="filename">include/*.h</code>.</p></li> 5655 e.g. <code class="filename">include/*.h</code>.</p></li>
5656<li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code> 5656<li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code>
5657 (not shown above) is a shell pipeline that 5657 (not shown above) is a shell pipeline that
5658 outputs to stdout a list of files relative to 5658 outputs to stdout a list of files relative to
5659 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>. 5659 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>.
5660 The resulting files are to be symlinked 5660 The resulting files are to be symlinked
5661 into <code class="filename">${BUILDLINK_DIR}</code>. By default, 5661 into <code class="filename">${BUILDLINK_DIR}</code>. By default,
5662 this takes the <code class="filename">+CONTENTS</code> of a 5662 this takes the <code class="filename">+CONTENTS</code> of a
5663 <em class="replaceable"><code>pkg</code></em> and filters it through 5663 <em class="replaceable"><code>pkg</code></em> and filters it through
5664 <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li> 5664 <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li>
5665<li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code> 5665<li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
5666 (not shown above) is a filter command that filters 5666 (not shown above) is a filter command that filters
5667 <code class="filename">+CONTENTS</code> input into a list of files 5667 <code class="filename">+CONTENTS</code> input into a list of files
5668 relative to 5668 relative to
5669 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code> 5669 <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
5670 on stdout. By default for overwrite packages, 5670 on stdout. By default for overwrite packages,
5671 <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code> 5671 <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
5672 outputs the contents of the <code class="filename">include</code> 5672 outputs the contents of the <code class="filename">include</code>
5673 and <code class="filename">lib</code> directories in the package 5673 and <code class="filename">lib</code> directories in the package
5674 <code class="filename">+CONTENTS</code>, and for pkgviews packages, 5674 <code class="filename">+CONTENTS</code>, and for pkgviews packages,
5675 it outputs any libtool archives in 5675 it outputs any libtool archives in
5676 <code class="filename">lib</code> directories.</p></li> 5676 <code class="filename">lib</code> directories.</p></li>
5677<li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code> 5677<li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code>
5678 (not shown above) is a list of sed arguments used to 5678 (not shown above) is a list of sed arguments used to
5679 transform the name of the source filename into a 5679 transform the name of the source filename into a
5680 destination filename, e.g. <span class="command"><strong>-e 5680 destination filename, e.g. <span class="command"><strong>-e
5681 "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li> 5681 "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li>
5682</ul></div> 5682</ul></div>
5683<p>This section can additionally include any 5683<p>This section can additionally include any
5684 <code class="filename">buildlink3.mk</code> needed for 5684 <code class="filename">buildlink3.mk</code> needed for
5685 <em class="replaceable"><code>pkg</code></em>'s library dependencies. 5685 <em class="replaceable"><code>pkg</code></em>'s library dependencies.
5686 Including these <code class="filename">buildlink3.mk</code> files 5686 Including these <code class="filename">buildlink3.mk</code> files
5687 means that the headers and libraries for these 5687 means that the headers and libraries for these
5688 dependencies are also symlinked into 5688 dependencies are also symlinked into
5689 <code class="filename">${BUILDLINK_DIR}</code> 5689 <code class="filename">${BUILDLINK_DIR}</code>
5690 whenever the <em class="replaceable"><code>pkg</code></em> 5690 whenever the <em class="replaceable"><code>pkg</code></em>
5691 <code class="filename">buildlink3.mk</code> 5691 <code class="filename">buildlink3.mk</code>
5692 file is included. Dependencies are only added for directly 5692 file is included. Dependencies are only added for directly
5693 include <code class="filename">buildlink3.mk</code> files.</p> 5693 include <code class="filename">buildlink3.mk</code> files.</p>
5694<p>When providing a <code class="filename">buildlink3.mk</code> and 5694<p>When providing a <code class="filename">buildlink3.mk</code> and
5695 including other <code class="filename">buildlink3.mk</code> files in it, 5695 including other <code class="filename">buildlink3.mk</code> files in it,
5696 please only add necessary ones, i.e., those whose libraries or 5696 please only add necessary ones, i.e., those whose libraries or
5697 header files are automatically exposed when the package is 5697 header files are automatically exposed when the package is
5698 use.</p> 5698 use.</p>
5699<p>In particular, if only an executable 5699<p>In particular, if only an executable
5700 (<code class="filename">bin/foo</code>) is linked against a library, that 5700 (<code class="filename">bin/foo</code>) is linked against a library, that
5701 library does not need to be propagated in the 5701 library does not need to be propagated in the
5702 <code class="filename">buildlink3.mk</code> file.</p> 5702 <code class="filename">buildlink3.mk</code> file.</p>
5703<p>The following steps should help you decide if a 5703<p>The following steps should help you decide if a
5704 <code class="filename">buildlink3.mk</code> file needs to be included: 5704 <code class="filename">buildlink3.mk</code> file needs to be included:
5705 </p> 5705 </p>
5706<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5706<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5707<li class="listitem"><p>Look at the installed header files: What 5707<li class="listitem"><p>Look at the installed header files: What
5708 headers do they include? The packages providing these files 5708 headers do they include? The packages providing these files
5709 must be buildlinked.</p></li> 5709 must be buildlinked.</p></li>
5710<li class="listitem"><p>Run <code class="filename">ldd</code> on all installed 5710<li class="listitem"><p>Run <code class="filename">ldd</code> on all installed
5711 libraries and look against what other libraries they link. 5711 libraries and look against what other libraries they link.
5712 Some of the packages providing these probably need to be 5712 Some of the packages providing these probably need to be
5713 buildlinked; however, it's not automatic, since e.g. GTK on 5713 buildlinked; however, it's not automatic, since e.g. GTK on
5714 some systems pulls in the X libraries, so they will show up in 5714 some systems pulls in the X libraries, so they will show up in
5715 the <code class="filename">ldd</code> output, while on others (like OS 5715 the <code class="filename">ldd</code> output, while on others (like OS
5716 X) it won't. <code class="filename">ldd</code> output can thus only be 5716 X) it won't. <code class="filename">ldd</code> output can thus only be
5717 used as a hint.</p></li> 5717 used as a hint.</p></li>
5718</ul></div> 5718</ul></div>
5719<p> 5719<p>
5720 </p> 5720 </p>
5721</div> 5721</div>
5722<div class="sect2"> 5722<div class="sect2">
5723<div class="titlepage"><div><div><h3 class="title"> 5723<div class="titlepage"><div><div><h3 class="title">
5724<a name="updating-buildlink-depends"></a>14.2.2. Updating 5724<a name="updating-buildlink-depends"></a>14.2.2. Updating
5725 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5725 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5726 and 5726 and
5727 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5727 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5728 in <code class="filename">buildlink3.mk</code> files</h3></div></div></div> 5728 in <code class="filename">buildlink3.mk</code> files</h3></div></div></div>
5729<p>These two variables differ in that one describes source 5729<p>These two variables differ in that one describes source
5730 compatibility (API) and the other binary compatibility (ABI). 5730 compatibility (API) and the other binary compatibility (ABI).
5731 The difference is that a change in the API breaks compilation of 5731 The difference is that a change in the API breaks compilation of
5732 programs while changes in the ABI stop compiled programs from 5732 programs while changes in the ABI stop compiled programs from
5733 running.</p> 5733 running.</p>
5734<p>Changes to the 5734<p>Changes to the
5735 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5735 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5736 variable in a <code class="filename">buildlink3.mk</code> file happen 5736 variable in a <code class="filename">buildlink3.mk</code> file happen
5737 very rarely. One possible reason is that all packages depending 5737 very rarely. One possible reason is that all packages depending
5738 on this already need a newer version. In case it is bumped see 5738 on this already need a newer version. In case it is bumped see
5739 the description below.</p> 5739 the description below.</p>
5740<p>The most common example of an ABI change is that the major 5740<p>The most common example of an ABI change is that the major
5741 version of a shared library is increased. In this case, 5741 version of a shared library is increased. In this case,
5742 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5742 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5743 should be adjusted to require at least the new package version. 5743 should be adjusted to require at least the new package version.
5744 Then the packages that depend on this package need their 5744 Then the packages that depend on this package need their
5745 <code class="varname">PKGREVISION</code>s increased and, if they have 5745 <code class="varname">PKGREVISION</code>s increased and, if they have
5746 <code class="filename">buildlink3.mk</code> files, their 5746 <code class="filename">buildlink3.mk</code> files, their
5747 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5747 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5748 adjusted, too. This is needed so pkgsrc will require the correct 5748 adjusted, too. This is needed so pkgsrc will require the correct
5749 package dependency and not settle for an older one when building 5749 package dependency and not settle for an older one when building
5750 the source.</p> 5750 the source.</p>
5751<p>See <a class="xref" href="#dependencies" title="19.1.6. Handling dependencies">Section 19.1.6, &#8220;Handling dependencies&#8221;</a> for 5751<p>See <a class="xref" href="#dependencies" title="19.1.6. Handling dependencies">Section 19.1.6, &#8220;Handling dependencies&#8221;</a> for
5752 more information about dependencies on other packages, 5752 more information about dependencies on other packages,
5753 including the <code class="varname">BUILDLINK_ABI_DEPENDS</code> and 5753 including the <code class="varname">BUILDLINK_ABI_DEPENDS</code> and
5754 <code class="varname">ABI_DEPENDS</code> definitions.</p> 5754 <code class="varname">ABI_DEPENDS</code> definitions.</p>
5755<p>Please take careful consideration before adjusting 5755<p>Please take careful consideration before adjusting
5756 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5756 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5757 or 5757 or
5758 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5758 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5759 as we don't want to cause unneeded package deletions and 5759 as we don't want to cause unneeded package deletions and
5760 rebuilds. In many cases, new versions of packages work just 5760 rebuilds. In many cases, new versions of packages work just
5761 fine with older dependencies.</p> 5761 fine with older dependencies.</p>
5762<p>Also it is not needed to set 5762<p>Also it is not needed to set
5763 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code> 5763 <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
5764 when it is identical to 5764 when it is identical to
5765 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>. </p> 5765 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>. </p>
5766</div> 5766</div>
5767</div> 5767</div>
5768<div class="sect1"> 5768<div class="sect1">
5769<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5769<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5770<a name="writing-builtin.mk"></a>14.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div> 5770<a name="writing-builtin.mk"></a>14.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div>
5771<p>Some packages in pkgsrc install headers and libraries that 5771<p>Some packages in pkgsrc install headers and libraries that
5772 coincide with headers and libraries present in the base system. 5772 coincide with headers and libraries present in the base system.
5773 Aside from a <code class="filename">buildlink3.mk</code> file, these 5773 Aside from a <code class="filename">buildlink3.mk</code> file, these
5774 packages should also include a <code class="filename">builtin.mk</code> 5774 packages should also include a <code class="filename">builtin.mk</code>
5775 file that includes the necessary checks to decide whether using 5775 file that includes the necessary checks to decide whether using
5776 the built-in software or the pkgsrc software is 5776 the built-in software or the pkgsrc software is
5777 appropriate.</p> 5777 appropriate.</p>
5778<p>The only requirements of a builtin.mk file for 5778<p>The only requirements of a builtin.mk file for
5779 <em class="replaceable"><code>pkg</code></em> are:</p> 5779 <em class="replaceable"><code>pkg</code></em> are:</p>
5780<div class="orderedlist"><ol class="orderedlist" type="1"> 5780<div class="orderedlist"><ol class="orderedlist" type="1">
5781<li class="listitem"><p>It should set 5781<li class="listitem"><p>It should set
5782 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5782 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5783 to either <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span> 5783 to either <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>
5784 after it is included.</p></li> 5784 after it is included.</p></li>
5785<li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any 5785<li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any
5786 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5786 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5787 which is already set before the 5787 which is already set before the
5788 <code class="filename">builtin.mk</code> file is included.</p></li> 5788 <code class="filename">builtin.mk</code> file is included.</p></li>
5789<li class="listitem"><p>It should be written to allow multiple inclusion. This 5789<li class="listitem"><p>It should be written to allow multiple inclusion. This
5790 is <span class="emphasis"><em>very</em></span> important and takes careful 5790 is <span class="emphasis"><em>very</em></span> important and takes careful
5791 attention to <code class="filename">Makefile</code> coding.</p></li> 5791 attention to <code class="filename">Makefile</code> coding.</p></li>
5792</ol></div> 5792</ol></div>
5793<div class="sect2"> 5793<div class="sect2">
5794<div class="titlepage"><div><div><h3 class="title"> 5794<div class="titlepage"><div><div><h3 class="title">
5795<a name="anatomy-of-builtin.mk"></a>14.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</h3></div></div></div> 5795<a name="anatomy-of-builtin.mk"></a>14.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</h3></div></div></div>
5796<p>The following is the recommended template for builtin.mk 5796<p>The following is the recommended template for builtin.mk
5797 files:</p> 5797 files:</p>
5798<pre class="programlisting"> 5798<pre class="programlisting">
5799.if !defined(IS_BUILTIN.foo) 5799.if !defined(IS_BUILTIN.foo)
5800# 5800#
5801# IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo" 5801# IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
5802# genuinely exists in the system or not. 5802# genuinely exists in the system or not.
5803# 5803#
5804IS_BUILTIN.foo?= no 5804IS_BUILTIN.foo?= no
5805 5805
5806# BUILTIN_PKG.foo should be set here if "foo" is built-in and its package 5806# BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
5807# version can be determined. 5807# version can be determined.
5808# 5808#
5809. if !empty(IS_BUILTIN.foo:M[yY][eE][sS]) 5809. if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
5810BUILTIN_PKG.foo?= foo-1.0 5810BUILTIN_PKG.foo?= foo-1.0
5811. endif 5811. endif
5812.endif # IS_BUILTIN.foo 5812.endif # IS_BUILTIN.foo
5813 5813
5814.if !defined(USE_BUILTIN.foo) 5814.if !defined(USE_BUILTIN.foo)
5815USE_BUILTIN.foo?= ${IS_BUILTIN.foo} 5815USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
5816. if defined(BUILTIN_PKG.foo) 5816. if defined(BUILTIN_PKG.foo)
5817. for _depend_ in ${BUILDLINK_API_DEPENDS.foo} 5817. for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
5818. if !empty(USE_BUILTIN.foo:M[yY][eE][sS]) 5818. if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
5819USE_BUILTIN.foo!= \ 5819USE_BUILTIN.foo!= \
5820 ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \ 5820 ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
5821 &amp;&amp; ${ECHO} "yes" || ${ECHO} "no" 5821 &amp;&amp; ${ECHO} "yes" || ${ECHO} "no"
5822. endif 5822. endif
5823. endfor 5823. endfor
5824. endif 5824. endif
5825.endif # USE_BUILTIN.foo 5825.endif # USE_BUILTIN.foo
5826 5826
5827CHECK_BUILTIN.foo?= no 5827CHECK_BUILTIN.foo?= no
5828.if !empty(CHECK_BUILTIN.foo:M[nN][oO]) 5828.if !empty(CHECK_BUILTIN.foo:M[nN][oO])
5829# 5829#
5830# Here we place code that depends on whether USE_BUILTIN.foo is set to 5830# Here we place code that depends on whether USE_BUILTIN.foo is set to
5831# "yes" or "no". 5831# "yes" or "no".
5832# 5832#
5833.endif # CHECK_BUILTIN.foo 5833.endif # CHECK_BUILTIN.foo
5834</pre> 5834</pre>
5835<p>The first section sets 5835<p>The first section sets
5836 <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5836 <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5837 depending on if <em class="replaceable"><code>pkg</code></em> really exists 5837 depending on if <em class="replaceable"><code>pkg</code></em> really exists
5838 in the base system. This should not be a base system software 5838 in the base system. This should not be a base system software
5839 with similar functionality to <em class="replaceable"><code>pkg</code></em>; 5839 with similar functionality to <em class="replaceable"><code>pkg</code></em>;
5840 it should only be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> if the actual package is 5840 it should only be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> if the actual package is
5841 included as part of the base system. This variable is only 5841 included as part of the base system. This variable is only
5842 used internally within the <code class="filename">builtin.mk</code> 5842 used internally within the <code class="filename">builtin.mk</code>
5843 file.</p> 5843 file.</p>
5844<p>The second section sets 5844<p>The second section sets
5845 <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code> 5845 <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
5846 to the version of <em class="replaceable"><code>pkg</code></em> in the base 5846 to the version of <em class="replaceable"><code>pkg</code></em> in the base
5847 system if it exists (if 5847 system if it exists (if
5848 <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5848 <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5849 is <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>). This variable is only used internally 5849 is <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>). This variable is only used internally
5850 within the <code class="filename">builtin.mk</code> file.</p> 5850 within the <code class="filename">builtin.mk</code> file.</p>
5851<p>The third section sets 5851<p>The third section sets
5852 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5852 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5853 and is <span class="emphasis"><em>required</em></span> in all 5853 and is <span class="emphasis"><em>required</em></span> in all
5854 <code class="filename">builtin.mk</code> files. The code in this 5854 <code class="filename">builtin.mk</code> files. The code in this
5855 section must make the determination whether the built-in 5855 section must make the determination whether the built-in
5856 software is adequate to satisfy the dependencies listed in 5856 software is adequate to satisfy the dependencies listed in
5857 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>. 5857 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
5858 This is typically done by comparing 5858 This is typically done by comparing
5859 <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code> 5859 <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
5860 against each of the dependencies in 5860 against each of the dependencies in
5861 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>. 5861 <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
5862 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5862 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5863 <span class="emphasis"><em>must</em></span> be set to the correct value by the 5863 <span class="emphasis"><em>must</em></span> be set to the correct value by the
5864 end of the <code class="filename">builtin.mk</code> file. Note that 5864 end of the <code class="filename">builtin.mk</code> file. Note that
5865 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5865 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5866 may be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> even if 5866 may be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> even if
5867 <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5867 <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5868 is <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span> because we may make the determination 5868 is <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span> because we may make the determination
5869 that the built-in version of the software is similar enough to 5869 that the built-in version of the software is similar enough to
5870 be used as a replacement.</p> 5870 be used as a replacement.</p>
5871<p>The last section is guarded by 5871<p>The last section is guarded by
5872 <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>, 5872 <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>,
5873 and includes code that uses the value of 5873 and includes code that uses the value of
5874 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code> 5874 <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
5875 set in the previous section. This typically includes, e.g., 5875 set in the previous section. This typically includes, e.g.,
5876 adding additional dependency restrictions and listing additional 5876 adding additional dependency restrictions and listing additional
5877 files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via 5877 files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via
5878 <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p> 5878 <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p>
5879</div> 5879</div>
5880<div class="sect2"> 5880<div class="sect2">
5881<div class="titlepage"><div><div><h3 class="title"> 5881<div class="titlepage"><div><div><h3 class="title">
5882<a name="native-or-pkgsrc-preference"></a>14.3.2. Global preferences for native or pkgsrc software</h3></div></div></div> 5882<a name="native-or-pkgsrc-preference"></a>14.3.2. Global preferences for native or pkgsrc software</h3></div></div></div>
5883<p>When building packages, it's possible to choose whether to set 5883<p>When building packages, it's possible to choose whether to set
5884 a global preference for using either the built-in (native) 5884 a global preference for using either the built-in (native)
5885 version or the pkgsrc version of software to satisfy a 5885 version or the pkgsrc version of software to satisfy a
5886 dependency. This is controlled by setting 5886 dependency. This is controlled by setting
5887 <code class="varname">PREFER_PKGSRC</code> and 5887 <code class="varname">PREFER_PKGSRC</code> and
5888 <code class="varname">PREFER_NATIVE</code>. These variables take values 5888 <code class="varname">PREFER_NATIVE</code>. These variables take values
5889 of either <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>, or a list of 5889 of either <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>, or a list of
5890 packages. <code class="varname">PREFER_PKGSRC</code> tells pkgsrc to 5890 packages. <code class="varname">PREFER_PKGSRC</code> tells pkgsrc to
5891 use the pkgsrc versions of software, while 5891 use the pkgsrc versions of software, while
5892 <code class="varname">PREFER_NATIVE</code> tells pkgsrc to use the 5892 <code class="varname">PREFER_NATIVE</code> tells pkgsrc to use the
5893 built-in versions. Preferences are determined by the most 5893 built-in versions. Preferences are determined by the most
5894 specific instance of the package in either 5894 specific instance of the package in either
5895 <code class="varname">PREFER_PKGSRC</code> or 5895 <code class="varname">PREFER_PKGSRC</code> or
5896 <code class="varname">PREFER_NATIVE</code>. If a package is specified 5896 <code class="varname">PREFER_NATIVE</code>. If a package is specified
5897 in neither or in both variables, then 5897 in neither or in both variables, then
5898 <code class="varname">PREFER_PKGSRC</code> has precedence over 5898 <code class="varname">PREFER_PKGSRC</code> has precedence over
5899 <code class="varname">PREFER_NATIVE</code>. For example, to require 5899 <code class="varname">PREFER_NATIVE</code>. For example, to require
5900 using pkgsrc versions of software for all but the most basic 5900 using pkgsrc versions of software for all but the most basic
5901 bits on a NetBSD system, you can set:</p> 5901 bits on a NetBSD system, you can set:</p>
5902<pre class="programlisting"> 5902<pre class="programlisting">
5903PREFER_PKGSRC= yes 5903PREFER_PKGSRC= yes
5904PREFER_NATIVE= getopt skey tcp_wrappers 5904PREFER_NATIVE= getopt skey tcp_wrappers
5905</pre> 5905</pre>
5906<p>A package <span class="emphasis"><em>must</em></span> have a 5906<p>A package <span class="emphasis"><em>must</em></span> have a
5907 <code class="filename">builtin.mk</code> 5907 <code class="filename">builtin.mk</code>
5908 file to be listed in <code class="varname">PREFER_NATIVE</code>, 5908 file to be listed in <code class="varname">PREFER_NATIVE</code>,
5909 otherwise it is simply ignored in that list.</p> 5909 otherwise it is simply ignored in that list.</p>
5910</div> 5910</div>
5911</div> 5911</div>
5912</div> 5912</div>
5913<div class="chapter"> 5913<div class="chapter">
5914<div class="titlepage"><div><div><h2 class="title"> 5914<div class="titlepage"><div><div><h2 class="title">
5915<a name="pkginstall"></a>Chapter 15. The pkginstall framework</h2></div></div></div> 5915<a name="pkginstall"></a>Chapter 15. The pkginstall framework</h2></div></div></div>
5916<div class="toc"> 5916<div class="toc">
5917<p><b>Table of Contents</b></p> 5917<p><b>Table of Contents</b></p>
5918<dl> 5918<dl>
5919<dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">15.1. Files and directories outside the installation prefix</a></span></dt> 5919<dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">15.1. Files and directories outside the installation prefix</a></span></dt>
5920<dd><dl> 5920<dd><dl>
5921<dt><span class="sect2"><a href="#dirs-outside-prefix">15.1.1. Directory manipulation</a></span></dt> 5921<dt><span class="sect2"><a href="#dirs-outside-prefix">15.1.1. Directory manipulation</a></span></dt>
5922<dt><span class="sect2"><a href="#files-outside-prefix">15.1.2. File manipulation</a></span></dt> 5922<dt><span class="sect2"><a href="#files-outside-prefix">15.1.2. File manipulation</a></span></dt>
5923</dl></dd> 5923</dl></dd>
5924<dt><span class="sect1"><a href="#conf-files">15.2. Configuration files</a></span></dt> 5924<dt><span class="sect1"><a href="#conf-files">15.2. Configuration files</a></span></dt>
5925<dd><dl> 5925<dd><dl>
5926<dt><span class="sect2"><a href="#conf-files-sysconfdir">15.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt> 5926<dt><span class="sect2"><a href="#conf-files-sysconfdir">15.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
5927<dt><span class="sect2"><a href="#conf-files-configure">15.2.2. Telling the software where configuration files are</a></span></dt> 5927<dt><span class="sect2"><a href="#conf-files-configure">15.2.2. Telling the software where configuration files are</a></span></dt>
5928<dt><span class="sect2"><a href="#conf-files-patching">15.2.3. Patching installations</a></span></dt> 5928<dt><span class="sect2"><a href="#conf-files-patching">15.2.3. Patching installations</a></span></dt>
5929<dt><span class="sect2"><a href="#conf-files-disable">15.2.4. Disabling handling of configuration files</a></span></dt> 5929<dt><span class="sect2"><a href="#conf-files-disable">15.2.4. Disabling handling of configuration files</a></span></dt>
5930</dl></dd> 5930</dl></dd>
5931<dt><span class="sect1"><a href="#rcd-scripts">15.3. System startup scripts</a></span></dt> 5931<dt><span class="sect1"><a href="#rcd-scripts">15.3. System startup scripts</a></span></dt>
5932<dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">15.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd> 5932<dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">15.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
5933<dt><span class="sect1"><a href="#users-and-groups">15.4. System users and groups</a></span></dt> 5933<dt><span class="sect1"><a href="#users-and-groups">15.4. System users and groups</a></span></dt>
5934<dt><span class="sect1"><a href="#shells">15.5. System shells</a></span></dt> 5934<dt><span class="sect1"><a href="#shells">15.5. System shells</a></span></dt>
5935<dd><dl><dt><span class="sect2"><a href="#shells-disable">15.5.1. Disabling shell registration</a></span></dt></dl></dd> 5935<dd><dl><dt><span class="sect2"><a href="#shells-disable">15.5.1. Disabling shell registration</a></span></dt></dl></dd>
5936<dt><span class="sect1"><a href="#fonts">15.6. Fonts</a></span></dt> 5936<dt><span class="sect1"><a href="#fonts">15.6. Fonts</a></span></dt>
5937<dd><dl><dt><span class="sect2"><a href="#fonts-disable">15.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd> 5937<dd><dl><dt><span class="sect2"><a href="#fonts-disable">15.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
5938</dl> 5938</dl>
5939</div> 5939</div>
5940<p>This chapter describes the framework known as 5940<p>This chapter describes the framework known as
5941<code class="literal">pkginstall</code>, whose key features are:</p> 5941<code class="literal">pkginstall</code>, whose key features are:</p>
5942<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5942<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5943<li class="listitem"><p>Generic installation and manipulation of directories and files 5943<li class="listitem"><p>Generic installation and manipulation of directories and files
5944 outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li> 5944 outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li>
5945<li class="listitem"><p>Automatic handling of configuration files during installation, 5945<li class="listitem"><p>Automatic handling of configuration files during installation,
5946 provided that packages are correctly designed.</p></li> 5946 provided that packages are correctly designed.</p></li>
5947<li class="listitem"><p>Generation and installation of system startup scripts.</p></li> 5947<li class="listitem"><p>Generation and installation of system startup scripts.</p></li>
5948<li class="listitem"><p>Registration of system users and groups.</p></li> 5948<li class="listitem"><p>Registration of system users and groups.</p></li>
5949<li class="listitem"><p>Registration of system shells.</p></li> 5949<li class="listitem"><p>Registration of system shells.</p></li>
5950<li class="listitem"><p>Automatic updating of fonts databases.</p></li> 5950<li class="listitem"><p>Automatic updating of fonts databases.</p></li>
5951</ul></div> 5951</ul></div>
5952<p>The following sections inspect each of the above points in detail.</p> 5952<p>The following sections inspect each of the above points in detail.</p>
5953<p>You may be thinking that many of the things described here could be 5953<p>You may be thinking that many of the things described here could be
5954easily done with simple code in the package's post-installation target 5954easily done with simple code in the package's post-installation target
5955(<code class="literal">post-install</code>). <span class="emphasis"><em>This is incorrect</em></span>, 5955(<code class="literal">post-install</code>). <span class="emphasis"><em>This is incorrect</em></span>,
5956as the code in them is only executed when building from source. Machines 5956as the code in them is only executed when building from source. Machines
5957using binary packages could not benefit from it at all (as the code itself 5957using binary packages could not benefit from it at all (as the code itself
5958could be unavailable). Therefore, the only way to achieve any of the items 5958could be unavailable). Therefore, the only way to achieve any of the items
5959described above is by means of the installation scripts, which are 5959described above is by means of the installation scripts, which are
5960automatically generated by pkginstall.</p> 5960automatically generated by pkginstall.</p>
5961<div class="sect1"> 5961<div class="sect1">
5962<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 5962<div class="titlepage"><div><div><h2 class="title" style="clear: both">
5963<a name="files-and-dirs-outside-prefix"></a>15.1. Files and directories outside the installation prefix</h2></div></div></div> 5963<a name="files-and-dirs-outside-prefix"></a>15.1. Files and directories outside the installation prefix</h2></div></div></div>
5964<p>As you already know, the <code class="filename">PLIST</code> file holds a list 5964<p>As you already know, the <code class="filename">PLIST</code> file holds a list
5965of files and directories that belong to a package. The names used in it 5965of files and directories that belong to a package. The names used in it
5966are relative to the installation prefix (<code class="filename">${PREFIX}</code>), 5966are relative to the installation prefix (<code class="filename">${PREFIX}</code>),
5967which means that it cannot register files outside this directory (absolute 5967which means that it cannot register files outside this directory (absolute
5968path names are not allowed). Despite this restriction, some packages need 5968path names are not allowed). Despite this restriction, some packages need
5969to install files outside this location; e.g., under 5969to install files outside this location; e.g., under
5970<code class="filename">${VARBASE}</code> or 5970<code class="filename">${VARBASE}</code> or
5971<code class="filename">${PKG_SYSCONFDIR}</code>. The only way to achieve this 5971<code class="filename">${PKG_SYSCONFDIR}</code>. The only way to achieve this
5972is to create such files during installation time by using 5972is to create such files during installation time by using
5973installation scripts.</p> 5973installation scripts.</p>
5974<p>The generic installation scripts are shell scripts that can 5974<p>The generic installation scripts are shell scripts that can
5975contain arbitrary code. The list of scripts to execute is taken from 5975contain arbitrary code. The list of scripts to execute is taken from
5976the <code class="varname">INSTALL_FILE</code> variable, which defaults to 5976the <code class="varname">INSTALL_FILE</code> variable, which defaults to
5977<code class="filename">INSTALL</code>. A similar variable exists for package 5977<code class="filename">INSTALL</code>. A similar variable exists for package
5978removal (<code class="varname">DEINSTALL_FILE</code>, whose default is 5978removal (<code class="varname">DEINSTALL_FILE</code>, whose default is
5979<code class="filename">DEINSTALL</code>). These scripts can run arbitrary 5979<code class="filename">DEINSTALL</code>). These scripts can run arbitrary
5980commands, so they have the potential to create and manage files 5980commands, so they have the potential to create and manage files
5981anywhere in the file system.</p> 5981anywhere in the file system.</p>
5982<p>Using these general installation files is not recommended, but 5982<p>Using these general installation files is not recommended, but
5983may be needed in some special cases. One reason for avoiding them is 5983may be needed in some special cases. One reason for avoiding them is
5984that the user has to trust the packager that there is no unwanted or 5984that the user has to trust the packager that there is no unwanted or
5985simply erroneous code included in the installation script. Also, 5985simply erroneous code included in the installation script. Also,
5986previously there were many similar scripts for the same functionality, 5986previously there were many similar scripts for the same functionality,
5987and fixing a common error involved finding and changing all of 5987and fixing a common error involved finding and changing all of
5988them.</p> 5988them.</p>
5989<p>The pkginstall framework offers another, standardized way. It 5989<p>The pkginstall framework offers another, standardized way. It
5990provides generic scripts to abstract the manipulation of such files 5990provides generic scripts to abstract the manipulation of such files
5991and directories based on variables set in the package's 5991and directories based on variables set in the package's
5992<code class="filename">Makefile</code>. The rest of this section describes 5992<code class="filename">Makefile</code>. The rest of this section describes
5993these variables.</p> 5993these variables.</p>
5994<div class="sect2"> 5994<div class="sect2">
5995<div class="titlepage"><div><div><h3 class="title"> 5995<div class="titlepage"><div><div><h3 class="title">
5996<a name="dirs-outside-prefix"></a>15.1.1. Directory manipulation</h3></div></div></div> 5996<a name="dirs-outside-prefix"></a>15.1.1. Directory manipulation</h3></div></div></div>
5997<p>The following variables can be set to request the creation of 5997<p>The following variables can be set to request the creation of
5998directories anywhere in the file system:</p> 5998directories anywhere in the file system:</p>
5999<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 5999<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6000<li class="listitem"><p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code> 6000<li class="listitem"><p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code>
6001 contain a list of directories that should be created and should attempt 6001 contain a list of directories that should be created and should attempt
6002 to be destroyed by the installation scripts. The difference between 6002 to be destroyed by the installation scripts. The difference between
6003 the two is that the latter prompts the administrator to remove any 6003 the two is that the latter prompts the administrator to remove any
6004 directories that may be left after deinstallation (because they were 6004 directories that may be left after deinstallation (because they were
6005 not empty), while the former does not.</p></li> 6005 not empty), while the former does not.</p></li>
6006<li class="listitem"> 6006<li class="listitem">
6007<p><code class="varname">MAKE_DIRS_PERMS</code> and 6007<p><code class="varname">MAKE_DIRS_PERMS</code> and
6008 <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing 6008 <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing
6009 which directories should be created and should attempt to be destroyed 6009 which directories should be created and should attempt to be destroyed
6010 by the installation scripts. Each tuple holds the following values, 6010 by the installation scripts. Each tuple holds the following values,
6011 separated by spaces: the directory name, its owner, its group and its 6011 separated by spaces: the directory name, its owner, its group and its
6012 numerical mode. For example:</p> 6012 numerical mode. For example:</p>
6013<pre class="programlisting"> 6013<pre class="programlisting">
6014MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700 6014MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
6015</pre> 6015</pre>
6016<p>The difference between the two is exactly the same as their 6016<p>The difference between the two is exactly the same as their
6017 non-<code class="varname">PERMS</code> counterparts.</p> 6017 non-<code class="varname">PERMS</code> counterparts.</p>
6018</li> 6018</li>
6019</ul></div> 6019</ul></div>
6020</div> 6020</div>
6021<div class="sect2"> 6021<div class="sect2">
6022<div class="titlepage"><div><div><h3 class="title"> 6022<div class="titlepage"><div><div><h3 class="title">
6023<a name="files-outside-prefix"></a>15.1.2. File manipulation</h3></div></div></div> 6023<a name="files-outside-prefix"></a>15.1.2. File manipulation</h3></div></div></div>
6024<p>Creating non-empty files outside the installation prefix is tricky 6024<p>Creating non-empty files outside the installation prefix is tricky
6025because the <code class="filename">PLIST</code> forces all files to be inside it. 6025because the <code class="filename">PLIST</code> forces all files to be inside it.
6026To overcome this problem, the only solution is to extract the file in the 6026To overcome this problem, the only solution is to extract the file in the
6027known place (i.e., inside the installation prefix) and copy it to the 6027known place (i.e., inside the installation prefix) and copy it to the
6028appropriate location during installation (done by the installation scripts 6028appropriate location during installation (done by the installation scripts
6029generated by pkginstall). We will call the former the <span class="emphasis"><em>master 6029generated by pkginstall). We will call the former the <span class="emphasis"><em>master
6030file</em></span> in the following paragraphs, which describe the variables 6030file</em></span> in the following paragraphs, which describe the variables
6031that can be used to automatically and consistently handle files outside the 6031that can be used to automatically and consistently handle files outside the
6032installation prefix:</p> 6032installation prefix:</p>
6033<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 6033<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6034<li class="listitem"> 6034<li class="listitem">
6035<p><code class="varname">CONF_FILES</code> and 6035<p><code class="varname">CONF_FILES</code> and
6036 <code class="varname">REQD_FILES</code> are pairs of master and target files. 6036 <code class="varname">REQD_FILES</code> are pairs of master and target files.
6037 During installation time, the master file is copied to the target one 6037 During installation time, the master file is copied to the target one
6038 if and only if the latter does not exist. Upon deinstallation, the 6038 if and only if the latter does not exist. Upon deinstallation, the
6039 target file is removed provided that it was not modified by the 6039 target file is removed provided that it was not modified by the
6040 installation.</p> 6040 installation.</p>
6041<p>The difference between the two is that the latter prompts the 6041<p>The difference between the two is that the latter prompts the
6042 administrator to remove any files that may be left after 6042 administrator to remove any files that may be left after
6043 deinstallation (because they were not empty), while the former does 6043 deinstallation (because they were not empty), while the former does
6044 not.</p> 6044 not.</p>
6045</li> 6045</li>
6046<li class="listitem"> 6046<li class="listitem">
6047<p><code class="varname">CONF_FILES_PERMS</code> and 6047<p><code class="varname">CONF_FILES_PERMS</code> and
6048 <code class="varname">REQD_FILES_PERMS</code> contain tuples describing master 6048 <code class="varname">REQD_FILES_PERMS</code> contain tuples describing master
6049 files as well as their target locations. For each of them, it also 6049 files as well as their target locations. For each of them, it also
6050 specifies their owner, their group and their numeric permissions, in 6050 specifies their owner, their group and their numeric permissions, in
6051 this order. For example:</p> 6051 this order. For example:</p>
6052<pre class="programlisting"> 6052<pre class="programlisting">
6053REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700 6053REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
6054</pre> 6054</pre>
6055<p>The difference between the two is exactly the same as their 6055<p>The difference between the two is exactly the same as their
6056 non-<code class="varname">PERMS</code> counterparts.</p> 6056 non-<code class="varname">PERMS</code> counterparts.</p>
6057</li> 6057</li>
6058</ul></div> 6058</ul></div>
6059</div> 6059</div>
6060</div> 6060</div>
6061<div class="sect1"> 6061<div class="sect1">
6062<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6062<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6063<a name="conf-files"></a>15.2. Configuration files</h2></div></div></div> 6063<a name="conf-files"></a>15.2. Configuration files</h2></div></div></div>
6064<p>Configuration files are special in the sense that they are installed 6064<p>Configuration files are special in the sense that they are installed
6065in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and 6065in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and
6066need special treatment during installation (most of which is automated by 6066need special treatment during installation (most of which is automated by
6067pkginstall). The main concept you must bear in mind is that files marked 6067pkginstall). The main concept you must bear in mind is that files marked
6068as configuration files are automatically copied to the right place (somewhere 6068as configuration files are automatically copied to the right place (somewhere
6069inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if 6069inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if
6070and only if</em></span> they didn't exist before. Similarly, they will not 6070and only if</em></span> they didn't exist before. Similarly, they will not
6071be removed if they have local modifications. This ensures that 6071be removed if they have local modifications. This ensures that
6072administrators never lose any custom changes they may have made.</p> 6072administrators never lose any custom changes they may have made.</p>
6073<div class="sect2"> 6073<div class="sect2">
6074<div class="titlepage"><div><div><h3 class="title"> 6074<div class="titlepage"><div><div><h3 class="title">
6075<a name="conf-files-sysconfdir"></a>15.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</h3></div></div></div> 6075<a name="conf-files-sysconfdir"></a>15.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</h3></div></div></div>
6076<p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable 6076<p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable
6077specifies where configuration files shall be installed. Its contents are 6077specifies where configuration files shall be installed. Its contents are
6078set based upon the following variables:</p> 6078set based upon the following variables:</p>
6079<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 6079<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6080<li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root 6080<li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root
6081 directory. Defaults to <code class="filename">${PREFIX}/etc</code> although it may 6081 directory. Defaults to <code class="filename">${PREFIX}/etc</code> although it may
6082 be overridden by the user to point to his preferred location (e.g., 6082 be overridden by the user to point to his preferred location (e.g.,
6083 <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.). 6083 <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.).
6084 Packages must not use it directly.</p></li> 6084 Packages must not use it directly.</p></li>
6085<li class="listitem"> 6085<li class="listitem">
6086<p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of 6086<p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of
6087 <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files 6087 <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files
6088 for the package being built shall be installed. The definition of this 6088 for the package being built shall be installed. The definition of this
6089 variable only makes sense in the package's 6089 variable only makes sense in the package's
6090 <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p> 6090 <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p>
6091<p>As an example, consider the Apache package, 6091<p>As an example, consider the Apache package,
6092 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache2/README.html" target="_top"><code class="filename">www/apache2</code></a>, which places its 6092 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache2/README.html" target="_top"><code class="filename">www/apache2</code></a>, which places its
6093 configuration files under the 6093 configuration files under the
6094 <code class="filename">httpd/</code> subdirectory of 6094 <code class="filename">httpd/</code> subdirectory of
6095 <code class="varname">PKG_SYSCONFBASE</code>. This should be set in the package 6095 <code class="varname">PKG_SYSCONFBASE</code>. This should be set in the package
6096 Makefile.</p> 6096 Makefile.</p>
6097</li> 6097</li>
6098<li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the 6098<li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the
6099 variable that holds this package's configuration directory (if 6099 variable that holds this package's configuration directory (if
6100 different from <code class="varname">PKG_SYSCONFBASE</code>). It defaults to 6100 different from <code class="varname">PKG_SYSCONFBASE</code>). It defaults to
6101 <code class="varname">PKGBASE</code>'s value, and is always prefixed with 6101 <code class="varname">PKGBASE</code>'s value, and is always prefixed with
6102 <code class="literal">PKG_SYSCONFDIR</code>.</p></li> 6102 <code class="literal">PKG_SYSCONFDIR</code>.</p></li>
6103<li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the 6103<li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the
6104 directory where the configuration files for the package identified by 6104 directory where the configuration files for the package identified by
6105 <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li> 6105 <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li>
6106</ul></div> 6106</ul></div>
6107<p>Based on the above variables, pkginstall determines the value of 6107<p>Based on the above variables, pkginstall determines the value of
6108<code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span> 6108<code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span>
6109variable that can be used within a package to refer to its configuration 6109variable that can be used within a package to refer to its configuration
6110directory. The algorithm used to set its value is basically the 6110directory. The algorithm used to set its value is basically the
6111following:</p> 6111following:</p>
6112<div class="orderedlist"><ol class="orderedlist" type="1"> 6112<div class="orderedlist"><ol class="orderedlist" type="1">
6113<li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set, 6113<li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set,
6114 its value is used.</p></li> 6114 its value is used.</p></li>
6115<li class="listitem"><p>If the previous variable is not defined but 6115<li class="listitem"><p>If the previous variable is not defined but
6116 <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's 6116 <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's
6117 <code class="filename">Makefile</code>, the resulting value is 6117 <code class="filename">Makefile</code>, the resulting value is
6118 <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li> 6118 <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li>
6119<li class="listitem"><p>Otherwise, it is set to 6119<li class="listitem"><p>Otherwise, it is set to
6120 <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li> 6120 <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li>
6121</ol></div> 6121</ol></div>
6122<p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is 6122<p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is
6123automatically added to <code class="filename">OWN_DIRS</code>. See <a class="xref" href="#dirs-outside-prefix" title="15.1.1. Directory manipulation">Section 15.1.1, &#8220;Directory manipulation&#8221;</a> what this means. This does not apply to 6123automatically added to <code class="filename">OWN_DIRS</code>. See <a class="xref" href="#dirs-outside-prefix" title="15.1.1. Directory manipulation">Section 15.1.1, &#8220;Directory manipulation&#8221;</a> what this means. This does not apply to
6124subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to 6124subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to
6125be created with OWN_DIRS or MAKE_DIRS.</p> 6125be created with OWN_DIRS or MAKE_DIRS.</p>
6126</div> 6126</div>
6127<div class="sect2"> 6127<div class="sect2">
6128<div class="titlepage"><div><div><h3 class="title"> 6128<div class="titlepage"><div><div><h3 class="title">
6129<a name="conf-files-configure"></a>15.2.2. Telling the software where configuration files are</h3></div></div></div> 6129<a name="conf-files-configure"></a>15.2.2. Telling the software where configuration files are</h3></div></div></div>
6130<p>Given that pkgsrc (and users!) expect configuration files to be in a 6130<p>Given that pkgsrc (and users!) expect configuration files to be in a
6131known place, you need to teach each package where it shall install its 6131known place, you need to teach each package where it shall install its
6132files. In some cases you will have to patch the package Makefiles to 6132files. In some cases you will have to patch the package Makefiles to
6133achieve it. If you are lucky, though, it may be as easy as passing an 6133achieve it. If you are lucky, though, it may be as easy as passing an
6134extra flag to the configuration script; this is the case of GNU Autoconf- 6134extra flag to the configuration script; this is the case of GNU Autoconf-
6135generated files:</p> 6135generated files:</p>
6136<pre class="programlisting"> 6136<pre class="programlisting">
6137CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} 6137CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
6138</pre> 6138</pre>
6139<p>Note that this specifies where the package has to <span class="emphasis"><em>look 6139<p>Note that this specifies where the package has to <span class="emphasis"><em>look
6140for</em></span> its configuration files, not where they will be originally 6140for</em></span> its configuration files, not where they will be originally
6141installed (although the difference is never explicit, 6141installed (although the difference is never explicit,
6142unfortunately).</p> 6142unfortunately).</p>
6143</div> 6143</div>
6144<div class="sect2"> 6144<div class="sect2">
6145<div class="titlepage"><div><div><h3 class="title"> 6145<div class="titlepage"><div><div><h3 class="title">
6146<a name="conf-files-patching"></a>15.2.3. Patching installations</h3></div></div></div> 6146<a name="conf-files-patching"></a>15.2.3. Patching installations</h3></div></div></div>
6147<p>As said before, pkginstall automatically handles configuration files. 6147<p>As said before, pkginstall automatically handles configuration files.
6148This means that <span class="strong"><strong>the packages themselves must not 6148This means that <span class="strong"><strong>the packages themselves must not
6149touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code> 6149touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code>
6150directly</strong></span>. Bad news is that many software installation scripts 6150directly</strong></span>. Bad news is that many software installation scripts
6151will, out of the box, mess with the contents of that directory. So what is 6151will, out of the box, mess with the contents of that directory. So what is
6152the correct procedure to fix this issue?</p> 6152the correct procedure to fix this issue?</p>
6153<p>You must teach the package (usually by manually patching it) to 6153<p>You must teach the package (usually by manually patching it) to
6154install any configuration files under the examples hierarchy, 6154install any configuration files under the examples hierarchy,
6155<code class="filename">share/examples/${PKGBASE}/</code>. This way, the 6155<code class="filename">share/examples/${PKGBASE}/</code>. This way, the
6156<code class="filename">PLIST</code> registers them and the administrator always 6156<code class="filename">PLIST</code> registers them and the administrator always
6157has the original copies available.</p> 6157has the original copies available.</p>
6158<p>Once the required configuration files are in place (i.e., under the 6158<p>Once the required configuration files are in place (i.e., under the
6159examples hierarchy), the pkginstall framework can use them as master copies 6159examples hierarchy), the pkginstall framework can use them as master copies
6160during the package installation to update what is in 6160during the package installation to update what is in
6161<code class="filename">${PKG_SYSCONFDIR}</code>. To achieve this, the variables 6161<code class="filename">${PKG_SYSCONFDIR}</code>. To achieve this, the variables
6162<code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are 6162<code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are
6163used. Check out <a class="xref" href="#files-outside-prefix" title="15.1.2. File manipulation">Section 15.1.2, &#8220;File manipulation&#8221;</a> for information 6163used. Check out <a class="xref" href="#files-outside-prefix" title="15.1.2. File manipulation">Section 15.1.2, &#8220;File manipulation&#8221;</a> for information
6164about their syntax and their purpose. Here is an example, taken from the 6164about their syntax and their purpose. Here is an example, taken from the
6165<a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/mail/mutt/README.html" target="_top"><code class="filename">mail/mutt</code></a> package:</p> 6165<a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/mail/mutt/README.html" target="_top"><code class="filename">mail/mutt</code></a> package:</p>
6166<pre class="programlisting"> 6166<pre class="programlisting">
6167EGDIR= ${PREFIX}/share/doc/mutt/samples 6167EGDIR= ${PREFIX}/share/doc/mutt/samples
6168CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc 6168CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
6169</pre> 6169</pre>
6170<p>Note that the <code class="varname">EGDIR</code> variable is specific to that 6170<p>Note that the <code class="varname">EGDIR</code> variable is specific to that
6171package and has no meaning outside it.</p> 6171package and has no meaning outside it.</p>
6172</div> 6172</div>
6173<div class="sect2"> 6173<div class="sect2">
6174<div class="titlepage"><div><div><h3 class="title"> 6174<div class="titlepage"><div><div><h3 class="title">
6175<a name="conf-files-disable"></a>15.2.4. Disabling handling of configuration files</h3></div></div></div> 6175<a name="conf-files-disable"></a>15.2.4. Disabling handling of configuration files</h3></div></div></div>
6176<p>The automatic copying of config files can be toggled by setting the 6176<p>The automatic copying of config files can be toggled by setting the
6177environment variable <code class="varname">PKG_CONFIG</code> prior to package 6177environment variable <code class="varname">PKG_CONFIG</code> prior to package
6178installation.</p> 6178installation.</p>
6179</div> 6179</div>
6180</div> 6180</div>
6181<div class="sect1"> 6181<div class="sect1">
6182<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6182<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6183<a name="rcd-scripts"></a>15.3. System startup scripts</h2></div></div></div> 6183<a name="rcd-scripts"></a>15.3. System startup scripts</h2></div></div></div>
6184<p>System startup scripts are special files because they must be 6184<p>System startup scripts are special files because they must be
6185installed in a place known by the underlying OS, usually outside the 6185installed in a place known by the underlying OS, usually outside the
6186installation prefix. Therefore, the same rules described in <a class="xref" href="#files-and-dirs-outside-prefix" title="15.1. Files and directories outside the installation prefix">Section 15.1, &#8220;Files and directories outside the installation prefix&#8221;</a> apply, and the same solutions 6186installation prefix. Therefore, the same rules described in <a class="xref" href="#files-and-dirs-outside-prefix" title="15.1. Files and directories outside the installation prefix">Section 15.1, &#8220;Files and directories outside the installation prefix&#8221;</a> apply, and the same solutions
6187can be used. However, pkginstall provides a special mechanism to handle 6187can be used. However, pkginstall provides a special mechanism to handle
6188these files.</p> 6188these files.</p>
6189<p>In order to provide system startup scripts, the package has 6189<p>In order to provide system startup scripts, the package has
6190to:</p> 6190to:</p>
6191<div class="orderedlist"><ol class="orderedlist" type="1"> 6191<div class="orderedlist"><ol class="orderedlist" type="1">
6192<li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with 6192<li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with
6193 the <code class="literal">.sh</code> suffix appended. Considering the 6193 the <code class="literal">.sh</code> suffix appended. Considering the
6194 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/cups/README.html" target="_top"><code class="filename">print/cups</code></a> package as an example, it has a 6194 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/cups/README.html" target="_top"><code class="filename">print/cups</code></a> package as an example, it has a
6195 <code class="filename">cupsd.sh</code> in its files directory.</p></li> 6195 <code class="filename">cupsd.sh</code> in its files directory.</p></li>
6196<li class="listitem"> 6196<li class="listitem">
6197<p>Tell pkginstall to handle it, appending the name of the script, 6197<p>Tell pkginstall to handle it, appending the name of the script,
6198 without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable. 6198 without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable.
6199 Continuing the previous example:</p> 6199 Continuing the previous example:</p>
6200<pre class="programlisting"> 6200<pre class="programlisting">
6201RCD_SCRIPTS+= cupsd 6201RCD_SCRIPTS+= cupsd
6202</pre> 6202</pre>
6203</li> 6203</li>
6204</ol></div> 6204</ol></div>
6205<p>Once this is done, pkginstall will do the following steps for each 6205<p>Once this is done, pkginstall will do the following steps for each
6206script in an automated fashion:</p> 6206script in an automated fashion:</p>
6207<div class="orderedlist"><ol class="orderedlist" type="1"> 6207<div class="orderedlist"><ol class="orderedlist" type="1">
6208<li class="listitem"><p>Process the file found in the files directory applying all the 6208<li class="listitem"><p>Process the file found in the files directory applying all the
6209 substitutions described in the <code class="filename">FILES_SUBST</code> 6209 substitutions described in the <code class="filename">FILES_SUBST</code>
6210 variable.</p></li> 6210 variable.</p></li>
6211<li class="listitem"><p>Copy the script from the files directory to the examples 6211<li class="listitem"><p>Copy the script from the files directory to the examples
6212 hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>. Note 6212 hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>. Note
6213 that this master file must be explicitly registered in the 6213 that this master file must be explicitly registered in the
6214 <code class="filename">PLIST</code>.</p></li> 6214 <code class="filename">PLIST</code>.</p></li>
6215<li class="listitem"><p>Add code to the installation scripts to copy the startup script 6215<li class="listitem"><p>Add code to the installation scripts to copy the startup script
6216 from the examples hierarchy into the system-wide startup scripts 6216 from the examples hierarchy into the system-wide startup scripts
6217 directory.</p></li> 6217 directory.</p></li>
6218</ol></div> 6218</ol></div>
6219<div class="sect2"> 6219<div class="sect2">
6220<div class="titlepage"><div><div><h3 class="title"> 6220<div class="titlepage"><div><div><h3 class="title">
6221<a name="rcd-scripts-disable"></a>15.3.1. Disabling handling of system startup scripts</h3></div></div></div> 6221<a name="rcd-scripts-disable"></a>15.3.1. Disabling handling of system startup scripts</h3></div></div></div>
6222<p>The automatic copying of config files can be toggled by setting the 6222<p>The automatic copying of config files can be toggled by setting the
6223environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package 6223environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package
6224installation. Note that the scripts will be always copied inside the 6224installation. Note that the scripts will be always copied inside the
6225examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no 6225examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no
6226matter what the value of this variable is.</p> 6226matter what the value of this variable is.</p>
6227</div> 6227</div>
6228</div> 6228</div>
6229<div class="sect1"> 6229<div class="sect1">
6230<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6230<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6231<a name="users-and-groups"></a>15.4. System users and groups</h2></div></div></div> 6231<a name="users-and-groups"></a>15.4. System users and groups</h2></div></div></div>
6232<p>If a package needs to create special users and/or groups during 6232<p>If a package needs to create special users and/or groups during
6233installation, it can do so by using the pkginstall framework.</p> 6233installation, it can do so by using the pkginstall framework.</p>
6234<p>Users can be created by adding entries to the 6234<p>Users can be created by adding entries to the
6235<code class="varname">PKG_USERS</code> variable. Each entry has the following 6235<code class="varname">PKG_USERS</code> variable. Each entry has the following
6236syntax:</p> 6236syntax:</p>
6237<pre class="programlisting"> 6237<pre class="programlisting">
6238user:group 6238user:group
6239</pre> 6239</pre>
6240<p>Further specification of user details may be done by setting 6240<p>Further specification of user details may be done by setting
6241per-user variables. 6241per-user variables.
6242<code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the 6242<code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the
6243numeric UID for the user. 6243numeric UID for the user.
6244<code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the 6244<code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the
6245user's description or comment. 6245user's description or comment.
6246<code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the 6246<code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the
6247user's home directory, and defaults to 6247user's home directory, and defaults to
6248<code class="filename">/nonexistent</code> if not specified. 6248<code class="filename">/nonexistent</code> if not specified.
6249<code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the 6249<code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the
6250user's shell, and defaults to <code class="filename">/sbin/nologin</code> if 6250user's shell, and defaults to <code class="filename">/sbin/nologin</code> if
6251not specified.</p> 6251not specified.</p>
6252<p>Similarly, groups can be created by adding entries to the 6252<p>Similarly, groups can be created by adding entries to the
6253<code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p> 6253<code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p>
6254<pre class="programlisting"> 6254<pre class="programlisting">
6255group 6255group
6256</pre> 6256</pre>
6257<p>The numeric GID of the group may be set by defining 6257<p>The numeric GID of the group may be set by defining
6258<code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p> 6258<code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p>
6259<p>If a package needs to create the users and groups at an earlier 6259<p>If a package needs to create the users and groups at an earlier
6260stage, then it can set <code class="varname">USERGROUP_PHASE</code> to 6260stage, then it can set <code class="varname">USERGROUP_PHASE</code> to
6261either <code class="literal">configure</code> or <code class="literal">build</code> to 6261either <code class="literal">configure</code> or <code class="literal">build</code> to
6262indicate the phase before which the users and groups are created. In 6262indicate the phase before which the users and groups are created. In
6263this case, the numeric UIDs and GIDs of the created users and groups 6263this case, the numeric UIDs and GIDs of the created users and groups
6264are automatically hardcoded into the final installation scripts.</p> 6264are automatically hardcoded into the final installation scripts.</p>
6265</div> 6265</div>
6266<div class="sect1"> 6266<div class="sect1">
6267<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6267<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6268<a name="shells"></a>15.5. System shells</h2></div></div></div> 6268<a name="shells"></a>15.5. System shells</h2></div></div></div>
6269<p>Packages that install system shells should register them in the shell 6269<p>Packages that install system shells should register them in the shell
6270database, <code class="filename">/etc/shells</code>, to make things easier to the 6270database, <code class="filename">/etc/shells</code>, to make things easier to the
6271administrator. This must be done from the installation scripts to keep 6271administrator. This must be done from the installation scripts to keep
6272binary packages working on any system. pkginstall provides an easy way to 6272binary packages working on any system. pkginstall provides an easy way to
6273accomplish this task.</p> 6273accomplish this task.</p>
6274<p>When a package provides a shell interpreter, it has to set the 6274<p>When a package provides a shell interpreter, it has to set the
6275<code class="varname">PKG_SHELL</code> variable to its absolute file name. This will 6275<code class="varname">PKG_SHELL</code> variable to its absolute file name. This will
6276add some hooks to the installation scripts to handle it. Consider the 6276add some hooks to the installation scripts to handle it. Consider the
6277following example, taken from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/zsh/README.html" target="_top"><code class="filename">shells/zsh</code></a>:</p> 6277following example, taken from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/zsh/README.html" target="_top"><code class="filename">shells/zsh</code></a>:</p>
6278<pre class="programlisting"> 6278<pre class="programlisting">
6279PKG_SHELL= ${PREFIX}/bin/zsh 6279PKG_SHELL= ${PREFIX}/bin/zsh
6280</pre> 6280</pre>
6281<div class="sect2"> 6281<div class="sect2">
6282<div class="titlepage"><div><div><h3 class="title"> 6282<div class="titlepage"><div><div><h3 class="title">
6283<a name="shells-disable"></a>15.5.1. Disabling shell registration</h3></div></div></div> 6283<a name="shells-disable"></a>15.5.1. Disabling shell registration</h3></div></div></div>
6284<p>The automatic registration of shell interpreters can be disabled by 6284<p>The automatic registration of shell interpreters can be disabled by
6285the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code> 6285the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code>
6286environment variable to <code class="literal">NO</code>.</p> 6286environment variable to <code class="literal">NO</code>.</p>
6287</div> 6287</div>
6288</div> 6288</div>
6289<div class="sect1"> 6289<div class="sect1">
6290<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6290<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6291<a name="fonts"></a>15.6. Fonts</h2></div></div></div> 6291<a name="fonts"></a>15.6. Fonts</h2></div></div></div>
6292<p>Packages that install X11 fonts should update the database files 6292<p>Packages that install X11 fonts should update the database files
6293that index the fonts within each fonts directory. This can easily be 6293that index the fonts within each fonts directory. This can easily be
6294accomplished within the pkginstall framework.</p> 6294accomplished within the pkginstall framework.</p>
6295<p>When a package installs X11 fonts, it must list the directories in 6295<p>When a package installs X11 fonts, it must list the directories in
6296which fonts are installed in the 6296which fonts are installed in the
6297<code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables, 6297<code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables,
6298where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>, 6298where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>,
6299<span class="quote">&#8220;<span class="quote">type1</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">x11</span>&#8221;</span>. This will add hooks to the 6299<span class="quote">&#8220;<span class="quote">type1</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">x11</span>&#8221;</span>. This will add hooks to the
6300installation scripts to run the appropriate commands to update the fonts 6300installation scripts to run the appropriate commands to update the fonts
6301database files within each of those directories. For convenience, if the 6301database files within each of those directories. For convenience, if the
6302directory path is relative, it is taken to be relative to the package's 6302directory path is relative, it is taken to be relative to the package's
6303installation prefix. Consider the following example, taken from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/fonts/dbz-ttf/README.html" target="_top"><code class="filename">fonts/dbz-ttf</code></a>:</p> 6303installation prefix. Consider the following example, taken from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/fonts/dbz-ttf/README.html" target="_top"><code class="filename">fonts/dbz-ttf</code></a>:</p>
6304<pre class="programlisting"> 6304<pre class="programlisting">
6305FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF 6305FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
6306</pre> 6306</pre>
6307<div class="sect2"> 6307<div class="sect2">
6308<div class="titlepage"><div><div><h3 class="title"> 6308<div class="titlepage"><div><div><h3 class="title">
6309<a name="fonts-disable"></a>15.6.1. Disabling automatic update of the fonts databases</h3></div></div></div> 6309<a name="fonts-disable"></a>15.6.1. Disabling automatic update of the fonts databases</h3></div></div></div>
6310<p>The automatic update of fonts databases can be disabled by 6310<p>The automatic update of fonts databases can be disabled by
6311the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code> 6311the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code>
6312environment variable to <code class="literal">NO</code>.</p> 6312environment variable to <code class="literal">NO</code>.</p>
6313</div> 6313</div>
6314</div> 6314</div>
6315</div> 6315</div>
6316<div class="chapter"> 6316<div class="chapter">
6317<div class="titlepage"><div><div><h2 class="title"> 6317<div class="titlepage"><div><div><h2 class="title">
6318<a name="options"></a>Chapter 16. Options handling</h2></div></div></div> 6318<a name="options"></a>Chapter 16. Options handling</h2></div></div></div>
6319<div class="toc"> 6319<div class="toc">
6320<p><b>Table of Contents</b></p> 6320<p><b>Table of Contents</b></p>
6321<dl> 6321<dl>
6322<dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt> 6322<dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
6323<dt><span class="sect1"><a href="#converting-to-options">16.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt> 6323<dt><span class="sect1"><a href="#converting-to-options">16.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
6324<dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt> 6324<dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
6325<dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt> 6325<dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
6326</dl> 6326</dl>
6327</div> 6327</div>
6328<p>Many packages have the ability to be built to support different 6328<p>Many packages have the ability to be built to support different
6329sets of features. <code class="filename">bsd.options.mk</code> is a framework 6329sets of features. <code class="filename">bsd.options.mk</code> is a framework
6330in pkgsrc that provides generic handling of those options that 6330in pkgsrc that provides generic handling of those options that
6331determine different ways in which the packages can be built. It's 6331determine different ways in which the packages can be built. It's
6332possible for the user to specify exactly which sets of options will be 6332possible for the user to specify exactly which sets of options will be
6333built into a package or to allow a set of global default options 6333built into a package or to allow a set of global default options
6334apply.</p> 6334apply.</p>
6335<p>There are two broad classes of behaviors that one might want to 6335<p>There are two broad classes of behaviors that one might want to
6336control via options. One is whether some particular feature is 6336control via options. One is whether some particular feature is
6337enabled in a program that will be built anyway, often by including or 6337enabled in a program that will be built anyway, often by including or
6338not including a dependency on some other package. The other is 6338not including a dependency on some other package. The other is
6339whether or not an additional program will be built as part of the 6339whether or not an additional program will be built as part of the
6340package. Generally, it is better to make a split package for such 6340package. Generally, it is better to make a split package for such
6341additional programs instead of using options, because it enables 6341additional programs instead of using options, because it enables
6342binary packages to be built which can then be added separately. For 6342binary packages to be built which can then be added separately. For
6343example, the foo package might have minimal dependencies (those 6343example, the foo package might have minimal dependencies (those
6344packages without which foo doesn't make sense), and then the foo-gfoo 6344packages without which foo doesn't make sense), and then the foo-gfoo
6345package might include the GTK frontend program gfoo. This is better 6345package might include the GTK frontend program gfoo. This is better
6346than including a gtk option to foo that adds gfoo, because either that 6346than including a gtk option to foo that adds gfoo, because either that
6347option is default, in which case binary users can't get foo without 6347option is default, in which case binary users can't get foo without
6348gfoo, or not default, in which case they can't get gfoo. With split 6348gfoo, or not default, in which case they can't get gfoo. With split
6349packages, they can install foo without having GTK, and later decide to 6349packages, they can install foo without having GTK, and later decide to
6350install gfoo (pulling in GTK at that time). This is an advantage to 6350install gfoo (pulling in GTK at that time). This is an advantage to
6351source users too, avoiding the need for rebuilds.</p> 6351source users too, avoiding the need for rebuilds.</p>
6352<p>Plugins with widely varying dependencies should usually be split 6352<p>Plugins with widely varying dependencies should usually be split
6353instead of options.</p> 6353instead of options.</p>
6354<p>It is often more work to maintain split packages, especially if 6354<p>It is often more work to maintain split packages, especially if
6355the upstream package does not support this. The decision of split 6355the upstream package does not support this. The decision of split
6356vs. option should be made based on the likelihood that users will want 6356vs. option should be made based on the likelihood that users will want
6357or object to the various pieces, the size of the dependencies that are 6357or object to the various pieces, the size of the dependencies that are
6358included, and the amount of work.</p> 6358included, and the amount of work.</p>
6359<p>A further consideration is licensing. Non-free parts, or parts 6359<p>A further consideration is licensing. Non-free parts, or parts
6360that depend on non-free dependencies (especially plugins) should 6360that depend on non-free dependencies (especially plugins) should
6361almost always be split if feasible.</p> 6361almost always be split if feasible.</p>
6362<div class="sect1"> 6362<div class="sect1">
6363<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6363<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6364<a name="global-default-options"></a>16.1. Global default options</h2></div></div></div> 6364<a name="global-default-options"></a>16.1. Global default options</h2></div></div></div>
6365<p>Global default options are listed in 6365<p>Global default options are listed in
6366<code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options 6366<code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options
6367that should be built into every package if that option is supported. 6367that should be built into every package if that option is supported.
6368This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> 6368This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
6369</div> 6369</div>
6370<div class="sect1"> 6370<div class="sect1">
6371<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6371<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6372<a name="converting-to-options"></a>16.2. Converting packages to use <code class="filename">bsd.options.mk</code> 6372<a name="converting-to-options"></a>16.2. Converting packages to use <code class="filename">bsd.options.mk</code>
6373</h2></div></div></div> 6373</h2></div></div></div>
6374<p>The following example shows how 6374<p>The following example shows how
6375<code class="filename">bsd.options.mk</code> should be used 6375<code class="filename">bsd.options.mk</code> should be used
6376by the hypothetical ``wibble'' package, either in the package 6376by the hypothetical ``wibble'' package, either in the package
6377<code class="filename">Makefile</code>, or in a file, 6377<code class="filename">Makefile</code>, or in a file,
6378e.g. <code class="filename">options.mk</code>, that is included by the 6378e.g. <code class="filename">options.mk</code>, that is included by the
6379main package <code class="filename">Makefile</code>.</p> 6379main package <code class="filename">Makefile</code>.</p>
6380<pre class="programlisting"> 6380<pre class="programlisting">
6381PKG_OPTIONS_VAR= PKG_OPTIONS.wibble 6381PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
6382PKG_SUPPORTED_OPTIONS= wibble-foo ldap 6382PKG_SUPPORTED_OPTIONS= wibble-foo ldap
6383PKG_OPTIONS_OPTIONAL_GROUPS= database 6383PKG_OPTIONS_OPTIONAL_GROUPS= database
6384PKG_OPTIONS_GROUP.database= mysql pgsql 6384PKG_OPTIONS_GROUP.database= mysql pgsql
6385PKG_SUGGESTED_OPTIONS= wibble-foo 6385PKG_SUGGESTED_OPTIONS= wibble-foo
6386PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap 6386PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
6387PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo 6387PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
6388 6388
6389.include "../../mk/bsd.prefs.mk" 6389.include "../../mk/bsd.prefs.mk"
6390 6390
6391# this package was previously named wibble2 6391# this package was previously named wibble2
6392.if defined(PKG_OPTIONS.wibble2) 6392.if defined(PKG_OPTIONS.wibble2)
6393PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2} 6393PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
6394PKG_OPTIONS_DEPRECATED_WARNINGS+= \ 6394PKG_OPTIONS_DEPRECATED_WARNINGS+= \
6395 "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead." 6395 "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
6396.endif 6396.endif
6397 6397
6398.include "../../mk/bsd.options.mk" 6398.include "../../mk/bsd.options.mk"
6399 6399
6400# Package-specific option-handling 6400# Package-specific option-handling
6401 6401
6402### 6402###
6403### FOO support 6403### FOO support
6404### 6404###
6405.if !empty(PKG_OPTIONS:Mwibble-foo) 6405.if !empty(PKG_OPTIONS:Mwibble-foo)
6406CONFIGURE_ARGS+= --enable-foo 6406CONFIGURE_ARGS+= --enable-foo
6407.endif 6407.endif
6408 6408
6409### 6409###
6410### LDAP support 6410### LDAP support
6411### 6411###
6412.if !empty(PKG_OPTIONS:Mldap) 6412.if !empty(PKG_OPTIONS:Mldap)
6413. include "../../databases/openldap-client/buildlink3.mk" 6413. include "../../databases/openldap-client/buildlink3.mk"
6414CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client} 6414CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
6415.endif 6415.endif
6416 6416
6417### 6417###
6418### database support 6418### database support
6419### 6419###
6420.if !empty(PKG_OPTIONS:Mmysql) 6420.if !empty(PKG_OPTIONS:Mmysql)
6421. include "../../mk/mysql.buildlink3.mk" 6421. include "../../mk/mysql.buildlink3.mk"
6422.endif 6422.endif
6423.if !empty(PKG_OPTIONS:Mpgsql) 6423.if !empty(PKG_OPTIONS:Mpgsql)
6424. include "../../mk/pgsql.buildlink3.mk" 6424. include "../../mk/pgsql.buildlink3.mk"
6425.endif 6425.endif
6426</pre> 6426</pre>
6427<p>The first section contains the information about which build 6427<p>The first section contains the information about which build
6428options are supported by the package, and any default options settings 6428options are supported by the package, and any default options settings
6429if needed.</p> 6429if needed.</p>
6430<div class="orderedlist"><ol class="orderedlist" type="1"> 6430<div class="orderedlist"><ol class="orderedlist" type="1">
6431<li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the 6431<li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the
6432<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> variable that the user can set to override the default 6432<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> variable that the user can set to override the default
6433options. It should be set to 6433options. It should be set to
6434PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to 6434PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to
6435PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined 6435PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined
6436at the point where the options are processed.</p></li> 6436at the point where the options are processed.</p></li>
6437<li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of 6437<li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of
6438build options supported by the package.</p></li> 6438build options supported by the package.</p></li>
6439<li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a 6439<li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
6440list of names of groups of mutually exclusive options. The options in 6440list of names of groups of mutually exclusive options. The options in
6441each group are listed in 6441each group are listed in
6442<code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>. 6442<code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>.
6443The most specific setting of any option from the group takes 6443The most specific setting of any option from the group takes
6444precedence over all other options in the group. Options from the 6444precedence over all other options in the group. Options from the
6445groups will be automatically added to 6445groups will be automatically added to
6446<code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li> 6446<code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li>
6447<li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like 6447<li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like
6448<code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the 6448<code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the
6449packages will fail if no option from the group is 6449packages will fail if no option from the group is
6450selected.</p></li> 6450selected.</p></li>
6451<li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list 6451<li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list
6452of names of sets of options. At least one option from each set must 6452of names of sets of options. At least one option from each set must
6453be selected. The options in each set are listed in 6453be selected. The options in each set are listed in
6454<code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>. 6454<code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>.
6455Options from the sets will be automatically added to 6455Options from the sets will be automatically added to
6456<code class="varname">PKG_SUPPORTED_OPTIONS</code>. Building the package will 6456<code class="varname">PKG_SUPPORTED_OPTIONS</code>. Building the package will
6457fail if no option from the set is selected.</p></li> 6457fail if no option from the set is selected.</p></li>
6458<li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of 6458<li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of
6459build options which are enabled by default.</p></li> 6459build options which are enabled by default.</p></li>
6460<li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list 6460<li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
6461of 6461of
6462<span class="quote">&#8220;<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;</span> 6462<span class="quote">&#8220;<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;</span>
6463pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to 6463pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to
6464their option counterparts. Pairs should be added with 6464their option counterparts. Pairs should be added with
6465<span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep the listing of global legacy variables. A 6465<span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep the listing of global legacy variables. A
6466warning will be issued if the user uses a legacy 6466warning will be issued if the user uses a legacy
6467variable.</p></li> 6467variable.</p></li>
6468<li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list 6468<li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
6469of 6469of
6470<span class="quote">&#8220;<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;</span> 6470<span class="quote">&#8220;<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;</span>
6471pairs that map options that have been renamed to their new 6471pairs that map options that have been renamed to their new
6472counterparts. Pairs should be added with <span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep 6472counterparts. Pairs should be added with <span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep
6473the listing of global legacy options. A warning will be issued if 6473the listing of global legacy options. A warning will be issued if
6474the user uses a legacy option.</p></li> 6474the user uses a legacy option.</p></li>
6475<li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of 6475<li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of
6476options implied by deprecated variables used. This can be used for 6476options implied by deprecated variables used. This can be used for
6477cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor 6477cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor
6478<code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when 6478<code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when
6479<code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li> 6479<code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li>
6480<li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is 6480<li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
6481a list of warnings about deprecated variables or options used, and 6481a list of warnings about deprecated variables or options used, and
6482what to use instead.</p></li> 6482what to use instead.</p></li>
6483</ol></div> 6483</ol></div>
6484<p>A package should never modify 6484<p>A package should never modify
6485<code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in 6485<code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in
6486<code class="varname">PKG_OPTIONS_VAR</code>. These are strictly user-settable. 6486<code class="varname">PKG_OPTIONS_VAR</code>. These are strictly user-settable.
6487To suggest a default set of options, use 6487To suggest a default set of options, use
6488<code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p> 6488<code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p>
6489<p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before 6489<p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before
6490including <code class="filename">bsd.options.mk</code>. If none of 6490including <code class="filename">bsd.options.mk</code>. If none of
6491<code class="varname">PKG_SUPPORTED_OPTIONS</code>, 6491<code class="varname">PKG_SUPPORTED_OPTIONS</code>,
6492<code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and 6492<code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
6493<code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can 6493<code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can
6494happen with platform-specific options if none of them is supported on 6494happen with platform-specific options if none of them is supported on
6495the current platform), <code class="varname">PKG_OPTIONS</code> is set to the 6495the current platform), <code class="varname">PKG_OPTIONS</code> is set to the
6496empty list and the package is otherwise treated as not using the 6496empty list and the package is otherwise treated as not using the
6497options framework.</p> 6497options framework.</p>
6498<p>After the inclusion of <code class="filename">bsd.options.mk</code>, the 6498<p>After the inclusion of <code class="filename">bsd.options.mk</code>, the
6499variable <code class="varname">PKG_OPTIONS</code> contains the list of selected 6499variable <code class="varname">PKG_OPTIONS</code> contains the list of selected
6500build options, properly filtered to remove unsupported and duplicate 6500build options, properly filtered to remove unsupported and duplicate
6501options.</p> 6501options.</p>
6502<p>The remaining sections contain the logic that is specific to 6502<p>The remaining sections contain the logic that is specific to
6503each option. The correct way to check for an option is to check 6503each option. The correct way to check for an option is to check
6504whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p> 6504whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p>
6505<pre class="programlisting"> 6505<pre class="programlisting">
6506.if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>) 6506.if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>)
6507</pre> 6507</pre>
6508</div> 6508</div>
6509<div class="sect1"> 6509<div class="sect1">
6510<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6510<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6511<a name="option-names"></a>16.3. Option Names</h2></div></div></div> 6511<a name="option-names"></a>16.3. Option Names</h2></div></div></div>
6512<p>Options that enable similar features in different packages (like 6512<p>Options that enable similar features in different packages (like
6513optional support for a library) should use a common name in all 6513optional support for a library) should use a common name in all
6514packages that support it (like the name of the library). If another 6514packages that support it (like the name of the library). If another
6515package already has an option with the same meaning, use the same 6515package already has an option with the same meaning, use the same
6516name.</p> 6516name.</p>
6517<p>Options that enable features specific to one package, where it's 6517<p>Options that enable features specific to one package, where it's
6518unlikely that another (unrelated) package has the same (or a similar) 6518unlikely that another (unrelated) package has the same (or a similar)
6519optional feature, should use a name prefixed with 6519optional feature, should use a name prefixed with
6520<code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p> 6520<code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p>
6521<p>If a group of related packages share an optional feature 6521<p>If a group of related packages share an optional feature
6522specific to that group, prefix it with the name of the 6522specific to that group, prefix it with the name of the
6523<span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> package 6523<span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> package
6524(e. g. <code class="varname">djbware-errno-hack</code>).</p> 6524(e. g. <code class="varname">djbware-errno-hack</code>).</p>
6525<p>For new options, add a line to 6525<p>For new options, add a line to
6526<code class="filename">mk/defaults/options.description</code>. Lines have two 6526<code class="filename">mk/defaults/options.description</code>. Lines have two
6527fields, separated by tab. The first field is the option name, the 6527fields, separated by tab. The first field is the option name, the
6528second its description. The description should be a whole sentence 6528second its description. The description should be a whole sentence
6529(starting with an uppercase letter and ending with a period) that 6529(starting with an uppercase letter and ending with a period) that
@@ -6670,2039 +6670,2039 @@ details.

 @@ -6670,2039 +6670,2039 @@ details.

6670 is enabled by default.</p> 6670 is enabled by default.</p>
6671</li> 6671</li>
6672<li class="listitem"><p><code class="varname">X11PREFIX</code> should be used to refer to 6672<li class="listitem"><p><code class="varname">X11PREFIX</code> should be used to refer to
6673 the installed location of an X11 6673 the installed location of an X11
6674 package. <code class="varname">X11PREFIX</code> will be set to 6674 package. <code class="varname">X11PREFIX</code> will be set to
6675 <code class="varname">X11BASE</code> if xpkgwedge is not installed, and 6675 <code class="varname">X11BASE</code> if xpkgwedge is not installed, and
6676 to <code class="varname">LOCALBASE</code> if xpkgwedge is 6676 to <code class="varname">LOCALBASE</code> if xpkgwedge is
6677 installed.</p></li> 6677 installed.</p></li>
6678<li class="listitem"> 6678<li class="listitem">
6679<p>If xpkgwedge is installed, it is possible to have some 6679<p>If xpkgwedge is installed, it is possible to have some
6680 packages installed in <code class="varname">X11BASE</code> and some in 6680 packages installed in <code class="varname">X11BASE</code> and some in
6681 <code class="varname">LOCALBASE</code>. To determine the prefix of an 6681 <code class="varname">LOCALBASE</code>. To determine the prefix of an
6682 installed package, the <code class="varname">EVAL_PREFIX</code> 6682 installed package, the <code class="varname">EVAL_PREFIX</code>
6683 definition can be used. It takes pairs in the format 6683 definition can be used. It takes pairs in the format
6684 <span class="quote">&#8220;<span class="quote">DIRNAME=&lt;package&gt;</span>&#8221;</span>, and 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> 6684 <span class="quote">&#8220;<span class="quote">DIRNAME=&lt;package&gt;</span>&#8221;</span>, and 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>
6685 variable <code class="varname">DIRNAME</code> will be set to the prefix 6685 variable <code class="varname">DIRNAME</code> will be set to the prefix
6686 of the installed package &lt;package&gt;, or 6686 of the installed package &lt;package&gt;, or
6687 <span class="quote">&#8220;<span class="quote">${X11PREFIX}</span>&#8221;</span> if the package is not 6687 <span class="quote">&#8220;<span class="quote">${X11PREFIX}</span>&#8221;</span> if the package is not
6688 installed.</p> 6688 installed.</p>
6689<p>This is best illustrated by example.</p> 6689<p>This is best illustrated by example.</p>
6690<p>The following lines are taken from 6690<p>The following lines are taken from
6691 <code class="filename">pkgsrc/wm/scwm/Makefile</code>:</p> 6691 <code class="filename">pkgsrc/wm/scwm/Makefile</code>:</p>
6692<pre class="programlisting"> 6692<pre class="programlisting">
6693EVAL_PREFIX+= GTKDIR=gtk+ 6693EVAL_PREFIX+= GTKDIR=gtk+
6694CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q} 6694CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q}
6695CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q} 6695CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q}
6696CONFIGURE_ARGS+= --enable-multibyte 6696CONFIGURE_ARGS+= --enable-multibyte
6697</pre> 6697</pre>
6698<p>Specific defaults can be defined for the packages 6698<p>Specific defaults can be defined for the packages
6699 evaluated using <code class="varname">EVAL_PREFIX</code>, by using a 6699 evaluated using <code class="varname">EVAL_PREFIX</code>, by using a
6700 definition of the form:</p> 6700 definition of the form:</p>
6701<pre class="programlisting"> 6701<pre class="programlisting">
6702GTKDIR_DEFAULT= ${LOCALBASE} 6702GTKDIR_DEFAULT= ${LOCALBASE}
6703</pre> 6703</pre>
6704<p>where <code class="varname">GTKDIR</code> corresponds 6704<p>where <code class="varname">GTKDIR</code> corresponds
6705 to the first definition in 6705 to the first definition in
6706 the <code class="varname">EVAL_PREFIX</code> pair.</p> 6706 the <code class="varname">EVAL_PREFIX</code> pair.</p>
6707</li> 6707</li>
6708<li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should 6708<li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should
6709 install files according to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span></a>, with the exception that 6709 install files according to <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span></a>, with the exception that
6710 manual pages go into <code class="filename">${PREFIX}/man</code>, not 6710 manual pages go into <code class="filename">${PREFIX}/man</code>, not
6711 <code class="filename">${PREFIX}/share/man</code>.</p></li> 6711 <code class="filename">${PREFIX}/share/man</code>.</p></li>
6712</ul></div> 6712</ul></div>
6713</div> 6713</div>
6714<div class="sect1"> 6714<div class="sect1">
6715<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6715<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6716<a name="build.builddirs"></a>17.3. Directories used during the build process</h2></div></div></div> 6716<a name="build.builddirs"></a>17.3. Directories used during the build process</h2></div></div></div>
6717<p>When building a package, various directories are used to store 6717<p>When building a package, various directories are used to store
6718 source files, temporary files, pkgsrc-internal files, and so on. These 6718 source files, temporary files, pkgsrc-internal files, and so on. These
6719 directories are explained here.</p> 6719 directories are explained here.</p>
6720<p>Some of the directory variables contain relative pathnames. There 6720<p>Some of the directory variables contain relative pathnames. There
6721 are two common base directories for these relative directories: 6721 are two common base directories for these relative directories:
6722 <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are 6722 <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are
6723 pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories 6723 pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories
6724 inside the package itself.</p> 6724 inside the package itself.</p>
6725<div class="variablelist"><dl class="variablelist"> 6725<div class="variablelist"><dl class="variablelist">
6726<dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt> 6726<dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt>
6727<dd><p>This is an absolute pathname that points to the pkgsrc 6727<dd><p>This is an absolute pathname that points to the pkgsrc
6728 root directory. Generally, you don't need 6728 root directory. Generally, you don't need
6729 it.</p></dd> 6729 it.</p></dd>
6730<dt><span class="term"><code class="varname">PKGDIR</code></span></dt> 6730<dt><span class="term"><code class="varname">PKGDIR</code></span></dt>
6731<dd><p>This is an absolute pathname that points to the 6731<dd><p>This is an absolute pathname that points to the
6732 current package.</p></dd> 6732 current package.</p></dd>
6733<dt><span class="term"><code class="varname">PKGPATH</code></span></dt> 6733<dt><span class="term"><code class="varname">PKGPATH</code></span></dt>
6734<dd><p>This is a pathname relative to 6734<dd><p>This is a pathname relative to
6735 <code class="varname">PKGSRCDIR</code> that points to the current 6735 <code class="varname">PKGSRCDIR</code> that points to the current
6736 package.</p></dd> 6736 package.</p></dd>
6737<dt><span class="term"><code class="varname">WRKDIR</code></span></dt> 6737<dt><span class="term"><code class="varname">WRKDIR</code></span></dt>
6738<dd><p>This is an absolute pathname pointing to the directory 6738<dd><p>This is an absolute pathname pointing to the directory
6739 where all work takes place. The distfiles are extracted to this 6739 where all work takes place. The distfiles are extracted to this
6740 directory. It also contains temporary directories and log files used by 6740 directory. It also contains temporary directories and log files used by
6741 the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or 6741 the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or
6742 the <span class="emphasis"><em>wrappers</em></span>.</p></dd> 6742 the <span class="emphasis"><em>wrappers</em></span>.</p></dd>
6743<dt><span class="term"><code class="varname">WRKSRC</code></span></dt> 6743<dt><span class="term"><code class="varname">WRKSRC</code></span></dt>
6744<dd><p>This is an absolute pathname pointing to the directory 6744<dd><p>This is an absolute pathname pointing to the directory
6745 where the distfiles are extracted. It is usually a direct subdirectory 6745 where the distfiles are extracted. It is usually a direct subdirectory
6746 of <code class="varname">WRKDIR</code>, and often it's the only directory entry 6746 of <code class="varname">WRKDIR</code>, and often it's the only directory entry
6747 that isn't hidden. This variable may be changed by a package 6747 that isn't hidden. This variable may be changed by a package
6748 <code class="filename">Makefile</code>.</p></dd> 6748 <code class="filename">Makefile</code>.</p></dd>
6749</dl></div> 6749</dl></div>
6750<p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either 6750<p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either
6751 the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults 6751 the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults
6752 to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the 6752 to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the
6753 <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory. 6753 <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory.
6754 If users would like to have their pkgsrc trees behave in a 6754 If users would like to have their pkgsrc trees behave in a
6755 read-only manner, then the value of 6755 read-only manner, then the value of
6756 <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to 6756 <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to
6757 <span class="emphasis"><em>no</em></span>.</p> 6757 <span class="emphasis"><em>no</em></span>.</p>
6758</div> 6758</div>
6759<div class="sect1"> 6759<div class="sect1">
6760<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6760<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6761<a name="build.running"></a>17.4. Running a phase</h2></div></div></div> 6761<a name="build.running"></a>17.4. Running a phase</h2></div></div></div>
6762<p>You can run a particular phase by typing <span class="command"><strong>make 6762<p>You can run a particular phase by typing <span class="command"><strong>make
6763 phase</strong></span>, where <span class="emphasis"><em>phase</em></span> is the name of the 6763 phase</strong></span>, where <span class="emphasis"><em>phase</em></span> is the name of the
6764 phase. This will automatically run all phases that are required for this 6764 phase. This will automatically run all phases that are required for this
6765 phase. The default phase is <code class="varname">build</code>, that is, when you 6765 phase. The default phase is <code class="varname">build</code>, that is, when you
6766 run <span class="command"><strong>make</strong></span> without parameters in a package directory, 6766 run <span class="command"><strong>make</strong></span> without parameters in a package directory,
6767 the package will be built, but not installed.</p> 6767 the package will be built, but not installed.</p>
6768</div> 6768</div>
6769<div class="sect1"> 6769<div class="sect1">
6770<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6770<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6771<a name="build.fetch"></a>17.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div> 6771<a name="build.fetch"></a>17.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
6772<p>The first step in building a package is to fetch the 6772<p>The first step in building a package is to fetch the
6773 distribution files (distfiles) from the sites that are providing 6773 distribution files (distfiles) from the sites that are providing
6774 them. This is the task of the <span class="emphasis"><em>fetch</em></span> 6774 them. This is the task of the <span class="emphasis"><em>fetch</em></span>
6775 phase.</p> 6775 phase.</p>
6776<div class="sect2"> 6776<div class="sect2">
6777<div class="titlepage"><div><div><h3 class="title"> 6777<div class="titlepage"><div><div><h3 class="title">
6778<a name="build.fetch.what"></a>17.5.1. What to fetch and where to get it from</h3></div></div></div> 6778<a name="build.fetch.what"></a>17.5.1. What to fetch and where to get it from</h3></div></div></div>
6779<p>In simple cases, <code class="varname">MASTER_SITES</code> 6779<p>In simple cases, <code class="varname">MASTER_SITES</code>
6780 defines all URLs from where the distfile, whose name is 6780 defines all URLs from where the distfile, whose name is
6781 derived from the <code class="varname">DISTNAME</code> variable, is 6781 derived from the <code class="varname">DISTNAME</code> variable, is
6782 fetched. The more complicated cases are described 6782 fetched. The more complicated cases are described
6783 below.</p> 6783 below.</p>
6784<p>The variable <code class="varname">DISTFILES</code> specifies 6784<p>The variable <code class="varname">DISTFILES</code> specifies
6785 the list of distfiles that have to be fetched. Its value 6785 the list of distfiles that have to be fetched. Its value
6786 defaults to <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>, 6786 defaults to <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>,
6787 so that most packages don't need to define it at all. 6787 so that most packages don't need to define it at all.
6788 <code class="varname">EXTRACT_SUFX</code> is 6788 <code class="varname">EXTRACT_SUFX</code> is
6789 <code class="literal">.tar.gz</code> by default, but can be changed 6789 <code class="literal">.tar.gz</code> by default, but can be changed
6790 freely. Note that if your package requires additional 6790 freely. Note that if your package requires additional
6791 distfiles to the default one, you cannot just append the 6791 distfiles to the default one, you cannot just append the
6792 additional filenames using the <code class="literal">+=</code> 6792 additional filenames using the <code class="literal">+=</code>
6793 operator, but you have write for example:</p> 6793 operator, but you have write for example:</p>
6794<pre class="programlisting"> 6794<pre class="programlisting">
6795DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz 6795DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
6796</pre> 6796</pre>
6797<p>Each distfile is fetched from a list of sites, usually 6797<p>Each distfile is fetched from a list of sites, usually
6798 <code class="varname">MASTER_SITES</code>. If the package has multiple 6798 <code class="varname">MASTER_SITES</code>. If the package has multiple
6799 <code class="varname">DISTFILES</code> or multiple 6799 <code class="varname">DISTFILES</code> or multiple
6800 <code class="varname">PATCHFILES</code> from different sites, you can 6800 <code class="varname">PATCHFILES</code> from different sites, you can
6801 set 6801 set
6802 <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code> 6802 <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code>
6803 to the list of URLs where the file 6803 to the list of URLs where the file
6804 <code class="filename"><em class="replaceable"><code>distfile</code></em></code> 6804 <code class="filename"><em class="replaceable"><code>distfile</code></em></code>
6805 (including the suffix) can be found.</p> 6805 (including the suffix) can be found.</p>
6806<pre class="programlisting"> 6806<pre class="programlisting">
6807DISTFILES= ${DISTNAME}${EXTRACT_SUFX} 6807DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
6808DISTFILES+= foo-file.tar.gz 6808DISTFILES+= foo-file.tar.gz
6809SITES.foo-file.tar.gz= \ 6809SITES.foo-file.tar.gz= \
6810http://www.somewhere.com/somehow/ \ 6810http://www.somewhere.com/somehow/ \
6811http://www.somewhereelse.com/mirror/somehow/ 6811http://www.somewhereelse.com/mirror/somehow/
6812</pre> 6812</pre>
6813<p>When actually fetching the distfiles, each item from 6813<p>When actually fetching the distfiles, each item from
6814 <code class="varname">MASTER_SITES</code> or 6814 <code class="varname">MASTER_SITES</code> or
6815 <code class="varname">SITES.*</code> gets the name of each distfile 6815 <code class="varname">SITES.*</code> gets the name of each distfile
6816 appended to it, without an intermediate slash. Therefore, 6816 appended to it, without an intermediate slash. Therefore,
6817 all site values have to end with a slash or other separator 6817 all site values have to end with a slash or other separator
6818 character. This allows for example to set 6818 character. This allows for example to set
6819 <code class="varname">MASTER_SITES</code> to a URL of a CGI script 6819 <code class="varname">MASTER_SITES</code> to a URL of a CGI script
6820 that gets the name of the distfile as a parameter. In this 6820 that gets the name of the distfile as a parameter. In this
6821 case, the definition would look like:</p> 6821 case, the definition would look like:</p>
6822<pre class="programlisting"> 6822<pre class="programlisting">
6823MASTER_SITES= http://www.example.com/download.cgi?file= 6823MASTER_SITES= http://www.example.com/download.cgi?file=
6824</pre> 6824</pre>
6825<p> The exception to this rule are URLs starting with a dash. 6825<p> The exception to this rule are URLs starting with a dash.
6826 In that case the URL is taken as is, fetched and the result stored 6826 In that case the URL is taken as is, fetched and the result stored
6827 under the name of the distfile.</p> 6827 under the name of the distfile.</p>
6828<p>There are some predefined values for 6828<p>There are some predefined values for
6829 <code class="varname">MASTER_SITES</code>, which can be used in 6829 <code class="varname">MASTER_SITES</code>, which can be used in
6830 packages. The names of the variables should speak for 6830 packages. The names of the variables should speak for
6831 themselves.</p> 6831 themselves.</p>
6832<pre class="programlisting"> 6832<pre class="programlisting">
6833${MASTER_SITE_APACHE} 6833${MASTER_SITE_APACHE}
6834${MASTER_SITE_BACKUP} 6834${MASTER_SITE_BACKUP}
6835${MASTER_SITE_CYGWIN} 6835${MASTER_SITE_CYGWIN}
6836${MASTER_SITE_DEBIAN} 6836${MASTER_SITE_DEBIAN}
6837${MASTER_SITE_FREEBSD} 6837${MASTER_SITE_FREEBSD}
6838${MASTER_SITE_FREEBSD_LOCAL} 6838${MASTER_SITE_FREEBSD_LOCAL}
6839${MASTER_SITE_GENTOO} 6839${MASTER_SITE_GENTOO}
6840${MASTER_SITE_GNOME} 6840${MASTER_SITE_GNOME}
6841${MASTER_SITE_GNU} 6841${MASTER_SITE_GNU}
6842${MASTER_SITE_GNUSTEP} 6842${MASTER_SITE_GNUSTEP}
6843${MASTER_SITE_IFARCHIVE} 6843${MASTER_SITE_IFARCHIVE}
6844${MASTER_SITE_KDE} 6844${MASTER_SITE_KDE}
6845${MASTER_SITE_MOZILLA} 6845${MASTER_SITE_MOZILLA}
6846${MASTER_SITE_MYSQL} 6846${MASTER_SITE_MYSQL}
6847${MASTER_SITE_OPENOFFICE} 6847${MASTER_SITE_OPENOFFICE}
6848${MASTER_SITE_PERL_CPAN} 6848${MASTER_SITE_PERL_CPAN}
6849${MASTER_SITE_PGSQL} 6849${MASTER_SITE_PGSQL}
6850${MASTER_SITE_R_CRAN} 6850${MASTER_SITE_R_CRAN}
6851${MASTER_SITE_SOURCEFORGE} 6851${MASTER_SITE_SOURCEFORGE}
6852${MASTER_SITE_SOURCEFORGE_JP} 6852${MASTER_SITE_SOURCEFORGE_JP}
6853${MASTER_SITE_SUNSITE} 6853${MASTER_SITE_SUNSITE}
6854${MASTER_SITE_SUSE} 6854${MASTER_SITE_SUSE}
6855${MASTER_SITE_TEX_CTAN} 6855${MASTER_SITE_TEX_CTAN}
6856${MASTER_SITE_XCONTRIB} 6856${MASTER_SITE_XCONTRIB}
6857${MASTER_SITE_XEMACS} 6857${MASTER_SITE_XEMACS}
6858</pre> 6858</pre>
6859<p>Some explanations for the less self-explaining ones: 6859<p>Some explanations for the less self-explaining ones:
6860 <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites 6860 <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites
6861 for packages that are maintained in <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/%24%7BDIST_SUBDIR%7D" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}</a>. <code class="varname">MASTER_SITE_LOCAL</code> contains local 6861 for packages that are maintained in <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/%24%7BDIST_SUBDIR%7D" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}</a>. <code class="varname">MASTER_SITE_LOCAL</code> contains local
6862 package source distributions that are maintained in <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/</a>.</p> 6862 package source distributions that are maintained in <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/</a>.</p>
6863<p>If you choose one of these predefined sites, you may 6863<p>If you choose one of these predefined sites, you may
6864 want to specify a subdirectory of that site. Since these 6864 want to specify a subdirectory of that site. Since these
6865 macros may expand to more than one actual site, you 6865 macros may expand to more than one actual site, you
6866 <span class="emphasis"><em>must</em></span> use the following construct to 6866 <span class="emphasis"><em>must</em></span> use the following construct to
6867 specify a subdirectory:</p> 6867 specify a subdirectory:</p>
6868<pre class="programlisting"> 6868<pre class="programlisting">
6869MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/} 6869MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
6870MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/} 6870MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
6871</pre> 6871</pre>
6872<p>Note the trailing slash after the subdirectory 6872<p>Note the trailing slash after the subdirectory
6873 name.</p> 6873 name.</p>
6874</div> 6874</div>
6875<div class="sect2"> 6875<div class="sect2">
6876<div class="titlepage"><div><div><h3 class="title"> 6876<div class="titlepage"><div><div><h3 class="title">
6877<a name="build.fetch.how"></a>17.5.2. How are the files fetched?</h3></div></div></div> 6877<a name="build.fetch.how"></a>17.5.2. How are the files fetched?</h3></div></div></div>
6878<p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that 6878<p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that
6879 all the distfiles exist in a local directory 6879 all the distfiles exist in a local directory
6880 (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc 6880 (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc
6881 user). If the files do not exist, they are fetched using 6881 user). If the files do not exist, they are fetched using
6882 commands of the form</p> 6882 commands of the form</p>
6883<pre class="programlisting"> 6883<pre class="programlisting">
6884${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS} 6884${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
6885</pre> 6885</pre>
6886<p>where <code class="literal">${site}</code> varies through 6886<p>where <code class="literal">${site}</code> varies through
6887 several possibilities in turn: first, 6887 several possibilities in turn: first,
6888 <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the 6888 <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the
6889 sites specified in either <code class="varname">SITES.file</code> if 6889 sites specified in either <code class="varname">SITES.file</code> if
6890 defined, else <code class="varname">MASTER_SITES</code> or 6890 defined, else <code class="varname">MASTER_SITES</code> or
6891 <code class="varname">PATCH_SITES</code>, as applies, then finally the 6891 <code class="varname">PATCH_SITES</code>, as applies, then finally the
6892 value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of 6892 value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of
6893 all except the first and the last can be optionally sorted 6893 all except the first and the last can be optionally sorted
6894 by the user, via setting either 6894 by the user, via setting either
6895 <code class="varname">MASTER_SORT_RANDOM</code>, and 6895 <code class="varname">MASTER_SORT_RANDOM</code>, and
6896 <code class="varname">MASTER_SORT_AWK</code> or 6896 <code class="varname">MASTER_SORT_AWK</code> or
6897 <code class="varname">MASTER_SORT_REGEX</code>.</p> 6897 <code class="varname">MASTER_SORT_REGEX</code>.</p>
6898<p> The specific command and arguments used depend on the 6898<p> The specific command and arguments used depend on the
6899 <code class="varname">FETCH_USING</code> parameter. The example above is 6899 <code class="varname">FETCH_USING</code> parameter. The example above is
6900 for <code class="literal">FETCH_USING=custom</code>.</p> 6900 for <code class="literal">FETCH_USING=custom</code>.</p>
6901<p>The distfiles mirror run by the NetBSD Foundation uses the 6901<p>The distfiles mirror run by the NetBSD Foundation uses the
6902 <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the 6902 <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the
6903 distfiles, if they are freely distributable. Packages setting 6903 distfiles, if they are freely distributable. Packages setting
6904 <code class="varname">NO_SRC_ON_FTP</code> (usually to 6904 <code class="varname">NO_SRC_ON_FTP</code> (usually to
6905 <span class="quote">&#8220;<span class="quote">${RESTRICTED}</span>&#8221;</span>) will not have their distfiles 6905 <span class="quote">&#8220;<span class="quote">${RESTRICTED}</span>&#8221;</span>) will not have their distfiles
6906 mirrored.</p> 6906 mirrored.</p>
6907</div> 6907</div>
6908</div> 6908</div>
6909<div class="sect1"> 6909<div class="sect1">
6910<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6910<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6911<a name="build.checksum"></a>17.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div> 6911<a name="build.checksum"></a>17.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div>
6912<p>After the distfile(s) are fetched, their checksum is 6912<p>After the distfile(s) are fetched, their checksum is
6913 generated and compared with the checksums stored in the 6913 generated and compared with the checksums stored in the
6914 distinfo file. If the checksums don't match, the build is 6914 distinfo file. If the checksums don't match, the build is
6915 aborted. This is to ensure the same distfile is used for 6915 aborted. This is to ensure the same distfile is used for
6916 building, and that the distfile wasn't changed, e.g. by some 6916 building, and that the distfile wasn't changed, e.g. by some
6917 malign force, deliberately changed distfiles on the master 6917 malign force, deliberately changed distfiles on the master
6918 distribution site or network lossage.</p> 6918 distribution site or network lossage.</p>
6919</div> 6919</div>
6920<div class="sect1"> 6920<div class="sect1">
6921<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6921<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6922<a name="build.extract"></a>17.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div> 6922<a name="build.extract"></a>17.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div>
6923<p>When the distfiles are present on the local system, they 6923<p>When the distfiles are present on the local system, they
6924 need to be extracted, as they usually come in the form of some 6924 need to be extracted, as they usually come in the form of some
6925 compressed archive format.</p> 6925 compressed archive format.</p>
6926<p>By default, all <code class="varname">DISTFILES</code> are 6926<p>By default, all <code class="varname">DISTFILES</code> are
6927 extracted. If you only need some of them, you can set the 6927 extracted. If you only need some of them, you can set the
6928 <code class="varname">EXTRACT_ONLY</code> variable to the list of those 6928 <code class="varname">EXTRACT_ONLY</code> variable to the list of those
6929 files.</p> 6929 files.</p>
6930<p>Extracting the files is usually done by a little 6930<p>Extracting the files is usually done by a little
6931 program, <code class="filename">mk/extract/extract</code>, which 6931 program, <code class="filename">mk/extract/extract</code>, which
6932 already knows how to extract various archive formats, so most 6932 already knows how to extract various archive formats, so most
6933 likely you will not need to change anything here. But if you 6933 likely you will not need to change anything here. But if you
6934 need, the following variables may help you:</p> 6934 need, the following variables may help you:</p>
6935<div class="variablelist"><dl class="variablelist"> 6935<div class="variablelist"><dl class="variablelist">
6936<dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt> 6936<dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
6937<dd><p>Use these variables to override the default 6937<dd><p>Use these variables to override the default
6938 options for an extract command, which are defined in 6938 options for an extract command, which are defined in
6939 <code class="filename">mk/extract/extract</code>.</p></dd> 6939 <code class="filename">mk/extract/extract</code>.</p></dd>
6940<dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt> 6940<dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt>
6941<dd><p>This variable can be set to 6941<dd><p>This variable can be set to
6942 <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code> 6942 <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code>
6943 (which is the default value), <code class="literal">pax</code>, or an 6943 (which is the default value), <code class="literal">pax</code>, or an
6944 absolute pathname pointing to the command with which tar 6944 absolute pathname pointing to the command with which tar
6945 archives should be extracted. It is preferred to choose bsdtar over gtar 6945 archives should be extracted. It is preferred to choose bsdtar over gtar
6946 if NetBSD's pax-as-tar is not good enough.</p></dd> 6946 if NetBSD's pax-as-tar is not good enough.</p></dd>
6947</dl></div> 6947</dl></div>
6948<p>If the <code class="filename">extract</code> program doesn't 6948<p>If the <code class="filename">extract</code> program doesn't
6949 serve your needs, you can also override the 6949 serve your needs, you can also override the
6950 <code class="varname">EXTRACT_CMD</code> variable, which holds the 6950 <code class="varname">EXTRACT_CMD</code> variable, which holds the
6951 command used for extracting the files. This command is 6951 command used for extracting the files. This command is
6952 executed in the <code class="filename">${WRKSRC}</code> 6952 executed in the <code class="filename">${WRKSRC}</code>
6953 directory. During execution of this command, the shell 6953 directory. During execution of this command, the shell
6954 variable <code class="varname">extract_file</code> holds the absolute 6954 variable <code class="varname">extract_file</code> holds the absolute
6955 pathname of the file that is going to be extracted.</p> 6955 pathname of the file that is going to be extracted.</p>
6956<p>And if that still does not suffice, you can override the 6956<p>And if that still does not suffice, you can override the
6957 <code class="varname">do-extract</code> target in the package 6957 <code class="varname">do-extract</code> target in the package
6958 Makefile.</p> 6958 Makefile.</p>
6959</div> 6959</div>
6960<div class="sect1"> 6960<div class="sect1">
6961<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6961<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6962<a name="build.patch"></a>17.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div> 6962<a name="build.patch"></a>17.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
6963<p>After extraction, all the patches named by the 6963<p>After extraction, all the patches named by the
6964 <code class="varname">PATCHFILES</code>, those present in the patches 6964 <code class="varname">PATCHFILES</code>, those present in the patches
6965 subdirectory of the package as well as in 6965 subdirectory of the package as well as in
6966 $LOCALPATCHES/$PKGPATH (e.g. 6966 $LOCALPATCHES/$PKGPATH (e.g.
6967 <code class="filename">/usr/local/patches/graphics/png</code>) are 6967 <code class="filename">/usr/local/patches/graphics/png</code>) are
6968 applied. Patchfiles ending in <code class="filename">.Z</code> or 6968 applied. Patchfiles ending in <code class="filename">.Z</code> or
6969 <code class="filename">.gz</code> are uncompressed before they are 6969 <code class="filename">.gz</code> are uncompressed before they are
6970 applied, files ending in <code class="filename">.orig</code> or 6970 applied, files ending in <code class="filename">.orig</code> or
6971 <code class="filename">.rej</code> are ignored. Any special options to 6971 <code class="filename">.rej</code> are ignored. Any special options to
6972 <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 6972 <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
6973 <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> 6973 <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>
6974<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 6974<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
6975 it fail if the patches apply with some lines of fuzz. Please 6975 it fail if the patches apply with some lines of fuzz. Please
6976 fix (regen) the patches so that they apply cleanly. The 6976 fix (regen) the patches so that they apply cleanly. The
6977 rationale behind this is that patches that don't apply cleanly 6977 rationale behind this is that patches that don't apply cleanly
6978 may end up being applied in the wrong place, and cause severe 6978 may end up being applied in the wrong place, and cause severe
6979 harm there.</p> 6979 harm there.</p>
6980</div> 6980</div>
6981<div class="sect1"> 6981<div class="sect1">
6982<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6982<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6983<a name="build.tools"></a>17.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div> 6983<a name="build.tools"></a>17.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
6984<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>. 6984<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>.
6985 </p> 6985 </p>
6986</div> 6986</div>
6987<div class="sect1"> 6987<div class="sect1">
6988<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 6988<div class="titlepage"><div><div><h2 class="title" style="clear: both">
6989<a name="build.wrapper"></a>17.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div> 6989<a name="build.wrapper"></a>17.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div>
6990<p>This phase creates wrapper programs for the compilers and 6990<p>This phase creates wrapper programs for the compilers and
6991 linkers. The following variables can be used to tweak the 6991 linkers. The following variables can be used to tweak the
6992 wrappers.</p> 6992 wrappers.</p>
6993<div class="variablelist"><dl class="variablelist"> 6993<div class="variablelist"><dl class="variablelist">
6994<dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt> 6994<dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt>
6995<dd><p>The command used to print progress 6995<dd><p>The command used to print progress
6996 messages. Does nothing by default. Set to 6996 messages. Does nothing by default. Set to
6997 <code class="literal">${ECHO}</code> to see the progress 6997 <code class="literal">${ECHO}</code> to see the progress
6998 messages.</p></dd> 6998 messages.</p></dd>
6999<dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt> 6999<dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt>
7000<dd><p>This variable can be set to 7000<dd><p>This variable can be set to
7001 <code class="literal">yes</code> (default) or <code class="literal">no</code>, 7001 <code class="literal">yes</code> (default) or <code class="literal">no</code>,
7002 depending on whether you want additional information in the 7002 depending on whether you want additional information in the
7003 wrapper log file.</p></dd> 7003 wrapper log file.</p></dd>
7004<dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt> 7004<dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt>
7005<dd><p>This variable can be set to 7005<dd><p>This variable can be set to
7006 <code class="literal">yes</code> or <code class="literal">no</code>, depending 7006 <code class="literal">yes</code> or <code class="literal">no</code>, depending
7007 on whether the wrapper should use its cache, which will 7007 on whether the wrapper should use its cache, which will
7008 improve the speed. The default value is 7008 improve the speed. The default value is
7009 <code class="literal">yes</code>, but is forced to 7009 <code class="literal">yes</code>, but is forced to
7010 <code class="literal">no</code> if the platform does not support 7010 <code class="literal">no</code> if the platform does not support
7011 it.</p></dd> 7011 it.</p></dd>
7012<dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt> 7012<dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt>
7013<dd><p>A list of reordering commands. A reordering 7013<dd><p>A list of reordering commands. A reordering
7014 command has the form 7014 command has the form
7015 <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>. 7015 <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>.
7016 It ensures that that 7016 It ensures that that
7017 <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs 7017 <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs
7018 before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>. 7018 before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>.
7019 </p></dd> 7019 </p></dd>
7020<dt><span class="term"><code class="varname">WRAPPER_TRANSFORM_CMDS</code></span></dt> 7020<dt><span class="term"><code class="varname">WRAPPER_TRANSFORM_CMDS</code></span></dt>
7021<dd><p>A list of transformation commands. [TODO: 7021<dd><p>A list of transformation commands. [TODO:
7022 investigate further]</p></dd> 7022 investigate further]</p></dd>
7023</dl></div> 7023</dl></div>
7024</div> 7024</div>
7025<div class="sect1"> 7025<div class="sect1">
7026<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7026<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7027<a name="build.configure"></a>17.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div> 7027<a name="build.configure"></a>17.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
7028<p>Most pieces of software need information on the header 7028<p>Most pieces of software need information on the header
7029 files, system calls, and library routines which are available 7029 files, system calls, and library routines which are available
7030 on the platform they run on. The process of determining this 7030 on the platform they run on. The process of determining this
7031 information is known as configuration, and is usually 7031 information is known as configuration, and is usually
7032 automated. In most cases, a script is supplied with the 7032 automated. In most cases, a script is supplied with the
7033 distfiles, and its invocation results in generation of header 7033 distfiles, and its invocation results in generation of header
7034 files, Makefiles, etc.</p> 7034 files, Makefiles, etc.</p>
7035<p>If the package contains a configure script, this can be 7035<p>If the package contains a configure script, this can be
7036 invoked by setting <code class="varname">HAS_CONFIGURE</code> to 7036 invoked by setting <code class="varname">HAS_CONFIGURE</code> to
7037 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. If the configure script is a GNU autoconf 7037 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. If the configure script is a GNU autoconf
7038 script, you should set <code class="varname">GNU_CONFIGURE</code> to 7038 script, you should set <code class="varname">GNU_CONFIGURE</code> to
7039 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> instead. What happens in the 7039 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> instead. What happens in the
7040 <span class="emphasis"><em>configure</em></span> phase is roughly:</p> 7040 <span class="emphasis"><em>configure</em></span> phase is roughly:</p>
7041<pre class="programlisting"> 7041<pre class="programlisting">
7042.for d in ${CONFIGURE_DIRS} 7042.for d in ${CONFIGURE_DIRS}
7043 cd ${WRKSRC} \ 7043 cd ${WRKSRC} \
7044 &amp;&amp; cd ${d} \ 7044 &amp;&amp; cd ${d} \
7045 &amp;&amp; env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS} 7045 &amp;&amp; env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
7046.endfor 7046.endfor
7047</pre> 7047</pre>
7048<p><code class="varname">CONFIGURE_DIRS</code> (default: 7048<p><code class="varname">CONFIGURE_DIRS</code> (default:
7049 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to 7049 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to
7050 <code class="varname">WRKSRC</code>. In each of these directories, the 7050 <code class="varname">WRKSRC</code>. In each of these directories, the
7051 configure script is run with the environment 7051 configure script is run with the environment
7052 <code class="varname">CONFIGURE_ENV</code> and arguments 7052 <code class="varname">CONFIGURE_ENV</code> and arguments
7053 <code class="varname">CONFIGURE_ARGS</code>. The variables 7053 <code class="varname">CONFIGURE_ARGS</code>. The variables
7054 <code class="varname">CONFIGURE_ENV</code>, 7054 <code class="varname">CONFIGURE_ENV</code>,
7055 <code class="varname">CONFIGURE_SCRIPT</code> (default: 7055 <code class="varname">CONFIGURE_SCRIPT</code> (default:
7056 <span class="quote">&#8220;<span class="quote">./configure</span>&#8221;</span>) and 7056 <span class="quote">&#8220;<span class="quote">./configure</span>&#8221;</span>) and
7057 <code class="varname">CONFIGURE_ARGS</code> may all be changed by the 7057 <code class="varname">CONFIGURE_ARGS</code> may all be changed by the
7058 package.</p> 7058 package.</p>
7059<p>If the program uses the Perl way of configuration (mainly Perl 7059<p>If the program uses the Perl way of configuration (mainly Perl
7060 modules, but not only), i.e. a file called 7060 modules, but not only), i.e. a file called
7061 <code class="filename">Makefile.PL</code>, it should include 7061 <code class="filename">Makefile.PL</code>, it should include
7062 <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for 7062 <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for
7063 <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code> 7063 <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code>
7064 variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p> 7064 variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p>
7065<p>If the program uses an <code class="filename">Imakefile</code> 7065<p>If the program uses an <code class="filename">Imakefile</code>
7066 for configuration, the appropriate steps can be invoked by 7066 for configuration, the appropriate steps can be invoked by
7067 setting <code class="varname">USE_IMAKE</code> to 7067 setting <code class="varname">USE_IMAKE</code> to
7068 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. (If you only want the package installed in 7068 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. (If you only want the package installed in
7069 <code class="varname">${X11PREFIX}</code> but xmkmf not being run, set 7069 <code class="varname">${X11PREFIX}</code> but xmkmf not being run, set
7070 <code class="varname">USE_X11BASE</code> instead.) You can add variables to 7070 <code class="varname">USE_X11BASE</code> instead.) You can add variables to
7071 xmkmf's environment by adding them to the 7071 xmkmf's environment by adding them to the
7072 <code class="varname">SCRIPTS_ENV</code> variable.</p> 7072 <code class="varname">SCRIPTS_ENV</code> variable.</p>
7073<p>If the program uses <code class="filename">cmake</code> 7073<p>If the program uses <code class="filename">cmake</code>
7074 for configuration, the appropriate steps can be invoked by 7074 for configuration, the appropriate steps can be invoked by
7075 setting <code class="varname">USE_CMAKE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. 7075 setting <code class="varname">USE_CMAKE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.
7076 You can add variables to cmake's environment by adding them to the 7076 You can add variables to cmake's environment by adding them to the
7077 <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake 7077 <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake
7078 by adding them to the <code class="varname">CMAKE_ARGS</code> variable. 7078 by adding them to the <code class="varname">CMAKE_ARGS</code> variable.
7079 The top directory argument is given by the 7079 The top directory argument is given by the
7080 <code class="varname">CMAKE_ARG_PATH</code> variable, that defaults to 7080 <code class="varname">CMAKE_ARG_PATH</code> variable, that defaults to
7081 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p> 7081 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p>
7082<p>If there is no configure step at all, set 7082<p>If there is no configure step at all, set
7083 <code class="varname">NO_CONFIGURE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p> 7083 <code class="varname">NO_CONFIGURE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p>
7084</div> 7084</div>
7085<div class="sect1"> 7085<div class="sect1">
7086<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7086<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7087<a name="build.build"></a>17.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div> 7087<a name="build.build"></a>17.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
7088<p>For building a package, a rough equivalent of the 7088<p>For building a package, a rough equivalent of the
7089 following code is executed.</p> 7089 following code is executed.</p>
7090<pre class="programlisting"> 7090<pre class="programlisting">
7091.for d in ${BUILD_DIRS} 7091.for d in ${BUILD_DIRS}
7092 cd ${WRKSRC} \ 7092 cd ${WRKSRC} \
7093 &amp;&amp; cd ${d} \ 7093 &amp;&amp; cd ${d} \
7094 &amp;&amp; env ${MAKE_ENV} \ 7094 &amp;&amp; env ${MAKE_ENV} \
7095 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \ 7095 ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
7096 -f ${MAKE_FILE} \ 7096 -f ${MAKE_FILE} \
7097 ${BUILD_TARGET} 7097 ${BUILD_TARGET}
7098.endfor 7098.endfor
7099</pre> 7099</pre>
7100<p><code class="varname">BUILD_DIRS</code> (default: 7100<p><code class="varname">BUILD_DIRS</code> (default:
7101 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to 7101 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to
7102 <code class="varname">WRKSRC</code>. In each of these directories, 7102 <code class="varname">WRKSRC</code>. In each of these directories,
7103 <code class="varname">MAKE_PROGRAM</code> is run with the environment 7103 <code class="varname">MAKE_PROGRAM</code> is run with the environment
7104 <code class="varname">MAKE_ENV</code> and arguments 7104 <code class="varname">MAKE_ENV</code> and arguments
7105 <code class="varname">BUILD_MAKE_FLAGS</code>. The variables 7105 <code class="varname">BUILD_MAKE_FLAGS</code>. The variables
7106 <code class="varname">MAKE_ENV</code>, 7106 <code class="varname">MAKE_ENV</code>,
7107 <code class="varname">BUILD_MAKE_FLAGS</code>, 7107 <code class="varname">BUILD_MAKE_FLAGS</code>,
7108 <code class="varname">MAKE_FILE</code> and 7108 <code class="varname">MAKE_FILE</code> and
7109 <code class="varname">BUILD_TARGET</code> may all be changed by the 7109 <code class="varname">BUILD_TARGET</code> may all be changed by the
7110 package.</p> 7110 package.</p>
7111<p>The default value of <code class="varname">MAKE_PROGRAM</code> is 7111<p>The default value of <code class="varname">MAKE_PROGRAM</code> is
7112 <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> if <code class="varname">USE_TOOLS</code> contains 7112 <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> if <code class="varname">USE_TOOLS</code> contains
7113 <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> otherwise. The 7113 <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> otherwise. The
7114 default value of <code class="varname">MAKE_FILE</code> is 7114 default value of <code class="varname">MAKE_FILE</code> is
7115 <span class="quote">&#8220;<span class="quote">Makefile</span>&#8221;</span>, and <code class="varname">BUILD_TARGET</code> 7115 <span class="quote">&#8220;<span class="quote">Makefile</span>&#8221;</span>, and <code class="varname">BUILD_TARGET</code>
7116 defaults to <span class="quote">&#8220;<span class="quote">all</span>&#8221;</span>.</p> 7116 defaults to <span class="quote">&#8220;<span class="quote">all</span>&#8221;</span>.</p>
7117<p>If there is no build step at all, set 7117<p>If there is no build step at all, set
7118 <code class="varname">NO_BUILD</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p> 7118 <code class="varname">NO_BUILD</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p>
7119</div> 7119</div>
7120<div class="sect1"> 7120<div class="sect1">
7121<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7121<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7122<a name="build.test"></a>17.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div> 7122<a name="build.test"></a>17.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div>
7123<p>[TODO]</p> 7123<p>[TODO]</p>
7124</div> 7124</div>
7125<div class="sect1"> 7125<div class="sect1">
7126<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7126<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7127<a name="build.install"></a>17.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div> 7127<a name="build.install"></a>17.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
7128<p>Once the build stage has completed, the final step is to 7128<p>Once the build stage has completed, the final step is to
7129 install the software in public directories, so users can 7129 install the software in public directories, so users can
7130 access the programs and files.</p> 7130 access the programs and files.</p>
7131<p>In the <span class="emphasis"><em>install</em></span> phase, a rough 7131<p>In the <span class="emphasis"><em>install</em></span> phase, a rough
7132 equivalent of the following code is executed. Additionally, 7132 equivalent of the following code is executed. Additionally,
7133 before and after this code, much magic is performed to do 7133 before and after this code, much magic is performed to do
7134 consistency checks, registering the package, and so on.</p> 7134 consistency checks, registering the package, and so on.</p>
7135<pre class="programlisting"> 7135<pre class="programlisting">
7136.for d in ${INSTALL_DIRS} 7136.for d in ${INSTALL_DIRS}
7137 cd ${WRKSRC} \ 7137 cd ${WRKSRC} \
7138 &amp;&amp; cd ${d} \ 7138 &amp;&amp; cd ${d} \
7139 &amp;&amp; env ${MAKE_ENV} \ 7139 &amp;&amp; env ${MAKE_ENV} \
7140 ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \ 7140 ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
7141 -f ${MAKE_FILE} \ 7141 -f ${MAKE_FILE} \
7142 ${INSTALL_TARGET} 7142 ${INSTALL_TARGET}
7143.endfor 7143.endfor
7144</pre> 7144</pre>
7145<p>The variable's meanings are analogous to the ones in the 7145<p>The variable's meanings are analogous to the ones in the
7146 <span class="emphasis"><em>build</em></span> phase. 7146 <span class="emphasis"><em>build</em></span> phase.
7147 <code class="varname">INSTALL_DIRS</code> defaults to 7147 <code class="varname">INSTALL_DIRS</code> defaults to
7148 <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code> 7148 <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code>
7149 is <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> by default, plus 7149 is <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> by default, plus
7150 <span class="quote">&#8220;<span class="quote">install.man</span>&#8221;</span> if <code class="varname">USE_IMAKE</code> is 7150 <span class="quote">&#8220;<span class="quote">install.man</span>&#8221;</span> if <code class="varname">USE_IMAKE</code> is
7151 defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not 7151 defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not
7152 defined.</p> 7152 defined.</p>
7153<p>In the <span class="emphasis"><em>install</em></span> phase, the following 7153<p>In the <span class="emphasis"><em>install</em></span> phase, the following
7154 variables are useful. They are all variations of the 7154 variables are useful. They are all variations of the
7155 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> command that have the owner, group and 7155 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> command that have the owner, group and
7156 permissions preset. <code class="varname">INSTALL</code> is the plain 7156 permissions preset. <code class="varname">INSTALL</code> is the plain
7157 install command. The specialized variants, together with their 7157 install command. The specialized variants, together with their
7158 intended use, are:</p> 7158 intended use, are:</p>
7159<div class="variablelist"><dl class="variablelist"> 7159<div class="variablelist"><dl class="variablelist">
7160<dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt> 7160<dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt>
7161<dd><p>directories that contain 7161<dd><p>directories that contain
7162 binaries</p></dd> 7162 binaries</p></dd>
7163<dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt> 7163<dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt>
7164<dd><p>directories that contain 7164<dd><p>directories that contain
7165 scripts</p></dd> 7165 scripts</p></dd>
7166<dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt> 7166<dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt>
7167<dd><p>directories that contain shared and static 7167<dd><p>directories that contain shared and static
7168 libraries</p></dd> 7168 libraries</p></dd>
7169<dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt> 7169<dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt>
7170<dd><p>directories that contain data 7170<dd><p>directories that contain data
7171 files</p></dd> 7171 files</p></dd>
7172<dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt> 7172<dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt>
7173<dd><p>directories that contain man 7173<dd><p>directories that contain man
7174 pages</p></dd> 7174 pages</p></dd>
7175<dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt> 7175<dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt>
7176<dd><p>binaries that can be stripped from debugging 7176<dd><p>binaries that can be stripped from debugging
7177 symbols</p></dd> 7177 symbols</p></dd>
7178<dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt> 7178<dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt>
7179<dd><p>binaries that cannot be 7179<dd><p>binaries that cannot be
7180 stripped</p></dd> 7180 stripped</p></dd>
7181<dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt> 7181<dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt>
7182<dd><p>game 7182<dd><p>game
7183 binaries</p></dd> 7183 binaries</p></dd>
7184<dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt> 7184<dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt>
7185<dd><p>shared and static 7185<dd><p>shared and static
7186 libraries</p></dd> 7186 libraries</p></dd>
7187<dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt> 7187<dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt>
7188<dd><p>data files</p></dd> 7188<dd><p>data files</p></dd>
7189<dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt> 7189<dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt>
7190<dd><p>data files for 7190<dd><p>data files for
7191 games</p></dd> 7191 games</p></dd>
7192<dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt> 7192<dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt>
7193<dd><p>man pages</p></dd> 7193<dd><p>man pages</p></dd>
7194</dl></div> 7194</dl></div>
7195<p>Some other variables are:</p> 7195<p>Some other variables are:</p>
7196<div class="variablelist"><dl class="variablelist"> 7196<div class="variablelist"><dl class="variablelist">
7197<dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt> 7197<dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt>
7198<dd><p>A list of directories relative to 7198<dd><p>A list of directories relative to
7199 <code class="varname">PREFIX</code> that are created by pkgsrc at the 7199 <code class="varname">PREFIX</code> that are created by pkgsrc at the
7200 beginning of the <span class="emphasis"><em>install</em></span> phase. 7200 beginning of the <span class="emphasis"><em>install</em></span> phase.
7201 The package is supposed to create all needed directories itself 7201 The package is supposed to create all needed directories itself
7202 before installing files to it and list all other directories here. 7202 before installing files to it and list all other directories here.
7203 </p></dd> 7203 </p></dd>
7204</dl></div> 7204</dl></div>
7205<p>In the rare cases that a package shouldn't install anything, 7205<p>In the rare cases that a package shouldn't install anything,
7206 set <code class="varname">NO_INSTALL</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. This is 7206 set <code class="varname">NO_INSTALL</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. This is
7207 mostly relevant for packages in the <code class="filename">regress</code> 7207 mostly relevant for packages in the <code class="filename">regress</code>
7208 category.</p> 7208 category.</p>
7209</div> 7209</div>
7210<div class="sect1"> 7210<div class="sect1">
7211<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7211<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7212<a name="build.package"></a>17.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div> 7212<a name="build.package"></a>17.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div>
7213<p>Once the install stage has completed, a binary package of 7213<p>Once the install stage has completed, a binary package of
7214 the installed files can be built. These binary packages can be 7214 the installed files can be built. These binary packages can be
7215 used for quick installation without previous compilation, e.g. by 7215 used for quick installation without previous compilation, e.g. by
7216 the <span class="command"><strong>make bin-install</strong></span> or by using 7216 the <span class="command"><strong>make bin-install</strong></span> or by using
7217 <span class="command"><strong>pkg_add</strong></span>.</p> 7217 <span class="command"><strong>pkg_add</strong></span>.</p>
7218<p>By default, the binary packages are created in 7218<p>By default, the binary packages are created in
7219 <code class="filename">${PACKAGES}/All</code> and symlinks are created in 7219 <code class="filename">${PACKAGES}/All</code> and symlinks are created in
7220 <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>, 7220 <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>,
7221 one for each category in the <code class="varname">CATEGORIES</code> 7221 one for each category in the <code class="varname">CATEGORIES</code>
7222 variable. <code class="varname">PACKAGES</code> defaults to 7222 variable. <code class="varname">PACKAGES</code> defaults to
7223 <code class="filename">pkgsrc/packages</code>.</p> 7223 <code class="filename">pkgsrc/packages</code>.</p>
7224</div> 7224</div>
7225<div class="sect1"> 7225<div class="sect1">
7226<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7226<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7227<a name="build.clean"></a>17.16. Cleaning up</h2></div></div></div> 7227<a name="build.clean"></a>17.16. Cleaning up</h2></div></div></div>
7228<p>Once you're finished with a package, you can clean the work 7228<p>Once you're finished with a package, you can clean the work
7229 directory by running <span class="command"><strong>make clean</strong></span>. If you want 7229 directory by running <span class="command"><strong>make clean</strong></span>. If you want
7230 to clean the work directories of all dependencies too, use 7230 to clean the work directories of all dependencies too, use
7231 <span class="command"><strong>make clean-depends</strong></span>.</p> 7231 <span class="command"><strong>make clean-depends</strong></span>.</p>
7232</div> 7232</div>
7233<div class="sect1"> 7233<div class="sect1">
7234<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7234<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7235<a name="build.helpful-targets"></a>17.17. Other helpful targets</h2></div></div></div> 7235<a name="build.helpful-targets"></a>17.17. Other helpful targets</h2></div></div></div>
7236<div class="variablelist"><dl class="variablelist"> 7236<div class="variablelist"><dl class="variablelist">
7237<dt><span class="term">pre/post-*</span></dt> 7237<dt><span class="term">pre/post-*</span></dt>
7238<dd><p>For any of the main targets described in the 7238<dd><p>For any of the main targets described in the
7239 previous section, two auxiliary targets exist with 7239 previous section, two auxiliary targets exist with
7240 <span class="quote">&#8220;<span class="quote">pre-</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">post-</span>&#8221;</span> used as a 7240 <span class="quote">&#8220;<span class="quote">pre-</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">post-</span>&#8221;</span> used as a
7241 prefix for the main target's name. These targets are 7241 prefix for the main target's name. These targets are
7242 invoked before and after the main target is called, 7242 invoked before and after the main target is called,
7243 allowing extra configuration or installation steps be 7243 allowing extra configuration or installation steps be
7244 performed from a package's Makefile, for example, which 7244 performed from a package's Makefile, for example, which
7245 a program's configure script or install target 7245 a program's configure script or install target
7246 omitted.</p></dd> 7246 omitted.</p></dd>
7247<dt><span class="term">do-*</span></dt> 7247<dt><span class="term">do-*</span></dt>
7248<dd><p>Should one of the main targets do the wrong thing, 7248<dd><p>Should one of the main targets do the wrong thing,
7249 and should there be no variable to fix this, you can 7249 and should there be no variable to fix this, you can
7250 redefine it with the do-* target. (Note that redefining 7250 redefine it with the do-* target. (Note that redefining
7251 the target itself instead of the do-* target is a bad 7251 the target itself instead of the do-* target is a bad
7252 idea, as the pre-* and post-* targets won't be called 7252 idea, as the pre-* and post-* targets won't be called
7253 anymore, etc.) You will not usually need to do 7253 anymore, etc.) You will not usually need to do
7254 this.</p></dd> 7254 this.</p></dd>
7255<dt><span class="term">reinstall</span></dt> 7255<dt><span class="term">reinstall</span></dt>
7256<dd> 7256<dd>
7257<p>If you did a <span class="command"><strong>make install</strong></span> and 7257<p>If you did a <span class="command"><strong>make install</strong></span> and
7258 you noticed some file was not installed properly, you 7258 you noticed some file was not installed properly, you
7259 can repeat the installation with this target, which will 7259 can repeat the installation with this target, which will
7260 ignore the <span class="quote">&#8220;<span class="quote">already installed</span>&#8221;</span> flag.</p> 7260 ignore the <span class="quote">&#8220;<span class="quote">already installed</span>&#8221;</span> flag.</p>
7261<p>This is the default value of 7261<p>This is the default value of
7262 <code class="varname">DEPENDS_TARGET</code> except in the case of 7262 <code class="varname">DEPENDS_TARGET</code> except in the case of
7263 <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make 7263 <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make
7264 package</strong></span>, where the defaults are 7264 package</strong></span>, where the defaults are
7265 <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span>, 7265 <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span>,
7266 respectively.</p> 7266 respectively.</p>
7267</dd> 7267</dd>
7268<dt><span class="term">deinstall</span></dt> 7268<dt><span class="term">deinstall</span></dt>
7269<dd> 7269<dd>
7270<p>This target does a <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> in the 7270<p>This target does a <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> in the
7271 current directory, effectively de-installing the 7271 current directory, effectively de-installing the
7272 package. The following variables can be used to tune the 7272 package. The following variables can be used to tune the
7273 behaviour:</p> 7273 behaviour:</p>
7274<div class="variablelist"><dl class="variablelist"> 7274<div class="variablelist"><dl class="variablelist">
7275<dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt> 7275<dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt>
7276<dd><p>Add a "-v" to the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> command.</p></dd> 7276<dd><p>Add a "-v" to the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> command.</p></dd>
7277<dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt> 7277<dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt>
7278<dd><p>Remove all packages that require (depend on) 7278<dd><p>Remove all packages that require (depend on)
7279 the given package. This can be used to remove any 7279 the given package. This can be used to remove any
7280 packages that may have been pulled in by a given 7280 packages that may have been pulled in by a given
7281 package, e.g. if <span class="command"><strong>make deinstall 7281 package, e.g. if <span class="command"><strong>make deinstall
7282 DEINSTALLDEPENDS=1</strong></span> is done in 7282 DEINSTALLDEPENDS=1</strong></span> is done in
7283 <code class="filename">pkgsrc/x11/kde</code>, this is 7283 <code class="filename">pkgsrc/x11/kde</code>, this is
7284 likely to remove whole KDE. Works by adding 7284 likely to remove whole KDE. Works by adding
7285 <span class="quote">&#8220;<span class="quote">-R</span>&#8221;</span> to the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> 7285 <span class="quote">&#8220;<span class="quote">-R</span>&#8221;</span> to the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
7286 command line.</p></dd> 7286 command line.</p></dd>
7287</dl></div> 7287</dl></div>
7288</dd> 7288</dd>
7289<dt><span class="term">bin-install</span></dt> 7289<dt><span class="term">bin-install</span></dt>
7290<dd><p>Install a binary package from local disk and via FTP 7290<dd><p>Install a binary package from local disk and via FTP
7291 from a list of sites (see the 7291 from a list of sites (see the
7292 <code class="varname">BINPKG_SITES</code> variable), and do a 7292 <code class="varname">BINPKG_SITES</code> variable), and do a
7293 <span class="command"><strong>make package</strong></span> if no binary package is 7293 <span class="command"><strong>make package</strong></span> if no binary package is
7294 available anywhere. The arguments given to 7294 available anywhere. The arguments given to
7295 <span class="command"><strong>pkg_add</strong></span> can be set via 7295 <span class="command"><strong>pkg_add</strong></span> can be set via
7296 <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose 7296 <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose
7297 operation, etc.</p></dd> 7297 operation, etc.</p></dd>
7298<dt><span class="term">update</span></dt> 7298<dt><span class="term">update</span></dt>
7299<dd> 7299<dd>
7300<p>This target causes the current package to be 7300<p>This target causes the current package to be
7301 updated to the latest version. The package and all 7301 updated to the latest version. The package and all
7302 depending packages first get de-installed, then current 7302 depending packages first get de-installed, then current
7303 versions of the corresponding packages get compiled and 7303 versions of the corresponding packages get compiled and
7304 installed. This is similar to manually noting which 7304 installed. This is similar to manually noting which
7305 packages are currently installed, then performing a 7305 packages are currently installed, then performing a
7306 series of <span class="command"><strong>make deinstall</strong></span> and 7306 series of <span class="command"><strong>make deinstall</strong></span> and
7307 <span class="command"><strong>make install</strong></span> (or whatever 7307 <span class="command"><strong>make install</strong></span> (or whatever
7308 <code class="varname">UPDATE_TARGET</code> is set to) for these 7308 <code class="varname">UPDATE_TARGET</code> is set to) for these
7309 packages.</p> 7309 packages.</p>
7310<p>You can use the <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> target to 7310<p>You can use the <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> target to
7311 resume package updating in case a previous <span class="command"><strong>make 7311 resume package updating in case a previous <span class="command"><strong>make
7312 update</strong></span> was interrupted for some reason. 7312 update</strong></span> was interrupted for some reason.
7313 However, in this case, make sure you don't call 7313 However, in this case, make sure you don't call
7314 <span class="command"><strong>make clean</strong></span> or otherwise remove the 7314 <span class="command"><strong>make clean</strong></span> or otherwise remove the
7315 list of dependent packages in <code class="varname">WRKDIR</code>. 7315 list of dependent packages in <code class="varname">WRKDIR</code>.
7316 Otherwise, you lose the ability to automatically update 7316 Otherwise, you lose the ability to automatically update
7317 the current package along with the dependent packages 7317 the current package along with the dependent packages
7318 you have installed.</p> 7318 you have installed.</p>
7319<p>Resuming an interrupted <span class="command"><strong>make 7319<p>Resuming an interrupted <span class="command"><strong>make
7320 update</strong></span> will only work as long as the package 7320 update</strong></span> will only work as long as the package
7321 tree remains unchanged. If the source code for one of 7321 tree remains unchanged. If the source code for one of
7322 the packages to be updated has been changed, resuming 7322 the packages to be updated has been changed, resuming
7323 <span class="command"><strong>make update</strong></span> will most certainly 7323 <span class="command"><strong>make update</strong></span> will most certainly
7324 fail!</p> 7324 fail!</p>
7325<p>The following variables can be used either on the 7325<p>The following variables can be used either on the
7326 command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to 7326 command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
7327 alter the behaviour of <span class="command"><strong>make 7327 alter the behaviour of <span class="command"><strong>make
7328 update</strong></span>:</p> 7328 update</strong></span>:</p>
7329<div class="variablelist"><dl class="variablelist"> 7329<div class="variablelist"><dl class="variablelist">
7330<dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt> 7330<dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt>
7331<dd><p>Install target to recursively use for the 7331<dd><p>Install target to recursively use for the
7332 updated package and the dependent packages. 7332 updated package and the dependent packages.
7333 Defaults to <code class="varname">DEPENDS_TARGET</code> if 7333 Defaults to <code class="varname">DEPENDS_TARGET</code> if
7334 set, <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> otherwise for 7334 set, <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> otherwise for
7335 <span class="command"><strong>make update</strong></span>. Other good 7335 <span class="command"><strong>make update</strong></span>. Other good
7336 targets are <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> or 7336 targets are <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> or
7337 <span class="quote">&#8220;<span class="quote">bin-install</span>&#8221;</span>. Do not set this to 7337 <span class="quote">&#8220;<span class="quote">bin-install</span>&#8221;</span>. Do not set this to
7338 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> or you will get stuck in an 7338 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> or you will get stuck in an
7339 endless loop!</p></dd> 7339 endless loop!</p></dd>
7340<dt><span class="term"><code class="varname">NOCLEAN</code></span></dt> 7340<dt><span class="term"><code class="varname">NOCLEAN</code></span></dt>
7341<dd><p>Don't clean up after updating. Useful if 7341<dd><p>Don't clean up after updating. Useful if
7342 you want to leave the work sources of the updated 7342 you want to leave the work sources of the updated
7343 packages around for inspection or other purposes. 7343 packages around for inspection or other purposes.
7344 Be sure you eventually clean up the source tree 7344 Be sure you eventually clean up the source tree
7345 (see the <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target below) 7345 (see the <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target below)
7346 or you may run into troubles with old source code 7346 or you may run into troubles with old source code
7347 still lying around on your next 7347 still lying around on your next
7348 <span class="command"><strong>make</strong></span> or <span class="command"><strong>make 7348 <span class="command"><strong>make</strong></span> or <span class="command"><strong>make
7349 update</strong></span>.</p></dd> 7349 update</strong></span>.</p></dd>
7350<dt><span class="term"><code class="varname">REINSTALL</code></span></dt> 7350<dt><span class="term"><code class="varname">REINSTALL</code></span></dt>
7351<dd><p>Deinstall each package before installing 7351<dd><p>Deinstall each package before installing
7352 (making <code class="varname">DEPENDS_TARGET</code>). This 7352 (making <code class="varname">DEPENDS_TARGET</code>). This
7353 may be necessary if the 7353 may be necessary if the
7354 <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target (see below) was 7354 <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target (see below) was
7355 called after interrupting a running <span class="command"><strong>make 7355 called after interrupting a running <span class="command"><strong>make
7356 update</strong></span>.</p></dd> 7356 update</strong></span>.</p></dd>
7357<dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt> 7357<dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt>
7358<dd><p>Allows you to disable recursion and hardcode 7358<dd><p>Allows you to disable recursion and hardcode
7359 the target for packages. The default is 7359 the target for packages. The default is
7360 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for the update target, 7360 <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for the update target,
7361 facilitating a recursive update of prerequisite 7361 facilitating a recursive update of prerequisite
7362 packages. Only set 7362 packages. Only set
7363 <code class="varname">DEPENDS_TARGET</code> if you want to 7363 <code class="varname">DEPENDS_TARGET</code> if you want to
7364 disable recursive updates. Use 7364 disable recursive updates. Use
7365 <code class="varname">UPDATE_TARGET</code> instead to just 7365 <code class="varname">UPDATE_TARGET</code> instead to just
7366 set a specific target for each package to be 7366 set a specific target for each package to be
7367 installed during <span class="command"><strong>make update</strong></span> 7367 installed during <span class="command"><strong>make update</strong></span>
7368 (see above).</p></dd> 7368 (see above).</p></dd>
7369</dl></div> 7369</dl></div>
7370</dd> 7370</dd>
7371<dt><span class="term">clean-update</span></dt> 7371<dt><span class="term">clean-update</span></dt>
7372<dd> 7372<dd>
7373<p>Clean the source tree for all packages that would 7373<p>Clean the source tree for all packages that would
7374 get updated if <span class="command"><strong>make update</strong></span> was called 7374 get updated if <span class="command"><strong>make update</strong></span> was called
7375 from the current directory. This target should not be 7375 from the current directory. This target should not be
7376 used if the current package (or any of its depending 7376 used if the current package (or any of its depending
7377 packages) have already been de-installed (e.g., after 7377 packages) have already been de-installed (e.g., after
7378 calling <span class="command"><strong>make update</strong></span>) or you may lose 7378 calling <span class="command"><strong>make update</strong></span>) or you may lose
7379 some packages you intended to update. As a rule of 7379 some packages you intended to update. As a rule of
7380 thumb: only use this target <span class="emphasis"><em>before</em></span> 7380 thumb: only use this target <span class="emphasis"><em>before</em></span>
7381 the first time you run <span class="command"><strong>make update</strong></span> 7381 the first time you run <span class="command"><strong>make update</strong></span>
7382 and only if you have a dirty package tree (e.g., if you 7382 and only if you have a dirty package tree (e.g., if you
7383 used <code class="varname">NOCLEAN</code>).</p> 7383 used <code class="varname">NOCLEAN</code>).</p>
7384<p>If you are unsure about whether your tree is 7384<p>If you are unsure about whether your tree is
7385 clean, you can either perform a <span class="command"><strong>make 7385 clean, you can either perform a <span class="command"><strong>make
7386 clean</strong></span> at the top of the tree, or use the 7386 clean</strong></span> at the top of the tree, or use the
7387 following sequence of commands from the directory of the 7387 following sequence of commands from the directory of the
7388 package you want to update (<span class="emphasis"><em>before</em></span> 7388 package you want to update (<span class="emphasis"><em>before</em></span>
7389 running <span class="command"><strong>make update</strong></span> for the first 7389 running <span class="command"><strong>make update</strong></span> for the first
7390 time, otherwise you lose all the packages you wanted to 7390 time, otherwise you lose all the packages you wanted to
7391 update!):</p> 7391 update!):</p>
7392<pre class="screen"> 7392<pre class="screen">
7393<code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong> 7393<code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong>
7394<code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong> 7394<code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
7395<code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong> 7395<code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong>
7396 </pre> 7396 </pre>
7397<p>The following variables can be used either on the 7397<p>The following variables can be used either on the
7398 command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of 7398 command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of
7399 <span class="command"><strong>make clean-update</strong></span>:</p> 7399 <span class="command"><strong>make clean-update</strong></span>:</p>
7400<div class="variablelist"><dl class="variablelist"> 7400<div class="variablelist"><dl class="variablelist">
7401<dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt> 7401<dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt>
7402<dd><p>After <span class="command"><strong>make clean</strong></span>, do not 7402<dd><p>After <span class="command"><strong>make clean</strong></span>, do not
7403 reconstruct the list of directories to update for 7403 reconstruct the list of directories to update for
7404 this package. Only use this if <span class="command"><strong>make 7404 this package. Only use this if <span class="command"><strong>make
7405 update</strong></span> successfully installed all 7405 update</strong></span> successfully installed all
7406 packages you wanted to update. Normally, this is 7406 packages you wanted to update. Normally, this is
7407 done automatically on <span class="command"><strong>make 7407 done automatically on <span class="command"><strong>make
7408 update</strong></span>, but may have been suppressed by 7408 update</strong></span>, but may have been suppressed by
7409 the <code class="varname">NOCLEAN</code> variable (see 7409 the <code class="varname">NOCLEAN</code> variable (see
7410 above).</p></dd> 7410 above).</p></dd>
7411</dl></div> 7411</dl></div>
7412</dd> 7412</dd>
7413<dt><span class="term">replace</span></dt> 7413<dt><span class="term">replace</span></dt>
7414<dd> 7414<dd>
7415<p>Update the installation of the current package. This 7415<p>Update the installation of the current package. This
7416 differs from update in that it does not replace dependent 7416 differs from update in that it does not replace dependent
7417 packages. You will need to install <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/README.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a> for this 7417 packages. You will need to install <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/README.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a> for this
7418 target to work.</p> 7418 target to work.</p>
7419<p><span class="emphasis"><em>Be careful when using this 7419<p><span class="emphasis"><em>Be careful when using this
7420 target!</em></span> There are no guarantees that dependent 7420 target!</em></span> There are no guarantees that dependent
7421 packages will still work, in particular they will most 7421 packages will still work, in particular they will most
7422 certainly break if you <span class="command"><strong>make replace</strong></span> a 7422 certainly break if you <span class="command"><strong>make replace</strong></span> a
7423 library package whose shared library major version changed 7423 library package whose shared library major version changed
7424 between your installed version and the new one. For this 7424 between your installed version and the new one. For this
7425 reason, this target is not officially supported and only 7425 reason, this target is not officially supported and only
7426 recommended for advanced users.</p> 7426 recommended for advanced users.</p>
7427</dd> 7427</dd>
7428<dt><span class="term">info</span></dt> 7428<dt><span class="term">info</span></dt>
7429<dd><p>This target invokes <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a> for the current 7429<dd><p>This target invokes <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a> for the current
7430 package. You can use this to check which version of a 7430 package. You can use this to check which version of a
7431 package is installed.</p></dd> 7431 package is installed.</p></dd>
7432<dt><span class="term">index</span></dt> 7432<dt><span class="term">index</span></dt>
7433<dd> 7433<dd>
7434<p>This is a top-level command, i.e. it should be used in 7434<p>This is a top-level command, i.e. it should be used in
7435 the <code class="filename">pkgsrc</code> directory. It creates a 7435 the <code class="filename">pkgsrc</code> directory. It creates a
7436 database of all packages in the local pkgsrc tree, including 7436 database of all packages in the local pkgsrc tree, including
7437 dependencies, comment, maintainer, and some other useful 7437 dependencies, comment, maintainer, and some other useful
7438 information. Individual entries are created by running 7438 information. Individual entries are created by running
7439 <span class="command"><strong>make describe</strong></span> in the packages' 7439 <span class="command"><strong>make describe</strong></span> in the packages'
7440 directories. This index file is saved as 7440 directories. This index file is saved as
7441 <code class="filename">pkgsrc/INDEX</code>. It can be displayed in 7441 <code class="filename">pkgsrc/INDEX</code>. It can be displayed in
7442 verbose format by running <span class="command"><strong>make 7442 verbose format by running <span class="command"><strong>make
7443 print-index</strong></span>. You can search in it with 7443 print-index</strong></span>. You can search in it with
7444 <span class="command"><strong>make search 7444 <span class="command"><strong>make search
7445 key=<em class="replaceable"><code>something</code></em></strong></span>. You can 7445 key=<em class="replaceable"><code>something</code></em></strong></span>. You can
7446 extract a list of all packages that depend on a particular 7446 extract a list of all packages that depend on a particular
7447 one by running <span class="command"><strong>make show-deps 7447 one by running <span class="command"><strong>make show-deps
7448 PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p> 7448 PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p>
7449<p>Running this command takes a very long time, some 7449<p>Running this command takes a very long time, some
7450 hours even on fast machines!</p> 7450 hours even on fast machines!</p>
7451</dd> 7451</dd>
7452<dt><span class="term">readme</span></dt> 7452<dt><span class="term">readme</span></dt>
7453<dd> 7453<dd>
7454<p>This target generates a 7454<p>This target generates a
7455 <code class="filename">README.html</code> file, which can be 7455 <code class="filename">README.html</code> file, which can be
7456 viewed using a browser such as <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/links/README.html" target="_top"><code class="filename">www/links</code></a>. The generated files 7456 viewed using a browser such as <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/links/README.html" target="_top"><code class="filename">www/links</code></a>. The generated files
7457 contain references to any packages which are in the 7457 contain references to any packages which are in the
7458 <code class="varname">PACKAGES</code> directory on the local 7458 <code class="varname">PACKAGES</code> directory on the local
7459 host. The generated files can be made to refer to URLs 7459 host. The generated files can be made to refer to URLs
7460 based on <code class="varname">FTP_PKG_URL_HOST</code> and 7460 based on <code class="varname">FTP_PKG_URL_HOST</code> and
7461 <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I 7461 <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I
7462 wanted to generate <code class="filename">README.html</code> 7462 wanted to generate <code class="filename">README.html</code>
7463 files which pointed to binary packages on the local 7463 files which pointed to binary packages on the local
7464 machine, in the directory 7464 machine, in the directory
7465 <code class="filename">/usr/packages</code>, set 7465 <code class="filename">/usr/packages</code>, set
7466 <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and 7466 <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and
7467 <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The 7467 <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
7468 <code class="varname">${PACKAGES}</code> directory and its 7468 <code class="varname">${PACKAGES}</code> directory and its
7469 subdirectories will be searched for all the binary 7469 subdirectories will be searched for all the binary
7470 packages.</p> 7470 packages.</p>
7471<p>The target can be run at the toplevel or in category 7471<p>The target can be run at the toplevel or in category
7472 directories, in which case it descends recursively.</p> 7472 directories, in which case it descends recursively.</p>
7473</dd> 7473</dd>
7474<dt><span class="term">readme-all</span></dt> 7474<dt><span class="term">readme-all</span></dt>
7475<dd><p>This is a top-level command, run it in 7475<dd><p>This is a top-level command, run it in
7476 <code class="filename">pkgsrc</code>. Use this target to create a 7476 <code class="filename">pkgsrc</code>. Use this target to create a
7477 file <code class="filename">README-all.html</code> which contains a 7477 file <code class="filename">README-all.html</code> which contains a
7478 list of all packages currently available in the NetBSD 7478 list of all packages currently available in the NetBSD
7479 Packages Collection, together with the category they belong 7479 Packages Collection, together with the category they belong
7480 to and a short description. This file is compiled from the 7480 to and a short description. This file is compiled from the
7481 <code class="filename">pkgsrc/*/README.html</code> files, so be sure 7481 <code class="filename">pkgsrc/*/README.html</code> files, so be sure
7482 to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make 7482 to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make
7483 readme</strong></span>.</p></dd> 7483 readme</strong></span>.</p></dd>
7484<dt><span class="term">cdrom-readme</span></dt> 7484<dt><span class="term">cdrom-readme</span></dt>
7485<dd><p>This is very much the same as the 7485<dd><p>This is very much the same as the
7486 <span class="quote">&#8220;<span class="quote">readme</span>&#8221;</span> target (see above), but is to be 7486 <span class="quote">&#8220;<span class="quote">readme</span>&#8221;</span> target (see above), but is to be
7487 used when generating a pkgsrc tree to be written to a 7487 used when generating a pkgsrc tree to be written to a
7488 CD-ROM. This target also produces 7488 CD-ROM. This target also produces
7489 <code class="filename">README.html</code> files, and can be made 7489 <code class="filename">README.html</code> files, and can be made
7490 to refer to URLs based on 7490 to refer to URLs based on
7491 <code class="varname">CDROM_PKG_URL_HOST</code> and 7491 <code class="varname">CDROM_PKG_URL_HOST</code> and
7492 <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd> 7492 <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd>
7493<dt><span class="term">show-distfiles</span></dt> 7493<dt><span class="term">show-distfiles</span></dt>
7494<dd><p>This target shows which distfiles and patchfiles 7494<dd><p>This target shows which distfiles and patchfiles
7495 are needed to build the package 7495 are needed to build the package
7496 (<code class="varname">ALLFILES</code>, which contains all 7496 (<code class="varname">ALLFILES</code>, which contains all
7497 <code class="varname">DISTFILES</code> and 7497 <code class="varname">DISTFILES</code> and
7498 <code class="varname">PATCHFILES</code>, but not 7498 <code class="varname">PATCHFILES</code>, but not
7499 <code class="filename">patches/*</code>).</p></dd> 7499 <code class="filename">patches/*</code>).</p></dd>
7500<dt><span class="term">show-downlevel</span></dt> 7500<dt><span class="term">show-downlevel</span></dt>
7501<dd><p>This target shows nothing if the package is not 7501<dd><p>This target shows nothing if the package is not
7502 installed. If a version of this package is installed, 7502 installed. If a version of this package is installed,
7503 but is not the version provided in this version of 7503 but is not the version provided in this version of
7504 pkgsrc, then a warning message is displayed. This target 7504 pkgsrc, then a warning message is displayed. This target
7505 can be used to show which of your installed packages are 7505 can be used to show which of your installed packages are
7506 downlevel, and so the old versions can be deleted, and 7506 downlevel, and so the old versions can be deleted, and
7507 the current ones added.</p></dd> 7507 the current ones added.</p></dd>
7508<dt><span class="term">show-pkgsrc-dir</span></dt> 7508<dt><span class="term">show-pkgsrc-dir</span></dt>
7509<dd><p>This target shows the directory in the pkgsrc 7509<dd><p>This target shows the directory in the pkgsrc
7510 hierarchy from which the package can be built and 7510 hierarchy from which the package can be built and
7511 installed. This may not be the same directory as the one 7511 installed. This may not be the same directory as the one
7512 from which the package was installed. This target is 7512 from which the package was installed. This target is
7513 intended to be used by people who may wish to upgrade 7513 intended to be used by people who may wish to upgrade
7514 many packages on a single host, and can be invoked from 7514 many packages on a single host, and can be invoked from
7515 the top-level pkgsrc Makefile by using the 7515 the top-level pkgsrc Makefile by using the
7516 <span class="quote">&#8220;<span class="quote">show-host-specific-pkgs</span>&#8221;</span> target.</p></dd> 7516 <span class="quote">&#8220;<span class="quote">show-host-specific-pkgs</span>&#8221;</span> target.</p></dd>
7517<dt><span class="term">show-installed-depends</span></dt> 7517<dt><span class="term">show-installed-depends</span></dt>
7518<dd><p>This target shows which installed packages match 7518<dd><p>This target shows which installed packages match
7519 the current package's <code class="varname">DEPENDS</code>. Useful 7519 the current package's <code class="varname">DEPENDS</code>. Useful
7520 if out of date dependencies are causing build 7520 if out of date dependencies are causing build
7521 problems.</p></dd> 7521 problems.</p></dd>
7522<dt><span class="term">check-shlibs</span></dt> 7522<dt><span class="term">check-shlibs</span></dt>
7523<dd><p>After a package is installed, check all its 7523<dd><p>After a package is installed, check all its
7524 binaries and (on ELF platforms) shared libraries to see 7524 binaries and (on ELF platforms) shared libraries to see
7525 if they find the shared libs they need. Run by default 7525 if they find the shared libs they need. Run by default
7526 if <code class="varname">PKG_DEVELOPER</code> is set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p></dd> 7526 if <code class="varname">PKG_DEVELOPER</code> is set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p></dd>
7527<dt><span class="term">print-PLIST</span></dt> 7527<dt><span class="term">print-PLIST</span></dt>
7528<dd> 7528<dd>
7529<p>After a <span class="quote">&#8220;<span class="quote">make install</span>&#8221;</span> from a new or 7529<p>After a <span class="quote">&#8220;<span class="quote">make install</span>&#8221;</span> from a new or
7530 upgraded pkg, this prints out an attempt to generate a 7530 upgraded pkg, this prints out an attempt to generate a
7531 new <code class="filename">PLIST</code> from a <span class="command"><strong>find 7531 new <code class="filename">PLIST</code> from a <span class="command"><strong>find
7532 -newer work/.extract_done</strong></span>. An attempt is made 7532 -newer work/.extract_done</strong></span>. An attempt is made
7533 to care for shared libs etc., but it is 7533 to care for shared libs etc., but it is
7534 <span class="emphasis"><em>strongly</em></span> recommended to review the 7534 <span class="emphasis"><em>strongly</em></span> recommended to review the
7535 result before putting it into 7535 result before putting it into
7536 <code class="filename">PLIST</code>. On upgrades, it's useful to 7536 <code class="filename">PLIST</code>. On upgrades, it's useful to
7537 diff the output of this command against an already 7537 diff the output of this command against an already
7538 existing <code class="filename">PLIST</code> file.</p> 7538 existing <code class="filename">PLIST</code> file.</p>
7539<p>If the package installs files via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or 7539<p>If the package installs files via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or
7540 other methods that don't update file access times, be 7540 other methods that don't update file access times, be
7541 sure to add these files manually to your 7541 sure to add these files manually to your
7542 <code class="filename">PLIST</code>, as the <span class="quote">&#8220;<span class="quote">find 7542 <code class="filename">PLIST</code>, as the <span class="quote">&#8220;<span class="quote">find
7543 -newer</span>&#8221;</span> command used by this target won't catch 7543 -newer</span>&#8221;</span> command used by this target won't catch
7544 them!</p> 7544 them!</p>
7545<p>See <a class="xref" href="#print-PLIST" title="13.3. Tweaking output of make print-PLIST">Section 13.3, &#8220;Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>&#8221;</a> for more 7545<p>See <a class="xref" href="#print-PLIST" title="13.3. Tweaking output of make print-PLIST">Section 13.3, &#8220;Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>&#8221;</a> for more
7546 information on this target.</p> 7546 information on this target.</p>
7547</dd> 7547</dd>
7548<dt><span class="term">bulk-package</span></dt> 7548<dt><span class="term">bulk-package</span></dt>
7549<dd> 7549<dd>
7550<p>Used to do bulk builds. If an appropriate binary 7550<p>Used to do bulk builds. If an appropriate binary
7551 package already exists, no action is taken. If not, this 7551 package already exists, no action is taken. If not, this
7552 target will compile, install and package it (and its 7552 target will compile, install and package it (and its
7553 depends, if <code class="varname">PKG_DEPENDS</code> is set 7553 depends, if <code class="varname">PKG_DEPENDS</code> is set
7554 properly. See <a class="xref" href="#binary.configuration" title="7.3.1. Configuration">Section 7.3.1, &#8220;Configuration&#8221;</a>). 7554 properly. See <a class="xref" href="#binary.configuration" title="7.3.1. Configuration">Section 7.3.1, &#8220;Configuration&#8221;</a>).
7555 After creating the binary package, the sources, the 7555 After creating the binary package, the sources, the
7556 just-installed package and its required packages are 7556 just-installed package and its required packages are
7557 removed, preserving free disk space.</p> 7557 removed, preserving free disk space.</p>
7558<p><span class="emphasis"><em>Beware that this target may deinstall 7558<p><span class="emphasis"><em>Beware that this target may deinstall
7559 all packages installed on a system!</em></span></p> 7559 all packages installed on a system!</em></span></p>
7560</dd> 7560</dd>
7561<dt><span class="term">bulk-install</span></dt> 7561<dt><span class="term">bulk-install</span></dt>
7562<dd> 7562<dd>
7563<p>Used during bulk-installs to install required 7563<p>Used during bulk-installs to install required
7564 packages. If an up-to-date binary package is available, 7564 packages. If an up-to-date binary package is available,
7565 it will be installed via <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>. If not, 7565 it will be installed via <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>. If not,
7566 <span class="command"><strong>make bulk-package</strong></span> will be executed, 7566 <span class="command"><strong>make bulk-package</strong></span> will be executed,
7567 but the installed binary won't be removed.</p> 7567 but the installed binary won't be removed.</p>
7568<p>A binary package is considered 7568<p>A binary package is considered
7569 <span class="quote">&#8220;<span class="quote">up-to-date</span>&#8221;</span> to be installed via 7569 <span class="quote">&#8220;<span class="quote">up-to-date</span>&#8221;</span> to be installed via
7570 <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> if:</p> 7570 <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> if:</p>
7571<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 7571<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
7572<li class="listitem"><p>None of the package's files 7572<li class="listitem"><p>None of the package's files
7573 (<code class="filename">Makefile</code>, ...) were modified 7573 (<code class="filename">Makefile</code>, ...) were modified
7574 since it was built.</p></li> 7574 since it was built.</p></li>
7575<li class="listitem"><p>None of the package's required (binary) 7575<li class="listitem"><p>None of the package's required (binary)
7576 packages were modified since it was built.</p></li> 7576 packages were modified since it was built.</p></li>
7577</ul></div> 7577</ul></div>
7578<p><span class="emphasis"><em>Beware that this target may deinstall 7578<p><span class="emphasis"><em>Beware that this target may deinstall
7579 all packages installed on a system!</em></span></p> 7579 all packages installed on a system!</em></span></p>
7580</dd> 7580</dd>
7581</dl></div> 7581</dl></div>
7582</div> 7582</div>
7583</div> 7583</div>
7584<div class="chapter"> 7584<div class="chapter">
7585<div class="titlepage"><div><div><h2 class="title"> 7585<div class="titlepage"><div><div><h2 class="title">
7586<a name="tools"></a>Chapter 18. Tools needed for building or running</h2></div></div></div> 7586<a name="tools"></a>Chapter 18. Tools needed for building or running</h2></div></div></div>
7587<div class="toc"> 7587<div class="toc">
7588<p><b>Table of Contents</b></p> 7588<p><b>Table of Contents</b></p>
7589<dl> 7589<dl>
7590<dt><span class="sect1"><a href="#pkgsrc-tools">18.1. Tools for pkgsrc builds</a></span></dt> 7590<dt><span class="sect1"><a href="#pkgsrc-tools">18.1. Tools for pkgsrc builds</a></span></dt>
7591<dt><span class="sect1"><a href="#package-tools">18.2. Tools needed by packages</a></span></dt> 7591<dt><span class="sect1"><a href="#package-tools">18.2. Tools needed by packages</a></span></dt>
7592<dt><span class="sect1"><a href="#platform-tools">18.3. Tools provided by platforms</a></span></dt> 7592<dt><span class="sect1"><a href="#platform-tools">18.3. Tools provided by platforms</a></span></dt>
7593<dt><span class="sect1"><a href="#tools.questions">18.4. Questions regarding the tools</a></span></dt> 7593<dt><span class="sect1"><a href="#tools.questions">18.4. Questions regarding the tools</a></span></dt>
7594</dl> 7594</dl>
7595</div> 7595</div>
7596<p>The <code class="varname">USE_TOOLS</code> definition is used both internally 7596<p>The <code class="varname">USE_TOOLS</code> definition is used both internally
7597by pkgsrc and also for individual packages to define what commands 7597by pkgsrc and also for individual packages to define what commands
7598are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>) 7598are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>)
7599or for later run-time of an installed packaged (such as 7599or for later run-time of an installed packaged (such as
7600<code class="varname">DEPENDS</code>). 7600<code class="varname">DEPENDS</code>).
7601If the native system provides an adequate tool, then in many cases, a pkgsrc 7601If the native system provides an adequate tool, then in many cases, a pkgsrc
7602package will not be used.</p> 7602package will not be used.</p>
7603<p>When building a package, the replacement tools are 7603<p>When building a package, the replacement tools are
7604made available in a directory (as symlinks or wrapper scripts) 7604made available in a directory (as symlinks or wrapper scripts)
7605that is early in the executable search path. Just like the buildlink 7605that is early in the executable search path. Just like the buildlink
7606system, this helps with consistent builds.</p> 7606system, this helps with consistent builds.</p>
7607<p>A tool may be needed to help build a specific package. For example, 7607<p>A tool may be needed to help build a specific package. For example,
7608perl, GNU make (gmake) or yacc may be needed.</p> 7608perl, GNU make (gmake) or yacc may be needed.</p>
7609<p>Also a tool may be needed, for example, because the native system's supplied 7609<p>Also a tool may be needed, for example, because the native system's supplied
7610tool may be inefficient for building a package with pkgsrc. 7610tool may be inefficient for building a package with pkgsrc.
7611For example, a package may need GNU awk, bison (instead of 7611For example, a package may need GNU awk, bison (instead of
7612yacc) or a better sed.</p> 7612yacc) or a better sed.</p>
7613<p>The tools used by a package can be listed by running 7613<p>The tools used by a package can be listed by running
7614<span class="command"><strong>make show-tools</strong></span>.</p> 7614<span class="command"><strong>make show-tools</strong></span>.</p>
7615<div class="sect1"> 7615<div class="sect1">
7616<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7616<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7617<a name="pkgsrc-tools"></a>18.1. Tools for pkgsrc builds</h2></div></div></div> 7617<a name="pkgsrc-tools"></a>18.1. Tools for pkgsrc builds</h2></div></div></div>
7618<p>The default set of tools used by pkgsrc is defined in 7618<p>The default set of tools used by pkgsrc is defined in
7619<code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools, 7619<code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
7620such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>, 7620such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
7621<span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on. 7621<span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
7622These can be seen by running: 7622These can be seen by running:
7623<span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p> 7623<span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
7624<p>If a package needs a specific program to build 7624<p>If a package needs a specific program to build
7625then the <code class="varname">USE_TOOLS</code> variable can be used 7625then the <code class="varname">USE_TOOLS</code> variable can be used
7626to define the tools needed.</p> 7626to define the tools needed.</p>
7627</div> 7627</div>
7628<div class="sect1"> 7628<div class="sect1">
7629<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7629<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7630<a name="package-tools"></a>18.2. Tools needed by packages</h2></div></div></div> 7630<a name="package-tools"></a>18.2. Tools needed by packages</h2></div></div></div>
7631<p>In the following examples, the :run means that it is needed at 7631<p>In the following examples, the :run means that it is needed at
7632run-time (and becomes a DEPENDS). 7632run-time (and becomes a DEPENDS).
7633The default is a build dependency which can be set with 7633The default is a build dependency which can be set with
7634:build. (So in this example, it is the same as gmake:build 7634:build. (So in this example, it is the same as gmake:build
7635and pkg-config:build.)</p> 7635and pkg-config:build.)</p>
7636<pre class="programlisting"> 7636<pre class="programlisting">
7637USE_TOOLS+= gmake perl:run pkg-config 7637USE_TOOLS+= gmake perl:run pkg-config
7638</pre> 7638</pre>
7639<p>When using the tools framework, a 7639<p>When using the tools framework, a
7640<code class="varname">TOOLS_PATH.foo</code> variable is defined 7640<code class="varname">TOOLS_PATH.foo</code> variable is defined
7641which contains the full path to the appropriate tool. For example, 7641which contains the full path to the appropriate tool. For example,
7642<code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">&#8220;<span class="quote">/bin/bash</span>&#8221;</span> 7642<code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">&#8220;<span class="quote">/bin/bash</span>&#8221;</span>
7643on Linux systems.</p> 7643on Linux systems.</p>
7644<p>If you always need a pkgsrc version of the 7644<p>If you always need a pkgsrc version of the
7645tool at run-time, then just use <code class="varname">DEPENDS</code> instead. 7645tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
7646</p> 7646</p>
7647</div> 7647</div>
7648<div class="sect1"> 7648<div class="sect1">
7649<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7649<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7650<a name="platform-tools"></a>18.3. Tools provided by platforms</h2></div></div></div> 7650<a name="platform-tools"></a>18.3. Tools provided by platforms</h2></div></div></div>
7651<p>When improving or porting pkgsrc to a new platform, have a look 7651<p>When improving or porting pkgsrc to a new platform, have a look
7652at (or create) the corresponding platform specific make file fragment under 7652at (or create) the corresponding platform specific make file fragment under
7653<code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines 7653<code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
7654the name of the common tools. For example:</p> 7654the name of the common tools. For example:</p>
7655<pre class="programlisting"> 7655<pre class="programlisting">
7656.if exists(/usr/bin/bzcat) 7656.if exists(/usr/bin/bzcat)
7657TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat 7657TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
7658.elif exists(/usr/bin/bzip2) 7658.elif exists(/usr/bin/bzip2)
7659TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd 7659TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
7660.endif 7660.endif
7661 7661
7662TOOLS_PLATFORM.true?= true # shell builtin 7662TOOLS_PLATFORM.true?= true # shell builtin
7663</pre> 7663</pre>
7664</div> 7664</div>
7665<div class="sect1"> 7665<div class="sect1">
7666<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7666<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7667<a name="tools.questions"></a>18.4. Questions regarding the tools</h2></div></div></div> 7667<a name="tools.questions"></a>18.4. Questions regarding the tools</h2></div></div></div>
7668<div class="qandaset"> 7668<div class="qandaset">
7669<a name="idm77762608"></a><dl> 7669<a name="idm76234800"></a><dl>
7670<dt>18.4.1. <a href="#tools.new">How do I add a new tool?</a> 7670<dt>18.4.1. <a href="#tools.new">How do I add a new tool?</a>
7671</dt> 7671</dt>
7672<dt>18.4.2. <a href="#tools.listall">How do I get a list of all available 7672<dt>18.4.2. <a href="#tools.listall">How do I get a list of all available
7673 tools?</a> 7673 tools?</a>
7674</dt> 7674</dt>
7675<dt>18.4.3. <a href="#tools.used">How can I get a list of all the tools that a 7675<dt>18.4.3. <a href="#tools.used">How can I get a list of all the tools that a
7676 package is using while being built? I want to know whether it 7676 package is using while being built? I want to know whether it
7677 uses sed or not.</a> 7677 uses sed or not.</a>
7678</dt> 7678</dt>
7679</dl> 7679</dl>
7680<table border="0" style="width: 100%;"> 7680<table border="0" style="width: 100%;">
7681<colgroup> 7681<colgroup>
7682<col align="left" width="1%"> 7682<col align="left" width="1%">
7683<col> 7683<col>
7684</colgroup> 7684</colgroup>
7685<tbody> 7685<tbody>
7686<tr class="question"> 7686<tr class="question">
7687<td align="left" valign="top"> 7687<td align="left" valign="top">
7688<a name="tools.new"></a><a name="idm77762224"></a><p><b>18.4.1.</b></p> 7688<a name="tools.new"></a><a name="idm76234416"></a><p><b>18.4.1.</b></p>
7689</td> 7689</td>
7690<td align="left" valign="top"><p>How do I add a new tool?</p></td> 7690<td align="left" valign="top"><p>How do I add a new tool?</p></td>
7691</tr> 7691</tr>
7692<tr class="answer"> 7692<tr class="answer">
7693<td align="left" valign="top"></td> 7693<td align="left" valign="top"></td>
7694<td align="left" valign="top"><p>TODO</p></td> 7694<td align="left" valign="top"><p>TODO</p></td>
7695</tr> 7695</tr>
7696<tr class="question"> 7696<tr class="question">
7697<td align="left" valign="top"> 7697<td align="left" valign="top">
7698<a name="tools.listall"></a><a name="idm77761072"></a><p><b>18.4.2.</b></p> 7698<a name="tools.listall"></a><a name="idm76233264"></a><p><b>18.4.2.</b></p>
7699</td> 7699</td>
7700<td align="left" valign="top"><p>How do I get a list of all available 7700<td align="left" valign="top"><p>How do I get a list of all available
7701 tools?</p></td> 7701 tools?</p></td>
7702</tr> 7702</tr>
7703<tr class="answer"> 7703<tr class="answer">
7704<td align="left" valign="top"></td> 7704<td align="left" valign="top"></td>
7705<td align="left" valign="top"><p>TODO</p></td> 7705<td align="left" valign="top"><p>TODO</p></td>
7706</tr> 7706</tr>
7707<tr class="question"> 7707<tr class="question">
7708<td align="left" valign="top"> 7708<td align="left" valign="top">
7709<a name="tools.used"></a><a name="idm77760048"></a><p><b>18.4.3.</b></p> 7709<a name="tools.used"></a><a name="idm76232240"></a><p><b>18.4.3.</b></p>
7710</td> 7710</td>
7711<td align="left" valign="top"><p>How can I get a list of all the tools that a 7711<td align="left" valign="top"><p>How can I get a list of all the tools that a
7712 package is using while being built? I want to know whether it 7712 package is using while being built? I want to know whether it
7713 uses sed or not.</p></td> 7713 uses sed or not.</p></td>
7714</tr> 7714</tr>
7715<tr class="answer"> 7715<tr class="answer">
7716<td align="left" valign="top"></td> 7716<td align="left" valign="top"></td>
7717<td align="left" valign="top"><p>Currently, you can't. (TODO: But I want to be able 7717<td align="left" valign="top"><p>Currently, you can't. (TODO: But I want to be able
7718 to do it.)</p></td> 7718 to do it.)</p></td>
7719</tr> 7719</tr>
7720</tbody> 7720</tbody>
7721</table> 7721</table>
7722</div> 7722</div>
7723</div> 7723</div>
7724</div> 7724</div>
7725<div class="chapter"> 7725<div class="chapter">
7726<div class="titlepage"><div><div><h2 class="title"> 7726<div class="titlepage"><div><div><h2 class="title">
7727<a name="fixes"></a>Chapter 19. Making your package work</h2></div></div></div> 7727<a name="fixes"></a>Chapter 19. Making your package work</h2></div></div></div>
7728<div class="toc"> 7728<div class="toc">
7729<p><b>Table of Contents</b></p> 7729<p><b>Table of Contents</b></p>
7730<dl> 7730<dl>
7731<dt><span class="sect1"><a href="#general-operation">19.1. General operation</a></span></dt> 7731<dt><span class="sect1"><a href="#general-operation">19.1. General operation</a></span></dt>
7732<dd><dl> 7732<dd><dl>
7733<dt><span class="sect2"><a href="#portability-of-packages">19.1.1. Portability of packages</a></span></dt> 7733<dt><span class="sect2"><a href="#portability-of-packages">19.1.1. Portability of packages</a></span></dt>
7734<dt><span class="sect2"><a href="#pulling-vars-from-etc-mk.conf">19.1.2. How to pull in user-settable variables from <code class="filename">mk.conf</code></a></span></dt> 7734<dt><span class="sect2"><a href="#pulling-vars-from-etc-mk.conf">19.1.2. How to pull in user-settable variables from <code class="filename">mk.conf</code></a></span></dt>
7735<dt><span class="sect2"><a href="#user-interaction">19.1.3. User interaction</a></span></dt> 7735<dt><span class="sect2"><a href="#user-interaction">19.1.3. User interaction</a></span></dt>
7736<dt><span class="sect2"><a href="#handling-licenses">19.1.4. Handling licenses</a></span></dt> 7736<dt><span class="sect2"><a href="#handling-licenses">19.1.4. Handling licenses</a></span></dt>
7737<dt><span class="sect2"><a href="#restricted-packages">19.1.5. Restricted packages</a></span></dt> 7737<dt><span class="sect2"><a href="#restricted-packages">19.1.5. Restricted packages</a></span></dt>
7738<dt><span class="sect2"><a href="#dependencies">19.1.6. Handling dependencies</a></span></dt> 7738<dt><span class="sect2"><a href="#dependencies">19.1.6. Handling dependencies</a></span></dt>
7739<dt><span class="sect2"><a href="#conflicts">19.1.7. Handling conflicts with other packages</a></span></dt> 7739<dt><span class="sect2"><a href="#conflicts">19.1.7. Handling conflicts with other packages</a></span></dt>
7740<dt><span class="sect2"><a href="#not-building-packages">19.1.8. Packages that cannot or should not be built</a></span></dt> 7740<dt><span class="sect2"><a href="#not-building-packages">19.1.8. Packages that cannot or should not be built</a></span></dt>
7741<dt><span class="sect2"><a href="#undeletable-packages">19.1.9. Packages which should not be deleted, once installed</a></span></dt> 7741<dt><span class="sect2"><a href="#undeletable-packages">19.1.9. Packages which should not be deleted, once installed</a></span></dt>
7742<dt><span class="sect2"><a href="#security-handling">19.1.10. Handling packages with security problems</a></span></dt> 7742<dt><span class="sect2"><a href="#security-handling">19.1.10. Handling packages with security problems</a></span></dt>
7743<dt><span class="sect2"><a href="#bumping-pkgrevision">19.1.11. How to handle incrementing versions when fixing an existing package</a></span></dt> 7743<dt><span class="sect2"><a href="#bumping-pkgrevision">19.1.11. How to handle incrementing versions when fixing an existing package</a></span></dt>
7744<dt><span class="sect2"><a href="#fixes.subst">19.1.12. Substituting variable text in the package files (the SUBST framework)</a></span></dt> 7744<dt><span class="sect2"><a href="#fixes.subst">19.1.12. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
7745</dl></dd> 7745</dl></dd>
7746<dt><span class="sect1"><a href="#fixes.fetch">19.2. Fixing problems in the <span class="emphasis"><em>fetch</em></span> phase</a></span></dt> 7746<dt><span class="sect1"><a href="#fixes.fetch">19.2. Fixing problems in the <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
7747<dd><dl> 7747<dd><dl>
7748<dt><span class="sect2"><a href="#no-plain-download">19.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt> 7748<dt><span class="sect2"><a href="#no-plain-download">19.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
7749<dt><span class="sect2"><a href="#modified-distfiles-same-name">19.2.2. How to handle modified distfiles with the 'old' name</a></span></dt> 7749<dt><span class="sect2"><a href="#modified-distfiles-same-name">19.2.2. How to handle modified distfiles with the 'old' name</a></span></dt>
7750</dl></dd> 7750</dl></dd>
7751<dt><span class="sect1"><a href="#fixes.configure">19.3. Fixing problems in the <span class="emphasis"><em>configure</em></span> phase</a></span></dt> 7751<dt><span class="sect1"><a href="#fixes.configure">19.3. Fixing problems in the <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
7752<dd><dl> 7752<dd><dl>
7753<dt><span class="sect2"><a href="#fixes.libtool">19.3.1. Shared libraries - libtool</a></span></dt> 7753<dt><span class="sect2"><a href="#fixes.libtool">19.3.1. Shared libraries - libtool</a></span></dt>
7754<dt><span class="sect2"><a href="#using-libtool">19.3.2. Using libtool on GNU packages that already support libtool</a></span></dt> 7754<dt><span class="sect2"><a href="#using-libtool">19.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
7755<dt><span class="sect2"><a href="#autoconf-automake">19.3.3. GNU Autoconf/Automake</a></span></dt> 7755<dt><span class="sect2"><a href="#autoconf-automake">19.3.3. GNU Autoconf/Automake</a></span></dt>
7756</dl></dd> 7756</dl></dd>
7757<dt><span class="sect1"><a href="#programming-languages">19.4. Programming languages</a></span></dt> 7757<dt><span class="sect1"><a href="#programming-languages">19.4. Programming languages</a></span></dt>
7758<dd><dl> 7758<dd><dl>
7759<dt><span class="sect2"><a href="#basic-programming-languages">19.4.1. C, C++, and Fortran</a></span></dt> 7759<dt><span class="sect2"><a href="#basic-programming-languages">19.4.1. C, C++, and Fortran</a></span></dt>
7760<dt><span class="sect2"><a href="#java-programming-language">19.4.2. Java</a></span></dt> 7760<dt><span class="sect2"><a href="#java-programming-language">19.4.2. Java</a></span></dt>
7761<dt><span class="sect2"><a href="#perl-scripts">19.4.3. Packages containing perl scripts</a></span></dt> 7761<dt><span class="sect2"><a href="#perl-scripts">19.4.3. Packages containing perl scripts</a></span></dt>
7762<dt><span class="sect2"><a href="#shell-scripts">19.4.4. Packages containing shell scripts</a></span></dt> 7762<dt><span class="sect2"><a href="#shell-scripts">19.4.4. Packages containing shell scripts</a></span></dt>
7763<dt><span class="sect2"><a href="#other-programming-languages">19.4.5. Other programming languages</a></span></dt> 7763<dt><span class="sect2"><a href="#other-programming-languages">19.4.5. Other programming languages</a></span></dt>
7764</dl></dd> 7764</dl></dd>
7765<dt><span class="sect1"><a href="#fixes.build">19.5. Fixing problems in the <span class="emphasis"><em>build</em></span> phase</a></span></dt> 7765<dt><span class="sect1"><a href="#fixes.build">19.5. Fixing problems in the <span class="emphasis"><em>build</em></span> phase</a></span></dt>
7766<dd><dl> 7766<dd><dl>
7767<dt><span class="sect2"><a href="#fixes.build.cpp">19.5.1. Compiling C and C++ code conditionally</a></span></dt> 7767<dt><span class="sect2"><a href="#fixes.build.cpp">19.5.1. Compiling C and C++ code conditionally</a></span></dt>
7768<dt><span class="sect2"><a href="#compiler-bugs">19.5.2. How to handle compiler bugs</a></span></dt> 7768<dt><span class="sect2"><a href="#compiler-bugs">19.5.2. How to handle compiler bugs</a></span></dt>
7769<dt><span class="sect2"><a href="#undefined-reference">19.5.3. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt> 7769<dt><span class="sect2"><a href="#undefined-reference">19.5.3. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt>
7770<dt><span class="sect2"><a href="#out-of-memory">19.5.4. Running out of memory</a></span></dt> 7770<dt><span class="sect2"><a href="#out-of-memory">19.5.4. Running out of memory</a></span></dt>
7771</dl></dd> 7771</dl></dd>
7772<dt><span class="sect1"><a href="#fixes.install">19.6. Fixing problems in the <span class="emphasis"><em>install</em></span> phase</a></span></dt> 7772<dt><span class="sect1"><a href="#fixes.install">19.6. Fixing problems in the <span class="emphasis"><em>install</em></span> phase</a></span></dt>
7773<dd><dl> 7773<dd><dl>
7774<dt><span class="sect2"><a href="#install-scripts">19.6.1. Creating needed directories</a></span></dt> 7774<dt><span class="sect2"><a href="#install-scripts">19.6.1. Creating needed directories</a></span></dt>
7775<dt><span class="sect2"><a href="#where-to-install-documentation">19.6.2. Where to install documentation</a></span></dt> 7775<dt><span class="sect2"><a href="#where-to-install-documentation">19.6.2. Where to install documentation</a></span></dt>
7776<dt><span class="sect2"><a href="#installing-score-files">19.6.3. Installing highscore files</a></span></dt> 7776<dt><span class="sect2"><a href="#installing-score-files">19.6.3. Installing highscore files</a></span></dt>
7777<dt><span class="sect2"><a href="#destdir-support">19.6.4. Adding DESTDIR support to packages</a></span></dt> 7777<dt><span class="sect2"><a href="#destdir-support">19.6.4. Adding DESTDIR support to packages</a></span></dt>
7778<dt><span class="sect2"><a href="#hardcoded-paths">19.6.5. Packages with hardcoded paths to other interpreters</a></span></dt> 7778<dt><span class="sect2"><a href="#hardcoded-paths">19.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
7779<dt><span class="sect2"><a href="#perl-modules">19.6.6. Packages installing perl modules</a></span></dt> 7779<dt><span class="sect2"><a href="#perl-modules">19.6.6. Packages installing perl modules</a></span></dt>
7780<dt><span class="sect2"><a href="#faq.info-files">19.6.7. Packages installing info files</a></span></dt> 7780<dt><span class="sect2"><a href="#faq.info-files">19.6.7. Packages installing info files</a></span></dt>
7781<dt><span class="sect2"><a href="#manpages">19.6.8. Packages installing man pages</a></span></dt> 7781<dt><span class="sect2"><a href="#manpages">19.6.8. Packages installing man pages</a></span></dt>
7782<dt><span class="sect2"><a href="#gconf-data-files">19.6.9. Packages installing GConf data files</a></span></dt> 7782<dt><span class="sect2"><a href="#gconf-data-files">19.6.9. Packages installing GConf data files</a></span></dt>
7783<dt><span class="sect2"><a href="#scrollkeeper-data-files">19.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt> 7783<dt><span class="sect2"><a href="#scrollkeeper-data-files">19.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
7784<dt><span class="sect2"><a href="#x11-fonts">19.6.11. Packages installing X11 fonts</a></span></dt> 7784<dt><span class="sect2"><a href="#x11-fonts">19.6.11. Packages installing X11 fonts</a></span></dt>
7785<dt><span class="sect2"><a href="#gtk2-modules">19.6.12. Packages installing GTK2 modules</a></span></dt> 7785<dt><span class="sect2"><a href="#gtk2-modules">19.6.12. Packages installing GTK2 modules</a></span></dt>
7786<dt><span class="sect2"><a href="#sgml-xml-data">19.6.13. Packages installing SGML or XML data</a></span></dt> 7786<dt><span class="sect2"><a href="#sgml-xml-data">19.6.13. Packages installing SGML or XML data</a></span></dt>
7787<dt><span class="sect2"><a href="#mime-database">19.6.14. Packages installing extensions to the MIME database</a></span></dt> 7787<dt><span class="sect2"><a href="#mime-database">19.6.14. Packages installing extensions to the MIME database</a></span></dt>
7788<dt><span class="sect2"><a href="#intltool">19.6.15. Packages using intltool</a></span></dt> 7788<dt><span class="sect2"><a href="#intltool">19.6.15. Packages using intltool</a></span></dt>
7789<dt><span class="sect2"><a href="#startup-scripts">19.6.16. Packages installing startup scripts</a></span></dt> 7789<dt><span class="sect2"><a href="#startup-scripts">19.6.16. Packages installing startup scripts</a></span></dt>
7790<dt><span class="sect2"><a href="#tex-packages">19.6.17. Packages installing TeX modules</a></span></dt> 7790<dt><span class="sect2"><a href="#tex-packages">19.6.17. Packages installing TeX modules</a></span></dt>
7791<dt><span class="sect2"><a href="#emulation-packages">19.6.18. Packages supporting running binaries in 7791<dt><span class="sect2"><a href="#emulation-packages">19.6.18. Packages supporting running binaries in
7792 emulation</a></span></dt> 7792 emulation</a></span></dt>
7793<dt><span class="sect2"><a href="#hicolor-theme">19.6.19. Packages installing hicolor theme icons</a></span></dt> 7793<dt><span class="sect2"><a href="#hicolor-theme">19.6.19. Packages installing hicolor theme icons</a></span></dt>
7794<dt><span class="sect2"><a href="#desktop-files">19.6.20. Packages installing desktop files</a></span></dt> 7794<dt><span class="sect2"><a href="#desktop-files">19.6.20. Packages installing desktop files</a></span></dt>
7795</dl></dd> 7795</dl></dd>
7796<dt><span class="sect1"><a href="#punting">19.7. Marking packages as having problems</a></span></dt> 7796<dt><span class="sect1"><a href="#punting">19.7. Marking packages as having problems</a></span></dt>
7797</dl> 7797</dl>
7798</div> 7798</div>
7799<div class="sect1"> 7799<div class="sect1">
7800<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 7800<div class="titlepage"><div><div><h2 class="title" style="clear: both">
7801<a name="general-operation"></a>19.1. General operation</h2></div></div></div> 7801<a name="general-operation"></a>19.1. General operation</h2></div></div></div>
7802<div class="sect2"> 7802<div class="sect2">
7803<div class="titlepage"><div><div><h3 class="title"> 7803<div class="titlepage"><div><div><h3 class="title">
7804<a name="portability-of-packages"></a>19.1.1. Portability of packages</h3></div></div></div> 7804<a name="portability-of-packages"></a>19.1.1. Portability of packages</h3></div></div></div>
7805<p>One appealing feature of pkgsrc is that it runs on many 7805<p>One appealing feature of pkgsrc is that it runs on many
7806 different platforms. As a result, it is important to ensure, 7806 different platforms. As a result, it is important to ensure,
7807 where possible, that packages in pkgsrc are portable. This 7807 where possible, that packages in pkgsrc are portable. This
7808 chapter mentions some particular details you should pay 7808 chapter mentions some particular details you should pay
7809 attention to while working on pkgsrc.</p> 7809 attention to while working on pkgsrc.</p>
7810</div> 7810</div>
7811<div class="sect2"> 7811<div class="sect2">
7812<div class="titlepage"><div><div><h3 class="title"> 7812<div class="titlepage"><div><div><h3 class="title">
7813<a name="pulling-vars-from-etc-mk.conf"></a>19.1.2. How to pull in user-settable variables from <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> 7813<a name="pulling-vars-from-etc-mk.conf"></a>19.1.2. How to pull in user-settable variables from <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
7814</h3></div></div></div> 7814</h3></div></div></div>
7815<p>The pkgsrc user can configure pkgsrc by overriding several 7815<p>The pkgsrc user can configure pkgsrc by overriding several
7816 variables in the file pointed to by <code class="varname">MAKECONF</code>, 7816 variables in the file pointed to by <code class="varname">MAKECONF</code>,
7817 which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you 7817 which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
7818 want to use those variables in the preprocessor directives of 7818 want to use those variables in the preprocessor directives of
7819 <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 7819 <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
7820 <code class="literal">.for</code>), you need to include the file 7820 <code class="literal">.for</code>), you need to include the file
7821 <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn 7821 <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
7822 loads the user preferences.</p> 7822 loads the user preferences.</p>
7823<p>But note that some variables may not be completely defined 7823<p>But note that some variables may not be completely defined
7824 after <code class="filename">../../mk/bsd.prefs.mk</code> has been 7824 after <code class="filename">../../mk/bsd.prefs.mk</code> has been
7825 included, as they may contain references to variables that are 7825 included, as they may contain references to variables that are
7826 not yet defined. In shell commands this is no problem, since 7826 not yet defined. In shell commands this is no problem, since
7827 variables are actually macros, which are only expanded when they 7827 variables are actually macros, which are only expanded when they
7828 are used. But in the preprocessor directives mentioned above and 7828 are used. But in the preprocessor directives mentioned above and
7829 in dependency lines (of the form <code class="literal">target: 7829 in dependency lines (of the form <code class="literal">target:
7830 dependencies</code>) the variables are expanded at load 7830 dependencies</code>) the variables are expanded at load
7831 time.</p> 7831 time.</p>
7832<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 7832<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
7833<h3 class="title">Note</h3> 7833<h3 class="title">Note</h3>
7834<p>Currently there is no exhaustive list of all 7834<p>Currently there is no exhaustive list of all
7835 variables that tells you whether they can be used at load time 7835 variables that tells you whether they can be used at load time
7836 or only at run time, but it is in preparation.</p> 7836 or only at run time, but it is in preparation.</p>
7837</div> 7837</div>
7838</div> 7838</div>
7839<div class="sect2"> 7839<div class="sect2">
7840<div class="titlepage"><div><div><h3 class="title"> 7840<div class="titlepage"><div><div><h3 class="title">
7841<a name="user-interaction"></a>19.1.3. User interaction</h3></div></div></div> 7841<a name="user-interaction"></a>19.1.3. User interaction</h3></div></div></div>
7842<p>Occasionally, packages require interaction from the user, 7842<p>Occasionally, packages require interaction from the user,
7843 and this can be in a number of ways:</p> 7843 and this can be in a number of ways:</p>
7844<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 7844<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
7845<li class="listitem"><p>When fetching the distfiles, some packages require user 7845<li class="listitem"><p>When fetching the distfiles, some packages require user
7846 interaction such as entering username/password or accepting a 7846 interaction such as entering username/password or accepting a
7847 license on a web page.</p></li> 7847 license on a web page.</p></li>
7848<li class="listitem"><p>When extracting the distfiles, some packages may ask for 7848<li class="listitem"><p>When extracting the distfiles, some packages may ask for
7849 passwords.</p></li> 7849 passwords.</p></li>
7850<li class="listitem"><p>help to configure the package before it is built</p></li> 7850<li class="listitem"><p>help to configure the package before it is built</p></li>
7851<li class="listitem"><p>help during the build process</p></li> 7851<li class="listitem"><p>help during the build process</p></li>
7852<li class="listitem"><p>help during the installation of a package</p></li> 7852<li class="listitem"><p>help during the installation of a package</p></li>
7853</ul></div> 7853</ul></div>
7854<p>The <code class="varname">INTERACTIVE_STAGE</code> definition is 7854<p>The <code class="varname">INTERACTIVE_STAGE</code> definition is
7855 provided to notify the pkgsrc mechanism of an interactive stage 7855 provided to notify the pkgsrc mechanism of an interactive stage
7856 which will be needed, and this should be set in the package's 7856 which will be needed, and this should be set in the package's
7857 <code class="filename">Makefile</code>, e.g.:</p> 7857 <code class="filename">Makefile</code>, e.g.:</p>
7858<pre class="programlisting"> 7858<pre class="programlisting">
7859INTERACTIVE_STAGE= build 7859INTERACTIVE_STAGE= build
7860 </pre> 7860 </pre>
7861<p>Multiple interactive stages can be specified:</p> 7861<p>Multiple interactive stages can be specified:</p>
7862<pre class="programlisting"> 7862<pre class="programlisting">
7863INTERACTIVE_STAGE= configure install 7863INTERACTIVE_STAGE= configure install
7864 </pre> 7864 </pre>
7865<p>The user can then decide to skip this package by setting the 7865<p>The user can then decide to skip this package by setting the
7866 <code class="varname">BATCH</code> variable.</p> 7866 <code class="varname">BATCH</code> variable.</p>
7867</div> 7867</div>
7868<div class="sect2"> 7868<div class="sect2">
7869<div class="titlepage"><div><div><h3 class="title"> 7869<div class="titlepage"><div><div><h3 class="title">
7870<a name="handling-licenses"></a>19.1.4. Handling licenses</h3></div></div></div> 7870<a name="handling-licenses"></a>19.1.4. Handling licenses</h3></div></div></div>
7871<p>Authors of software can choose the licence under which 7871<p>Authors of software can choose the licence under which
7872 software can be copied. This is due to copyright law, and reasons 7872 software can be copied. This is due to copyright law, and reasons
7873 for license choices are outside the scope of pkgsrc. The pkgsrc 7873 for license choices are outside the scope of pkgsrc. The pkgsrc
7874 system recognizes that there are a number of licenses which some 7874 system recognizes that there are a number of licenses which some
7875 users may find objectionable or difficult or impossible to comply 7875 users may find objectionable or difficult or impossible to comply
7876 with. The Free Software Foundation has declared some licenses 7876 with. The Free Software Foundation has declared some licenses
7877 "Free", and the Open Source Initiative has a definition of "Open 7877 "Free", and the Open Source Initiative has a definition of "Open
7878 Source". The pkgsrc system, as a policy choice, does not label 7878 Source". The pkgsrc system, as a policy choice, does not label
7879 packages which have licenses that are Free or Open Source. 7879 packages which have licenses that are Free or Open Source.
7880 However, packages without a license meeting either of those tests 7880 However, packages without a license meeting either of those tests
7881 are labeled with a license tag denoting the license. Note that a 7881 are labeled with a license tag denoting the license. Note that a
7882 package with no license to copy trivially does not meet either the 7882 package with no license to copy trivially does not meet either the
7883 Free or Open Source test.</p> 7883 Free or Open Source test.</p>
7884<p>For packages which are not Free or Open Source, pkgsrc will 7884<p>For packages which are not Free or Open Source, pkgsrc will
7885 not build the package unless the user has indicated to pkgsrc that 7885 not build the package unless the user has indicated to pkgsrc that
7886 packages with that particular license may be built. Note that 7886 packages with that particular license may be built. Note that
7887 this documentation avoids the term "accepted the license". The 7887 this documentation avoids the term "accepted the license". The
7888 pkgsrc system is merely providing a mechanism to avoid 7888 pkgsrc system is merely providing a mechanism to avoid
7889 accidentally building a package with a non-free license; 7889 accidentally building a package with a non-free license;
7890 judgement and responsibility remain with the user. (Installation 7890 judgement and responsibility remain with the user. (Installation
7891 of binary packages are not currently subject to this mechanism; 7891 of binary packages are not currently subject to this mechanism;
7892 this is a bug.)</p> 7892 this is a bug.)</p>
7893<p>One might want to only install packages with a BSD license, 7893<p>One might want to only install packages with a BSD license,
7894 or the GPL, and not the other. The free licenses are added to the  7894 or the GPL, and not the other. The free licenses are added to the
7895 default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The 7895 default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The
7896 user can override the default by setting the 7896 user can override the default by setting the
7897 <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead 7897 <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead
7898 of "+=". The licenses accepted by default are: 7898 of "+=". The licenses accepted by default are:
7899 </p> 7899 </p>
7900<pre class="programlisting"> 7900<pre class="programlisting">
7901 apache-1.1 apache-2.0 7901 apache-1.1 apache-2.0
7902 arphic-public 7902 arphic-public
7903 artistic artistic-2.0 7903 artistic artistic-2.0
7904 boost-license 7904 boost-license
7905 cc-by-sa-v3.0 7905 cc-by-sa-v3.0
7906 cc0-1.0-universal 7906 cc0-1.0-universal
7907 cddl-1.0 7907 cddl-1.0
7908 cpl-1.0 7908 cpl-1.0
7909 epl-v1.0 7909 epl-v1.0
7910 gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3 7910 gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3
7911 gnu-gpl-v1 7911 gnu-gpl-v1
7912 gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 7912 gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1
7913 gnu-gpl-v3 gnu-lgpl-v3 7913 gnu-gpl-v3 gnu-lgpl-v3
7914 ibm-public-license-1.0 7914 ibm-public-license-1.0
7915 ipafont 7915 ipafont
7916 isc 7916 isc
7917 lppl-1.3c 7917 lppl-1.3c
7918 lucent 7918 lucent
7919 miros 7919 miros
7920 mit 7920 mit
7921 mpl-1.0 mpl-1.1 mpl-2.0 7921 mpl-1.0 mpl-1.1 mpl-2.0
7922 mplusfont 7922 mplusfont
7923 ofl-v1.0 ofl-v1.1 7923 ofl-v1.0 ofl-v1.1
7924 original-bsd modified-bsd 2-clause-bsd 7924 original-bsd modified-bsd 2-clause-bsd
7925 php 7925 php
7926 png-license 7926 png-license
7927 postgresql-license 7927 postgresql-license
7928 public-domain 7928 public-domain
7929 python-software-foundation 7929 python-software-foundation
7930 qpl-v1.0 7930 qpl-v1.0
7931 sgi-free-software-b-v2.0 7931 sgi-free-software-b-v2.0
7932 sleepycat-public 7932 sleepycat-public
7933 unlicense 7933 unlicense
7934 x11 7934 x11
7935 zlib 7935 zlib
7936 zpl 7936 zpl
7937 </pre> 7937 </pre>
7938<p> 7938<p>
7939 </p> 7939 </p>
7940<p>The license tag mechanism is intended to address 7940<p>The license tag mechanism is intended to address
7941 copyright-related issues surrounding building, installing and 7941 copyright-related issues surrounding building, installing and
7942 using a package, and not to address redistribution issues (see 7942 using a package, and not to address redistribution issues (see
7943 <code class="varname">RESTRICTED</code> and 7943 <code class="varname">RESTRICTED</code> and
7944 <code class="varname">NO_SRC_ON_FTP</code>, etc.).  7944 <code class="varname">NO_SRC_ON_FTP</code>, etc.).
7945 Packages with redistribution restrictions should set these 7945 Packages with redistribution restrictions should set these
7946 tags.</p> 7946 tags.</p>
7947<p>Denoting that a package may be copied according to a 7947<p>Denoting that a package may be copied according to a
7948 particular license is done by placing the license in 7948 particular license is done by placing the license in
7949 <code class="filename">pkgsrc/licenses</code> and setting the 7949 <code class="filename">pkgsrc/licenses</code> and setting the
7950 <code class="varname">LICENSE</code> variable to a string identifying the 7950 <code class="varname">LICENSE</code> variable to a string identifying the
7951 license, e.g. in <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/xv/README.html" target="_top"><code class="filename">graphics/xv</code></a>:</p> 7951 license, e.g. in <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/xv/README.html" target="_top"><code class="filename">graphics/xv</code></a>:</p>
7952<pre class="programlisting"> 7952<pre class="programlisting">
7953LICENSE= xv-license 7953LICENSE= xv-license
7954 </pre> 7954 </pre>
7955<p>When trying to build, the user will get a notice that the 7955<p>When trying to build, the user will get a notice that the
7956 package is covered by a license which has not been placed in the 7956 package is covered by a license which has not been placed in the
7957 <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p> 7957 <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p>
7958<pre class="programlisting"> 7958<pre class="programlisting">
7959<code class="prompt">%</code> <strong class="userinput"><code>make</code></strong> 7959<code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
7960===&gt; xv-3.10anb9 has an unacceptable license: xv-license. 7960===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
7961===&gt; To view the license, enter "/usr/bin/make show-license". 7961===&gt; To view the license, enter "/usr/bin/make show-license".
7962===&gt; To indicate acceptance, add this line to your /etc/mk.conf: 7962===&gt; To indicate acceptance, add this line to your /etc/mk.conf:
7963===&gt; ACCEPTABLE_LICENSES+=xv-license 7963===&gt; ACCEPTABLE_LICENSES+=xv-license
7964*** Error code 1 7964*** Error code 1
7965 </pre> 7965 </pre>
7966<p>The license can be viewed with <span class="command"><strong>make 7966<p>The license can be viewed with <span class="command"><strong>make
7967 show-license</strong></span>, and if the user so chooses, the line 7967 show-license</strong></span>, and if the user so chooses, the line
7968 printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to 7968 printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
7969 convey to pkgsrc that it should not in the future fail because of 7969 convey to pkgsrc that it should not in the future fail because of
7970 that license:</p> 7970 that license:</p>
7971<pre class="programlisting"> 7971<pre class="programlisting">
7972ACCEPTABLE_LICENSES+=xv-license 7972ACCEPTABLE_LICENSES+=xv-license
7973 </pre> 7973 </pre>
7974<p>When adding a package with a new license, the following steps 7974<p>When adding a package with a new license, the following steps
7975 are required:</p> 7975 are required:</p>
7976<div class="orderedlist"><ol class="orderedlist" type="1"> 7976<div class="orderedlist"><ol class="orderedlist" type="1">
7977<li class="listitem"> 7977<li class="listitem">
7978<p>Check if the file can avoid the -license filename tag as described above by referencing <a class="ulink" href="http://www.gnu.org/licenses/license-list.html" target="_top">Various Licenses and Comments about Them</a> and <a class="ulink" href="http://opensource.org/licenses/alphabetical" target="_top">Licenses by Name | Open Source Initiative</a>. If this is the case, additionally add the license filename to:</p> 7978<p>Check if the file can avoid the -license filename tag as described above by referencing <a class="ulink" href="http://www.gnu.org/licenses/license-list.html" target="_top">Various Licenses and Comments about Them</a> and <a class="ulink" href="http://opensource.org/licenses/alphabetical" target="_top">Licenses by Name | Open Source Initiative</a>. If this is the case, additionally add the license filename to:</p>
7979<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 7979<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
7980<li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in <code class="filename">pkgsrc/mk/license.mk</code></p></li> 7980<li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in <code class="filename">pkgsrc/mk/license.mk</code></p></li>
7981<li class="listitem"><p>default_acceptable_licenses in <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li> 7981<li class="listitem"><p>default_acceptable_licenses in <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li>
7982<li class="listitem"><p>the ACCEPTABLE_LICENSES list in <code class="filename">pkgsrc/doc/guide/files/fixes.xml</code></p></li> 7982<li class="listitem"><p>the ACCEPTABLE_LICENSES list in <code class="filename">pkgsrc/doc/guide/files/fixes.xml</code></p></li>
7983</ul></div> 7983</ul></div>
7984<p>with the proper syntax as demonstrated in those files, respectively.</p> 7984<p>with the proper syntax as demonstrated in those files, respectively.</p>
7985</li> 7985</li>
7986<li class="listitem"><p>The license text should be added to <code class="filename">pkgsrc/licenses</code> for displaying. A list of known licenses can be seen in this directory.</p></li> 7986<li class="listitem"><p>The license text should be added to <code class="filename">pkgsrc/licenses</code> for displaying. A list of known licenses can be seen in this directory.</p></li>
7987</ol></div> 7987</ol></div>
7988<p>When the license changes (in a way other than formatting), 7988<p>When the license changes (in a way other than formatting),
7989 please make sure that the new license has a different name (e.g., 7989 please make sure that the new license has a different name (e.g.,
7990 append the version number if it exists, or the date). Just 7990 append the version number if it exists, or the date). Just
7991 because a user told pkgsrc to build programs under a previous 7991 because a user told pkgsrc to build programs under a previous
7992 version of a license does not mean that pkgsrc should build 7992 version of a license does not mean that pkgsrc should build
7993 programs under the new licenses. The higher-level point is that 7993 programs under the new licenses. The higher-level point is that
7994 pkgsrc does not evaluate licenses for reasonableness; the only 7994 pkgsrc does not evaluate licenses for reasonableness; the only
7995 test is a mechanistic test of whether a particular text has been 7995 test is a mechanistic test of whether a particular text has been
7996 approved by either of two bodies.</p> 7996 approved by either of two bodies.</p>
7997<p>The use of <code class="varname">LICENSE=shareware</code>, 7997<p>The use of <code class="varname">LICENSE=shareware</code>,
7998 <code class="varname">LICENSE=no-commercial-use</code>, and similar language 7998 <code class="varname">LICENSE=no-commercial-use</code>, and similar language
7999 is deprecated because it does not crisply refer to a particular 7999 is deprecated because it does not crisply refer to a particular
8000 license text. Another problem with such usage is that it does not 8000 license text. Another problem with such usage is that it does not
8001 enable a user to tell pkgsrc to proceed for a single package 8001 enable a user to tell pkgsrc to proceed for a single package
8002 without also telling pkgsrc to proceed for all packages with that 8002 without also telling pkgsrc to proceed for all packages with that
8003 tag.</p> 8003 tag.</p>
8004</div> 8004</div>
8005<div class="sect2"> 8005<div class="sect2">
8006<div class="titlepage"><div><div><h3 class="title"> 8006<div class="titlepage"><div><div><h3 class="title">
8007<a name="restricted-packages"></a>19.1.5. Restricted packages</h3></div></div></div> 8007<a name="restricted-packages"></a>19.1.5. Restricted packages</h3></div></div></div>
8008<p>Some licenses restrict how software may be re-distributed. 8008<p>Some licenses restrict how software may be re-distributed.
8009 Because a license tag is required unless the package is Free or 8009 Because a license tag is required unless the package is Free or
8010 Open Source, all packages with restrictions should have license 8010 Open Source, all packages with restrictions should have license
8011 tags. By declaring the restrictions, package tools can 8011 tags. By declaring the restrictions, package tools can
8012 automatically refrain from e.g. placing binary packages on FTP 8012 automatically refrain from e.g. placing binary packages on FTP
8013 sites.</p> 8013 sites.</p>
8014<p>There are four restrictions that may be encoded, which are 8014<p>There are four restrictions that may be encoded, which are
8015 the cross product of sources (distfiles) and binaries not being 8015 the cross product of sources (distfiles) and binaries not being
8016 placed on FTP sites and CD-ROMs. Because this is rarely the exact 8016 placed on FTP sites and CD-ROMs. Because this is rarely the exact
8017 language in any license, and because non-Free licenses tend to be 8017 language in any license, and because non-Free licenses tend to be
8018 different from each other, pkgsrc adopts a definition of FTP and 8018 different from each other, pkgsrc adopts a definition of FTP and
8019 CD-ROM. Pkgsrc uses "FTP" to mean that the source or binary file 8019 CD-ROM. Pkgsrc uses "FTP" to mean that the source or binary file
8020 should not be made available over the Internet at no charge. 8020 should not be made available over the Internet at no charge.
8021 Pkgsrc uses "CD-ROM" to mean that the source or binary may not be 8021 Pkgsrc uses "CD-ROM" to mean that the source or binary may not be
8022 made available on some kind of media, together with other source 8022 made available on some kind of media, together with other source
8023 and binary packages, and which is sold for a distribution charge. 8023 and binary packages, and which is sold for a distribution charge.
8024 </p> 8024 </p>
8025<p>In order to encode these restrictions, the package system 8025<p>In order to encode these restrictions, the package system
8026 defines five make variables that can be set to note these 8026 defines five make variables that can be set to note these
8027 restrictions:</p> 8027 restrictions:</p>
8028<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 8028<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8029<li class="listitem"> 8029<li class="listitem">
8030<p><code class="varname">RESTRICTED</code></p> 8030<p><code class="varname">RESTRICTED</code></p>
8031<p>This variable should be set whenever a restriction 8031<p>This variable should be set whenever a restriction
8032 exists (regardless of its kind). Set this variable to a 8032 exists (regardless of its kind). Set this variable to a
8033 string containing the reason for the restriction. It should 8033 string containing the reason for the restriction. It should
8034 be understood that those wanting to understand the restriction 8034 be understood that those wanting to understand the restriction
8035 will have to read the license, and perhaps seek advice of 8035 will have to read the license, and perhaps seek advice of
8036 counsel.</p> 8036 counsel.</p>
8037</li> 8037</li>
8038<li class="listitem"> 8038<li class="listitem">
8039<p><code class="varname">NO_BIN_ON_CDROM</code></p> 8039<p><code class="varname">NO_BIN_ON_CDROM</code></p>
8040<p>Binaries may not be placed on CD-ROM containing other 8040<p>Binaries may not be placed on CD-ROM containing other
8041 binary packages, for which a distribution charge may be made. 8041 binary packages, for which a distribution charge may be made.
8042 In this case, set this variable to 8042 In this case, set this variable to
8043 <code class="varname">${RESTRICTED}</code>.</p> 8043 <code class="varname">${RESTRICTED}</code>.</p>
8044</li> 8044</li>
8045<li class="listitem"> 8045<li class="listitem">
8046<p><code class="varname">NO_BIN_ON_FTP</code></p> 8046<p><code class="varname">NO_BIN_ON_FTP</code></p>
8047<p>Binaries may not made available on the Internet without 8047<p>Binaries may not made available on the Internet without
8048 charge. In this case, set this variable to 8048 charge. In this case, set this variable to
8049 <code class="varname">${RESTRICTED}</code>. If this variable is set, 8049 <code class="varname">${RESTRICTED}</code>. If this variable is set,
8050 binary packages will not be included on ftp.NetBSD.org.</p> 8050 binary packages will not be included on ftp.NetBSD.org.</p>
8051</li> 8051</li>
8052<li class="listitem"> 8052<li class="listitem">
8053<p><code class="varname">NO_SRC_ON_CDROM</code></p> 8053<p><code class="varname">NO_SRC_ON_CDROM</code></p>
8054<p>Distfiles may not be placed on CD-ROM, together with 8054<p>Distfiles may not be placed on CD-ROM, together with
8055 other distfiles, for which a fee may be charged. In this 8055 other distfiles, for which a fee may be charged. In this
8056 case, set this variable to <code class="varname">${RESTRICTED}</code>. 8056 case, set this variable to <code class="varname">${RESTRICTED}</code>.
8057 </p> 8057 </p>
8058</li> 8058</li>
8059<li class="listitem"> 8059<li class="listitem">
8060<p><code class="varname">NO_SRC_ON_FTP</code></p> 8060<p><code class="varname">NO_SRC_ON_FTP</code></p>
8061<p>Distfiles may not made available via FTP at no charge. 8061<p>Distfiles may not made available via FTP at no charge.
8062 In this case, set this variable to 8062 In this case, set this variable to
8063 <code class="varname">${RESTRICTED}</code>. If this variable is set, 8063 <code class="varname">${RESTRICTED}</code>. If this variable is set,
8064 the distfile(s) will not be mirrored on ftp.NetBSD.org.</p> 8064 the distfile(s) will not be mirrored on ftp.NetBSD.org.</p>
8065</li> 8065</li>
8066</ul></div> 8066</ul></div>
8067<p>Please note that packages will to be removed from pkgsrc 8067<p>Please note that packages will to be removed from pkgsrc
8068 when the distfiles are not distributable and cannot be obtained 8068 when the distfiles are not distributable and cannot be obtained
8069 for a period of one full quarter branch. Packages with manual / 8069 for a period of one full quarter branch. Packages with manual /
8070 interactive fetch must have a maintainer and it is his/her 8070 interactive fetch must have a maintainer and it is his/her
8071 responsibility to ensure this.</p> 8071 responsibility to ensure this.</p>
8072</div> 8072</div>
8073<div class="sect2"> 8073<div class="sect2">
8074<div class="titlepage"><div><div><h3 class="title"> 8074<div class="titlepage"><div><div><h3 class="title">
8075<a name="dependencies"></a>19.1.6. Handling dependencies</h3></div></div></div> 8075<a name="dependencies"></a>19.1.6. Handling dependencies</h3></div></div></div>
8076<p>Your package may depend on some other package being present 8076<p>Your package may depend on some other package being present
8077 - and there are various ways of expressing this dependency. 8077 - and there are various ways of expressing this dependency.
8078 pkgsrc supports the <code class="varname">BUILD_DEPENDS</code> and 8078 pkgsrc supports the <code class="varname">BUILD_DEPENDS</code> and
8079 <code class="varname">DEPENDS</code> definitions, the 8079 <code class="varname">DEPENDS</code> definitions, the
8080 <code class="varname">USE_TOOLS</code> definition, as well as dependencies 8080 <code class="varname">USE_TOOLS</code> definition, as well as dependencies
8081 via <code class="filename">buildlink3.mk</code>, which is the preferred way 8081 via <code class="filename">buildlink3.mk</code>, which is the preferred way
8082 to handle dependencies, and which uses the variables named above. 8082 to handle dependencies, and which uses the variables named above.
8083 See <a class="xref" href="#buildlink" title="Chapter 14. Buildlink methodology">Chapter 14, <i>Buildlink methodology</i></a> for more information.</p> 8083 See <a class="xref" href="#buildlink" title="Chapter 14. Buildlink methodology">Chapter 14, <i>Buildlink methodology</i></a> for more information.</p>
8084<p>The basic difference between the two variables is as 8084<p>The basic difference between the two variables is as
8085 follows: The <code class="varname">DEPENDS</code> definition registers 8085 follows: The <code class="varname">DEPENDS</code> definition registers
8086 that pre-requisite in the binary package so it will be pulled in 8086 that pre-requisite in the binary package so it will be pulled in
8087 when the binary package is later installed, whilst the 8087 when the binary package is later installed, whilst the
8088 <code class="varname">BUILD_DEPENDS</code> definition does not, marking a 8088 <code class="varname">BUILD_DEPENDS</code> definition does not, marking a
8089 dependency that is only needed for building the package.</p> 8089 dependency that is only needed for building the package.</p>
8090<p>This means that if you only need a package present whilst 8090<p>This means that if you only need a package present whilst
8091 you are building, it should be noted as a 8091 you are building, it should be noted as a
8092 <code class="varname">BUILD_DEPENDS</code>.</p> 8092 <code class="varname">BUILD_DEPENDS</code>.</p>
8093<p>The format for a <code class="varname">BUILD_DEPENDS</code> and a 8093<p>The format for a <code class="varname">BUILD_DEPENDS</code> and a
8094 <code class="varname">DEPENDS</code> definition is:</p> 8094 <code class="varname">DEPENDS</code> definition is:</p>
8095<pre class="programlisting"> 8095<pre class="programlisting">
8096&lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt; 8096&lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
8097 </pre> 8097 </pre>
8098<p>Please note that the <span class="quote">&#8220;<span class="quote">pre-req-package-name</span>&#8221;</span> 8098<p>Please note that the <span class="quote">&#8220;<span class="quote">pre-req-package-name</span>&#8221;</span>
8099 may include any of the wildcard version numbers recognized by 8099 may include any of the wildcard version numbers recognized by
8100 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a>.</p> 8100 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a>.</p>
8101<div class="orderedlist"><ol class="orderedlist" type="1"> 8101<div class="orderedlist"><ol class="orderedlist" type="1">
8102<li class="listitem"> 8102<li class="listitem">
8103<p>If your package needs another package's binaries or 8103<p>If your package needs another package's binaries or
8104 libraries to build and run, and if that package has a 8104 libraries to build and run, and if that package has a
8105 <code class="filename">buildlink3.mk</code> file available, use it:</p> 8105 <code class="filename">buildlink3.mk</code> file available, use it:</p>
8106<pre class="programlisting"> 8106<pre class="programlisting">
8107.include "../../graphics/jpeg/buildlink3.mk" 8107.include "../../graphics/jpeg/buildlink3.mk"
8108 </pre> 8108 </pre>
8109</li> 8109</li>
8110<li class="listitem"> 8110<li class="listitem">
8111<p>If your package needs another package's binaries or 8111<p>If your package needs another package's binaries or
8112 libraries only for building, and if that package has a 8112 libraries only for building, and if that package has a
8113 <code class="filename">buildlink3.mk</code> file available, use it:</p> 8113 <code class="filename">buildlink3.mk</code> file available, use it:</p>
8114<pre class="programlisting"> 8114<pre class="programlisting">
8115.include "../../graphics/jpeg/buildlink3.mk" 8115.include "../../graphics/jpeg/buildlink3.mk"
8116 </pre> 8116 </pre>
8117<p>but set 8117<p>but set
8118 <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code> 8118 <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code>
8119 to make it a build dependency only. This case is rather 8119 to make it a build dependency only. This case is rather
8120 rare.</p> 8120 rare.</p>
8121</li> 8121</li>
8122<li class="listitem"> 8122<li class="listitem">
8123<p>If your package needs binaries from another package to build, 8123<p>If your package needs binaries from another package to build,
8124 use the <code class="varname">BUILD_DEPENDS</code> definition:</p> 8124 use the <code class="varname">BUILD_DEPENDS</code> definition:</p>
8125<pre class="programlisting"> 8125<pre class="programlisting">
8126BUILD_DEPENDS+= scons-[0-9]*:../../devel/scons 8126BUILD_DEPENDS+= scons-[0-9]*:../../devel/scons
8127 </pre> 8127 </pre>
8128</li> 8128</li>
8129<li class="listitem"><p>If your package needs a library with which to link and 8129<li class="listitem"><p>If your package needs a library with which to link and
8130 there is no <code class="filename">buildlink3.mk</code> file 8130 there is no <code class="filename">buildlink3.mk</code> file
8131 available, create one. Using 8131 available, create one. Using
8132 <code class="varname">DEPENDS</code> won't be sufficient because the 8132 <code class="varname">DEPENDS</code> won't be sufficient because the
8133 include files and libraries will be hidden from the compiler.</p></li> 8133 include files and libraries will be hidden from the compiler.</p></li>
8134<li class="listitem"> 8134<li class="listitem">
8135<p>If your package needs some executable to be able to run 8135<p>If your package needs some executable to be able to run
8136 correctly and if there's no 8136 correctly and if there's no
8137 <code class="filename">buildlink3.mk</code> file, this is specified 8137 <code class="filename">buildlink3.mk</code> file, this is specified
8138 using the <code class="varname">DEPENDS</code> variable. The 8138 using the <code class="varname">DEPENDS</code> variable. The
8139 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/lyx/README.html" target="_top"><code class="filename">print/lyx</code></a> package needs to 8139 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/lyx/README.html" target="_top"><code class="filename">print/lyx</code></a> package needs to
8140 be able to execute the latex binary from the teTeX package 8140 be able to execute the latex binary from the teTeX package
8141 when it runs, and that is specified:</p> 8141 when it runs, and that is specified:</p>
8142<pre class="programlisting"> 8142<pre class="programlisting">
8143DEPENDS+= teTeX-[0-9]*:../../print/teTeX 8143DEPENDS+= teTeX-[0-9]*:../../print/teTeX
8144 </pre> 8144 </pre>
8145</li> 8145</li>
8146<li class="listitem"> 8146<li class="listitem">
8147<p>You can use wildcards in package dependencies. Note that 8147<p>You can use wildcards in package dependencies. Note that
8148 such wildcard dependencies are retained when creating binary 8148 such wildcard dependencies are retained when creating binary
8149 packages. The dependency is checked when installing the binary 8149 packages. The dependency is checked when installing the binary
8150 package and any package which matches the pattern will be 8150 package and any package which matches the pattern will be
8151 used. Wildcard dependencies should be used with care.</p> 8151 used. Wildcard dependencies should be used with care.</p>
8152<p>The <span class="quote">&#8220;<span class="quote">-[0-9]*</span>&#8221;</span> should be used instead of 8152<p>The <span class="quote">&#8220;<span class="quote">-[0-9]*</span>&#8221;</span> should be used instead of
8153 <span class="quote">&#8220;<span class="quote">-*</span>&#8221;</span> to avoid potentially ambiguous matches 8153 <span class="quote">&#8220;<span class="quote">-*</span>&#8221;</span> to avoid potentially ambiguous matches
8154 such as <span class="quote">&#8220;<span class="quote">tk-postgresql</span>&#8221;</span> matching a 8154 such as <span class="quote">&#8220;<span class="quote">tk-postgresql</span>&#8221;</span> matching a
8155 <span class="quote">&#8220;<span class="quote">tk-*</span>&#8221;</span> <code class="varname">DEPENDS</code>.</p> 8155 <span class="quote">&#8220;<span class="quote">tk-*</span>&#8221;</span> <code class="varname">DEPENDS</code>.</p>
8156<p>Wildcards can also be used to specify that a package 8156<p>Wildcards can also be used to specify that a package
8157 will only build against a certain minimum version of a 8157 will only build against a certain minimum version of a
8158 pre-requisite:</p> 8158 pre-requisite:</p>
8159<pre class="programlisting"> 8159<pre class="programlisting">
8160DEPENDS+= ImageMagick&gt;=6.0:../../graphics/ImageMagick 8160DEPENDS+= ImageMagick&gt;=6.0:../../graphics/ImageMagick
8161 </pre> 8161 </pre>
8162<p>This means that the package will build using version 6.0 8162<p>This means that the package will build using version 6.0
8163 of ImageMagick or newer. Such a dependency may be warranted 8163 of ImageMagick or newer. Such a dependency may be warranted
8164 if, for example, the command line options of an executable 8164 if, for example, the command line options of an executable
8165 have changed.</p> 8165 have changed.</p>
8166<p>If you need to depend on minimum versions of libraries, 8166<p>If you need to depend on minimum versions of libraries,
8167 see the buildlink section of the pkgsrc guide.</p> 8167 see the buildlink section of the pkgsrc guide.</p>
8168<p>For security fixes, please update the package 8168<p>For security fixes, please update the package
8169 vulnerabilities file. See <a class="xref" href="#security-handling" title="19.1.10. Handling packages with security problems">Section 19.1.10, &#8220;Handling packages with security problems&#8221;</a> for more 8169 vulnerabilities file. See <a class="xref" href="#security-handling" title="19.1.10. Handling packages with security problems">Section 19.1.10, &#8220;Handling packages with security problems&#8221;</a> for more
8170 information.</p> 8170 information.</p>
8171</li> 8171</li>
8172</ol></div> 8172</ol></div>
8173<p>If your package needs files from another package to build, 8173<p>If your package needs files from another package to build,
8174 add the relevant distribution files to 8174 add the relevant distribution files to
8175 <code class="varname">DISTFILES</code>, so they will be extracted 8175 <code class="varname">DISTFILES</code>, so they will be extracted
8176 automatically. See the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/ghostscript/README.html" target="_top"><code class="filename">print/ghostscript</code></a> package for an example. 8176 automatically. See the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/ghostscript/README.html" target="_top"><code class="filename">print/ghostscript</code></a> package for an example.
8177 (It relies on the jpeg sources being present in source form 8177 (It relies on the jpeg sources being present in source form
8178 during the build.)</p> 8178 during the build.)</p>
8179</div> 8179</div>
8180<div class="sect2"> 8180<div class="sect2">
8181<div class="titlepage"><div><div><h3 class="title"> 8181<div class="titlepage"><div><div><h3 class="title">
8182<a name="conflicts"></a>19.1.7. Handling conflicts with other packages</h3></div></div></div> 8182<a name="conflicts"></a>19.1.7. Handling conflicts with other packages</h3></div></div></div>
8183<p>Your package may conflict with other packages a user might 8183<p>Your package may conflict with other packages a user might
8184 already have installed on his system, e.g. if your package 8184 already have installed on his system, e.g. if your package
8185 installs the same set of files as another package in the pkgsrc 8185 installs the same set of files as another package in the pkgsrc
8186 tree.</p> 8186 tree.</p>
8187<p>In this case you can set <code class="varname">CONFLICTS</code> to a 8187<p>In this case you can set <code class="varname">CONFLICTS</code> to a
8188 space-separated list of packages (including version string) your 8188 space-separated list of packages (including version string) your
8189 package conflicts with.</p> 8189 package conflicts with.</p>
8190<p>For example, <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw3d/README.html" target="_top"><code class="filename">x11/Xaw3d</code></a> 8190<p>For example, <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw3d/README.html" target="_top"><code class="filename">x11/Xaw3d</code></a>
8191 and <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw-Xpm/README.html" target="_top"><code class="filename">x11/Xaw-Xpm</code></a> 8191 and <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw-Xpm/README.html" target="_top"><code class="filename">x11/Xaw-Xpm</code></a>
8192 install the same shared library, thus you set in 8192 install the same shared library, thus you set in
8193 <code class="filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p> 8193 <code class="filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
8194<pre class="programlisting"> 8194<pre class="programlisting">
8195CONFLICTS= Xaw-Xpm-[0-9]* 8195CONFLICTS= Xaw-Xpm-[0-9]*
8196 </pre> 8196 </pre>
8197<p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p> 8197<p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
8198<pre class="programlisting"> 8198<pre class="programlisting">
8199CONFLICTS= Xaw3d-[0-9]* 8199CONFLICTS= Xaw3d-[0-9]*
8200 </pre> 8200 </pre>
8201<p>Packages will automatically conflict with other packages 8201<p>Packages will automatically conflict with other packages
8202 with the name prefix and a different version 8202 with the name prefix and a different version
8203 string. <span class="quote">&#8220;<span class="quote">Xaw3d-1.5</span>&#8221;</span> e.g. will automatically 8203 string. <span class="quote">&#8220;<span class="quote">Xaw3d-1.5</span>&#8221;</span> e.g. will automatically
8204 conflict with the older version <span class="quote">&#8220;<span class="quote">Xaw3d-1.3</span>&#8221;</span>.</p> 8204 conflict with the older version <span class="quote">&#8220;<span class="quote">Xaw3d-1.3</span>&#8221;</span>.</p>
8205</div> 8205</div>
8206<div class="sect2"> 8206<div class="sect2">
8207<div class="titlepage"><div><div><h3 class="title"> 8207<div class="titlepage"><div><div><h3 class="title">
8208<a name="not-building-packages"></a>19.1.8. Packages that cannot or should not be built</h3></div></div></div> 8208<a name="not-building-packages"></a>19.1.8. Packages that cannot or should not be built</h3></div></div></div>
8209<p>There are several reasons why a package might be 8209<p>There are several reasons why a package might be
8210 instructed to not build under certain circumstances. If the 8210 instructed to not build under certain circumstances. If the
8211 package builds and runs on most platforms, the exceptions 8211 package builds and runs on most platforms, the exceptions
8212 should be noted with <code class="varname">NOT_FOR_PLATFORM</code>. If 8212 should be noted with <code class="varname">NOT_FOR_PLATFORM</code>. If
8213 the package builds and runs on a small handful of platforms, 8213 the package builds and runs on a small handful of platforms,
8214 set <code class="varname">ONLY_FOR_PLATFORM</code> instead. 8214 set <code class="varname">ONLY_FOR_PLATFORM</code> instead.
8215 Both <code class="varname">ONLY_FOR_PLATFORM</code> and 8215 Both <code class="varname">ONLY_FOR_PLATFORM</code> and
8216 <code class="varname">NOT_FOR_PLATFORM</code> are OS triples 8216 <code class="varname">NOT_FOR_PLATFORM</code> are OS triples
8217 (OS-version-platform) that can use glob-style 8217 (OS-version-platform) that can use glob-style
8218 wildcards.</p> 8218 wildcards.</p>
8219<p>Some packages are tightly bound to a specific version of an 8219<p>Some packages are tightly bound to a specific version of an
8220 operating system, e.g. LKMs or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/lsof/README.html" target="_top"><code class="filename">sysutils/lsof</code></a>. Such binary packages are not 8220 operating system, e.g. LKMs or <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/lsof/README.html" target="_top"><code class="filename">sysutils/lsof</code></a>. Such binary packages are not
8221 backwards compatible with other versions of the OS, and should be 8221 backwards compatible with other versions of the OS, and should be
8222 uploaded to a version specific directory on the FTP server. Mark 8222 uploaded to a version specific directory on the FTP server. Mark
8223 these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to 8223 these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to
8224 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. This variable is not currently used by any of 8224 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. This variable is not currently used by any of
8225 the package system internals, but may be used in the 8225 the package system internals, but may be used in the
8226 future.</p> 8226 future.</p>
8227<p>If the package should be skipped (for example, because it 8227<p>If the package should be skipped (for example, because it
8228 provides functionality already provided by the system), set 8228 provides functionality already provided by the system), set
8229 <code class="varname">PKG_SKIP_REASON</code> to a descriptive message. If 8229 <code class="varname">PKG_SKIP_REASON</code> to a descriptive message. If
8230 the package should fail because some preconditions are not met, 8230 the package should fail because some preconditions are not met,
8231 set <code class="varname">PKG_FAIL_REASON</code> to a descriptive 8231 set <code class="varname">PKG_FAIL_REASON</code> to a descriptive
8232 message.</p> 8232 message.</p>
8233</div> 8233</div>
8234<div class="sect2"> 8234<div class="sect2">
8235<div class="titlepage"><div><div><h3 class="title"> 8235<div class="titlepage"><div><div><h3 class="title">
8236<a name="undeletable-packages"></a>19.1.9. Packages which should not be deleted, once installed</h3></div></div></div> 8236<a name="undeletable-packages"></a>19.1.9. Packages which should not be deleted, once installed</h3></div></div></div>
8237<p>To ensure that a package may not be deleted, once it has been 8237<p>To ensure that a package may not be deleted, once it has been
8238 installed, the <code class="varname">PKG_PRESERVE</code> definition should 8238 installed, the <code class="varname">PKG_PRESERVE</code> definition should
8239 be set in the package Makefile. This will be carried into any 8239 be set in the package Makefile. This will be carried into any
8240 binary package that is made from this pkgsrc entry. A 8240 binary package that is made from this pkgsrc entry. A
8241 <span class="quote">&#8220;<span class="quote">preserved</span>&#8221;</span> package will 8241 <span class="quote">&#8220;<span class="quote">preserved</span>&#8221;</span> package will
8242 not be deleted using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> unless the 8242 not be deleted using <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> unless the
8243 <span class="quote">&#8220;<span class="quote">-f</span>&#8221;</span> option is used.</p> 8243 <span class="quote">&#8220;<span class="quote">-f</span>&#8221;</span> option is used.</p>
8244</div> 8244</div>
8245<div class="sect2"> 8245<div class="sect2">
8246<div class="titlepage"><div><div><h3 class="title"> 8246<div class="titlepage"><div><div><h3 class="title">
8247<a name="security-handling"></a>19.1.10. Handling packages with security problems</h3></div></div></div> 8247<a name="security-handling"></a>19.1.10. Handling packages with security problems</h3></div></div></div>
8248<p>When a vulnerability is found, this should be noted in 8248<p>When a vulnerability is found, this should be noted in
8249 <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>, 8249 <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
8250 and after committing that file, ask pkgsrc-security@NetBSD.org to 8250 and after committing that file, ask pkgsrc-security@NetBSD.org to
8251 update the file on ftp.NetBSD.org.</p> 8251 update the file on ftp.NetBSD.org.</p>
8252<p>After fixing the vulnerability by a patch, its 8252<p>After fixing the vulnerability by a patch, its
8253 <code class="varname">PKGREVISION</code> should be increased (this is of 8253 <code class="varname">PKGREVISION</code> should be increased (this is of
8254 course not necessary if the problem is fixed by using a newer 8254 course not necessary if the problem is fixed by using a newer
8255 release of the software), and the pattern in the 8255 release of the software), and the pattern in the
8256 pkg-vulnerabilities file must be updated.</p> 8256 pkg-vulnerabilities file must be updated.</p>
8257<p>Also, if the fix should be applied to the stable pkgsrc 8257<p>Also, if the fix should be applied to the stable pkgsrc
8258 branch, be sure to submit a pullup request!</p> 8258 branch, be sure to submit a pullup request!</p>
8259<p>Binary packages already on ftp.NetBSD.org will be handled 8259<p>Binary packages already on ftp.NetBSD.org will be handled
8260 semi-automatically by a weekly cron job.</p> 8260 semi-automatically by a weekly cron job.</p>
8261</div> 8261</div>
8262<div class="sect2"> 8262<div class="sect2">
8263<div class="titlepage"><div><div><h3 class="title"> 8263<div class="titlepage"><div><div><h3 class="title">
8264<a name="bumping-pkgrevision"></a>19.1.11. How to handle incrementing versions when fixing an existing package</h3></div></div></div> 8264<a name="bumping-pkgrevision"></a>19.1.11. How to handle incrementing versions when fixing an existing package</h3></div></div></div>
8265<p>When making fixes to an existing package it can be useful 8265<p>When making fixes to an existing package it can be useful
8266 to change the version number in <code class="varname">PKGNAME</code>. To 8266 to change the version number in <code class="varname">PKGNAME</code>. To
8267 avoid conflicting with future versions by the original author, a 8267 avoid conflicting with future versions by the original author, a
8268 <span class="quote">&#8220;<span class="quote">nb1</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">nb2</span>&#8221;</span>, ... suffix can be used 8268 <span class="quote">&#8220;<span class="quote">nb1</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">nb2</span>&#8221;</span>, ... suffix can be used
8269 on package versions by setting <code class="varname">PKGREVISION=1</code> 8269 on package versions by setting <code class="varname">PKGREVISION=1</code>
8270 (2, ...). The <span class="quote">&#8220;<span class="quote">nb</span>&#8221;</span> is treated like a 8270 (2, ...). The <span class="quote">&#8220;<span class="quote">nb</span>&#8221;</span> is treated like a
8271 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> by the package tools. e.g.</p> 8271 <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> by the package tools. e.g.</p>
8272<pre class="programlisting"> 8272<pre class="programlisting">
8273DISTNAME= foo-17.42 8273DISTNAME= foo-17.42
8274PKGREVISION= 9 8274PKGREVISION= 9
8275 </pre> 8275 </pre>
8276<p>will result in a <code class="varname">PKGNAME</code> of 8276<p>will result in a <code class="varname">PKGNAME</code> of
8277 <span class="quote">&#8220;<span class="quote">foo-17.42nb9</span>&#8221;</span>. If you want to use the original 8277 <span class="quote">&#8220;<span class="quote">foo-17.42nb9</span>&#8221;</span>. If you want to use the original
8278 value of <code class="varname">PKGNAME</code> without the <span class="quote">&#8220;<span class="quote">nbX</span>&#8221;</span> 8278 value of <code class="varname">PKGNAME</code> without the <span class="quote">&#8220;<span class="quote">nbX</span>&#8221;</span>
8279 suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use 8279 suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use
8280 <code class="varname">PKGNAME_NOREV</code>.</p> 8280 <code class="varname">PKGNAME_NOREV</code>.</p>
8281<p>When a new release of the package is released, the 8281<p>When a new release of the package is released, the
8282 <code class="varname">PKGREVISION</code> should be removed, e.g. on a new 8282 <code class="varname">PKGREVISION</code> should be removed, e.g. on a new
8283 minor release of the above package, things should be like:</p> 8283 minor release of the above package, things should be like:</p>
8284<pre class="programlisting"> 8284<pre class="programlisting">
8285DISTNAME= foo-17.43 8285DISTNAME= foo-17.43
8286 </pre> 8286 </pre>
8287<p><code class="varname">PKGREVISION</code> should be incremented for any 8287<p><code class="varname">PKGREVISION</code> should be incremented for any
8288 non-trivial change in the resulting binary package. Without a 8288 non-trivial change in the resulting binary package. Without a
8289 <code class="varname">PKGREVISION</code> bump, someone with the previous 8289 <code class="varname">PKGREVISION</code> bump, someone with the previous
8290 version installed has no way of knowing that their package is out 8290 version installed has no way of knowing that their package is out
8291 of date. Thus, changes without increasing 8291 of date. Thus, changes without increasing
8292 <code class="varname">PKGREVISION</code> are essentially labeled "this is so 8292 <code class="varname">PKGREVISION</code> are essentially labeled "this is so
8293 trivial that no reasonable person would want to upgrade", and this 8293 trivial that no reasonable person would want to upgrade", and this
8294 is the rough test for when increasing 8294 is the rough test for when increasing
8295 <code class="varname">PKGREVISION</code> is appropriate. Examples of 8295 <code class="varname">PKGREVISION</code> is appropriate. Examples of
8296 changes that do not merit increasing 8296 changes that do not merit increasing
8297 <code class="varname">PKGREVISION</code> are:</p> 8297 <code class="varname">PKGREVISION</code> are:</p>
8298<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 8298<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8299<li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>, 8299<li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>,
8300 <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>, 8300 <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>,
8301 or comments in Makefile.</p></li> 8301 or comments in Makefile.</p></li>
8302<li class="listitem"><p> 8302<li class="listitem"><p>
8303 Changing build variables if the resulting binary package is the same.</p></li> 8303 Changing build variables if the resulting binary package is the same.</p></li>
8304<li class="listitem"><p> 8304<li class="listitem"><p>
8305 Changing <code class="filename">DESCR</code>.</p></li> 8305 Changing <code class="filename">DESCR</code>.</p></li>
8306<li class="listitem"><p> 8306<li class="listitem"><p>
8307 Adding <code class="varname">PKG_OPTIONS</code> if the default options don't change.</p></li> 8307 Adding <code class="varname">PKG_OPTIONS</code> if the default options don't change.</p></li>
8308</ul></div> 8308</ul></div>
8309<p>Examples of changes that do merit an increase to 8309<p>Examples of changes that do merit an increase to
8310 <code class="varname">PKGREVISION</code> include:</p> 8310 <code class="varname">PKGREVISION</code> include:</p>
8311<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 8311<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8312<li class="listitem"><p> 8312<li class="listitem"><p>
8313 Security fixes</p></li> 8313 Security fixes</p></li>
8314<li class="listitem"><p> 8314<li class="listitem"><p>
8315 Changes or additions to a patch file</p></li> 8315 Changes or additions to a patch file</p></li>
8316<li class="listitem"><p> 8316<li class="listitem"><p>
8317 Changes to the <code class="filename">PLIST</code></p></li> 8317 Changes to the <code class="filename">PLIST</code></p></li>
8318<li class="listitem"><p>A dependency is changed or renamed.</p></li> 8318<li class="listitem"><p>A dependency is changed or renamed.</p></li>
8319</ul></div> 8319</ul></div>
8320<p>PKGREVISION must also be incremented when dependencies have ABI 8320<p>PKGREVISION must also be incremented when dependencies have ABI
8321 changes.</p> 8321 changes.</p>
8322</div> 8322</div>
8323<div class="sect2"> 8323<div class="sect2">
8324<div class="titlepage"><div><div><h3 class="title"> 8324<div class="titlepage"><div><div><h3 class="title">
8325<a name="fixes.subst"></a>19.1.12. Substituting variable text in the package files (the SUBST framework)</h3></div></div></div> 8325<a name="fixes.subst"></a>19.1.12. Substituting variable text in the package files (the SUBST framework)</h3></div></div></div>
8326<p>When you want to replace the same text in multiple files 8326<p>When you want to replace the same text in multiple files
8327 or when the replacement text varies, patches alone cannot help. 8327 or when the replacement text varies, patches alone cannot help.
8328 This is where the SUBST framework comes in. It provides an 8328 This is where the SUBST framework comes in. It provides an
8329 easy-to-use interface for replacing text in files. 8329 easy-to-use interface for replacing text in files.
8330 Example:</p> 8330 Example:</p>
8331<pre class="programlisting"> 8331<pre class="programlisting">
8332SUBST_CLASSES+= fix-paths 8332SUBST_CLASSES+= fix-paths
8333SUBST_STAGE.fix-paths= pre-configure 8333SUBST_STAGE.fix-paths= pre-configure
8334SUBST_MESSAGE.fix-paths= Fixing absolute paths. 8334SUBST_MESSAGE.fix-paths= Fixing absolute paths.
8335SUBST_FILES.fix-paths= src/*.c 8335SUBST_FILES.fix-paths= src/*.c
8336SUBST_FILES.fix-paths+= scripts/*.sh 8336SUBST_FILES.fix-paths+= scripts/*.sh
8337SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' 8337SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g'
8338SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' 8338SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g'
8339 </pre> 8339 </pre>
8340<p><code class="varname">SUBST_CLASSES</code> is a list of identifiers 8340<p><code class="varname">SUBST_CLASSES</code> is a list of identifiers
8341 that are used to identify the different SUBST blocks that are 8341 that are used to identify the different SUBST blocks that are
8342 defined. The SUBST framework is heavily used by pkgsrc, so it is 8342 defined. The SUBST framework is heavily used by pkgsrc, so it is
8343 important to always use the <code class="literal">+=</code> operator with 8343 important to always use the <code class="literal">+=</code> operator with
8344 this variable. Otherwise some substitutions may be 8344 this variable. Otherwise some substitutions may be
8345 skipped.</p> 8345 skipped.</p>
8346<p>The remaining variables of each SUBST block are 8346<p>The remaining variables of each SUBST block are
8347 parameterized with the identifier from the first line 8347 parameterized with the identifier from the first line
8348 (<code class="literal">fix-paths</code> in this case.) They can be seen as 8348 (<code class="literal">fix-paths</code> in this case.) They can be seen as
8349 parameters to a function call.</p> 8349 parameters to a function call.</p>
8350<p><code class="varname">SUBST_STAGE.*</code> specifies the stage at 8350<p><code class="varname">SUBST_STAGE.*</code> specifies the stage at
8351 which the replacement will take place. All combinations of 8351 which the replacement will take place. All combinations of
8352 <code class="literal">pre-</code>, <code class="literal">do-</code> and 8352 <code class="literal">pre-</code>, <code class="literal">do-</code> and
8353 <code class="literal">post-</code> together with a phase name are 8353 <code class="literal">post-</code> together with a phase name are
8354 possible, though only few are actually used. Most commonly used 8354 possible, though only few are actually used. Most commonly used
8355 are <code class="literal">post-patch</code> and 8355 are <code class="literal">post-patch</code> and
8356 <code class="literal">pre-configure</code>. Of these two, 8356 <code class="literal">pre-configure</code>. Of these two,
8357 <code class="literal">pre-configure</code> should be preferred because 8357 <code class="literal">pre-configure</code> should be preferred because
8358 then it is possible to run <span class="command"><strong>bmake patch</strong></span> and 8358 then it is possible to run <span class="command"><strong>bmake patch</strong></span> and
8359 have the state after applying the patches but before making any 8359 have the state after applying the patches but before making any
8360 other changes. This is especially useful when you are debugging 8360 other changes. This is especially useful when you are debugging
8361 a package in order to create new patches for it. Similarly, 8361 a package in order to create new patches for it. Similarly,
8362 <code class="literal">post-build</code> is preferred over 8362 <code class="literal">post-build</code> is preferred over
8363 <code class="literal">pre-install</code>, because the install phase should 8363 <code class="literal">pre-install</code>, because the install phase should
8364 generally be kept as simple as possible. When you use 8364 generally be kept as simple as possible. When you use
8365 <code class="literal">post-build</code>, you have the same files in the 8365 <code class="literal">post-build</code>, you have the same files in the
8366 working directory that will be installed later, so you can check 8366 working directory that will be installed later, so you can check
8367 if the substitution has succeeded.</p> 8367 if the substitution has succeeded.</p>
8368<p><code class="varname">SUBST_MESSAGE.*</code> is an optional text 8368<p><code class="varname">SUBST_MESSAGE.*</code> is an optional text
8369 that is printed just before the substitution is done.</p> 8369 that is printed just before the substitution is done.</p>
8370<p><code class="varname">SUBST_FILES.*</code> is the list of shell 8370<p><code class="varname">SUBST_FILES.*</code> is the list of shell
8371 globbing patterns that specifies the files in which the 8371 globbing patterns that specifies the files in which the
8372 substitution will take place. The patterns are interpreted 8372 substitution will take place. The patterns are interpreted
8373 relatively to the <code class="varname">WRKSRC</code> directory.</p> 8373 relatively to the <code class="varname">WRKSRC</code> directory.</p>
8374<p><code class="varname">SUBST_SED.*</code> is a list of arguments to 8374<p><code class="varname">SUBST_SED.*</code> is a list of arguments to
8375 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> that specify the actual substitution. Every sed 8375 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> that specify the actual substitution. Every sed
8376 command should be prefixed with <code class="literal">-e</code>, so that 8376 command should be prefixed with <code class="literal">-e</code>, so that
8377 all SUBST blocks look uniform.</p> 8377 all SUBST blocks look uniform.</p>
8378<p>There are some more variables, but they are so seldomly 8378<p>There are some more variables, but they are so seldomly
8379 used that they are only documented in the 8379 used that they are only documented in the
8380 <code class="filename">mk/subst.mk</code> file.</p> 8380 <code class="filename">mk/subst.mk</code> file.</p>
8381</div> 8381</div>
8382</div> 8382</div>
8383<div class="sect1"> 8383<div class="sect1">
8384<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 8384<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8385<a name="fixes.fetch"></a>19.2. Fixing problems in the <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div> 8385<a name="fixes.fetch"></a>19.2. Fixing problems in the <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
8386<div class="sect2"> 8386<div class="sect2">
8387<div class="titlepage"><div><div><h3 class="title"> 8387<div class="titlepage"><div><div><h3 class="title">
8388<a name="no-plain-download"></a>19.2.1. Packages whose distfiles aren't available for plain downloading</h3></div></div></div> 8388<a name="no-plain-download"></a>19.2.1. Packages whose distfiles aren't available for plain downloading</h3></div></div></div>
8389<p>If you need to download from a dynamic URL you can set 8389<p>If you need to download from a dynamic URL you can set
8390 <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make 8390 <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make
8391 fetch</strong></span> will call <code class="filename">files/getsite.sh</code> 8391 fetch</strong></span> will call <code class="filename">files/getsite.sh</code>
8392 with the name of each file to download as an argument, expecting 8392 with the name of each file to download as an argument, expecting
8393 it to output the URL of the directory from which to download 8393 it to output the URL of the directory from which to download
8394 it. <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/ns-cult3d/README.html" target="_top"><code class="filename">graphics/ns-cult3d</code></a> is an 8394 it. <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/ns-cult3d/README.html" target="_top"><code class="filename">graphics/ns-cult3d</code></a> is an
8395 example of this usage.</p> 8395 example of this usage.</p>
8396<p>If the download can't be automated, because the user must 8396<p>If the download can't be automated, because the user must
8397 submit personal information to apply for a password, or must pay 8397 submit personal information to apply for a password, or must pay
8398 for the source, or whatever, you can set 8398 for the source, or whatever, you can set
8399 <code class="varname">FETCH_MESSAGE</code> to a list of lines that are 8399 <code class="varname">FETCH_MESSAGE</code> to a list of lines that are
8400 displayed to the user before aborting the build. Example:</p> 8400 displayed to the user before aborting the build. Example:</p>
8401<pre class="programlisting"> 8401<pre class="programlisting">
8402FETCH_MESSAGE= "Please download the files" 8402FETCH_MESSAGE= "Please download the files"
8403FETCH_MESSAGE+= " "${DISTFILES:Q} 8403FETCH_MESSAGE+= " "${DISTFILES:Q}
8404FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." 8404FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
8405 </pre> 8405 </pre>
8406</div> 8406</div>
8407<div class="sect2"> 8407<div class="sect2">
8408<div class="titlepage"><div><div><h3 class="title"> 8408<div class="titlepage"><div><div><h3 class="title">
8409<a name="modified-distfiles-same-name"></a>19.2.2. How to handle modified distfiles with the 'old' name</h3></div></div></div> 8409<a name="modified-distfiles-same-name"></a>19.2.2. How to handle modified distfiles with the 'old' name</h3></div></div></div>
8410<p>Sometimes authors of a software package make some 8410<p>Sometimes authors of a software package make some
8411 modifications after the software was released, and they put up a 8411 modifications after the software was released, and they put up a
8412 new distfile without changing the package's version number. If a 8412 new distfile without changing the package's version number. If a
8413 package is already in pkgsrc at that time, the checksum will 8413 package is already in pkgsrc at that time, the checksum will
8414 no longer match. The contents of the new distfile should be 8414 no longer match. The contents of the new distfile should be
8415 compared against the old one before changing anything, to make 8415 compared against the old one before changing anything, to make
8416 sure the distfile was really updated on purpose, and that 8416 sure the distfile was really updated on purpose, and that
8417 no trojan horse or so crept in. 8417 no trojan horse or so crept in.
8418 Please mention that the distfiles were compared and what was found 8418 Please mention that the distfiles were compared and what was found
8419 in your commit message.</p> 8419 in your commit message.</p>
8420<p>Then, the correct way to work around this is to 8420<p>Then, the correct way to work around this is to
8421 set <code class="varname">DIST_SUBDIR</code> to a unique directory name, 8421 set <code class="varname">DIST_SUBDIR</code> to a unique directory name,
8422 usually based on <code class="varname">PKGNAME_NOREV</code>. All 8422 usually based on <code class="varname">PKGNAME_NOREV</code>. All
8423 <code class="varname">DISTFILES</code> and 8423 <code class="varname">DISTFILES</code> and
8424 <code class="varname">PATCHFILES</code> for this package will be put in that 8424 <code class="varname">PATCHFILES</code> for this package will be put in that
8425 subdirectory of the local distfiles directory. 8425 subdirectory of the local distfiles directory.
8426 (See <a class="xref" href="#bumping-pkgrevision" title="19.1.11. How to handle incrementing versions when fixing an existing package">Section 19.1.11, &#8220;How to handle incrementing versions when fixing an existing package&#8221;</a> for more details.) 8426 (See <a class="xref" href="#bumping-pkgrevision" title="19.1.11. How to handle incrementing versions when fixing an existing package">Section 19.1.11, &#8220;How to handle incrementing versions when fixing an existing package&#8221;</a> for more details.)
8427 In case this 8427 In case this
8428 happens more often, <code class="varname">PKGNAME</code> can be used (thus 8428 happens more often, <code class="varname">PKGNAME</code> can be used (thus
8429 including the <code class="filename">nbX</code> suffix) or a date stamp 8429 including the <code class="filename">nbX</code> suffix) or a date stamp
8430 can be appended, like <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p> 8430 can be appended, like <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p>
8431<p><code class="varname">DIST_SUBDIR</code> is also used when a distfile's name does not contain a version and the distfile is apt to change. In cases where the likelihood of this is very small, <code class="varname">DIST_SUBDIR</code> might not be required. Additionally, <code class="varname">DIST_SUBDIR</code> must not be removed unless the distfile name changes, even if a package is being moved or renamed.</p> 8431<p><code class="varname">DIST_SUBDIR</code> is also used when a distfile's name does not contain a version and the distfile is apt to change. In cases where the likelihood of this is very small, <code class="varname">DIST_SUBDIR</code> might not be required. Additionally, <code class="varname">DIST_SUBDIR</code> must not be removed unless the distfile name changes, even if a package is being moved or renamed.</p>
8432<p>Do not forget regenerating the <code class="filename">distinfo</code> file 8432<p>Do not forget regenerating the <code class="filename">distinfo</code> file
8433 after that, since it contains the <code class="varname">DIST_SUBDIR</code> 8433 after that, since it contains the <code class="varname">DIST_SUBDIR</code>
8434 path in the filenames. 8434 path in the filenames.
8435 Also, increase the PKGREVISION if the installed package is different. 8435 Also, increase the PKGREVISION if the installed package is different.
8436 Furthermore, a mail to the package's authors seems appropriate 8436 Furthermore, a mail to the package's authors seems appropriate
8437 telling them that changing distfiles after releases without 8437 telling them that changing distfiles after releases without
8438 changing the file names is not good practice.</p> 8438 changing the file names is not good practice.</p>
8439</div> 8439</div>
8440</div> 8440</div>
8441<div class="sect1"> 8441<div class="sect1">
8442<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 8442<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8443<a name="fixes.configure"></a>19.3. Fixing problems in the <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div> 8443<a name="fixes.configure"></a>19.3. Fixing problems in the <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
8444<div class="sect2"> 8444<div class="sect2">
8445<div class="titlepage"><div><div><h3 class="title"> 8445<div class="titlepage"><div><div><h3 class="title">
8446<a name="fixes.libtool"></a>19.3.1. Shared libraries - libtool</h3></div></div></div> 8446<a name="fixes.libtool"></a>19.3.1. Shared libraries - libtool</h3></div></div></div>
8447<p>pkgsrc supports many different machines, with different 8447<p>pkgsrc supports many different machines, with different
8448 object formats like a.out and ELF, and varying abilities to do 8448 object formats like a.out and ELF, and varying abilities to do
8449 shared library and dynamic loading at all. To accompany this, 8449 shared library and dynamic loading at all. To accompany this,
8450 varying commands and options have to be passed to the 8450 varying commands and options have to be passed to the
8451 compiler, linker, etc. to get the Right Thing, which can be 8451 compiler, linker, etc. to get the Right Thing, which can be
8452 pretty annoying especially if you don't have all the machines 8452 pretty annoying especially if you don't have all the machines
8453 at your hand to test things. The 8453 at your hand to test things. The
8454 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/libtool/README.html" target="_top"><code class="filename">devel/libtool</code></a> pkg 8454 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/libtool/README.html" target="_top"><code class="filename">devel/libtool</code></a> pkg
8455 can help here, as it just <span class="quote">&#8220;<span class="quote">knows</span>&#8221;</span> how to build 8455 can help here, as it just <span class="quote">&#8220;<span class="quote">knows</span>&#8221;</span> how to build
8456 both static and dynamic libraries from a set of source files, 8456 both static and dynamic libraries from a set of source files,
8457 thus being platform-independent.</p> 8457 thus being platform-independent.</p>
8458<p>Here's how to use libtool in a package in seven simple 8458<p>Here's how to use libtool in a package in seven simple
8459 steps:</p> 8459 steps:</p>
8460<div class="orderedlist"><ol class="orderedlist" type="1"> 8460<div class="orderedlist"><ol class="orderedlist" type="1">
8461<li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package 8461<li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package
8462 Makefile.</p></li> 8462 Makefile.</p></li>
8463<li class="listitem"><p>For library objects, use <span class="quote">&#8220;<span class="quote">${LIBTOOL} --mode=compile 8463<li class="listitem"><p>For library objects, use <span class="quote">&#8220;<span class="quote">${LIBTOOL} --mode=compile
8464 ${CC}</span>&#8221;</span> in place of <span class="quote">&#8220;<span class="quote">${CC}</span>&#8221;</span>. You could even 8464 ${CC}</span>&#8221;</span> in place of <span class="quote">&#8220;<span class="quote">${CC}</span>&#8221;</span>. You could even
8465 add it to the definition of <code class="varname">CC</code>, if only 8465 add it to the definition of <code class="varname">CC</code>, if only
8466 libraries are being built in a given Makefile. This one command 8466 libraries are being built in a given Makefile. This one command
8467 will build both PIC and non-PIC library objects, so you need not 8467 will build both PIC and non-PIC library objects, so you need not
8468 have separate shared and non-shared library rules.</p></li> 8468 have separate shared and non-shared library rules.</p></li>
8469<li class="listitem"> 8469<li class="listitem">
8470<p>For the linking of the library, remove any 8470<p>For the linking of the library, remove any
8471 <span class="quote">&#8220;<span class="quote">ar</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">ranlib</span>&#8221;</span>, and <span class="quote">&#8220;<span class="quote">ld 8471 <span class="quote">&#8220;<span class="quote">ar</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">ranlib</span>&#8221;</span>, and <span class="quote">&#8220;<span class="quote">ld
8472 -Bshareable</span>&#8221;</span> commands, and instead use:</p> 8472 -Bshareable</span>&#8221;</span> commands, and instead use:</p>
8473<pre class="programlisting"> 8473<pre class="programlisting">
8474${LIBTOOL} --mode=link \ 8474${LIBTOOL} --mode=link \
8475 ${CC} -o ${.TARGET:.a=.la} \ 8475 ${CC} -o ${.TARGET:.a=.la} \
8476 ${OBJS:.o=.lo} \ 8476 ${OBJS:.o=.lo} \
8477 -rpath ${PREFIX}/lib \ 8477 -rpath ${PREFIX}/lib \
8478 -version-info major:minor 8478 -version-info major:minor
8479 </pre> 8479 </pre>
8480<p>Note that the library is changed to have a 8480<p>Note that the library is changed to have a
8481 <code class="filename">.la</code> extension, and the objects are 8481 <code class="filename">.la</code> extension, and the objects are
8482 changed to have a <code class="filename">.lo</code> 8482 changed to have a <code class="filename">.lo</code>
8483 extension. Change <code class="varname">OBJS</code> as 8483 extension. Change <code class="varname">OBJS</code> as
8484 necessary. This automatically creates all of the 8484 necessary. This automatically creates all of the
8485 <code class="filename">.a</code>, 8485 <code class="filename">.a</code>,
8486 <code class="filename">.so.major.minor</code>, and ELF symlinks (if 8486 <code class="filename">.so.major.minor</code>, and ELF symlinks (if
8487 necessary) in the build directory. Be sure to include 8487 necessary) in the build directory. Be sure to include
8488 <span class="quote">&#8220;<span class="quote">-version-info</span>&#8221;</span>, especially when major and 8488 <span class="quote">&#8220;<span class="quote">-version-info</span>&#8221;</span>, especially when major and
8489 minor are zero, as libtool will otherwise strip off the 8489 minor are zero, as libtool will otherwise strip off the
8490 shared library version.</p> 8490 shared library version.</p>
8491<p>From the libtool manual:</p> 8491<p>From the libtool manual:</p>
8492<pre class="programlisting"> 8492<pre class="programlisting">
8493So, libtool library versions are described by three integers: 8493So, libtool library versions are described by three integers:
8494 8494
8495CURRENT 8495CURRENT
8496The most recent interface number that this library implements. 8496The most recent interface number that this library implements.
8497 8497
8498REVISION 8498REVISION
8499The implementation number of the CURRENT interface. 8499The implementation number of the CURRENT interface.
8500 8500
8501AGE 8501AGE
8502The difference between the newest and oldest interfaces that 8502The difference between the newest and oldest interfaces that
8503this library implements. In other words, the library implements 8503this library implements. In other words, the library implements
8504all the interface numbers in the range from number `CURRENT - 8504all the interface numbers in the range from number `CURRENT -
8505AGE' to `CURRENT'. 8505AGE' to `CURRENT'.
8506 8506
8507If two libraries have identical CURRENT and AGE numbers, then the 8507If two libraries have identical CURRENT and AGE numbers, then the
8508dynamic linker chooses the library with the greater REVISION number. 8508dynamic linker chooses the library with the greater REVISION number.
8509 </pre> 8509 </pre>
8510<p>The <span class="quote">&#8220;<span class="quote">-release</span>&#8221;</span> option will produce 8510<p>The <span class="quote">&#8220;<span class="quote">-release</span>&#8221;</span> option will produce
8511 different results for a.out and ELF (excluding symlinks) 8511 different results for a.out and ELF (excluding symlinks)
8512 in only one case. An ELF library of the form 8512 in only one case. An ELF library of the form
8513 <span class="quote">&#8220;<span class="quote">libfoo-release.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>&#8221;</span> 8513 <span class="quote">&#8220;<span class="quote">libfoo-release.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>&#8221;</span>
8514 will have a symlink of 8514 will have a symlink of
8515 <span class="quote">&#8220;<span class="quote">libfoo.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>&#8221;</span> 8515 <span class="quote">&#8220;<span class="quote">libfoo.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>&#8221;</span>
8516 on an a.out platform. This is handled 8516 on an a.out platform. This is handled
8517 automatically.</p> 8517 automatically.</p>
8518<p>The <span class="quote">&#8220;<span class="quote">-rpath argument</span>&#8221;</span> is the install 8518<p>The <span class="quote">&#8220;<span class="quote">-rpath argument</span>&#8221;</span> is the install
8519 directory of the library being built.</p> 8519 directory of the library being built.</p>
8520<p>In the <code class="filename">PLIST</code>, include only the 8520<p>In the <code class="filename">PLIST</code>, include only the
8521 <code class="filename">.la</code> file, the other files will be 8521 <code class="filename">.la</code> file, the other files will be
8522 added automatically.</p> 8522 added automatically.</p>
8523</li> 8523</li>
8524<li class="listitem"> 8524<li class="listitem">
8525<p>When linking shared object (<code class="filename">.so</code>) 8525<p>When linking shared object (<code class="filename">.so</code>)
8526 files, i.e. files that are loaded via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">dlopen</span>(3)</span></a>, NOT 8526 files, i.e. files that are loaded via <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">dlopen</span>(3)</span></a>, NOT
8527 shared libraries, use <span class="quote">&#8220;<span class="quote">-module 8527 shared libraries, use <span class="quote">&#8220;<span class="quote">-module
8528 -avoid-version</span>&#8221;</span> to prevent them getting version 8528 -avoid-version</span>&#8221;</span> to prevent them getting version
8529 tacked on.</p> 8529 tacked on.</p>
8530<p>The <code class="filename">PLIST</code> file gets the 8530<p>The <code class="filename">PLIST</code> file gets the
8531 <code class="filename">foo.so</code> entry.</p> 8531 <code class="filename">foo.so</code> entry.</p>
8532</li> 8532</li>
8533<li class="listitem"> 8533<li class="listitem">
8534<p>When linking programs that depend on these libraries 8534<p>When linking programs that depend on these libraries
8535 <span class="emphasis"><em>before</em></span> they are installed, preface 8535 <span class="emphasis"><em>before</em></span> they are installed, preface
8536 the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">cc</span>(1)</span></a> or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">ld</span>(1)</span></a> line with <span class="quote">&#8220;<span class="quote">${LIBTOOL} 8536 the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">cc</span>(1)</span></a> or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">ld</span>(1)</span></a> line with <span class="quote">&#8220;<span class="quote">${LIBTOOL}
8537 --mode=link</span>&#8221;</span>, and it will find the correct 8537 --mode=link</span>&#8221;</span>, and it will find the correct
8538 libraries (static or shared), but please be aware that 8538 libraries (static or shared), but please be aware that
8539 libtool will not allow you to specify a relative path in 8539 libtool will not allow you to specify a relative path in
8540 -L (such as <span class="quote">&#8220;<span class="quote">-L../somelib</span>&#8221;</span>), because it 8540 -L (such as <span class="quote">&#8220;<span class="quote">-L../somelib</span>&#8221;</span>), because it
8541 expects you to change that argument to be the 8541 expects you to change that argument to be the
8542 <code class="filename">.la</code> file. e.g.</p> 8542 <code class="filename">.la</code> file. e.g.</p>
8543<pre class="programlisting"> 8543<pre class="programlisting">
8544${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib 8544${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
8545 </pre> 8545 </pre>
8546<p>should be changed to:</p> 8546<p>should be changed to:</p>
8547<pre class="programlisting"> 8547<pre class="programlisting">
8548${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em> 8548${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em>
8549 </pre> 8549 </pre>
8550<p>and it will do the right thing with the libraries.</p> 8550<p>and it will do the right thing with the libraries.</p>
8551</li> 8551</li>
8552<li class="listitem"> 8552<li class="listitem">
8553<p>When installing libraries, preface the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> 8553<p>When installing libraries, preface the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a>
8554 or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span></a> command with <span class="quote">&#8220;<span class="quote">${LIBTOOL} 8554 or <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span></a> command with <span class="quote">&#8220;<span class="quote">${LIBTOOL}
8555 --mode=install</span>&#8221;</span>, and change the library name to 8555 --mode=install</span>&#8221;</span>, and change the library name to
8556 <code class="filename">.la</code>. e.g.</p> 8556 <code class="filename">.la</code>. e.g.</p>
8557<pre class="programlisting"> 8557<pre class="programlisting">
8558${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib 8558${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
8559 </pre> 8559 </pre>
8560<p>This will install the static <code class="filename">.a</code>, 8560<p>This will install the static <code class="filename">.a</code>,
8561 shared library, any needed symlinks, and run 8561 shared library, any needed symlinks, and run
8562 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">ldconfig</span>(8)</span></a>.</p> 8562 <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">ldconfig</span>(8)</span></a>.</p>
8563</li> 8563</li>
8564<li class="listitem"><p>In your <code class="filename">PLIST</code>, include only 8564<li class="listitem"><p>In your <code class="filename">PLIST</code>, include only
8565 the <code class="filename">.la</code> 8565 the <code class="filename">.la</code>
8566 file (this is a change from previous behaviour).</p></li> 8566 file (this is a change from previous behaviour).</p></li>
8567</ol></div> 8567</ol></div>
8568</div> 8568</div>
8569<div class="sect2"> 8569<div class="sect2">
8570<div class="titlepage"><div><div><h3 class="title"> 8570<div class="titlepage"><div><div><h3 class="title">
8571<a name="using-libtool"></a>19.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div> 8571<a name="using-libtool"></a>19.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div>
8572<p>Add <code class="varname">USE_LIBTOOL=yes</code> to the 8572<p>Add <code class="varname">USE_LIBTOOL=yes</code> to the
8573 package Makefile. This will override the package's own libtool 8573 package Makefile. This will override the package's own libtool
8574 in most cases. For older libtool using packages, libtool is 8574 in most cases. For older libtool using packages, libtool is
8575 made by ltconfig script during the do-configure step; you can 8575 made by ltconfig script during the do-configure step; you can
8576 check the libtool script location by doing <span class="command"><strong>make 8576 check the libtool script location by doing <span class="command"><strong>make
8577 configure; find work*/ -name libtool</strong></span>.</p> 8577 configure; find work*/ -name libtool</strong></span>.</p>
8578<p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool 8578<p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool
8579 scripts, relative to <code class="varname">WRKSRC</code>, to override. By 8579 scripts, relative to <code class="varname">WRKSRC</code>, to override. By
8580 default, it is set to <span class="quote">&#8220;<span class="quote">libtool */libtool 8580 default, it is set to <span class="quote">&#8220;<span class="quote">libtool */libtool
8581 */*/libtool</span>&#8221;</span>. If this does not match the location of the 8581 */*/libtool</span>&#8221;</span>. If this does not match the location of the
8582 package's libtool script(s), set it as appropriate.</p> 8582 package's libtool script(s), set it as appropriate.</p>
8583<p>If you do not need <code class="filename">*.a</code> static 8583<p>If you do not need <code class="filename">*.a</code> static
8584 libraries built and installed, then use 8584 libraries built and installed, then use
8585 <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p> 8585 <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
8586<p>If your package makes use of the platform-independent library 8586<p>If your package makes use of the platform-independent library
8587 for loading dynamic shared objects, that comes with libtool 8587 for loading dynamic shared objects, that comes with libtool
8588 (libltdl), you should include devel/libltdl/buildlink3.mk.</p> 8588 (libltdl), you should include devel/libltdl/buildlink3.mk.</p>
8589<p>Some packages use libtool incorrectly so that the package 8589<p>Some packages use libtool incorrectly so that the package
8590 may not work or build in some circumstances. Some of the more 8590 may not work or build in some circumstances. Some of the more
8591 common errors are:</p> 8591 common errors are:</p>
8592<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 8592<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8593<li class="listitem"> 8593<li class="listitem">
8594<p>The inclusion of a shared object (-module) as a dependent library in an 8594<p>The inclusion of a shared object (-module) as a dependent library in an
8595 executable or library. This in itself isn't a problem if one of two things 8595 executable or library. This in itself isn't a problem if one of two things
8596 has been done:</p> 8596 has been done:</p>
8597<div class="orderedlist"><ol class="orderedlist" type="1"> 8597<div class="orderedlist"><ol class="orderedlist" type="1">
8598<li class="listitem"><p>The shared object is named correctly, i.e. 8598<li class="listitem"><p>The shared object is named correctly, i.e.
8599 <code class="filename">libfoo.la</code>, not 8599 <code class="filename">libfoo.la</code>, not
8600 <code class="filename">foo.la</code></p></li> 8600 <code class="filename">foo.la</code></p></li>
8601<li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li> 8601<li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li>
8602</ol></div> 8602</ol></div>
8603</li> 8603</li>
8604<li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines. 8604<li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines.
8605 The function lt_dlinit() should be called and the macro 8605 The function lt_dlinit() should be called and the macro
8606 <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in 8606 <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in
8607 executables.</p></li> 8607 executables.</p></li>
8608</ul></div> 8608</ul></div>
8609</div> 8609</div>
8610<div class="sect2"> 8610<div class="sect2">
8611<div class="titlepage"><div><div><h3 class="title"> 8611<div class="titlepage"><div><div><h3 class="title">
8612<a name="autoconf-automake"></a>19.3.3. GNU Autoconf/Automake</h3></div></div></div> 8612<a name="autoconf-automake"></a>19.3.3. GNU Autoconf/Automake</h3></div></div></div>
8613<p>If a package needs GNU autoconf or automake to be executed 8613<p>If a package needs GNU autoconf or automake to be executed
8614 to regenerate the configure script and Makefile.in makefile 8614 to regenerate the configure script and Makefile.in makefile
8615 templates, then they should be executed in a pre-configure 8615 templates, then they should be executed in a pre-configure
8616 target.</p> 8616 target.</p>
8617<p>For packages that need only autoconf:</p> 8617<p>For packages that need only autoconf:</p>
8618<pre class="programlisting"> 8618<pre class="programlisting">
8619AUTOCONF_REQD= 2.50 # if default version is not good enough 8619AUTOCONF_REQD= 2.50 # if default version is not good enough
8620USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 8620USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13
8621... 8621...
8622 8622
8623pre-configure: 8623pre-configure:
8624 cd ${WRKSRC} &amp;&amp; autoconf 8624 cd ${WRKSRC} &amp;&amp; autoconf
8625 8625
8626... 8626...
8627 </pre> 8627 </pre>
8628<p>and for packages that need automake and autoconf:</p> 8628<p>and for packages that need automake and autoconf:</p>
8629<pre class="programlisting"> 8629<pre class="programlisting">
8630AUTOMAKE_REQD= 1.7.1 # if default version is not good enough 8630AUTOMAKE_REQD= 1.7.1 # if default version is not good enough
8631USE_TOOLS+= automake # use "automake14" for automake-1.4 8631USE_TOOLS+= automake # use "automake14" for automake-1.4
8632... 8632...
8633 8633
8634pre-configure: 8634pre-configure:
8635 set -e; cd ${WRKSRC}; \ 8635 set -e; cd ${WRKSRC}; \
8636 aclocal; autoheader; automake -a --foreign -i; autoconf 8636 aclocal; autoheader; automake -a --foreign -i; autoconf
8637 8637
8638... 8638...
8639 </pre> 8639 </pre>
8640<p>Packages which use GNU Automake will almost certainly 8640<p>Packages which use GNU Automake will almost certainly
8641 require GNU Make.</p> 8641 require GNU Make.</p>
8642<p>There are times when the configure process makes 8642<p>There are times when the configure process makes
8643 additional changes to the generated files, which then causes 8643 additional changes to the generated files, which then causes
8644 the build process to try to re-execute the automake sequence. 8644 the build process to try to re-execute the automake sequence.
8645 This is prevented by touching various files in the configure 8645 This is prevented by touching various files in the configure
8646 stage. If this causes problems with your package you can set 8646 stage. If this causes problems with your package you can set
8647 <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package 8647 <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package
8648 Makefile.</p> 8648 Makefile.</p>
8649</div> 8649</div>
8650</div> 8650</div>
8651<div class="sect1"> 8651<div class="sect1">
8652<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 8652<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8653<a name="programming-languages"></a>19.4. Programming languages</h2></div></div></div> 8653<a name="programming-languages"></a>19.4. Programming languages</h2></div></div></div>
8654<div class="sect2"> 8654<div class="sect2">
8655<div class="titlepage"><div><div><h3 class="title"> 8655<div class="titlepage"><div><div><h3 class="title">
8656<a name="basic-programming-languages"></a>19.4.1. C, C++, and Fortran</h3></div></div></div> 8656<a name="basic-programming-languages"></a>19.4.1. C, C++, and Fortran</h3></div></div></div>
8657<p>Compilers for the C, C++, and Fortran languages comes with 8657<p>Compilers for the C, C++, and Fortran languages comes with
8658 the NetBSD base system. By default, pkgsrc assumes that a package 8658 the NetBSD base system. By default, pkgsrc assumes that a package
8659 is written in C and will hide all other compilers (via the wrapper 8659 is written in C and will hide all other compilers (via the wrapper
8660 framework, see <a class="xref" href="#buildlink" title="Chapter 14. Buildlink methodology">Chapter 14, <i>Buildlink methodology</i></a>).</p> 8660 framework, see <a class="xref" href="#buildlink" title="Chapter 14. Buildlink methodology">Chapter 14, <i>Buildlink methodology</i></a>).</p>
8661<p>To declare which language's compiler a package needs, set 8661<p>To declare which language's compiler a package needs, set
8662 the <code class="varname">USE_LANGUAGES</code> variable. Allowed values 8662 the <code class="varname">USE_LANGUAGES</code> variable. Allowed values
8663 currently are <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">c++</span>&#8221;</span>, and 8663 currently are <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">c++</span>&#8221;</span>, and
8664 <span class="quote">&#8220;<span class="quote">fortran</span>&#8221;</span> (and any combination). The default is 8664 <span class="quote">&#8220;<span class="quote">fortran</span>&#8221;</span> (and any combination). The default is
8665 <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>. Packages using GNU configure scripts, even if 8665 <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>. Packages using GNU configure scripts, even if
8666 written in C++, usually need a C compiler for the configure 8666 written in C++, usually need a C compiler for the configure
8667 phase.</p> 8667 phase.</p>
8668</div> 8668</div>
8669<div class="sect2"> 8669<div class="sect2">
8670<div class="titlepage"><div><div><h3 class="title"> 8670<div class="titlepage"><div><div><h3 class="title">
8671<a name="java-programming-language"></a>19.4.2. Java</h3></div></div></div> 8671<a name="java-programming-language"></a>19.4.2. Java</h3></div></div></div>
8672<p>If a program is written in Java, use the Java framework in 8672<p>If a program is written in Java, use the Java framework in
8673 pkgsrc. The package must include 8673 pkgsrc. The package must include
8674 <code class="filename">../../mk/java-vm.mk</code>. This Makefile fragment 8674 <code class="filename">../../mk/java-vm.mk</code>. This Makefile fragment
8675 provides the following variables:</p> 8675 provides the following variables:</p>
8676<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 8676<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8677<li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build 8677<li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build
8678 dependency on the JDK is added. If 8678 dependency on the JDK is added. If
8679 <code class="varname">USE_JAVA</code> is set to <span class="quote">&#8220;<span class="quote">run</span>&#8221;</span>, then 8679 <code class="varname">USE_JAVA</code> is set to <span class="quote">&#8220;<span class="quote">run</span>&#8221;</span>, then
8680 there is only a runtime dependency on the JDK. The default is 8680 there is only a runtime dependency on the JDK. The default is
8681 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, which also adds a build dependency on the 8681 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, which also adds a build dependency on the
8682 JDK.</p></li> 8682 JDK.</p></li>
8683<li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that 8683<li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that
8684 a package needs a Java2 implementation. The supported values 8684 a package needs a Java2 implementation. The supported values
8685 are <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span>, and 8685 are <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span>, and
8686 <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span>. <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> accepts any Java2 8686 <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span>. <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> accepts any Java2
8687 implementation, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span> insists on versions 1.4 or 8687 implementation, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span> insists on versions 1.4 or
8688 above, and <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span> only accepts versions 1.5 or 8688 above, and <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span> only accepts versions 1.5 or
8689 above. This variable is not set by default.</p></li> 8689 above. This variable is not set by default.</p></li>
8690<li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is 8690<li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is
8691 automatically set to the runtime location of the used Java 8691 automatically set to the runtime location of the used Java
8692 implementation dependency. It may be used to set 8692 implementation dependency. It may be used to set
8693 <code class="varname">JAVA_HOME</code> to a good value if the program 8693 <code class="varname">JAVA_HOME</code> to a good value if the program
8694 needs this variable to be defined. 8694 needs this variable to be defined.
8695 </p></li> 8695 </p></li>
8696</ul></div> 8696</ul></div>
8697</div> 8697</div>
8698<div class="sect2"> 8698<div class="sect2">
8699<div class="titlepage"><div><div><h3 class="title"> 8699<div class="titlepage"><div><div><h3 class="title">
8700<a name="perl-scripts"></a>19.4.3. Packages containing perl scripts</h3></div></div></div> 8700<a name="perl-scripts"></a>19.4.3. Packages containing perl scripts</h3></div></div></div>
8701<p>If your package contains interpreted perl scripts, add 8701<p>If your package contains interpreted perl scripts, add
8702 <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to the <code class="varname">USE_TOOLS</code> variable 8702 <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to the <code class="varname">USE_TOOLS</code> variable
8703 and set <code class="varname">REPLACE_PERL</code> to ensure that the proper 8703 and set <code class="varname">REPLACE_PERL</code> to ensure that the proper
8704 interpreter path is set. <code class="varname">REPLACE_PERL</code> should 8704 interpreter path is set. <code class="varname">REPLACE_PERL</code> should
8705 contain a list of scripts, relative to <code class="varname">WRKSRC</code>, 8705 contain a list of scripts, relative to <code class="varname">WRKSRC</code>,
8706 that you want adjusted. Every occurrence of 8706 that you want adjusted. Every occurrence of
8707 <code class="filename">*/bin/perl</code> will be replaced with the full 8707 <code class="filename">*/bin/perl</code> will be replaced with the full
8708 path to the perl executable.</p> 8708 path to the perl executable.</p>
@@ -8773,2222 +8773,2222 @@ pre-configure: @@ -8773,2222 +8773,2222 @@ pre-configure:
8773/* BSD-specific code goes here */ 8773/* BSD-specific code goes here */
8774#else 8774#else
8775/* non-BSD-specific code goes here */ 8775/* non-BSD-specific code goes here */
8776#endif 8776#endif
8777</pre> 8777</pre>
8778<p>If this distinction is not fine enough, you can also test 8778<p>If this distinction is not fine enough, you can also test
8779 for the following macros.</p> 8779 for the following macros.</p>
8780<pre class="programlisting"> 8780<pre class="programlisting">
8781Cygwin __CYGWIN__ 8781Cygwin __CYGWIN__
8782DragonFly __DragonFly__ 8782DragonFly __DragonFly__
8783FreeBSD __FreeBSD__ 8783FreeBSD __FreeBSD__
8784Haiku __HAIKU__ 8784Haiku __HAIKU__
8785Interix __INTERIX 8785Interix __INTERIX
8786IRIX __sgi (TODO: get a definite source for this) 8786IRIX __sgi (TODO: get a definite source for this)
8787Linux linux, __linux, __linux__ 8787Linux linux, __linux, __linux__
8788MirBSD __MirBSD__ (__OpenBSD__ is also defined) 8788MirBSD __MirBSD__ (__OpenBSD__ is also defined)
8789Minix3 __minix 8789Minix3 __minix
8790NetBSD __NetBSD__ 8790NetBSD __NetBSD__
8791OpenBSD __OpenBSD__ 8791OpenBSD __OpenBSD__
8792Solaris sun, __sun 8792Solaris sun, __sun
8793</pre> 8793</pre>
8794</div> 8794</div>
8795<div class="sect3"> 8795<div class="sect3">
8796<div class="titlepage"><div><div><h4 class="title"> 8796<div class="titlepage"><div><div><h4 class="title">
8797<a name="fixes.build.cpp.arch"></a>19.5.1.2. C preprocessor macros to identify the hardware architecture</h4></div></div></div> 8797<a name="fixes.build.cpp.arch"></a>19.5.1.2. C preprocessor macros to identify the hardware architecture</h4></div></div></div>
8798<pre class="programlisting"> 8798<pre class="programlisting">
8799i386 i386, __i386, __i386__ 8799i386 i386, __i386, __i386__
8800MIPS __mips 8800MIPS __mips
8801SPARC sparc, __sparc 8801SPARC sparc, __sparc
8802</pre> 8802</pre>
8803</div> 8803</div>
8804<div class="sect3"> 8804<div class="sect3">
8805<div class="titlepage"><div><div><h4 class="title"> 8805<div class="titlepage"><div><div><h4 class="title">
8806<a name="fixes.build.cpp.compiler"></a>19.5.1.3. C preprocessor macros to identify the compiler</h4></div></div></div> 8806<a name="fixes.build.cpp.compiler"></a>19.5.1.3. C preprocessor macros to identify the compiler</h4></div></div></div>
8807<pre class="programlisting"> 8807<pre class="programlisting">
8808GCC __GNUC__ (major version), __GNUC_MINOR__ 8808GCC __GNUC__ (major version), __GNUC_MINOR__
8809MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) 8809MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
8810SunPro __SUNPRO_C (0x570 for Sun C 5.7) 8810SunPro __SUNPRO_C (0x570 for Sun C 5.7)
8811SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) 8811SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
8812</pre> 8812</pre>
8813</div> 8813</div>
8814</div> 8814</div>
8815<div class="sect2"> 8815<div class="sect2">
8816<div class="titlepage"><div><div><h3 class="title"> 8816<div class="titlepage"><div><div><h3 class="title">
8817<a name="compiler-bugs"></a>19.5.2. How to handle compiler bugs</h3></div></div></div> 8817<a name="compiler-bugs"></a>19.5.2. How to handle compiler bugs</h3></div></div></div>
8818<p>Some source files trigger bugs in the compiler, based on 8818<p>Some source files trigger bugs in the compiler, based on
8819 combinations of compiler version and architecture and almost 8819 combinations of compiler version and architecture and almost
8820 always relation to optimisation being enabled. Common symptoms 8820 always relation to optimisation being enabled. Common symptoms
8821 are gcc internal errors or never finishing compiling a 8821 are gcc internal errors or never finishing compiling a
8822 file.</p> 8822 file.</p>
8823<p>Typically, a workaround involves testing the 8823<p>Typically, a workaround involves testing the
8824 <code class="varname">MACHINE_ARCH</code> and compiler version, disabling 8824 <code class="varname">MACHINE_ARCH</code> and compiler version, disabling
8825 optimisation for that combination of file, 8825 optimisation for that combination of file,
8826 <code class="varname">MACHINE_ARCH</code> and compiler, and documenting it 8826 <code class="varname">MACHINE_ARCH</code> and compiler, and documenting it
8827 in <code class="filename">pkgsrc/doc/HACKS</code>. See that file for a 8827 in <code class="filename">pkgsrc/doc/HACKS</code>. See that file for a
8828 number of examples.</p> 8828 number of examples.</p>
8829</div> 8829</div>
8830<div class="sect2"> 8830<div class="sect2">
8831<div class="titlepage"><div><div><h3 class="title"> 8831<div class="titlepage"><div><div><h3 class="title">
8832<a name="undefined-reference"></a>19.5.3. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span> 8832<a name="undefined-reference"></a>19.5.3. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span>
8833</h3></div></div></div> 8833</h3></div></div></div>
8834<p>This error message often means that a package did not 8834<p>This error message often means that a package did not
8835 link to a shared library it needs. The following functions are 8835 link to a shared library it needs. The following functions are
8836 known to cause this error message over and over.</p> 8836 known to cause this error message over and over.</p>
8837<div class="informaltable"> 8837<div class="informaltable">
8838<a name="undefined-reference-functions"></a><table border="1"> 8838<a name="undefined-reference-functions"></a><table border="1">
8839<colgroup> 8839<colgroup>
8840<col> 8840<col>
8841<col> 8841<col>
8842<col> 8842<col>
8843</colgroup> 8843</colgroup>
8844<thead><tr> 8844<thead><tr>
8845<th>Function</th> 8845<th>Function</th>
8846<th>Library</th> 8846<th>Library</th>
8847<th>Affected platforms</th> 8847<th>Affected platforms</th>
8848</tr></thead> 8848</tr></thead>
8849<tbody> 8849<tbody>
8850<tr> 8850<tr>
8851<td>accept, bind, connect</td> 8851<td>accept, bind, connect</td>
8852<td>-lsocket</td> 8852<td>-lsocket</td>
8853<td>Solaris</td> 8853<td>Solaris</td>
8854</tr> 8854</tr>
8855<tr> 8855<tr>
8856<td>crypt</td> 8856<td>crypt</td>
8857<td>-lcrypt</td> 8857<td>-lcrypt</td>
8858<td>DragonFly, NetBSD</td> 8858<td>DragonFly, NetBSD</td>
8859</tr> 8859</tr>
8860<tr> 8860<tr>
8861<td>dlopen, dlsym</td> 8861<td>dlopen, dlsym</td>
8862<td>-ldl</td> 8862<td>-ldl</td>
8863<td>Linux</td> 8863<td>Linux</td>
8864</tr> 8864</tr>
8865<tr> 8865<tr>
8866<td>gethost*</td> 8866<td>gethost*</td>
8867<td>-lnsl</td> 8867<td>-lnsl</td>
8868<td>Solaris</td> 8868<td>Solaris</td>
8869</tr> 8869</tr>
8870<tr> 8870<tr>
8871<td>inet_aton</td> 8871<td>inet_aton</td>
8872<td>-lresolv</td> 8872<td>-lresolv</td>
8873<td>Solaris</td> 8873<td>Solaris</td>
8874</tr> 8874</tr>
8875<tr> 8875<tr>
8876<td>nanosleep, sem_*, timer_*</td> 8876<td>nanosleep, sem_*, timer_*</td>
8877<td>-lrt</td> 8877<td>-lrt</td>
8878<td>Solaris</td> 8878<td>Solaris</td>
8879</tr> 8879</tr>
8880<tr> 8880<tr>
8881<td>openpty</td> 8881<td>openpty</td>
8882<td>-lutil</td> 8882<td>-lutil</td>
8883<td>Linux</td> 8883<td>Linux</td>
8884</tr> 8884</tr>
8885</tbody> 8885</tbody>
8886</table> 8886</table>
8887</div> 8887</div>
8888<p>To fix these linker errors, it is often sufficient to say 8888<p>To fix these linker errors, it is often sufficient to say
8889 <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+= 8889 <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+=
8890 -l<em class="replaceable"><code>foo</code></em></code> to the package 8890 -l<em class="replaceable"><code>foo</code></em></code> to the package
8891 <code class="filename">Makefile</code> and then say <span class="command"><strong>bmake clean; 8891 <code class="filename">Makefile</code> and then say <span class="command"><strong>bmake clean;
8892 bmake</strong></span>.</p> 8892 bmake</strong></span>.</p>
8893<div class="sect3"> 8893<div class="sect3">
8894<div class="titlepage"><div><div><h4 class="title"> 8894<div class="titlepage"><div><div><h4 class="title">
8895<a name="undefined-reference-sunpro"></a>19.5.3.1. Special issue: The SunPro compiler</h4></div></div></div> 8895<a name="undefined-reference-sunpro"></a>19.5.3.1. Special issue: The SunPro compiler</h4></div></div></div>
8896<p>When you are using the SunPro compiler, there is another 8896<p>When you are using the SunPro compiler, there is another
8897possibility. That compiler cannot handle the following code:</p> 8897possibility. That compiler cannot handle the following code:</p>
8898<pre class="programlisting"> 8898<pre class="programlisting">
8899extern int extern_func(int); 8899extern int extern_func(int);
8900 8900
8901static inline int 8901static inline int
8902inline_func(int x) 8902inline_func(int x)
8903{ 8903{
8904 return extern_func(x); 8904 return extern_func(x);
8905} 8905}
8906 8906
8907int main(void) 8907int main(void)
8908{ 8908{
8909 return 0; 8909 return 0;
8910} 8910}
8911</pre> 8911</pre>
8912<p>It generates the code for <code class="function">inline_func</code> even if 8912<p>It generates the code for <code class="function">inline_func</code> even if
8913that function is never used. This code then refers to 8913that function is never used. This code then refers to
8914<code class="function">extern_func</code>, which can usually not be resolved. To 8914<code class="function">extern_func</code>, which can usually not be resolved. To
8915solve this problem you can try to tell the package to disable inlining 8915solve this problem you can try to tell the package to disable inlining
8916of functions.</p> 8916of functions.</p>
8917</div> 8917</div>
8918</div> 8918</div>
8919<div class="sect2"> 8919<div class="sect2">
8920<div class="titlepage"><div><div><h3 class="title"> 8920<div class="titlepage"><div><div><h3 class="title">
8921<a name="out-of-memory"></a>19.5.4. Running out of memory</h3></div></div></div> 8921<a name="out-of-memory"></a>19.5.4. Running out of memory</h3></div></div></div>
8922<p>Sometimes packages fail to build because the compiler runs 8922<p>Sometimes packages fail to build because the compiler runs
8923 into an operating system specific soft limit. With the 8923 into an operating system specific soft limit. With the
8924 <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told 8924 <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told
8925 to unlimit the resources. Currently, the allowed values are 8925 to unlimit the resources. Currently, the allowed values are
8926 <span class="quote">&#8220;<span class="quote">datasize</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">stacksize</span>&#8221;</span> (or both). 8926 <span class="quote">&#8220;<span class="quote">datasize</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">stacksize</span>&#8221;</span> (or both).
8927 Setting this variable is similar to running the shell builtin 8927 Setting this variable is similar to running the shell builtin
8928 <span class="command"><strong>ulimit</strong></span> command to raise the maximum data 8928 <span class="command"><strong>ulimit</strong></span> command to raise the maximum data
8929 segment size or maximum stack size of a process, respectively, to 8929 segment size or maximum stack size of a process, respectively, to
8930 their hard limits.</p> 8930 their hard limits.</p>
8931</div> 8931</div>
8932</div> 8932</div>
8933<div class="sect1"> 8933<div class="sect1">
8934<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 8934<div class="titlepage"><div><div><h2 class="title" style="clear: both">
8935<a name="fixes.install"></a>19.6. Fixing problems in the <span class="emphasis"><em>install</em></span> phase</h2></div></div></div> 8935<a name="fixes.install"></a>19.6. Fixing problems in the <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
8936<div class="sect2"> 8936<div class="sect2">
8937<div class="titlepage"><div><div><h3 class="title"> 8937<div class="titlepage"><div><div><h3 class="title">
8938<a name="install-scripts"></a>19.6.1. Creating needed directories</h3></div></div></div> 8938<a name="install-scripts"></a>19.6.1. Creating needed directories</h3></div></div></div>
8939<p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied 8939<p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied
8940 with some operating systems cannot create more than one 8940 with some operating systems cannot create more than one
8941 directory at a time. As such, you should call 8941 directory at a time. As such, you should call
8942 <code class="literal">${INSTALL_*_DIR}</code> like this:</p> 8942 <code class="literal">${INSTALL_*_DIR}</code> like this:</p>
8943<pre class="programlisting"> 8943<pre class="programlisting">
8944${INSTALL_DATA_DIR} ${PREFIX}/dir1 8944${INSTALL_DATA_DIR} ${PREFIX}/dir1
8945${INSTALL_DATA_DIR} ${PREFIX}/dir2 8945${INSTALL_DATA_DIR} ${PREFIX}/dir2
8946 </pre> 8946 </pre>
8947<p>You can also just append <span class="quote">&#8220;<span class="quote"><code class="literal">dir1 8947<p>You can also just append <span class="quote">&#8220;<span class="quote"><code class="literal">dir1
8948 dir2</code></span>&#8221;</span> to the 8948 dir2</code></span>&#8221;</span> to the
8949 <code class="varname">INSTALLATION_DIRS</code> variable, which will 8949 <code class="varname">INSTALLATION_DIRS</code> variable, which will
8950 automatically do the right thing.</p> 8950 automatically do the right thing.</p>
8951</div> 8951</div>
8952<div class="sect2"> 8952<div class="sect2">
8953<div class="titlepage"><div><div><h3 class="title"> 8953<div class="titlepage"><div><div><h3 class="title">
8954<a name="where-to-install-documentation"></a>19.6.2. Where to install documentation</h3></div></div></div> 8954<a name="where-to-install-documentation"></a>19.6.2. Where to install documentation</h3></div></div></div>
8955<p>In general, documentation should be installed into 8955<p>In general, documentation should be installed into
8956 <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or 8956 <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
8957 <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code> (the latter 8957 <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code> (the latter
8958 includes the version number of the package).</p> 8958 includes the version number of the package).</p>
8959<p>Many modern packages using GNU autoconf allow to set the 8959<p>Many modern packages using GNU autoconf allow to set the
8960 directory where HTML documentation is installed with the 8960 directory where HTML documentation is installed with the
8961 <span class="quote">&#8220;<span class="quote">--with-html-dir</span>&#8221;</span> option. Sometimes using this flag 8961 <span class="quote">&#8220;<span class="quote">--with-html-dir</span>&#8221;</span> option. Sometimes using this flag
8962 is needed because otherwise the documentation ends up in 8962 is needed because otherwise the documentation ends up in
8963 <code class="filename">${PREFIX}/share/doc/html</code> or other 8963 <code class="filename">${PREFIX}/share/doc/html</code> or other
8964 places.</p> 8964 places.</p>
8965<p>An exception to the above is that library API documentation 8965<p>An exception to the above is that library API documentation
8966 generated with the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/textproc/gtk-doc/README.html" target="_top"><code class="filename">textproc/gtk-doc</code></a> tools, for use by special 8966 generated with the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/textproc/gtk-doc/README.html" target="_top"><code class="filename">textproc/gtk-doc</code></a> tools, for use by special
8967 browsers (devhelp) should be left at their default location, which 8967 browsers (devhelp) should be left at their default location, which
8968 is <code class="filename">${PREFIX}/share/gtk-doc</code>. Such 8968 is <code class="filename">${PREFIX}/share/gtk-doc</code>. Such
8969 documentation can be recognized from files ending in 8969 documentation can be recognized from files ending in
8970 <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>. 8970 <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>.
8971 (It is also acceptable to install such files in 8971 (It is also acceptable to install such files in
8972 <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or 8972 <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
8973 <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the 8973 <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the
8974 <code class="filename">.devhelp*</code> file must be directly in that 8974 <code class="filename">.devhelp*</code> file must be directly in that
8975 directory then, no additional subdirectory level is allowed in 8975 directory then, no additional subdirectory level is allowed in
8976 this case. This is usually achieved by using 8976 this case. This is usually achieved by using
8977 <span class="quote">&#8220;<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>&#8221;</span>. 8977 <span class="quote">&#8220;<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>&#8221;</span>.
8978 <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred 8978 <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred
8979 though.)</p> 8979 though.)</p>
8980</div> 8980</div>
8981<div class="sect2"> 8981<div class="sect2">
8982<div class="titlepage"><div><div><h3 class="title"> 8982<div class="titlepage"><div><div><h3 class="title">
8983<a name="installing-score-files"></a>19.6.3. Installing highscore files</h3></div></div></div> 8983<a name="installing-score-files"></a>19.6.3. Installing highscore files</h3></div></div></div>
8984<p>Certain packages, most of them in the games category, install 8984<p>Certain packages, most of them in the games category, install
8985 a score file that allows all users on the system to record their 8985 a score file that allows all users on the system to record their
8986 highscores. In order for this to work, the binaries need to be 8986 highscores. In order for this to work, the binaries need to be
8987 installed setgid and the score files owned by the appropriate 8987 installed setgid and the score files owned by the appropriate
8988 group and/or owner (traditionally the "games" user/group). Set 8988 group and/or owner (traditionally the "games" user/group). Set
8989 <code class="varname">USE_GAMESGROUP</code> to yes to support this. The 8989 <code class="varname">USE_GAMESGROUP</code> to yes to support this. The
8990 following variables, documented in more detail in 8990 following variables, documented in more detail in
8991 <code class="filename">mk/defaults/mk.conf</code>, control this 8991 <code class="filename">mk/defaults/mk.conf</code>, control this
8992 behaviour: <code class="varname">GAMEDATAMODE</code>, 8992 behaviour: <code class="varname">GAMEDATAMODE</code>,
8993 <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>, 8993 <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>,
8994 <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.</p> 8994 <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.</p>
8995<p>A package should therefore never hard code file ownership or 8995<p>A package should therefore never hard code file ownership or
8996 access permissions but rely on <code class="varname">INSTALL_GAME</code> and 8996 access permissions but rely on <code class="varname">INSTALL_GAME</code> and
8997 <code class="varname">INSTALL_GAME_DATA</code> to set these 8997 <code class="varname">INSTALL_GAME_DATA</code> to set these
8998 correctly.</p> 8998 correctly.</p>
8999</div> 8999</div>
9000<div class="sect2"> 9000<div class="sect2">
9001<div class="titlepage"><div><div><h3 class="title"> 9001<div class="titlepage"><div><div><h3 class="title">
9002<a name="destdir-support"></a>19.6.4. Adding DESTDIR support to packages</h3></div></div></div> 9002<a name="destdir-support"></a>19.6.4. Adding DESTDIR support to packages</h3></div></div></div>
9003<p><code class="varname">DESTDIR</code> support means that a package 9003<p><code class="varname">DESTDIR</code> support means that a package
9004 installs into a staging directory, not the final location of the 9004 installs into a staging directory, not the final location of the
9005 files. Then a binary package is created which can be used for 9005 files. Then a binary package is created which can be used for
9006 installation as usual. There are two ways: Either the package must 9006 installation as usual. There are two ways: Either the package must
9007 install as root (<span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span>) or the package can 9007 install as root (<span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span>) or the package can
9008 install as non-root user (<span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>).</p> 9008 install as non-root user (<span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>).</p>
9009<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9009<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9010<li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be 9010<li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be
9011 set to <span class="quote">&#8220;<span class="quote">none</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span>, or 9011 set to <span class="quote">&#8220;<span class="quote">none</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span>, or
9012 <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>. By default <code class="varname">PKG_DESTDIR_SUPPORT</code> 9012 <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>. By default <code class="varname">PKG_DESTDIR_SUPPORT</code>
9013 is set to <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span> to help catching more 9013 is set to <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span> to help catching more
9014 potential packaging problems. If bsd.prefs.mk is included in the Makefile, 9014 potential packaging problems. If bsd.prefs.mk is included in the Makefile,
9015 <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before 9015 <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before
9016 the inclusion.</p></li> 9016 the inclusion.</p></li>
9017<li class="listitem"><p>All installation operations have to be prefixed with 9017<li class="listitem"><p>All installation operations have to be prefixed with
9018 <code class="filename">${DESTDIR}</code>.</p></li> 9018 <code class="filename">${DESTDIR}</code>.</p></li>
9019<li class="listitem"><p>automake gets this DESTDIR mostly right 9019<li class="listitem"><p>automake gets this DESTDIR mostly right
9020 automatically. Many manual rules and pre/post-install often are 9020 automatically. Many manual rules and pre/post-install often are
9021 incorrect; fix them.</p></li> 9021 incorrect; fix them.</p></li>
9022<li class="listitem"><p>If files are installed with special owner/group 9022<li class="listitem"><p>If files are installed with special owner/group
9023 use <code class="varname">SPECIAL_PERMS</code>.</p></li> 9023 use <code class="varname">SPECIAL_PERMS</code>.</p></li>
9024<li class="listitem"><p>In general, packages should support 9024<li class="listitem"><p>In general, packages should support
9025 <code class="varname">UNPRIVILEGED</code> to be able to use 9025 <code class="varname">UNPRIVILEGED</code> to be able to use
9026 DESTDIR.</p></li> 9026 DESTDIR.</p></li>
9027</ul></div> 9027</ul></div>
9028</div> 9028</div>
9029<div class="sect2"> 9029<div class="sect2">
9030<div class="titlepage"><div><div><h3 class="title"> 9030<div class="titlepage"><div><div><h3 class="title">
9031<a name="hardcoded-paths"></a>19.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div> 9031<a name="hardcoded-paths"></a>19.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div>
9032<p>Your package may also contain scripts with hardcoded paths to 9032<p>Your package may also contain scripts with hardcoded paths to
9033 other interpreters besides (or as well as) perl. To correct the 9033 other interpreters besides (or as well as) perl. To correct the
9034 full pathname to the script interpreter, you need to set the 9034 full pathname to the script interpreter, you need to set the
9035 following definitions in your <code class="filename">Makefile</code> (we 9035 following definitions in your <code class="filename">Makefile</code> (we
9036 shall use <span class="command"><strong>tclsh</strong></span> in this example):</p> 9036 shall use <span class="command"><strong>tclsh</strong></span> in this example):</p>
9037<pre class="programlisting"> 9037<pre class="programlisting">
9038REPLACE_INTERPRETER+= tcl 9038REPLACE_INTERPRETER+= tcl
9039REPLACE.tcl.old= .*/bin/tclsh 9039REPLACE.tcl.old= .*/bin/tclsh
9040REPLACE.tcl.new= ${PREFIX}/bin/tclsh 9040REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9041REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, 9041REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
9042# relative to ${WRKSRC}, just as in REPLACE_PERL 9042# relative to ${WRKSRC}, just as in REPLACE_PERL
9043 </pre> 9043 </pre>
9044<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 9044<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
9045<h3 class="title">Note</h3> 9045<h3 class="title">Note</h3>
9046<p>Before March 2006, these variables were called 9046<p>Before March 2006, these variables were called
9047 <code class="varname">_REPLACE.*</code> and 9047 <code class="varname">_REPLACE.*</code> and
9048 <code class="varname">_REPLACE_FILES.*</code>.</p> 9048 <code class="varname">_REPLACE_FILES.*</code>.</p>
9049</div> 9049</div>
9050</div> 9050</div>
9051<div class="sect2"> 9051<div class="sect2">
9052<div class="titlepage"><div><div><h3 class="title"> 9052<div class="titlepage"><div><div><h3 class="title">
9053<a name="perl-modules"></a>19.6.6. Packages installing perl modules</h3></div></div></div> 9053<a name="perl-modules"></a>19.6.6. Packages installing perl modules</h3></div></div></div>
9054<p>Makefiles of packages providing perl5 modules should include 9054<p>Makefiles of packages providing perl5 modules should include
9055 the Makefile fragment 9055 the Makefile fragment
9056 <code class="filename">../../lang/perl5/module.mk</code>. It provides a 9056 <code class="filename">../../lang/perl5/module.mk</code>. It provides a
9057 <span class="command"><strong>do-configure</strong></span> target for the standard perl 9057 <span class="command"><strong>do-configure</strong></span> target for the standard perl
9058 configuration for such modules as well as various hooks to tune 9058 configuration for such modules as well as various hooks to tune
9059 this configuration. See comments in this file for 9059 this configuration. See comments in this file for
9060 details.</p> 9060 details.</p>
9061<p>Perl5 modules will install into different places depending 9061<p>Perl5 modules will install into different places depending
9062 on the version of perl used during the build process. To 9062 on the version of perl used during the build process. To
9063 address this, pkgsrc will append lines to the 9063 address this, pkgsrc will append lines to the
9064 <code class="filename">PLIST</code> corresponding to the files listed in 9064 <code class="filename">PLIST</code> corresponding to the files listed in
9065 the installed <code class="filename">.packlist</code> file generated by 9065 the installed <code class="filename">.packlist</code> file generated by
9066 most perl5 modules. This is invoked by defining 9066 most perl5 modules. This is invoked by defining
9067 <code class="varname">PERL5_PACKLIST</code> to a space-separated list of 9067 <code class="varname">PERL5_PACKLIST</code> to a space-separated list of
9068 packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code> 9068 packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code>
9069 (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default), 9069 (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default),
9070 e.g.:</p> 9070 e.g.:</p>
9071<pre class="programlisting"> 9071<pre class="programlisting">
9072PERL5_PACKLIST= auto/Pg/.packlist 9072PERL5_PACKLIST= auto/Pg/.packlist
9073 </pre> 9073 </pre>
9074<p>The perl5 config variables 9074<p>The perl5 config variables
9075 <code class="varname">installarchlib</code>, 9075 <code class="varname">installarchlib</code>,
9076 <code class="varname">installscript</code>, 9076 <code class="varname">installscript</code>,
9077 <code class="varname">installvendorbin</code>, 9077 <code class="varname">installvendorbin</code>,
9078 <code class="varname">installvendorscript</code>, 9078 <code class="varname">installvendorscript</code>,
9079 <code class="varname">installvendorarch</code>, 9079 <code class="varname">installvendorarch</code>,
9080 <code class="varname">installvendorlib</code>, 9080 <code class="varname">installvendorlib</code>,
9081 <code class="varname">installvendorman1dir</code>, and 9081 <code class="varname">installvendorman1dir</code>, and
9082 <code class="varname">installvendorman3dir</code> represent those 9082 <code class="varname">installvendorman3dir</code> represent those
9083 locations in which components of perl5 modules may be installed, 9083 locations in which components of perl5 modules may be installed,
9084 provided as variable with uppercase and prefixed with 9084 provided as variable with uppercase and prefixed with
9085 <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code> 9085 <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code>
9086 and may be used by perl5 packages that don't have a packlist. 9086 and may be used by perl5 packages that don't have a packlist.
9087 These variables are also substituted for in the 9087 These variables are also substituted for in the
9088 <code class="filename">PLIST</code> as uppercase prefixed with 9088 <code class="filename">PLIST</code> as uppercase prefixed with
9089 <code class="varname">PERL5_SUB_</code>.</p> 9089 <code class="varname">PERL5_SUB_</code>.</p>
9090</div> 9090</div>
9091<div class="sect2"> 9091<div class="sect2">
9092<div class="titlepage"><div><div><h3 class="title"> 9092<div class="titlepage"><div><div><h3 class="title">
9093<a name="faq.info-files"></a>19.6.7. Packages installing info files</h3></div></div></div> 9093<a name="faq.info-files"></a>19.6.7. Packages installing info files</h3></div></div></div>
9094<p>Some packages install info files or use the 9094<p>Some packages install info files or use the
9095 <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span> 9095 <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span>
9096 commands. <code class="varname">INFO_FILES</code> should be defined in 9096 commands. <code class="varname">INFO_FILES</code> should be defined in
9097 the package Makefile so that <code class="filename">INSTALL</code> and 9097 the package Makefile so that <code class="filename">INSTALL</code> and
9098 <code class="filename">DEINSTALL</code> scripts will be generated to 9098 <code class="filename">DEINSTALL</code> scripts will be generated to
9099 handle registration of the info files in the Info directory 9099 handle registration of the info files in the Info directory
9100 file. The <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span> command used for the info 9100 file. The <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span> command used for the info
9101 files registration is either provided by the system, or by a 9101 files registration is either provided by the system, or by a
9102 special purpose package automatically added as dependency if 9102 special purpose package automatically added as dependency if
9103 needed.</p> 9103 needed.</p>
9104<p><code class="varname">PKGINFODIR</code> is the directory under 9104<p><code class="varname">PKGINFODIR</code> is the directory under
9105 <code class="filename">${PREFIX}</code> where info files are primarily 9105 <code class="filename">${PREFIX}</code> where info files are primarily
9106 located. <code class="varname">PKGINFODIR</code> defaults to 9106 located. <code class="varname">PKGINFODIR</code> defaults to
9107 <span class="quote">&#8220;<span class="quote">info</span>&#8221;</span> and can be overridden by the user.</p> 9107 <span class="quote">&#8220;<span class="quote">info</span>&#8221;</span> and can be overridden by the user.</p>
9108<p>The info files for the package should be listed in the 9108<p>The info files for the package should be listed in the
9109 package <code class="filename">PLIST</code>; however any split info files 9109 package <code class="filename">PLIST</code>; however any split info files
9110 need not be listed.</p> 9110 need not be listed.</p>
9111<p>A package which needs the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command 9111<p>A package which needs the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command
9112 at build time must add <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> to 9112 at build time must add <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> to
9113 <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum 9113 <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum
9114 version of the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command is needed it 9114 version of the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command is needed it
9115 should be noted with the <code class="varname">TEXINFO_REQD</code> 9115 should be noted with the <code class="varname">TEXINFO_REQD</code>
9116 variable in the package <code class="filename">Makefile</code>. By 9116 variable in the package <code class="filename">Makefile</code>. By
9117 default, a minimum version of 3.12 is required. If the system 9117 default, a minimum version of 3.12 is required. If the system
9118 does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it 9118 does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it
9119 does not match the required minimum, a build dependency on the 9119 does not match the required minimum, a build dependency on the
9120 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/gtexinfo/README.html" target="_top"><code class="filename">devel/gtexinfo</code></a> package will 9120 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/gtexinfo/README.html" target="_top"><code class="filename">devel/gtexinfo</code></a> package will
9121 be added automatically.</p> 9121 be added automatically.</p>
9122<p>The build and installation process of the software provided 9122<p>The build and installation process of the software provided
9123 by the package should not use the 9123 by the package should not use the
9124 <span class="command"><strong>install-info</strong></span> command as the registration of 9124 <span class="command"><strong>install-info</strong></span> command as the registration of
9125 info files is the task of the package 9125 info files is the task of the package
9126 <code class="filename">INSTALL</code> script, and it must use the 9126 <code class="filename">INSTALL</code> script, and it must use the
9127 appropriate <span class="command"><strong>makeinfo</strong></span> command.</p> 9127 appropriate <span class="command"><strong>makeinfo</strong></span> command.</p>
9128<p>To achieve this goal, the pkgsrc infrastructure creates 9128<p>To achieve this goal, the pkgsrc infrastructure creates
9129 overriding scripts for the <span class="command"><strong>install-info</strong></span> and 9129 overriding scripts for the <span class="command"><strong>install-info</strong></span> and
9130 <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early 9130 <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early
9131 in <code class="varname">PATH</code>.</p> 9131 in <code class="varname">PATH</code>.</p>
9132<p>The script overriding <span class="command"><strong>install-info</strong></span> has 9132<p>The script overriding <span class="command"><strong>install-info</strong></span> has
9133 no effect except the logging of a message. The script overriding 9133 no effect except the logging of a message. The script overriding
9134 <span class="command"><strong>makeinfo</strong></span> logs a message and according to the 9134 <span class="command"><strong>makeinfo</strong></span> logs a message and according to the
9135 value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate 9135 value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate
9136 <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p> 9136 <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p>
9137</div> 9137</div>
9138<div class="sect2"> 9138<div class="sect2">
9139<div class="titlepage"><div><div><h3 class="title"> 9139<div class="titlepage"><div><div><h3 class="title">
9140<a name="manpages"></a>19.6.8. Packages installing man pages</h3></div></div></div> 9140<a name="manpages"></a>19.6.8. Packages installing man pages</h3></div></div></div>
9141<p>All packages that install manual pages should install them 9141<p>All packages that install manual pages should install them
9142 into the same directory, so that there is one common place to look 9142 into the same directory, so that there is one common place to look
9143 for them. In pkgsrc, this place is 9143 for them. In pkgsrc, this place is
9144 <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression 9144 <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression
9145 should be used in packages. The default for 9145 should be used in packages. The default for
9146 <code class="varname">PKGMANDIR</code> is 9146 <code class="varname">PKGMANDIR</code> is
9147 <span class="quote">&#8220;<span class="quote"><code class="filename">man</code></span>&#8221;</span>. Another often-used value 9147 <span class="quote">&#8220;<span class="quote"><code class="filename">man</code></span>&#8221;</span>. Another often-used value
9148 is <span class="quote">&#8220;<span class="quote"><code class="filename">share/man</code></span>&#8221;</span>.</p> 9148 is <span class="quote">&#8220;<span class="quote"><code class="filename">share/man</code></span>&#8221;</span>.</p>
9149<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 9149<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
9150<h3 class="title">Note</h3> 9150<h3 class="title">Note</h3>
9151<p>The support for a custom <code class="varname">PKGMANDIR</code> 9151<p>The support for a custom <code class="varname">PKGMANDIR</code>
9152 is far from complete.</p> 9152 is far from complete.</p>
9153</div> 9153</div>
9154<p>The <code class="filename">PLIST</code> files can just use 9154<p>The <code class="filename">PLIST</code> files can just use
9155 <code class="filename">man/</code> as the top level directory for the man 9155 <code class="filename">man/</code> as the top level directory for the man
9156 page file entries, and the pkgsrc framework will convert as 9156 page file entries, and the pkgsrc framework will convert as
9157 needed. In all other places, the correct 9157 needed. In all other places, the correct
9158 <code class="varname">PKGMANDIR</code> must be used.</p> 9158 <code class="varname">PKGMANDIR</code> must be used.</p>
9159<p>Packages that are 9159<p>Packages that are
9160 configured with <code class="varname">GNU_CONFIGURE</code> set as 9160 configured with <code class="varname">GNU_CONFIGURE</code> set as
9161 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, by default will use the 9161 <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, by default will use the
9162 <code class="filename">./configure</code> 9162 <code class="filename">./configure</code>
9163 --mandir switch to set where the man pages should be installed. 9163 --mandir switch to set where the man pages should be installed.
9164 The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults 9164 The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults
9165 to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p> 9165 to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p>
9166<p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not 9166<p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not
9167 use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code> 9167 use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code>
9168 to <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>. 9168 to <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>.
9169 Or if the <code class="filename">./configure</code> script uses 9169 Or if the <code class="filename">./configure</code> script uses
9170 a non-standard use of --mandir, you can set 9170 a non-standard use of --mandir, you can set
9171 <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p> 9171 <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
9172<p>See <a class="xref" href="#manpage-compression" title="13.5. Man page compression">Section 13.5, &#8220;Man page compression&#8221;</a> for 9172<p>See <a class="xref" href="#manpage-compression" title="13.5. Man page compression">Section 13.5, &#8220;Man page compression&#8221;</a> for
9173 information on installation of compressed manual pages.</p> 9173 information on installation of compressed manual pages.</p>
9174</div> 9174</div>
9175<div class="sect2"> 9175<div class="sect2">
9176<div class="titlepage"><div><div><h3 class="title"> 9176<div class="titlepage"><div><div><h3 class="title">
9177<a name="gconf-data-files"></a>19.6.9. Packages installing GConf data files</h3></div></div></div> 9177<a name="gconf-data-files"></a>19.6.9. Packages installing GConf data files</h3></div></div></div>
9178<p>If a package installs <code class="filename">.schemas</code> or 9178<p>If a package installs <code class="filename">.schemas</code> or
9179 <code class="filename">.entries</code> files, used by GConf, 9179 <code class="filename">.entries</code> files, used by GConf,
9180 you need to take some extra steps to make sure they get registered 9180 you need to take some extra steps to make sure they get registered
9181 in the database:</p> 9181 in the database:</p>
9182<div class="orderedlist"><ol class="orderedlist" type="1"> 9182<div class="orderedlist"><ol class="orderedlist" type="1">
9183<li class="listitem"><p>Include <code class="filename">../../devel/GConf/schemas.mk</code> 9183<li class="listitem"><p>Include <code class="filename">../../devel/GConf/schemas.mk</code>
9184 instead of its <code class="filename">buildlink3.mk</code> file. This 9184 instead of its <code class="filename">buildlink3.mk</code> file. This
9185 takes care of rebuilding the GConf database at installation and 9185 takes care of rebuilding the GConf database at installation and
9186 deinstallation time, and tells the package where to install 9186 deinstallation time, and tells the package where to install
9187 GConf data files using some standard configure arguments. It 9187 GConf data files using some standard configure arguments. It
9188 also disallows any access to the database directly from the 9188 also disallows any access to the database directly from the
9189 package.</p></li> 9189 package.</p></li>
9190<li class="listitem"><p>Ensure that the package installs its 9190<li class="listitem"><p>Ensure that the package installs its
9191 <code class="filename">.schemas</code> files under 9191 <code class="filename">.schemas</code> files under
9192 <code class="filename">${PREFIX}/share/gconf/schemas</code>. If they get 9192 <code class="filename">${PREFIX}/share/gconf/schemas</code>. If they get
9193 installed under <code class="filename">${PREFIX}/etc</code>, you will 9193 installed under <code class="filename">${PREFIX}/etc</code>, you will
9194 need to manually patch the package.</p></li> 9194 need to manually patch the package.</p></li>
9195<li class="listitem"><p>Check the PLIST and remove any entries under the etc/gconf 9195<li class="listitem"><p>Check the PLIST and remove any entries under the etc/gconf
9196 directory, as they will be handled automatically. See 9196 directory, as they will be handled automatically. See
9197 <a class="xref" href="#faq.conf" title="9.13. How do I change the location of configuration files?">Section 9.13, &#8220;How do I change the location of configuration files?&#8221;</a> for more information.</p></li> 9197 <a class="xref" href="#faq.conf" title="9.13. How do I change the location of configuration files?">Section 9.13, &#8220;How do I change the location of configuration files?&#8221;</a> for more information.</p></li>
9198<li class="listitem"><p>Define the <code class="varname">GCONF_SCHEMAS</code> variable in 9198<li class="listitem"><p>Define the <code class="varname">GCONF_SCHEMAS</code> variable in
9199 your <code class="filename">Makefile</code> with a list of all 9199 your <code class="filename">Makefile</code> with a list of all
9200 <code class="filename">.schemas</code> files installed by the package, if 9200 <code class="filename">.schemas</code> files installed by the package, if
9201 any. Names must not contain any directories in them.</p></li> 9201 any. Names must not contain any directories in them.</p></li>
9202<li class="listitem"><p>Define the <code class="varname">GCONF_ENTRIES</code> variable in 9202<li class="listitem"><p>Define the <code class="varname">GCONF_ENTRIES</code> variable in
9203 your <code class="filename">Makefile</code> with a 9203 your <code class="filename">Makefile</code> with a
9204 list of all <code class="filename">.entries</code> files installed by the 9204 list of all <code class="filename">.entries</code> files installed by the
9205 package, if any. Names must not contain any directories in 9205 package, if any. Names must not contain any directories in
9206 them.</p></li> 9206 them.</p></li>
9207</ol></div> 9207</ol></div>
9208</div> 9208</div>
9209<div class="sect2"> 9209<div class="sect2">
9210<div class="titlepage"><div><div><h3 class="title"> 9210<div class="titlepage"><div><div><h3 class="title">
9211<a name="scrollkeeper-data-files"></a>19.6.10. Packages installing scrollkeeper/rarian data files</h3></div></div></div> 9211<a name="scrollkeeper-data-files"></a>19.6.10. Packages installing scrollkeeper/rarian data files</h3></div></div></div>
9212<p>If a package installs <code class="filename">.omf</code> files, used by 9212<p>If a package installs <code class="filename">.omf</code> files, used by
9213 scrollkeeper/rarian, you need to take some extra steps to make sure they 9213 scrollkeeper/rarian, you need to take some extra steps to make sure they
9214 get registered in the database:</p> 9214 get registered in the database:</p>
9215<div class="orderedlist"><ol class="orderedlist" type="1"> 9215<div class="orderedlist"><ol class="orderedlist" type="1">
9216<li class="listitem"><p>Include 9216<li class="listitem"><p>Include
9217 <code class="filename">../../mk/omf-scrollkeeper.mk</code> 9217 <code class="filename">../../mk/omf-scrollkeeper.mk</code>
9218 instead of rarian's <code class="filename">buildlink3.mk</code> file. This 9218 instead of rarian's <code class="filename">buildlink3.mk</code> file. This
9219 takes care of rebuilding the scrollkeeper database at 9219 takes care of rebuilding the scrollkeeper database at
9220 installation and deinstallation time, and disallows any access 9220 installation and deinstallation time, and disallows any access
9221 to it directly from the package.</p></li> 9221 to it directly from the package.</p></li>
9222<li class="listitem"><p>Check the PLIST and remove any entries under the 9222<li class="listitem"><p>Check the PLIST and remove any entries under the
9223 <code class="filename">libdata/scrollkeeper</code> directory, as they 9223 <code class="filename">libdata/scrollkeeper</code> directory, as they
9224 will be handled automatically.</p></li> 9224 will be handled automatically.</p></li>
9225<li class="listitem"><p>Remove the <code class="filename">share/omf</code> directory from 9225<li class="listitem"><p>Remove the <code class="filename">share/omf</code> directory from
9226 the PLIST. It will be handled by rarian. (<span class="command"><strong>make 9226 the PLIST. It will be handled by rarian. (<span class="command"><strong>make
9227 print-PLIST</strong></span> does this automatically.)</p></li> 9227 print-PLIST</strong></span> does this automatically.)</p></li>
9228</ol></div> 9228</ol></div>
9229</div> 9229</div>
9230<div class="sect2"> 9230<div class="sect2">
9231<div class="titlepage"><div><div><h3 class="title"> 9231<div class="titlepage"><div><div><h3 class="title">
9232<a name="x11-fonts"></a>19.6.11. Packages installing X11 fonts</h3></div></div></div> 9232<a name="x11-fonts"></a>19.6.11. Packages installing X11 fonts</h3></div></div></div>
9233<p>If a package installs font files, you will need to rebuild 9233<p>If a package installs font files, you will need to rebuild
9234 the fonts database in the directory where they get installed at 9234 the fonts database in the directory where they get installed at
9235 installation and deinstallation time. This can be automatically 9235 installation and deinstallation time. This can be automatically
9236 done by using the pkginstall framework.</p> 9236 done by using the pkginstall framework.</p>
9237<p>You can list the directories where fonts are installed in the 9237<p>You can list the directories where fonts are installed in the
9238 <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> 9238 <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code>
9239 variables, where <em class="replaceable"><code>type</code></em> can be one of 9239 variables, where <em class="replaceable"><code>type</code></em> can be one of
9240 <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">type1</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">x11</span>&#8221;</span>. 9240 <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">type1</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">x11</span>&#8221;</span>.
9241 Also make sure that the database file 9241 Also make sure that the database file
9242 <code class="filename">fonts.dir</code> is not listed in the PLIST.</p> 9242 <code class="filename">fonts.dir</code> is not listed in the PLIST.</p>
9243<p>Note that you should not create new directories for fonts; 9243<p>Note that you should not create new directories for fonts;
9244 instead use the standard ones to avoid that the user needs to 9244 instead use the standard ones to avoid that the user needs to
9245 manually configure his X server to find them.</p> 9245 manually configure his X server to find them.</p>
9246</div> 9246</div>
9247<div class="sect2"> 9247<div class="sect2">
9248<div class="titlepage"><div><div><h3 class="title"> 9248<div class="titlepage"><div><div><h3 class="title">
9249<a name="gtk2-modules"></a>19.6.12. Packages installing GTK2 modules</h3></div></div></div> 9249<a name="gtk2-modules"></a>19.6.12. Packages installing GTK2 modules</h3></div></div></div>
9250<p>If a package installs GTK2 immodules or loaders, you need to 9250<p>If a package installs GTK2 immodules or loaders, you need to
9251 take some extra steps to get them registered in the GTK2 database 9251 take some extra steps to get them registered in the GTK2 database
9252 properly:</p> 9252 properly:</p>
9253<div class="orderedlist"><ol class="orderedlist" type="1"> 9253<div class="orderedlist"><ol class="orderedlist" type="1">
9254<li class="listitem"><p>Include 9254<li class="listitem"><p>Include
9255 <code class="filename">../../x11/gtk2/modules.mk</code> instead of its 9255 <code class="filename">../../x11/gtk2/modules.mk</code> instead of its
9256 <code class="filename">buildlink3.mk</code> file. This takes care of 9256 <code class="filename">buildlink3.mk</code> file. This takes care of
9257 rebuilding the database at installation and deinstallation time.</p></li> 9257 rebuilding the database at installation and deinstallation time.</p></li>
9258<li class="listitem"><p>Set <code class="varname">GTK2_IMMODULES=YES</code> if 9258<li class="listitem"><p>Set <code class="varname">GTK2_IMMODULES=YES</code> if
9259 your package installs GTK2 immodules.</p></li> 9259 your package installs GTK2 immodules.</p></li>
9260<li class="listitem"><p>Set <code class="varname">GTK2_LOADERS=YES</code> if your package installs 9260<li class="listitem"><p>Set <code class="varname">GTK2_LOADERS=YES</code> if your package installs
9261 GTK2 loaders.</p></li> 9261 GTK2 loaders.</p></li>
9262<li class="listitem"> 9262<li class="listitem">
9263<p>Patch the package to not touch any of the GTK2 9263<p>Patch the package to not touch any of the GTK2
9264 databases directly. These are:</p> 9264 databases directly. These are:</p>
9265<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9265<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9266<li class="listitem"><p><code class="filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p></li> 9266<li class="listitem"><p><code class="filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p></li>
9267<li class="listitem"><p><code class="filename">libdata/gtk-2.0/gtk.immodules</code></p></li> 9267<li class="listitem"><p><code class="filename">libdata/gtk-2.0/gtk.immodules</code></p></li>
9268</ul></div> 9268</ul></div>
9269</li> 9269</li>
9270<li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove 9270<li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove
9271 any entries under the <code class="filename">libdata/gtk-2.0</code> 9271 any entries under the <code class="filename">libdata/gtk-2.0</code>
9272 directory, as they will be handled automatically.</p></li> 9272 directory, as they will be handled automatically.</p></li>
9273</ol></div> 9273</ol></div>
9274</div> 9274</div>
9275<div class="sect2"> 9275<div class="sect2">
9276<div class="titlepage"><div><div><h3 class="title"> 9276<div class="titlepage"><div><div><h3 class="title">
9277<a name="sgml-xml-data"></a>19.6.13. Packages installing SGML or XML data</h3></div></div></div> 9277<a name="sgml-xml-data"></a>19.6.13. Packages installing SGML or XML data</h3></div></div></div>
9278<p>If a package installs SGML or XML data files that need to be 9278<p>If a package installs SGML or XML data files that need to be
9279 registered in system-wide catalogs (like DTDs, sub-catalogs, 9279 registered in system-wide catalogs (like DTDs, sub-catalogs,
9280 etc.), you need to take some extra steps:</p> 9280 etc.), you need to take some extra steps:</p>
9281<div class="orderedlist"><ol class="orderedlist" type="1"> 9281<div class="orderedlist"><ol class="orderedlist" type="1">
9282<li class="listitem"><p>Include 9282<li class="listitem"><p>Include
9283 <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in 9283 <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in
9284 your <code class="filename">Makefile</code>, which takes care of 9284 your <code class="filename">Makefile</code>, which takes care of
9285 registering those files in system-wide catalogs at 9285 registering those files in system-wide catalogs at
9286 installation and deinstallation time.</p></li> 9286 installation and deinstallation time.</p></li>
9287<li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of 9287<li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of
9288 any SGML catalogs installed by the package.</p></li> 9288 any SGML catalogs installed by the package.</p></li>
9289<li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of 9289<li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of
9290 any XML catalogs installed by the package.</p></li> 9290 any XML catalogs installed by the package.</p></li>
9291<li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries 9291<li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries
9292 to be added to the SGML catalog. These come in groups of 9292 to be added to the SGML catalog. These come in groups of
9293 three strings; see xmlcatmgr(1) for more information 9293 three strings; see xmlcatmgr(1) for more information
9294 (specifically, arguments recognized by the 'add' action). 9294 (specifically, arguments recognized by the 'add' action).
9295 Note that you will normally not use this variable.</p></li> 9295 Note that you will normally not use this variable.</p></li>
9296<li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries 9296<li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries
9297 to be added to the XML catalog. These come in groups of three 9297 to be added to the XML catalog. These come in groups of three
9298 strings; see xmlcatmgr(1) for more information (specifically, 9298 strings; see xmlcatmgr(1) for more information (specifically,
9299 arguments recognized by the 'add' action). Note that you will 9299 arguments recognized by the 'add' action). Note that you will
9300 normally not use this variable.</p></li> 9300 normally not use this variable.</p></li>
9301</ol></div> 9301</ol></div>
9302</div> 9302</div>
9303<div class="sect2"> 9303<div class="sect2">
9304<div class="titlepage"><div><div><h3 class="title"> 9304<div class="titlepage"><div><div><h3 class="title">
9305<a name="mime-database"></a>19.6.14. Packages installing extensions to the MIME database</h3></div></div></div> 9305<a name="mime-database"></a>19.6.14. Packages installing extensions to the MIME database</h3></div></div></div>
9306<p>If a package provides extensions to the MIME database by 9306<p>If a package provides extensions to the MIME database by
9307 installing <code class="filename">.xml</code> files inside 9307 installing <code class="filename">.xml</code> files inside
9308 <code class="filename">${PREFIX}/share/mime/packages</code>, you 9308 <code class="filename">${PREFIX}/share/mime/packages</code>, you
9309 need to take some extra steps to ensure that the database is kept 9309 need to take some extra steps to ensure that the database is kept
9310 consistent with respect to these new files:</p> 9310 consistent with respect to these new files:</p>
9311<div class="orderedlist"><ol class="orderedlist" type="1"> 9311<div class="orderedlist"><ol class="orderedlist" type="1">
9312<li class="listitem"><p>Include 9312<li class="listitem"><p>Include
9313 <code class="filename">../../databases/shared-mime-info/mimedb.mk</code> 9313 <code class="filename">../../databases/shared-mime-info/mimedb.mk</code>
9314 (avoid using the <code class="filename">buildlink3.mk</code> file from 9314 (avoid using the <code class="filename">buildlink3.mk</code> file from
9315 this same directory, which is reserved for inclusion from 9315 this same directory, which is reserved for inclusion from
9316 other <code class="filename">buildlink3.mk</code> files). It takes 9316 other <code class="filename">buildlink3.mk</code> files). It takes
9317 care of rebuilding the MIME database at installation and 9317 care of rebuilding the MIME database at installation and
9318 deinstallation time, and disallows any access to it directly 9318 deinstallation time, and disallows any access to it directly
9319 from the package.</p></li> 9319 from the package.</p></li>
9320<li class="listitem"><p>Check the PLIST and remove any entries under the 9320<li class="listitem"><p>Check the PLIST and remove any entries under the
9321 <code class="filename">share/mime</code> directory, 9321 <code class="filename">share/mime</code> directory,
9322 <span class="emphasis"><em>except</em></span> for files saved under 9322 <span class="emphasis"><em>except</em></span> for files saved under
9323 <code class="filename">share/mime/packages</code>. The former are 9323 <code class="filename">share/mime/packages</code>. The former are
9324 handled automatically by 9324 handled automatically by
9325 the update-mime-database program, but the latter are 9325 the update-mime-database program, but the latter are
9326 package-dependent and must be removed by the package that 9326 package-dependent and must be removed by the package that
9327 installed them in the first place.</p></li> 9327 installed them in the first place.</p></li>
9328<li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories 9328<li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories
9329 from the PLIST. They will be handled by the shared-mime-info 9329 from the PLIST. They will be handled by the shared-mime-info
9330 package.</p></li> 9330 package.</p></li>
9331</ol></div> 9331</ol></div>
9332</div> 9332</div>
9333<div class="sect2"> 9333<div class="sect2">
9334<div class="titlepage"><div><div><h3 class="title"> 9334<div class="titlepage"><div><div><h3 class="title">
9335<a name="intltool"></a>19.6.15. Packages using intltool</h3></div></div></div> 9335<a name="intltool"></a>19.6.15. Packages using intltool</h3></div></div></div>
9336<p>If a package uses intltool during its build, add 9336<p>If a package uses intltool during its build, add
9337 <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>, 9337 <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>,
9338 which forces it to use the intltool package provided by pkgsrc, 9338 which forces it to use the intltool package provided by pkgsrc,
9339 instead of the one bundled with the distribution file.</p> 9339 instead of the one bundled with the distribution file.</p>
9340<p>This tracks intltool's build-time dependencies and uses the 9340<p>This tracks intltool's build-time dependencies and uses the
9341 latest available version; this way, the package benefits of any 9341 latest available version; this way, the package benefits of any
9342 bug fixes that may have appeared since it was released.</p> 9342 bug fixes that may have appeared since it was released.</p>
9343</div> 9343</div>
9344<div class="sect2"> 9344<div class="sect2">
9345<div class="titlepage"><div><div><h3 class="title"> 9345<div class="titlepage"><div><div><h3 class="title">
9346<a name="startup-scripts"></a>19.6.16. Packages installing startup scripts</h3></div></div></div> 9346<a name="startup-scripts"></a>19.6.16. Packages installing startup scripts</h3></div></div></div>
9347<p>If a package contains a rc.d script, it won't be copied into 9347<p>If a package contains a rc.d script, it won't be copied into
9348 the startup directory by default, but you can enable it, by adding 9348 the startup directory by default, but you can enable it, by adding
9349 the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in 9349 the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in
9350 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts 9350 <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts
9351 into <code class="filename">/etc/rc.d</code> when a package is installed, and 9351 into <code class="filename">/etc/rc.d</code> when a package is installed, and
9352 it will automatically remove the scripts when the package is 9352 it will automatically remove the scripts when the package is
9353 deinstalled.</p> 9353 deinstalled.</p>
9354</div> 9354</div>
9355<div class="sect2"> 9355<div class="sect2">
9356<div class="titlepage"><div><div><h3 class="title"> 9356<div class="titlepage"><div><div><h3 class="title">
9357<a name="tex-packages"></a>19.6.17. Packages installing TeX modules</h3></div></div></div> 9357<a name="tex-packages"></a>19.6.17. Packages installing TeX modules</h3></div></div></div>
9358<p>If a package installs TeX packages into the texmf tree, 9358<p>If a package installs TeX packages into the texmf tree,
9359 the <code class="filename">ls-R</code> database of the tree needs to be 9359 the <code class="filename">ls-R</code> database of the tree needs to be
9360 updated.</p> 9360 updated.</p>
9361<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 9361<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
9362<h3 class="title">Note</h3> 9362<h3 class="title">Note</h3>
9363<p>Except the main TeX packages such as kpathsea, 9363<p>Except the main TeX packages such as kpathsea,
9364 packages should install files 9364 packages should install files
9365 into <code class="filename">${PREFIX}/share/texmf-dist</code>, 9365 into <code class="filename">${PREFIX}/share/texmf-dist</code>,
9366 not <code class="filename">${PREFIX}/share/texmf</code>.</p> 9366 not <code class="filename">${PREFIX}/share/texmf</code>.</p>
9367</div> 9367</div>
9368<div class="orderedlist"><ol class="orderedlist" type="1"> 9368<div class="orderedlist"><ol class="orderedlist" type="1">
9369<li class="listitem"><p>Include 9369<li class="listitem"><p>Include
9370 <code class="filename">../../print/kpathsea/texmf.mk</code>. This 9370 <code class="filename">../../print/kpathsea/texmf.mk</code>. This
9371 takes care of rebuilding the <code class="filename">ls-R</code> 9371 takes care of rebuilding the <code class="filename">ls-R</code>
9372 database at installation and deinstallation time.</p></li> 9372 database at installation and deinstallation time.</p></li>
9373<li class="listitem"> 9373<li class="listitem">
9374<p>If your package installs files into a texmf 9374<p>If your package installs files into a texmf
9375 tree other than the one 9375 tree other than the one
9376 at <code class="filename">${PREFIX}/share/texmf-dist</code>, 9376 at <code class="filename">${PREFIX}/share/texmf-dist</code>,
9377 set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf 9377 set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf
9378 trees that need database update.</p> 9378 trees that need database update.</p>
9379<p>If your package also installs font map files that need 9379<p>If your package also installs font map files that need
9380 to be registered using <span class="command"><strong>updmap</strong></span>, 9380 to be registered using <span class="command"><strong>updmap</strong></span>,
9381 include <code class="filename">../../print/tex-tetex/map.mk</code> and 9381 include <code class="filename">../../print/tex-tetex/map.mk</code> and
9382 set <code class="varname">TEX_MAP_FILES</code> and/or 9382 set <code class="varname">TEX_MAP_FILES</code> and/or
9383 <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all 9383 <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all
9384 such font map files. Then <span class="command"><strong>updmap</strong></span> will 9384 such font map files. Then <span class="command"><strong>updmap</strong></span> will
9385 be run automatically at installation/deinstallation to 9385 be run automatically at installation/deinstallation to
9386 enable/disable font map files for TeX output 9386 enable/disable font map files for TeX output
9387 drivers.</p> 9387 drivers.</p>
9388</li> 9388</li>
9389<li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code> 9389<li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code>
9390 databases are included in <code class="filename">PLIST</code>, as 9390 databases are included in <code class="filename">PLIST</code>, as
9391 they will be removed only by the kpathsea package.</p></li> 9391 they will be removed only by the kpathsea package.</p></li>
9392</ol></div> 9392</ol></div>
9393</div> 9393</div>
9394<div class="sect2"> 9394<div class="sect2">
9395<div class="titlepage"><div><div><h3 class="title"> 9395<div class="titlepage"><div><div><h3 class="title">
9396<a name="emulation-packages"></a>19.6.18. Packages supporting running binaries in 9396<a name="emulation-packages"></a>19.6.18. Packages supporting running binaries in
9397 emulation</h3></div></div></div> 9397 emulation</h3></div></div></div>
9398<p>There are some packages that provide libraries and 9398<p>There are some packages that provide libraries and
9399 executables for running binaries from a one operating system 9399 executables for running binaries from a one operating system
9400 on a different one (if the latter supports it). One example 9400 on a different one (if the latter supports it). One example
9401 is running Linux binaries on NetBSD.</p> 9401 is running Linux binaries on NetBSD.</p>
9402<p>The <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/rpm2pkg/README.html" target="_top"><code class="filename">pkgtools/rpm2pkg</code></a> 9402<p>The <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/rpm2pkg/README.html" target="_top"><code class="filename">pkgtools/rpm2pkg</code></a>
9403 helps in extracting and packaging Linux rpm packages.</p> 9403 helps in extracting and packaging Linux rpm packages.</p>
9404<p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to 9404<p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to
9405 avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests 9405 avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests
9406 if all libraries for each installed executable can be found by 9406 if all libraries for each installed executable can be found by
9407 the dynamic linker. Since the standard dynamic linker is run, 9407 the dynamic linker. Since the standard dynamic linker is run,
9408 this fails for emulation packages, because the libraries used 9408 this fails for emulation packages, because the libraries used
9409 by the emulation are not in the standard directories.</p> 9409 by the emulation are not in the standard directories.</p>
9410</div> 9410</div>
9411<div class="sect2"> 9411<div class="sect2">
9412<div class="titlepage"><div><div><h3 class="title"> 9412<div class="titlepage"><div><div><h3 class="title">
9413<a name="hicolor-theme"></a>19.6.19. Packages installing hicolor theme icons</h3></div></div></div> 9413<a name="hicolor-theme"></a>19.6.19. Packages installing hicolor theme icons</h3></div></div></div>
9414<p>If a package installs images under the 9414<p>If a package installs images under the
9415 <code class="filename">share/icons/hicolor</code> and/or updates the 9415 <code class="filename">share/icons/hicolor</code> and/or updates the
9416 <code class="filename">share/icons/hicolor/icon-theme.cache</code> 9416 <code class="filename">share/icons/hicolor/icon-theme.cache</code>
9417 database, you need to take some extra steps to make sure that the 9417 database, you need to take some extra steps to make sure that the
9418 shared theme directory is handled appropriately and that the cache 9418 shared theme directory is handled appropriately and that the cache
9419 database is rebuilt:</p> 9419 database is rebuilt:</p>
9420<div class="orderedlist"><ol class="orderedlist" type="1"> 9420<div class="orderedlist"><ol class="orderedlist" type="1">
9421<li class="listitem"><p>Include 9421<li class="listitem"><p>Include
9422 <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li> 9422 <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li>
9423<li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the 9423<li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the
9424 entry that refers to the theme cache.</p></li> 9424 entry that refers to the theme cache.</p></li>
9425<li class="listitem"><p>Ensure that the PLIST does not remove the shared icon 9425<li class="listitem"><p>Ensure that the PLIST does not remove the shared icon
9426 directories from the <code class="filename">share/icons/hicolor</code> 9426 directories from the <code class="filename">share/icons/hicolor</code>
9427 hierarchy because they will be handled automatically.</p></li> 9427 hierarchy because they will be handled automatically.</p></li>
9428</ol></div> 9428</ol></div>
9429<p>The best way to verify that the PLIST is correct with 9429<p>The best way to verify that the PLIST is correct with
9430 respect to the last two points is to regenerate it using 9430 respect to the last two points is to regenerate it using
9431 <span class="command"><strong>make print-PLIST</strong></span>.</p> 9431 <span class="command"><strong>make print-PLIST</strong></span>.</p>
9432</div> 9432</div>
9433<div class="sect2"> 9433<div class="sect2">
9434<div class="titlepage"><div><div><h3 class="title"> 9434<div class="titlepage"><div><div><h3 class="title">
9435<a name="desktop-files"></a>19.6.20. Packages installing desktop files</h3></div></div></div> 9435<a name="desktop-files"></a>19.6.20. Packages installing desktop files</h3></div></div></div>
9436<p>If a package installs <code class="filename">.desktop</code> files 9436<p>If a package installs <code class="filename">.desktop</code> files
9437 under <code class="filename">share/applications</code> and these include 9437 under <code class="filename">share/applications</code> and these include
9438 MIME information (MimeType key), you need to take extra steps to 9438 MIME information (MimeType key), you need to take extra steps to
9439 ensure that they are registered into the MIME database:</p> 9439 ensure that they are registered into the MIME database:</p>
9440<div class="orderedlist"><ol class="orderedlist" type="1"> 9440<div class="orderedlist"><ol class="orderedlist" type="1">
9441<li class="listitem"><p>Include 9441<li class="listitem"><p>Include
9442 <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li> 9442 <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li>
9443<li class="listitem"><p>Check the PLIST and remove the entry that refers to the 9443<li class="listitem"><p>Check the PLIST and remove the entry that refers to the
9444 <code class="filename">share/applications/mimeinfo.cache</code> file. 9444 <code class="filename">share/applications/mimeinfo.cache</code> file.
9445 It will be handled automatically.</p></li> 9445 It will be handled automatically.</p></li>
9446</ol></div> 9446</ol></div>
9447<p>The best way to verify that the PLIST is correct with 9447<p>The best way to verify that the PLIST is correct with
9448 respect to the last point is to regenerate it using <span class="command"><strong>make 9448 respect to the last point is to regenerate it using <span class="command"><strong>make
9449 print-PLIST</strong></span>.</p> 9449 print-PLIST</strong></span>.</p>
9450</div> 9450</div>
9451</div> 9451</div>
9452<div class="sect1"> 9452<div class="sect1">
9453<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9453<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9454<a name="punting"></a>19.7. Marking packages as having problems</h2></div></div></div> 9454<a name="punting"></a>19.7. Marking packages as having problems</h2></div></div></div>
9455<p>In some cases one does not have the time to solve a problem 9455<p>In some cases one does not have the time to solve a problem
9456 immediately. In this case, one can plainly mark a package as broken. For 9456 immediately. In this case, one can plainly mark a package as broken. For
9457 this, one just sets the variable <code class="varname">BROKEN</code> to the 9457 this, one just sets the variable <code class="varname">BROKEN</code> to the
9458 reason why the package is broken (similar to the 9458 reason why the package is broken (similar to the
9459 <code class="varname">RESTRICTED</code> variable). A user trying to build 9459 <code class="varname">RESTRICTED</code> variable). A user trying to build
9460 the package will immediately be shown this message, and the build 9460 the package will immediately be shown this message, and the build
9461 will not be even tried.</p> 9461 will not be even tried.</p>
9462<p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular 9462<p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular
9463 intervals.</p> 9463 intervals.</p>
9464</div> 9464</div>
9465</div> 9465</div>
9466<div class="chapter"> 9466<div class="chapter">
9467<div class="titlepage"><div><div><h2 class="title"> 9467<div class="titlepage"><div><div><h2 class="title">
9468<a name="debug"></a>Chapter 20. Debugging</h2></div></div></div> 9468<a name="debug"></a>Chapter 20. Debugging</h2></div></div></div>
9469<p>To check out all the gotchas when building a package, here are 9469<p>To check out all the gotchas when building a package, here are
9470 the steps that I do in order to get a package working. Please note 9470 the steps that I do in order to get a package working. Please note
9471 this is basically the same as what was explained in the previous 9471 this is basically the same as what was explained in the previous
9472 sections, only with some debugging aids.</p> 9472 sections, only with some debugging aids.</p>
9473<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9473<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9474<li class="listitem"><p>Be sure to set <code class="varname">PKG_DEVELOPER=yes</code> in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p></li> 9474<li class="listitem"><p>Be sure to set <code class="varname">PKG_DEVELOPER=yes</code> in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p></li>
9475<li class="listitem"> 9475<li class="listitem">
9476<p>Install <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>, 9476<p>Install <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>,
9477 create a directory for a new package, change into it, then run 9477 create a directory for a new package, change into it, then run
9478 <span class="command"><strong>url2pkg</strong></span>:</p> 9478 <span class="command"><strong>url2pkg</strong></span>:</p>
9479<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>mkdir /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong> 9479<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>mkdir /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong>
9480<code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong> 9480<code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>examplepkg</code></em></code></strong>
9481<code class="prompt">%</code> <strong class="userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong></pre> 9481<code class="prompt">%</code> <strong class="userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong></pre>
9482</li> 9482</li>
9483<li class="listitem"><p>Edit the <code class="filename">Makefile</code> as requested.</p></li> 9483<li class="listitem"><p>Edit the <code class="filename">Makefile</code> as requested.</p></li>
9484<li class="listitem"><p>Fill in the <code class="filename">DESCR</code> file</p></li> 9484<li class="listitem"><p>Fill in the <code class="filename">DESCR</code> file</p></li>
9485<li class="listitem"><p>Run <span class="command"><strong>make configure</strong></span></p></li> 9485<li class="listitem"><p>Run <span class="command"><strong>make configure</strong></span></p></li>
9486<li class="listitem"><p>Add any dependencies glimpsed from documentation and the 9486<li class="listitem"><p>Add any dependencies glimpsed from documentation and the
9487 configure step to the package's 9487 configure step to the package's
9488 <code class="filename">Makefile</code>.</p></li> 9488 <code class="filename">Makefile</code>.</p></li>
9489<li class="listitem"> 9489<li class="listitem">
9490<p>Make the package compile, doing multiple rounds of</p> 9490<p>Make the package compile, doing multiple rounds of</p>
9491<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make</code></strong> 9491<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
9492<code class="prompt">%</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong> 9492<code class="prompt">%</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
9493<code class="prompt">%</code> <strong class="userinput"><code>mkpatches</code></strong> 9493<code class="prompt">%</code> <strong class="userinput"><code>mkpatches</code></strong>
9494<code class="prompt">%</code> <strong class="userinput"><code>patchdiff</code></strong> 9494<code class="prompt">%</code> <strong class="userinput"><code>patchdiff</code></strong>
9495<code class="prompt">%</code> <strong class="userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong> 9495<code class="prompt">%</code> <strong class="userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
9496<code class="prompt">%</code> <strong class="userinput"><code>make mps</code></strong> 9496<code class="prompt">%</code> <strong class="userinput"><code>make mps</code></strong>
9497<code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong></pre> 9497<code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong></pre>
9498<p>Doing this step as non-root user will ensure that no files 9498<p>Doing this step as non-root user will ensure that no files
9499 are modified that shouldn't be, especially during the build 9499 are modified that shouldn't be, especially during the build
9500 phase. <span class="command"><strong>mkpatches</strong></span>, 9500 phase. <span class="command"><strong>mkpatches</strong></span>,
9501 <span class="command"><strong>patchdiff</strong></span> and <span class="command"><strong>pkgvi</strong></span> are 9501 <span class="command"><strong>patchdiff</strong></span> and <span class="command"><strong>pkgvi</strong></span> are
9502 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> 9502 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>
9503 package.</p> 9503 package.</p>
9504</li> 9504</li>
9505<li class="listitem"><p>Look at the <code class="filename">Makefile</code>, fix if 9505<li class="listitem"><p>Look at the <code class="filename">Makefile</code>, fix if
9506 necessary; see <a class="xref" href="#components.Makefile" title="11.1. Makefile">Section 11.1, &#8220;<code class="filename">Makefile</code>&#8221;</a>.</p></li> 9506 necessary; see <a class="xref" href="#components.Makefile" title="11.1. Makefile">Section 11.1, &#8220;<code class="filename">Makefile</code>&#8221;</a>.</p></li>
9507<li class="listitem"> 9507<li class="listitem">
9508<p>Generate a <code class="filename">PLIST</code>:</p> 9508<p>Generate a <code class="filename">PLIST</code>:</p>
9509<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong> 9509<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
9510<code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST &gt;PLIST</code></strong> 9510<code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST &gt;PLIST</code></strong>
9511<code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong> 9511<code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong>
9512<code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong> 9512<code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
9513<code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong></pre> 9513<code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong></pre>
9514<p>You usually need to be <code class="username">root</code> to do 9514<p>You usually need to be <code class="username">root</code> to do
9515 this. Look if there are any files left:</p> 9515 this. Look if there are any files left:</p>
9516<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre> 9516<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
9517<p>If this reveals any files that are missing in 9517<p>If this reveals any files that are missing in
9518 <code class="filename">PLIST</code>, add them.</p> 9518 <code class="filename">PLIST</code>, add them.</p>
9519</li> 9519</li>
9520<li class="listitem"> 9520<li class="listitem">
9521<p>Now that the <code class="filename">PLIST</code> is OK, install the 9521<p>Now that the <code class="filename">PLIST</code> is OK, install the
9522 package again and make a binary package:</p> 9522 package again and make a binary package:</p>
9523<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make reinstall</code></strong> 9523<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make reinstall</code></strong>
9524<code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong></pre> 9524<code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong></pre>
9525</li> 9525</li>
9526<li class="listitem"> 9526<li class="listitem">
9527<p>Delete the installed package:</p> 9527<p>Delete the installed package:</p>
9528<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_delete <em class="replaceable"><code>examplepkg</code></em></code></strong></pre> 9528<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_delete <em class="replaceable"><code>examplepkg</code></em></code></strong></pre>
9529</li> 9529</li>
9530<li class="listitem"> 9530<li class="listitem">
9531<p>Repeat the above <span class="command"><strong>make print-PLIST</strong></span> 9531<p>Repeat the above <span class="command"><strong>make print-PLIST</strong></span>
9532 command, which shouldn't find anything now:</p> 9532 command, which shouldn't find anything now:</p>
9533<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre> 9533<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
9534</li> 9534</li>
9535<li class="listitem"> 9535<li class="listitem">
9536<p>Reinstall the binary package:</p> 9536<p>Reinstall the binary package:</p>
9537<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add .../<em class="replaceable"><code>examplepkg</code></em>.tgz</code></strong></pre> 9537<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add .../<em class="replaceable"><code>examplepkg</code></em>.tgz</code></strong></pre>
9538</li> 9538</li>
9539<li class="listitem"><p>Play with it. Make sure everything works.</p></li> 9539<li class="listitem"><p>Play with it. Make sure everything works.</p></li>
9540<li class="listitem"> 9540<li class="listitem">
9541<p>Run <span class="command"><strong>pkglint</strong></span> from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>, and fix the problems it 9541<p>Run <span class="command"><strong>pkglint</strong></span> from <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>, and fix the problems it
9542 reports:</p> 9542 reports:</p>
9543<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre> 9543<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre>
9544</li> 9544</li>
9545<li class="listitem"><p>Submit (or commit, if you have cvs access); see <a class="xref" href="#submit" title="Chapter 21. Submitting and Committing">Chapter 21, <i>Submitting and Committing</i></a>.</p></li> 9545<li class="listitem"><p>Submit (or commit, if you have cvs access); see <a class="xref" href="#submit" title="Chapter 21. Submitting and Committing">Chapter 21, <i>Submitting and Committing</i></a>.</p></li>
9546</ul></div> 9546</ul></div>
9547</div> 9547</div>
9548<div class="chapter"> 9548<div class="chapter">
9549<div class="titlepage"><div><div><h2 class="title"> 9549<div class="titlepage"><div><div><h2 class="title">
9550<a name="submit"></a>Chapter 21. Submitting and Committing</h2></div></div></div> 9550<a name="submit"></a>Chapter 21. Submitting and Committing</h2></div></div></div>
9551<div class="toc"> 9551<div class="toc">
9552<p><b>Table of Contents</b></p> 9552<p><b>Table of Contents</b></p>
9553<dl> 9553<dl>
9554<dt><span class="sect1"><a href="#submitting-binary-packages">21.1. Submitting binary packages</a></span></dt> 9554<dt><span class="sect1"><a href="#submitting-binary-packages">21.1. Submitting binary packages</a></span></dt>
9555<dt><span class="sect1"><a href="#submitting-your-package">21.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt> 9555<dt><span class="sect1"><a href="#submitting-your-package">21.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
9556<dt><span class="sect1"><a href="#general-notes-for-changes">21.3. General notes when adding, updating, or removing packages</a></span></dt> 9556<dt><span class="sect1"><a href="#general-notes-for-changes">21.3. General notes when adding, updating, or removing packages</a></span></dt>
9557<dt><span class="sect1"><a href="#committing-importing">21.4. Committing: Adding a package to CVS</a></span></dt> 9557<dt><span class="sect1"><a href="#committing-importing">21.4. Committing: Adding a package to CVS</a></span></dt>
9558<dt><span class="sect1"><a href="#updating-package">21.5. Updating a package to a newer version</a></span></dt> 9558<dt><span class="sect1"><a href="#updating-package">21.5. Updating a package to a newer version</a></span></dt>
9559<dt><span class="sect1"><a href="#renaming-package">21.6. Renaming a package in pkgsrc</a></span></dt> 9559<dt><span class="sect1"><a href="#renaming-package">21.6. Renaming a package in pkgsrc</a></span></dt>
9560<dt><span class="sect1"><a href="#moving-package">21.7. Moving a package in pkgsrc</a></span></dt> 9560<dt><span class="sect1"><a href="#moving-package">21.7. Moving a package in pkgsrc</a></span></dt>
9561</dl> 9561</dl>
9562</div> 9562</div>
9563<div class="sect1"> 9563<div class="sect1">
9564<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9564<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9565<a name="submitting-binary-packages"></a>21.1. Submitting binary packages</h2></div></div></div> 9565<a name="submitting-binary-packages"></a>21.1. Submitting binary packages</h2></div></div></div>
9566<p>Our policy is that we accept binaries only from pkgsrc 9566<p>Our policy is that we accept binaries only from pkgsrc
9567 developers to guarantee that the packages don't contain any 9567 developers to guarantee that the packages don't contain any
9568 trojan horses etc. This is not to annoy anyone but rather to 9568 trojan horses etc. This is not to annoy anyone but rather to
9569 protect our users! You're still free to put up your home-made 9569 protect our users! You're still free to put up your home-made
9570 binary packages and tell the world where to get them. NetBSD 9570 binary packages and tell the world where to get them. NetBSD
9571 developers doing bulk builds and wanting to upload them please 9571 developers doing bulk builds and wanting to upload them please
9572 see <a class="xref" href="#bulk-upload" title="7.3.8. Uploading results of a bulk build">Section 7.3.8, &#8220;Uploading results of a bulk build&#8221;</a>.</p> 9572 see <a class="xref" href="#bulk-upload" title="7.3.8. Uploading results of a bulk build">Section 7.3.8, &#8220;Uploading results of a bulk build&#8221;</a>.</p>
9573</div> 9573</div>
9574<div class="sect1"> 9574<div class="sect1">
9575<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9575<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9576<a name="submitting-your-package"></a>21.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div> 9576<a name="submitting-your-package"></a>21.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div>
9577<p>First, check that your package is complete, compiles and 9577<p>First, check that your package is complete, compiles and
9578 runs well; see <a class="xref" href="#debug" title="Chapter 20. Debugging">Chapter 20, <i>Debugging</i></a> and the rest of this 9578 runs well; see <a class="xref" href="#debug" title="Chapter 20. Debugging">Chapter 20, <i>Debugging</i></a> and the rest of this
9579 document. Next, generate an uuencoded gzipped <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> 9579 document. Next, generate an uuencoded gzipped <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a>
9580 archive that contains all files that make up the package. 9580 archive that contains all files that make up the package.
9581 Finally, send this package to the pkgsrc bug tracking system, 9581 Finally, send this package to the pkgsrc bug tracking system,
9582 either with the <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> command, or if you don't have 9582 either with the <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> command, or if you don't have
9583 that, go to the web page 9583 that, go to the web page
9584 <a class="ulink" href="http://www.NetBSD.org/support/send-pr.html" target="_top">http://www.NetBSD.org/support/send-pr.html</a>, 9584 <a class="ulink" href="http://www.NetBSD.org/support/send-pr.html" target="_top">http://www.NetBSD.org/support/send-pr.html</a>,
9585 which contains some instructions and a link to a form where you 9585 which contains some instructions and a link to a form where you
9586 can submit packages. The 9586 can submit packages. The
9587 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/gtk-send-pr/README.html" target="_top"><code class="filename">sysutils/gtk-send-pr</code></a> package is 9587 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/gtk-send-pr/README.html" target="_top"><code class="filename">sysutils/gtk-send-pr</code></a> package is
9588 also available as a substitute for either of the above two tools. 9588 also available as a substitute for either of the above two tools.
9589 </p> 9589 </p>
9590<p>In the form of the problem report, the category should be 9590<p>In the form of the problem report, the category should be
9591 <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>, the synopsis should include the package name 9591 <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>, the synopsis should include the package name
9592 and version number, and the description field should contain a 9592 and version number, and the description field should contain a
9593 short description of your package (contents of the COMMENT 9593 short description of your package (contents of the COMMENT
9594 variable or DESCR file are OK). The uuencoded package data should 9594 variable or DESCR file are OK). The uuencoded package data should
9595 go into the <span class="quote">&#8220;<span class="quote">fix</span>&#8221;</span> field.</p> 9595 go into the <span class="quote">&#8220;<span class="quote">fix</span>&#8221;</span> field.</p>
9596<p>If you want to submit several packages, please send a 9596<p>If you want to submit several packages, please send a
9597 separate PR for each one, it's easier for us to track things 9597 separate PR for each one, it's easier for us to track things
9598 that way.</p> 9598 that way.</p>
9599<p>Alternatively, you can also import new packages into 9599<p>Alternatively, you can also import new packages into
9600 pkgsrc-wip (<span class="quote">&#8220;<span class="quote">pkgsrc work-in-progress</span>&#8221;</span>); see the 9600 pkgsrc-wip (<span class="quote">&#8220;<span class="quote">pkgsrc work-in-progress</span>&#8221;</span>); see the
9601 homepage at <a class="ulink" href="http://pkgsrc-wip.sourceforge.net/" target="_top">http://pkgsrc-wip.sourceforge.net/</a> 9601 homepage at <a class="ulink" href="http://pkgsrc-wip.sourceforge.net/" target="_top">http://pkgsrc-wip.sourceforge.net/</a>
9602 for details.</p> 9602 for details.</p>
9603</div> 9603</div>
9604<div class="sect1"> 9604<div class="sect1">
9605<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9605<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9606<a name="general-notes-for-changes"></a>21.3. General notes when adding, updating, or removing packages</h2></div></div></div> 9606<a name="general-notes-for-changes"></a>21.3. General notes when adding, updating, or removing packages</h2></div></div></div>
9607<p>Please note all package additions, updates, moves, and 9607<p>Please note all package additions, updates, moves, and
9608 removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very 9608 removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very
9609 important to keep this file up to date and conforming to the 9609 important to keep this file up to date and conforming to the
9610 existing format, because it will be used by scripts to 9610 existing format, because it will be used by scripts to
9611 automatically update pages on <a class="ulink" href="http://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other 9611 automatically update pages on <a class="ulink" href="http://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other
9612 sites. Additionally, check the 9612 sites. Additionally, check the
9613 <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry 9613 <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry
9614 for the package you updated or removed, in case it was mentioned 9614 for the package you updated or removed, in case it was mentioned
9615 there.</p> 9615 there.</p>
9616<p>When the <code class="varname">PKGREVISION</code> of a package is 9616<p>When the <code class="varname">PKGREVISION</code> of a package is
9617 bumped, the change should appear in 9617 bumped, the change should appear in
9618 <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security 9618 <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security
9619 related or otherwise relevant. Mass bumps that result from a 9619 related or otherwise relevant. Mass bumps that result from a
9620 dependency being updated should not be mentioned. In all other 9620 dependency being updated should not be mentioned. In all other
9621 cases it's the developer's decision.</p> 9621 cases it's the developer's decision.</p>
9622<p>There is a make target that helps in creating proper 9622<p>There is a make target that helps in creating proper
9623 <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries: <span class="command"><strong>make 9623 <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries: <span class="command"><strong>make
9624 changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code> 9624 changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code>
9625 and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general 9625 and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general
9626 usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> 9626 usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code>
9627 file is up-to-date (to avoid having to resolve conflicts later-on) 9627 file is up-to-date (to avoid having to resolve conflicts later-on)
9628 and then to <span class="command"><strong>cd</strong></span> to the package directory. For 9628 and then to <span class="command"><strong>cd</strong></span> to the package directory. For
9629 package updates, <span class="command"><strong>make changes-entry</strong></span> is enough. 9629 package updates, <span class="command"><strong>make changes-entry</strong></span> is enough.
9630 For new packages, or package moves or removals, set the 9630 For new packages, or package moves or removals, set the
9631 <code class="varname">CTYPE</code> variable on the command line to "Added", 9631 <code class="varname">CTYPE</code> variable on the command line to "Added",
9632 "Moved", or "Removed". You can set <code class="varname">NETBSD_LOGIN_NAME</code> 9632 "Moved", or "Removed". You can set <code class="varname">NETBSD_LOGIN_NAME</code>
9633 in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is 9633 in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is
9634 not the same as your NetBSD login name. The target also automatically 9634 not the same as your NetBSD login name. The target also automatically
9635 removes possibly existing entries for the package in the 9635 removes possibly existing entries for the package in the
9636 <code class="filename">TODO</code> file. Don't forget to commit 9636 <code class="filename">TODO</code> file. Don't forget to commit
9637 the changes, e.g. by using <span class="command"><strong>make changes-entry-commit</strong></span>! 9637 the changes, e.g. by using <span class="command"><strong>make changes-entry-commit</strong></span>!
9638 If you are not using a checkout directly from cvs.NetBSD.org, but e.g. 9638 If you are not using a checkout directly from cvs.NetBSD.org, but e.g.
9639 a local copy of the repository, you can set USE_NETBSD_REPO=yes. This 9639 a local copy of the repository, you can set USE_NETBSD_REPO=yes. This
9640 makes the cvs commands use the main repository. 9640 makes the cvs commands use the main repository.
9641 </p> 9641 </p>
9642</div> 9642</div>
9643<div class="sect1"> 9643<div class="sect1">
9644<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9644<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9645<a name="committing-importing"></a>21.4. Committing: Adding a package to CVS</h2></div></div></div> 9645<a name="committing-importing"></a>21.4. Committing: Adding a package to CVS</h2></div></div></div>
9646<p>This section is only of interest for pkgsrc developers with write 9646<p>This section is only of interest for pkgsrc developers with write
9647 access to the pkgsrc repository.</p> 9647 access to the pkgsrc repository.</p>
9648<p>When the package is finished, <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span> the files. 9648<p>When the package is finished, <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span> the files.
9649Start by adding the directory and then files in the directory. Don't 9649Start by adding the directory and then files in the directory. Don't
9650forget to add the new package to the category's 9650forget to add the new package to the category's
9651<code class="filename">Makefile</code>. Make sure you don't forget any files; 9651<code class="filename">Makefile</code>. Make sure you don't forget any files;
9652you can check by running <span class="quote">&#8220;<span class="quote">cvs status</span>&#8221;</span>. An example:</p> 9652you can check by running <span class="quote">&#8220;<span class="quote">cvs status</span>&#8221;</span>. An example:</p>
9653<pre class="programlisting"> 9653<pre class="programlisting">
9654<code class="prompt">$</code> cd .../pkgsrc/category 9654<code class="prompt">$</code> cd .../pkgsrc/category
9655<code class="prompt">$</code> cvs add pkgname 9655<code class="prompt">$</code> cvs add pkgname
9656<code class="prompt">$</code> cd pkgname 9656<code class="prompt">$</code> cd pkgname
9657<code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches 9657<code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
9658<code class="prompt">$</code> cvs add patches/p* 9658<code class="prompt">$</code> cvs add patches/p*
9659<code class="prompt">$</code> cvs status | less 9659<code class="prompt">$</code> cvs status | less
9660<code class="prompt">$</code> cvs commit 9660<code class="prompt">$</code> cvs commit
9661<code class="prompt">$</code> cd .. 9661<code class="prompt">$</code> cd ..
9662<code class="prompt">$</code> vi Makefile # add SUBDIRS+=pkgname line 9662<code class="prompt">$</code> vi Makefile # add SUBDIRS+=pkgname line
9663<code class="prompt">$</code> cvs commit Makefile 9663<code class="prompt">$</code> cvs commit Makefile
9664</pre> 9664</pre>
9665<p>The commit message of the initial import should include part of the 9665<p>The commit message of the initial import should include part of the
9666 <code class="filename">DESCR</code> file, so people reading the mailing lists know 9666 <code class="filename">DESCR</code> file, so people reading the mailing lists know
9667 what the package is/does.</p> 9667 what the package is/does.</p>
9668<p>Also mention the new package in 9668<p>Also mention the new package in
9669<code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p> 9669<code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p>
9670<p>Previously, <span class="quote">&#8220;<span class="quote">cvs import</span>&#8221;</span> was suggested, but it was 9670<p>Previously, <span class="quote">&#8220;<span class="quote">cvs import</span>&#8221;</span> was suggested, but it was
9671much easier to get wrong than <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span>.</p> 9671much easier to get wrong than <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span>.</p>
9672</div> 9672</div>
9673<div class="sect1"> 9673<div class="sect1">
9674<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9674<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9675<a name="updating-package"></a>21.5. Updating a package to a newer version</h2></div></div></div> 9675<a name="updating-package"></a>21.5. Updating a package to a newer version</h2></div></div></div>
9676<p>Please always put a concise, appropriate and relevant summary of the 9676<p>Please always put a concise, appropriate and relevant summary of the
9677 changes between old and new versions into the commit log when updating 9677 changes between old and new versions into the commit log when updating
9678 a package. There are various reasons for this:</p> 9678 a package. There are various reasons for this:</p>
9679<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9679<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9680<li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely 9680<li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely
9681 or its information may be overwritten by newer information.</p></li> 9681 or its information may be overwritten by newer information.</p></li>
9682<li class="listitem"><p>Having the change information between old and new versions in our CVS 9682<li class="listitem"><p>Having the change information between old and new versions in our CVS
9683 repository is very useful for people who use either cvs or anoncvs.</p></li> 9683 repository is very useful for people who use either cvs or anoncvs.</p></li>
9684<li class="listitem"><p>Having the change information between old and new versions in our CVS 9684<li class="listitem"><p>Having the change information between old and new versions in our CVS
9685 repository is very useful for people who read the pkgsrc-changes mailing 9685 repository is very useful for people who read the pkgsrc-changes mailing
9686 list, so that they can make tactical decisions about when to upgrade 9686 list, so that they can make tactical decisions about when to upgrade
9687 the package.</p></li> 9687 the package.</p></li>
9688</ul></div> 9688</ul></div>
9689<p>Please also recognize that, just because a new version of a package 9689<p>Please also recognize that, just because a new version of a package
9690 has been released, it should not automatically be upgraded in the CVS 9690 has been released, it should not automatically be upgraded in the CVS
9691 repository. We prefer to be conservative in the packages that are 9691 repository. We prefer to be conservative in the packages that are
9692 included in pkgsrc - development or beta packages are not really the 9692 included in pkgsrc - development or beta packages are not really the
9693 best thing for most places in which pkgsrc is used. Please use your 9693 best thing for most places in which pkgsrc is used. Please use your
9694 judgement about what should go into pkgsrc, and bear in mind that 9694 judgement about what should go into pkgsrc, and bear in mind that
9695 stability is to be preferred above new and possibly untested features.</p> 9695 stability is to be preferred above new and possibly untested features.</p>
9696</div> 9696</div>
9697<div class="sect1"> 9697<div class="sect1">
9698<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9698<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9699<a name="renaming-package"></a>21.6. Renaming a package in pkgsrc</h2></div></div></div> 9699<a name="renaming-package"></a>21.6. Renaming a package in pkgsrc</h2></div></div></div>
9700<p>Renaming packages is not recommended.</p> 9700<p>Renaming packages is not recommended.</p>
9701<p>When renaming packages, be sure to fix any references to old name 9701<p>When renaming packages, be sure to fix any references to old name
9702 in other Makefiles, options, buildlink files, etc.</p> 9702 in other Makefiles, options, buildlink files, etc.</p>
9703<p>Also When renaming a package, please define 9703<p>Also When renaming a package, please define
9704 <code class="varname">SUPERSEDES</code> to the package name and dewey version 9704 <code class="varname">SUPERSEDES</code> to the package name and dewey version
9705 pattern(s) of the previous package name. 9705 pattern(s) of the previous package name.
9706 This may be repeated for multiple renames. 9706 This may be repeated for multiple renames.
9707 The new package would be an exact replacement. 9707 The new package would be an exact replacement.
9708</p> 9708</p>
9709<p>Note that <span class="quote">&#8220;<span class="quote">successor</span>&#8221;</span> in the 9709<p>Note that <span class="quote">&#8220;<span class="quote">successor</span>&#8221;</span> in the
9710 CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily 9710 CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily
9711 mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may 9711 mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may
9712 not be an exact replacement but is a suggestion for the replaced 9712 not be an exact replacement but is a suggestion for the replaced
9713 functionality.</p> 9713 functionality.</p>
9714</div> 9714</div>
9715<div class="sect1"> 9715<div class="sect1">
9716<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 9716<div class="titlepage"><div><div><h2 class="title" style="clear: both">
9717<a name="moving-package"></a>21.7. Moving a package in pkgsrc</h2></div></div></div> 9717<a name="moving-package"></a>21.7. Moving a package in pkgsrc</h2></div></div></div>
9718<p>It is preferred that packages are not renamed or moved, but if needed 9718<p>It is preferred that packages are not renamed or moved, but if needed
9719 please follow these steps. 9719 please follow these steps.
9720</p> 9720</p>
9721<div class="orderedlist"><ol class="orderedlist" type="1"> 9721<div class="orderedlist"><ol class="orderedlist" type="1">
9722<li class="listitem"><p>Make a copy of the directory somewhere else.</p></li> 9722<li class="listitem"><p>Make a copy of the directory somewhere else.</p></li>
9723<li class="listitem"> 9723<li class="listitem">
9724<p>Remove all CVS dirs.</p> 9724<p>Remove all CVS dirs.</p>
9725<p>Alternatively to the first two steps you can also do:</p> 9725<p>Alternatively to the first two steps you can also do:</p>
9726<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong></pre> 9726<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong></pre>
9727<p>and use that for further work.</p> 9727<p>and use that for further work.</p>
9728</li> 9728</li>
9729<li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any 9729<li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any
9730<code class="varname">DEPENDS</code> paths that just did <span class="quote">&#8220;<span class="quote">../package</span>&#8221;</span> 9730<code class="varname">DEPENDS</code> paths that just did <span class="quote">&#8220;<span class="quote">../package</span>&#8221;</span>
9731instead of <span class="quote">&#8220;<span class="quote">../../category/package</span>&#8221;</span>.</p></li> 9731instead of <span class="quote">&#8220;<span class="quote">../../category/package</span>&#8221;</span>.</p></li>
9732<li class="listitem"><p>In the modified package's Makefile, consider setting 9732<li class="listitem"><p>In the modified package's Makefile, consider setting
9733<code class="varname">PREV_PKGPATH</code> to the previous category/package 9733<code class="varname">PREV_PKGPATH</code> to the previous category/package
9734pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools 9734pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools
9735for doing an update using pkgsrc building; for example, it can 9735for doing an update using pkgsrc building; for example, it can
9736search the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> database for <code class="varname">PREV_PKGPATH</code> 9736search the <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> database for <code class="varname">PREV_PKGPATH</code>
9737(if no <code class="varname">SUPERSEDES</code>) and then use the corresponding 9737(if no <code class="varname">SUPERSEDES</code>) and then use the corresponding
9738new <code class="varname">PKGPATH</code> for that moved package. Note that 9738new <code class="varname">PKGPATH</code> for that moved package. Note that
9739it may have multiple matches, so the tool should also check on the 9739it may have multiple matches, so the tool should also check on the
9740<code class="varname">PKGBASE</code> too. The <code class="varname">PREV_PKGPATH</code> 9740<code class="varname">PKGBASE</code> too. The <code class="varname">PREV_PKGPATH</code>
9741probably has no value unless <code class="varname">SUPERSEDES</code> is not 9741probably has no value unless <code class="varname">SUPERSEDES</code> is not
9742set, i.e. <code class="varname">PKGBASE</code> stays the same. </p></li> 9742set, i.e. <code class="varname">PKGBASE</code> stays the same. </p></li>
9743<li class="listitem"><p><span class="command"><strong>cvs import</strong></span> the modified package in the new 9743<li class="listitem"><p><span class="command"><strong>cvs import</strong></span> the modified package in the new
9744place.</p></li> 9744place.</p></li>
9745<li class="listitem"> 9745<li class="listitem">
9746<p>Check if any package depends on it: 9746<p>Check if any package depends on it:
9747</p> 9747</p>
9748<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong> 9748<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
9749<code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre> 9749<code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre>
9750</li> 9750</li>
9751<li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li> 9751<li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li>
9752<li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li> 9752<li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li>
9753<li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li> 9753<li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li>
9754<li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li> 9754<li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li>
9755<li class="listitem"> 9755<li class="listitem">
9756<p>Commit the changed and removed files:</p> 9756<p>Commit the changed and removed files:</p>
9757<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong></pre> 9757<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong></pre>
9758<p>(and any packages from step 5, of course).</p> 9758<p>(and any packages from step 5, of course).</p>
9759</li> 9759</li>
9760</ol></div> 9760</ol></div>
9761</div> 9761</div>
9762</div> 9762</div>
9763<div class="chapter"> 9763<div class="chapter">
9764<div class="titlepage"><div><div><h2 class="title"> 9764<div class="titlepage"><div><div><h2 class="title">
9765<a name="devfaq"></a>Chapter 22. Frequently Asked Questions</h2></div></div></div> 9765<a name="devfaq"></a>Chapter 22. Frequently Asked Questions</h2></div></div></div>
9766<p>This section contains the answers to questions that may 9766<p>This section contains the answers to questions that may
9767 arise when you are writing a package. If you don't find your 9767 arise when you are writing a package. If you don't find your
9768 question answered here, first have a look in the other chapters, 9768 question answered here, first have a look in the other chapters,
9769 and if you still don't have the answer, ask on the 9769 and if you still don't have the answer, ask on the
9770 <code class="literal">pkgsrc-users</code> mailing list.</p> 9770 <code class="literal">pkgsrc-users</code> mailing list.</p>
9771<div class="qandaset"> 9771<div class="qandaset">
9772<a name="idm77207344"></a><dl> 9772<a name="idm77764400"></a><dl>
9773<dt>22.1. <a href="#devfaq.makeflags">What is the difference between 9773<dt>22.1. <a href="#devfaq.makeflags">What is the difference between
9774 MAKEFLAGS, .MAKEFLAGS and 9774 MAKEFLAGS, .MAKEFLAGS and
9775 MAKE_FLAGS?</a> 9775 MAKE_FLAGS?</a>
9776</dt> 9776</dt>
9777<dt>22.2. <a href="#devfaq.make">What is the difference between 9777<dt>22.2. <a href="#devfaq.make">What is the difference between
9778 MAKE, GMAKE and 9778 MAKE, GMAKE and
9779 MAKE_PROGRAM?</a> 9779 MAKE_PROGRAM?</a>
9780</dt> 9780</dt>
9781<dt>22.3. <a href="#devfaq.cc">What is the difference between 9781<dt>22.3. <a href="#devfaq.cc">What is the difference between
9782 CC, PKG_CC and 9782 CC, PKG_CC and
9783 PKGSRC_COMPILER?</a> 9783 PKGSRC_COMPILER?</a>
9784</dt> 9784</dt>
9785<dt>22.4. <a href="#devfaq.bl3flags">What is the difference between 9785<dt>22.4. <a href="#devfaq.bl3flags">What is the difference between
9786 BUILDLINK_LDFLAGS, 9786 BUILDLINK_LDFLAGS,
9787 BUILDLINK_LDADD and 9787 BUILDLINK_LDADD and
9788 BUILDLINK_LIBS?</a> 9788 BUILDLINK_LIBS?</a>
9789</dt> 9789</dt>
9790<dt>22.5. <a href="#devfaq.bl3prefix">Why does make show-var 9790<dt>22.5. <a href="#devfaq.bl3prefix">Why does make show-var
9791 VARNAME=BUILDLINK_PREFIX.foo 9791 VARNAME=BUILDLINK_PREFIX.foo
9792 say it's empty?</a> 9792 say it's empty?</a>
9793</dt> 9793</dt>
9794<dt>22.6. <a href="#devfaq.master_sites">What does 9794<dt>22.6. <a href="#devfaq.master_sites">What does
9795 ${MASTER_SITE_SOURCEFORGE:=package/} mean? I 9795 ${MASTER_SITE_SOURCEFORGE:=package/} mean? I
9796 don't understand the := inside 9796 don't understand the := inside
9797 it.</a> 9797 it.</a>
9798</dt> 9798</dt>
9799<dt>22.7. <a href="#devfaq.mailinglists">Which mailing lists are there for package 9799<dt>22.7. <a href="#devfaq.mailinglists">Which mailing lists are there for package
9800 developers?</a> 9800 developers?</a>
9801</dt> 9801</dt>
9802<dt>22.8. <a href="#devfaq.documentation">Where is the pkgsrc 9802<dt>22.8. <a href="#devfaq.documentation">Where is the pkgsrc
9803 documentation?</a> 9803 documentation?</a>
9804</dt> 9804</dt>
9805<dt>22.9. <a href="#devfaq.too-much-time">I have a little time to kill. What shall I 9805<dt>22.9. <a href="#devfaq.too-much-time">I have a little time to kill. What shall I
9806do?</a> 9806do?</a>
9807</dt> 9807</dt>
9808</dl> 9808</dl>
9809<table border="0" style="width: 100%;"> 9809<table border="0" style="width: 100%;">
9810<colgroup> 9810<colgroup>
9811<col align="left" width="1%"> 9811<col align="left" width="1%">
9812<col> 9812<col>
9813</colgroup> 9813</colgroup>
9814<tbody> 9814<tbody>
9815<tr class="question"> 9815<tr class="question">
9816<td align="left" valign="top"> 9816<td align="left" valign="top">
9817<a name="devfaq.makeflags"></a><a name="idm77206960"></a><p><b>22.1.</b></p> 9817<a name="devfaq.makeflags"></a><a name="idm77764016"></a><p><b>22.1.</b></p>
9818</td> 9818</td>
9819<td align="left" valign="top"><p>What is the difference between 9819<td align="left" valign="top"><p>What is the difference between
9820 <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and 9820 <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
9821 <code class="varname">MAKE_FLAGS</code>?</p></td> 9821 <code class="varname">MAKE_FLAGS</code>?</p></td>
9822</tr> 9822</tr>
9823<tr class="answer"> 9823<tr class="answer">
9824<td align="left" valign="top"></td> 9824<td align="left" valign="top"></td>
9825<td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed 9825<td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed
9826 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 9826 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
9827 <code class="varname">MAKE_FLAGS</code> are the flags that are passed to 9827 <code class="varname">MAKE_FLAGS</code> are the flags that are passed to
9828 the <code class="varname">MAKE_PROGRAM</code> when building the 9828 the <code class="varname">MAKE_PROGRAM</code> when building the
9829 package. [FIXME: What is .MAKEFLAGS for?]</p></td> 9829 package. [FIXME: What is .MAKEFLAGS for?]</p></td>
9830</tr> 9830</tr>
9831<tr class="question"> 9831<tr class="question">
9832<td align="left" valign="top"> 9832<td align="left" valign="top">
9833<a name="devfaq.make"></a><a name="idm77202864"></a><p><b>22.2.</b></p> 9833<a name="devfaq.make"></a><a name="idm77759920"></a><p><b>22.2.</b></p>
9834</td> 9834</td>
9835<td align="left" valign="top"><p>What is the difference between 9835<td align="left" valign="top"><p>What is the difference between
9836 <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and 9836 <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
9837 <code class="varname">MAKE_PROGRAM</code>?</p></td> 9837 <code class="varname">MAKE_PROGRAM</code>?</p></td>
9838</tr> 9838</tr>
9839<tr class="answer"> 9839<tr class="answer">
9840<td align="left" valign="top"></td> 9840<td align="left" valign="top"></td>
9841<td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the 9841<td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the
9842 <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 9842 <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
9843 infrastructure. <code class="varname">GMAKE</code> is the path to GNU 9843 infrastructure. <code class="varname">GMAKE</code> is the path to GNU
9844 Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to 9844 Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to
9845 use that. <code class="varname">MAKE_PROGRAM</code> is the path to the 9845 use that. <code class="varname">MAKE_PROGRAM</code> is the path to the
9846 Make program that is used for building the 9846 Make program that is used for building the
9847 package.</p></td> 9847 package.</p></td>
9848</tr> 9848</tr>
9849<tr class="question"> 9849<tr class="question">
9850<td align="left" valign="top"> 9850<td align="left" valign="top">
9851<a name="devfaq.cc"></a><a name="idm77198512"></a><p><b>22.3.</b></p> 9851<a name="devfaq.cc"></a><a name="idm77755568"></a><p><b>22.3.</b></p>
9852</td> 9852</td>
9853<td align="left" valign="top"><p>What is the difference between 9853<td align="left" valign="top"><p>What is the difference between
9854 <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and 9854 <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
9855 <code class="varname">PKGSRC_COMPILER</code>?</p></td> 9855 <code class="varname">PKGSRC_COMPILER</code>?</p></td>
9856</tr> 9856</tr>
9857<tr class="answer"> 9857<tr class="answer">
9858<td align="left" valign="top"></td> 9858<td align="left" valign="top"></td>
9859<td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C 9859<td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C
9860 compiler, which can be configured by the pkgsrc user. 9860 compiler, which can be configured by the pkgsrc user.
9861 <code class="varname">PKG_CC</code> is the path to the compiler wrapper. 9861 <code class="varname">PKG_CC</code> is the path to the compiler wrapper.
9862 <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a 9862 <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a
9863 path to a compiler, but the type of compiler that should be 9863 path to a compiler, but the type of compiler that should be
9864 used. See <code class="filename">mk/compiler.mk</code> for more 9864 used. See <code class="filename">mk/compiler.mk</code> for more
9865 information about the latter variable.</p></td> 9865 information about the latter variable.</p></td>
9866</tr> 9866</tr>
9867<tr class="question"> 9867<tr class="question">
9868<td align="left" valign="top"> 9868<td align="left" valign="top">
9869<a name="devfaq.bl3flags"></a><a name="idm77194288"></a><p><b>22.4.</b></p> 9869<a name="devfaq.bl3flags"></a><a name="idm77751344"></a><p><b>22.4.</b></p>
9870</td> 9870</td>
9871<td align="left" valign="top"><p>What is the difference between 9871<td align="left" valign="top"><p>What is the difference between
9872 <code class="varname">BUILDLINK_LDFLAGS</code>, 9872 <code class="varname">BUILDLINK_LDFLAGS</code>,
9873 <code class="varname">BUILDLINK_LDADD</code> and 9873 <code class="varname">BUILDLINK_LDADD</code> and
9874 <code class="varname">BUILDLINK_LIBS</code>?</p></td> 9874 <code class="varname">BUILDLINK_LIBS</code>?</p></td>
9875</tr> 9875</tr>
9876<tr class="answer"> 9876<tr class="answer">
9877<td align="left" valign="top"></td> 9877<td align="left" valign="top"></td>
9878<td align="left" valign="top"><p>[FIXME]</p></td> 9878<td align="left" valign="top"><p>[FIXME]</p></td>
9879</tr> 9879</tr>
9880<tr class="question"> 9880<tr class="question">
9881<td align="left" valign="top"> 9881<td align="left" valign="top">
9882<a name="devfaq.bl3prefix"></a><a name="idm77192112"></a><p><b>22.5.</b></p> 9882<a name="devfaq.bl3prefix"></a><a name="idm77749168"></a><p><b>22.5.</b></p>
9883</td> 9883</td>
9884<td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var 9884<td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
9885 VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span> 9885 VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
9886 say it's empty?</p></td> 9886 say it's empty?</p></td>
9887</tr> 9887</tr>
9888<tr class="answer"> 9888<tr class="answer">
9889<td align="left" valign="top"></td> 9889<td align="left" valign="top"></td>
9890<td align="left" valign="top"><p>For optimization reasons, some variables are only 9890<td align="left" valign="top"><p>For optimization reasons, some variables are only
9891 available in the <span class="quote">&#8220;<span class="quote">wrapper</span>&#8221;</span> phase and later. To 9891 available in the <span class="quote">&#8220;<span class="quote">wrapper</span>&#8221;</span> phase and later. To
9892 <span class="quote">&#8220;<span class="quote">simulate</span>&#8221;</span> the wrapper phase, append 9892 <span class="quote">&#8220;<span class="quote">simulate</span>&#8221;</span> the wrapper phase, append
9893 <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above 9893 <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
9894 command.</p></td> 9894 command.</p></td>
9895</tr> 9895</tr>
9896<tr class="question"> 9896<tr class="question">
9897<td align="left" valign="top"> 9897<td align="left" valign="top">
9898<a name="devfaq.master_sites"></a><a name="idm77189040"></a><p><b>22.6.</b></p> 9898<a name="devfaq.master_sites"></a><a name="idm77746096"></a><p><b>22.6.</b></p>
9899</td> 9899</td>
9900<td align="left" valign="top"><p>What does 9900<td align="left" valign="top"><p>What does
9901 <code class="literal">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I 9901 <code class="literal">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
9902 don't understand the <code class="literal">:=</code> inside 9902 don't understand the <code class="literal">:=</code> inside
9903 it.</p></td> 9903 it.</p></td>
9904</tr> 9904</tr>
9905<tr class="answer"> 9905<tr class="answer">
9906<td align="left" valign="top"></td> 9906<td align="left" valign="top"></td>
9907<td align="left" valign="top"><p>The <code class="literal">:=</code> is not really an 9907<td align="left" valign="top"><p>The <code class="literal">:=</code> is not really an
9908 assignment operator, like you might expect at first sight. 9908 assignment operator, like you might expect at first sight.
9909 Instead, it is a degenerate form of 9909 Instead, it is a degenerate form of
9910 <code class="literal">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>, 9910 <code class="literal">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
9911 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 9911 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
9912 may have seen as in <code class="literal">${SRCS:.c=.o}</code>. In the 9912 may have seen as in <code class="literal">${SRCS:.c=.o}</code>. In the
9913 case of <code class="varname">MASTER_SITE_*</code>, 9913 case of <code class="varname">MASTER_SITE_*</code>,
9914 <em class="replaceable"><code>old_string</code></em> is the empty string and 9914 <em class="replaceable"><code>old_string</code></em> is the empty string and
9915 <em class="replaceable"><code>new_string</code></em> is 9915 <em class="replaceable"><code>new_string</code></em> is
9916 <code class="literal">package/</code>. That's where the 9916 <code class="literal">package/</code>. That's where the
9917 <code class="literal">:</code> and the <code class="literal">=</code> fall 9917 <code class="literal">:</code> and the <code class="literal">=</code> fall
9918 together.</p></td> 9918 together.</p></td>
9919</tr> 9919</tr>
9920<tr class="question"> 9920<tr class="question">
9921<td align="left" valign="top"> 9921<td align="left" valign="top">
9922<a name="devfaq.mailinglists"></a><a name="idm77172784"></a><p><b>22.7.</b></p> 9922<a name="devfaq.mailinglists"></a><a name="idm77738032"></a><p><b>22.7.</b></p>
9923</td> 9923</td>
9924<td align="left" valign="top"><p>Which mailing lists are there for package 9924<td align="left" valign="top"><p>Which mailing lists are there for package
9925 developers?</p></td> 9925 developers?</p></td>
9926</tr> 9926</tr>
9927<tr class="answer"> 9927<tr class="answer">
9928<td align="left" valign="top"></td> 9928<td align="left" valign="top"></td>
9929<td align="left" valign="top"><div class="variablelist"><dl class="variablelist"> 9929<td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
9930<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a></span></dt> 9930<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a></span></dt>
9931<dd><p>This is a list for technical discussions related 9931<dd><p>This is a list for technical discussions related
9932 to pkgsrc development, e.g. soliciting feedback for changes to 9932 to pkgsrc development, e.g. soliciting feedback for changes to
9933 pkgsrc infrastructure, proposed new features, questions related 9933 pkgsrc infrastructure, proposed new features, questions related
9934 to porting pkgsrc to a new platform, advice for maintaining a 9934 to porting pkgsrc to a new platform, advice for maintaining a
9935 package, patches that affect many packages, help requests moved 9935 package, patches that affect many packages, help requests moved
9936 from pkgsrc-users when an infrastructure bug is found, 9936 from pkgsrc-users when an infrastructure bug is found,
9937 etc.</p></dd> 9937 etc.</p></dd>
9938<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-bugs" target="_top">pkgsrc-bugs</a></span></dt> 9938<dt><span class="term"><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-bugs" target="_top">pkgsrc-bugs</a></span></dt>
9939<dd><p>All bug reports in category "pkg" sent with 9939<dd><p>All bug reports in category "pkg" sent with
9940 <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 9940 <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
9941 directly; use one of the other mailing 9941 directly; use one of the other mailing
9942 lists.</p></dd> 9942 lists.</p></dd>
9943</dl></div></td> 9943</dl></div></td>
9944</tr> 9944</tr>
9945<tr class="question"> 9945<tr class="question">
9946<td align="left" valign="top"> 9946<td align="left" valign="top">
9947<a name="devfaq.documentation"></a><a name="idm77168944"></a><p><b>22.8.</b></p> 9947<a name="devfaq.documentation"></a><a name="idm77734192"></a><p><b>22.8.</b></p>
9948</td> 9948</td>
9949<td align="left" valign="top"><p>Where is the pkgsrc 9949<td align="left" valign="top"><p>Where is the pkgsrc
9950 documentation?</p></td> 9950 documentation?</p></td>
9951</tr> 9951</tr>
9952<tr class="answer"> 9952<tr class="answer">
9953<td align="left" valign="top"></td> 9953<td align="left" valign="top"></td>
9954<td align="left" valign="top"> 9954<td align="left" valign="top">
9955<p>There are many places where you can find 9955<p>There are many places where you can find
9956 documentation about pkgsrc:</p> 9956 documentation about pkgsrc:</p>
9957<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 9957<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9958<li class="listitem"><p>The pkgsrc guide (this document) is a collection 9958<li class="listitem"><p>The pkgsrc guide (this document) is a collection
9959 of chapters that explain large parts of pkgsrc, but some 9959 of chapters that explain large parts of pkgsrc, but some
9960 chapters tend to be outdated. Which ones they are is hard to 9960 chapters tend to be outdated. Which ones they are is hard to
9961 say.</p></li> 9961 say.</p></li>
9962<li class="listitem"><p>On the mailing list archives (see <a class="ulink" href="http://mail-index.NetBSD.org/" target="_top">http://mail-index.NetBSD.org/</a>), you can find discussions 9962<li class="listitem"><p>On the mailing list archives (see <a class="ulink" href="http://mail-index.NetBSD.org/" target="_top">http://mail-index.NetBSD.org/</a>), you can find discussions
9963 about certain features, announcements of new parts of the pkgsrc 9963 about certain features, announcements of new parts of the pkgsrc
9964 infrastructure and sometimes even announcements that a certain 9964 infrastructure and sometimes even announcements that a certain
9965 feature has been marked as obsolete. The benefit here is that 9965 feature has been marked as obsolete. The benefit here is that
9966 each message has a date appended to it.</p></li> 9966 each message has a date appended to it.</p></li>
9967<li class="listitem"><p>Many of the files in the 9967<li class="listitem"><p>Many of the files in the
9968 <code class="filename">mk/</code> directory start with a comment that 9968 <code class="filename">mk/</code> directory start with a comment that
9969 describes the purpose of the file and how it can be used by the 9969 describes the purpose of the file and how it can be used by the
9970 pkgsrc user and package authors. An easy way to find this 9970 pkgsrc user and package authors. An easy way to find this
9971 documentation is to run <span class="command"><strong>bmake 9971 documentation is to run <span class="command"><strong>bmake
9972 help</strong></span>.</p></li> 9972 help</strong></span>.</p></li>
9973<li class="listitem"><p>The CVS log messages are a rich source of 9973<li class="listitem"><p>The CVS log messages are a rich source of
9974 information, but they tend to be highly abbreviated, especially 9974 information, but they tend to be highly abbreviated, especially
9975 for actions that occur often. Some contain a detailed 9975 for actions that occur often. Some contain a detailed
9976 description of what has changed, but they are geared towards the 9976 description of what has changed, but they are geared towards the
9977 other pkgsrc developers, not towards an average pkgsrc user. 9977 other pkgsrc developers, not towards an average pkgsrc user.
9978 They also only document <span class="emphasis"><em>changes</em></span>, so if you 9978 They also only document <span class="emphasis"><em>changes</em></span>, so if you
9979 don't know what has been before, these messages may not be worth 9979 don't know what has been before, these messages may not be worth
9980 too much to you.</p></li> 9980 too much to you.</p></li>
9981<li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">&#8220;<span class="quote">implicitly 9981<li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">&#8220;<span class="quote">implicitly
9982 documented</span>&#8221;</span>, that is the documentation exists only in the 9982 documented</span>&#8221;</span>, that is the documentation exists only in the
9983 mind of the developer who wrote the code. To get this 9983 mind of the developer who wrote the code. To get this
9984 information, use the <span class="command"><strong>cvs annotate</strong></span> command 9984 information, use the <span class="command"><strong>cvs annotate</strong></span> command
9985 to see who has written it and ask on the 9985 to see who has written it and ask on the
9986 <code class="literal">tech-pkg</code> mailing list, so that others can 9986 <code class="literal">tech-pkg</code> mailing list, so that others can
9987 find your questions later (see above). To be sure that the 9987 find your questions later (see above). To be sure that the
9988 developer in charge reads the mail, you may CC him or 9988 developer in charge reads the mail, you may CC him or
9989 her.</p></li> 9989 her.</p></li>
9990</ul></div> 9990</ul></div>
9991</td> 9991</td>
9992</tr> 9992</tr>
9993<tr class="question"> 9993<tr class="question">
9994<td align="left" valign="top"> 9994<td align="left" valign="top">
9995<a name="devfaq.too-much-time"></a><a name="idm77162416"></a><p><b>22.9.</b></p> 9995<a name="devfaq.too-much-time"></a><a name="idm77727664"></a><p><b>22.9.</b></p>
9996</td> 9996</td>
9997<td align="left" valign="top"><p>I have a little time to kill. What shall I 9997<td align="left" valign="top"><p>I have a little time to kill. What shall I
9998do?</p></td> 9998do?</p></td>
9999</tr> 9999</tr>
10000<tr class="answer"> 10000<tr class="answer">
10001<td align="left" valign="top"></td> 10001<td align="left" valign="top"></td>
10002<td align="left" valign="top"> 10002<td align="left" valign="top">
10003<p>This is not really an FAQ yet, but here's the answer 10003<p>This is not really an FAQ yet, but here's the answer
10004anyway.</p> 10004anyway.</p>
10005<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 10005<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
10006<li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the 10006<li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
10007 <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 10007 <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
10008 will tell you about newer versions of installed packages that are 10008 will tell you about newer versions of installed packages that are
10009 available, but not yet updated in pkgsrc.</p></li> 10009 available, but not yet updated in pkgsrc.</p></li>
10010<li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code> 10010<li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code>
10011 &mdash; it contains a list of suggested new packages and a list of 10011 &mdash; it contains a list of suggested new packages and a list of
10012 cleanups and enhancements for pkgsrc that would be nice to 10012 cleanups and enhancements for pkgsrc that would be nice to
10013 have.</p></li> 10013 have.</p></li>
10014<li class="listitem"><p>Review packages for which review was requested on 10014<li class="listitem"><p>Review packages for which review was requested on
10015 the <a class="ulink" href="http://pkgsrc-wip.sourceforge.net/" target="_top">pkgsrc-wip</a> review 10015 the <a class="ulink" href="http://pkgsrc-wip.sourceforge.net/" target="_top">pkgsrc-wip</a> review
10016 mailing list.</p></li> 10016 mailing list.</p></li>
10017</ul></div> 10017</ul></div>
10018</td> 10018</td>
10019</tr> 10019</tr>
10020</tbody> 10020</tbody>
10021</table> 10021</table>
10022</div> 10022</div>
10023</div> 10023</div>
10024<div class="chapter"> 10024<div class="chapter">
10025<div class="titlepage"><div><div><h2 class="title"> 10025<div class="titlepage"><div><div><h2 class="title">
10026<a name="gnome"></a>Chapter 23. GNOME packaging and porting</h2></div></div></div> 10026<a name="gnome"></a>Chapter 23. GNOME packaging and porting</h2></div></div></div>
10027<div class="toc"> 10027<div class="toc">
10028<p><b>Table of Contents</b></p> 10028<p><b>Table of Contents</b></p>
10029<dl> 10029<dl>
10030<dt><span class="sect1"><a href="#meta-packages">23.1. Meta packages</a></span></dt> 10030<dt><span class="sect1"><a href="#meta-packages">23.1. Meta packages</a></span></dt>
10031<dt><span class="sect1"><a href="#new-package">23.2. Packaging a GNOME application</a></span></dt> 10031<dt><span class="sect1"><a href="#new-package">23.2. Packaging a GNOME application</a></span></dt>
10032<dt><span class="sect1"><a href="#full-update">23.3. Updating GNOME to a newer version</a></span></dt> 10032<dt><span class="sect1"><a href="#full-update">23.3. Updating GNOME to a newer version</a></span></dt>
10033<dt><span class="sect1"><a href="#patching">23.4. Patching guidelines</a></span></dt> 10033<dt><span class="sect1"><a href="#patching">23.4. Patching guidelines</a></span></dt>
10034</dl> 10034</dl>
10035</div> 10035</div>
10036<p>Quoting <a class="ulink" href="http://www.gnome.org/" target="_top">GNOME's web 10036<p>Quoting <a class="ulink" href="http://www.gnome.org/" target="_top">GNOME's web
10037site</a>:</p> 10037site</a>:</p>
10038<div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop 10038<div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop
10039 environment, an intuitive and attractive desktop for users, and the 10039 environment, an intuitive and attractive desktop for users, and the
10040 GNOME development platform, an extensive framework for building 10040 GNOME development platform, an extensive framework for building
10041 applications that integrate into the rest of the desktop.</p></blockquote></div> 10041 applications that integrate into the rest of the desktop.</p></blockquote></div>
10042<p>pkgsrc provides a seamless way to automatically build and install 10042<p>pkgsrc provides a seamless way to automatically build and install
10043a complete GNOME environment <span class="emphasis"><em>under many different 10043a complete GNOME environment <span class="emphasis"><em>under many different
10044platforms</em></span>. We can say with confidence that pkgsrc is one of 10044platforms</em></span>. We can say with confidence that pkgsrc is one of
10045the most advanced build and packaging systems for GNOME due to its 10045the most advanced build and packaging systems for GNOME due to its
10046included technologies buildlink3, the wrappers and tools framework and 10046included technologies buildlink3, the wrappers and tools framework and
10047automatic configuration file management. Lots of efforts are put into 10047automatic configuration file management. Lots of efforts are put into
10048achieving a completely clean deinstallation of installed software 10048achieving a completely clean deinstallation of installed software
10049components.</p> 10049components.</p>
10050<p>Given that pkgsrc is <a class="ulink" href="http://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system, 10050<p>Given that pkgsrc is <a class="ulink" href="http://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system,
10051the above also means that great efforts are put into making GNOME work 10051the above also means that great efforts are put into making GNOME work
10052under this operating system. Recently, <a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted 10052under this operating system. Recently, <a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted
10053pkgsrc as its preferred packaging system, contributing lots of 10053pkgsrc as its preferred packaging system, contributing lots of
10054portability fixes to make GNOME build and install under it.</p> 10054portability fixes to make GNOME build and install under it.</p>
10055<p>This chapter is aimed at pkgsrc developers and other people 10055<p>This chapter is aimed at pkgsrc developers and other people
10056interested in helping our GNOME porting and packaging efforts. It 10056interested in helping our GNOME porting and packaging efforts. It
10057provides instructions on how to manage the existing packages and some 10057provides instructions on how to manage the existing packages and some
10058important information regarding their internals.</p> 10058important information regarding their internals.</p>
10059<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 10059<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
10060<h3 class="title">We need your help!</h3> 10060<h3 class="title">We need your help!</h3>
10061<p>Should you have some spare cycles to devote to NetBSD, pkgsrc 10061<p>Should you have some spare cycles to devote to NetBSD, pkgsrc
10062 and GNOME and are willing to learn new exciting stuff, please jump 10062 and GNOME and are willing to learn new exciting stuff, please jump
10063 straight to the <a class="ulink" href="http://www.NetBSD.org/contrib/projects.html#gnome" target="_top">pending 10063 straight to the <a class="ulink" href="http://www.NetBSD.org/contrib/projects.html#gnome" target="_top">pending
10064 work</a> list! There is still a long way to go to get a 10064 work</a> list! There is still a long way to go to get a
10065 fully-functional GNOME desktop under NetBSD and we need your help to 10065 fully-functional GNOME desktop under NetBSD and we need your help to
10066 achieve it!</p> 10066 achieve it!</p>
10067</div> 10067</div>
10068<div class="sect1"> 10068<div class="sect1">
10069<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10069<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10070<a name="meta-packages"></a>23.1. Meta packages</h2></div></div></div> 10070<a name="meta-packages"></a>23.1. Meta packages</h2></div></div></div>
10071<p>pkgsrc includes three GNOME-related meta packages:</p> 10071<p>pkgsrc includes three GNOME-related meta packages:</p>
10072<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 10072<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
10073<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>: Provides 10073<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>: Provides
10074 the core GNOME desktop environment. It only includes the necessary 10074 the core GNOME desktop environment. It only includes the necessary
10075 bits to get it to boot correctly, although it may lack important 10075 bits to get it to boot correctly, although it may lack important
10076 functionality for daily operation. The idea behind this package is 10076 functionality for daily operation. The idea behind this package is
10077 to let end users build their own configurations on top of this one, 10077 to let end users build their own configurations on top of this one,
10078 first installing this meta package to achieve a functional setup and 10078 first installing this meta package to achieve a functional setup and
10079 then adding individual applications.</p></li> 10079 then adding individual applications.</p></li>
10080<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>: Provides a 10080<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>: Provides a
10081 complete installation of the GNOME platform and desktop as defined 10081 complete installation of the GNOME platform and desktop as defined
10082 by the GNOME project; this is based on the components distributed in 10082 by the GNOME project; this is based on the components distributed in
10083 the <code class="filename">platform/x.y/x.y.z/sources</code> and 10083 the <code class="filename">platform/x.y/x.y.z/sources</code> and
10084 <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the 10084 <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the
10085 official FTP server. Developer-only tools found in those 10085 official FTP server. Developer-only tools found in those
10086 directories are not installed unless required by some other 10086 directories are not installed unless required by some other
10087 component to work properly. Similarly, packages from the bindings 10087 component to work properly. Similarly, packages from the bindings
10088 set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled 10088 set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled
10089 in unless required as a dependency for an end-user component. This 10089 in unless required as a dependency for an end-user component. This
10090 package "extends" <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>.</p></li> 10090 package "extends" <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>.</p></li>
10091<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a>: 10091<li class="listitem"><p><a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a>:
10092 Installs all the tools required to build a GNOME component when 10092 Installs all the tools required to build a GNOME component when
10093 fetched from the CVS repository. These are required to let the 10093 fetched from the CVS repository. These are required to let the
10094 <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li> 10094 <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li>
10095</ul></div> 10095</ul></div>
10096<p>In all these packages, the <code class="varname">DEPENDS</code> lines are 10096<p>In all these packages, the <code class="varname">DEPENDS</code> lines are
10097sorted in a way that eases updates: a package may depend on other 10097sorted in a way that eases updates: a package may depend on other
10098packages listed before it but not on any listed after it. It is very 10098packages listed before it but not on any listed after it. It is very
10099important to keep this order to ease updates so... <span class="emphasis"><em>do not 10099important to keep this order to ease updates so... <span class="emphasis"><em>do not
10100change it to alphabetical sorting!</em></span></p> 10100change it to alphabetical sorting!</em></span></p>
10101</div> 10101</div>
10102<div class="sect1"> 10102<div class="sect1">
10103<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10103<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10104<a name="new-package"></a>23.2. Packaging a GNOME application</h2></div></div></div> 10104<a name="new-package"></a>23.2. Packaging a GNOME application</h2></div></div></div>
10105<p>Almost all GNOME applications are written in C and use a common 10105<p>Almost all GNOME applications are written in C and use a common
10106set of tools as their build system. Things get different with the new 10106set of tools as their build system. Things get different with the new
10107bindings to other languages (such as Python), but the following will 10107bindings to other languages (such as Python), but the following will
10108give you a general idea on the minimum required tools:</p> 10108give you a general idea on the minimum required tools:</p>
10109<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 10109<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
10110<li class="listitem"> 10110<li class="listitem">
10111<p>Almost all GNOME applications use the GNU Autotools as their 10111<p>Almost all GNOME applications use the GNU Autotools as their
10112 build system. As a general rule you will need to tell this to your 10112 build system. As a general rule you will need to tell this to your
10113 package:</p> 10113 package:</p>
10114<pre class="programlisting"> 10114<pre class="programlisting">
10115GNU_CONFIGURE=yes 10115GNU_CONFIGURE=yes
10116USE_LIBTOOL=yes 10116USE_LIBTOOL=yes
10117USE_TOOLS+=gmake 10117USE_TOOLS+=gmake
10118</pre> 10118</pre>
10119</li> 10119</li>
10120<li class="listitem"> 10120<li class="listitem">
10121<p>If the package uses pkg-config to detect dependencies, add this 10121<p>If the package uses pkg-config to detect dependencies, add this
10122 tool to the list of required utilities:</p> 10122 tool to the list of required utilities:</p>
10123<pre class="programlisting">USE_TOOLS+=pkg-config</pre> 10123<pre class="programlisting">USE_TOOLS+=pkg-config</pre>
10124<p>Also use <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/verifypc/README.html" target="_top"><code class="filename">pkgtools/verifypc</code></a> at 10124<p>Also use <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/verifypc/README.html" target="_top"><code class="filename">pkgtools/verifypc</code></a> at
10125 the end of the build process to ensure that you did not miss to 10125 the end of the build process to ensure that you did not miss to
10126 specify any dependency in your package and that the version 10126 specify any dependency in your package and that the version
10127 requirements are all correct.</p> 10127 requirements are all correct.</p>
10128</li> 10128</li>
10129<li class="listitem"><p>If the package uses intltool, be sure to add 10129<li class="listitem"><p>If the package uses intltool, be sure to add
10130 <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code> 10130 <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>
10131 to handle dependencies and to force the package to use the latest 10131 to handle dependencies and to force the package to use the latest
10132 available version.</p></li> 10132 available version.</p></li>
10133<li class="listitem"> 10133<li class="listitem">
10134<p>If the package uses gtk-doc (a documentation generation 10134<p>If the package uses gtk-doc (a documentation generation
10135 utility), do <span class="emphasis"><em>not</em></span> add a dependency on it. The 10135 utility), do <span class="emphasis"><em>not</em></span> add a dependency on it. The
10136 tool is rather big and the distfile should come with pregenerated 10136 tool is rather big and the distfile should come with pregenerated
10137 documentation anyway; if it does not, it is a bug that you ought to 10137 documentation anyway; if it does not, it is a bug that you ought to
10138 report. For such packages you should disable gtk-doc (unless it is 10138 report. For such packages you should disable gtk-doc (unless it is
10139 the default):</p> 10139 the default):</p>
10140<pre class="programlisting">CONFIGURE_ARGS+=--disable-gtk-doc</pre> 10140<pre class="programlisting">CONFIGURE_ARGS+=--disable-gtk-doc</pre>
10141<p>The default location of installed HTML files 10141<p>The default location of installed HTML files
10142 (<code class="filename">share/gtk-doc/&lt;package-name&gt;</code>) is correct 10142 (<code class="filename">share/gtk-doc/&lt;package-name&gt;</code>) is correct
10143 and should not be changed unless the package insists on installing 10143 and should not be changed unless the package insists on installing
10144 them somewhere else. Otherwise programs as 10144 them somewhere else. Otherwise programs as
10145 <span class="command"><strong>devhelp</strong></span> will not be able to open them. You can 10145 <span class="command"><strong>devhelp</strong></span> will not be able to open them. You can
10146 do that with an entry similar to:</p> 10146 do that with an entry similar to:</p>
10147<pre class="programlisting">CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...</pre> 10147<pre class="programlisting">CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...</pre>
10148</li> 10148</li>
10149</ul></div> 10149</ul></div>
10150<p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and 10150<p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and
10151files under the installation prefix to maintain databases. In this 10151files under the installation prefix to maintain databases. In this
10152context, shared means that those exact same directories and files are 10152context, shared means that those exact same directories and files are
10153used among several different packages, leading to conflicts in the 10153used among several different packages, leading to conflicts in the
10154<code class="filename">PLIST</code>. pkgsrc currently includes functionality to 10154<code class="filename">PLIST</code>. pkgsrc currently includes functionality to
10155handle the most common cases, so you have to forget about using 10155handle the most common cases, so you have to forget about using
10156<code class="literal">@unexec ${RMDIR}</code> lines in your file lists and 10156<code class="literal">@unexec ${RMDIR}</code> lines in your file lists and
10157omitting shared files from them. If you find yourself doing those, 10157omitting shared files from them. If you find yourself doing those,
10158<span class="emphasis"><em>your package is most likely incorrect</em></span>.</p> 10158<span class="emphasis"><em>your package is most likely incorrect</em></span>.</p>
10159<p>The following table lists the common situations that result in 10159<p>The following table lists the common situations that result in
10160using shared directories or files. For each of them, the appropriate 10160using shared directories or files. For each of them, the appropriate
10161solution is given. After applying the solution be sure to 10161solution is given. After applying the solution be sure to
10162<span class="emphasis"><em>regenerate the package's file list</em></span> with 10162<span class="emphasis"><em>regenerate the package's file list</em></span> with
10163<span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p> 10163<span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p>
10164<div class="table"> 10164<div class="table">
10165<a name="plist-handling"></a><p class="title"><b>Table 23.1. PLIST handling for GNOME packages</b></p> 10165<a name="plist-handling"></a><p class="title"><b>Table 23.1. PLIST handling for GNOME packages</b></p>
10166<div class="table-contents"><table summary="PLIST handling for GNOME packages" border="1"> 10166<div class="table-contents"><table summary="PLIST handling for GNOME packages" border="1">
10167<colgroup> 10167<colgroup>
10168<col> 10168<col>
10169<col> 10169<col>
10170</colgroup> 10170</colgroup>
10171<thead><tr> 10171<thead><tr>
10172<th>If the package...</th> 10172<th>If the package...</th>
10173<th>Then...</th> 10173<th>Then...</th>
10174</tr></thead> 10174</tr></thead>
10175<tbody> 10175<tbody>
10176<tr> 10176<tr>
10177<td>Installs OMF files under <code class="filename">share/omf</code>.</td> 10177<td>Installs OMF files under <code class="filename">share/omf</code>.</td>
10178<td>See <a class="xref" href="#scrollkeeper-data-files" title="19.6.10. Packages installing scrollkeeper/rarian data files">Section 19.6.10, &#8220;Packages installing scrollkeeper/rarian data files&#8221;</a>.</td> 10178<td>See <a class="xref" href="#scrollkeeper-data-files" title="19.6.10. Packages installing scrollkeeper/rarian data files">Section 19.6.10, &#8220;Packages installing scrollkeeper/rarian data files&#8221;</a>.</td>
10179</tr> 10179</tr>
10180<tr> 10180<tr>
10181<td>Installs icons under the 10181<td>Installs icons under the
10182 <code class="filename">share/icons/hicolor</code> hierarchy or updates 10182 <code class="filename">share/icons/hicolor</code> hierarchy or updates
10183 <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td> 10183 <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td>
10184<td>See <a class="xref" href="#hicolor-theme" title="19.6.19. Packages installing hicolor theme icons">Section 19.6.19, &#8220;Packages installing hicolor theme icons&#8221;</a>.</td> 10184<td>See <a class="xref" href="#hicolor-theme" title="19.6.19. Packages installing hicolor theme icons">Section 19.6.19, &#8220;Packages installing hicolor theme icons&#8221;</a>.</td>
10185</tr> 10185</tr>
10186<tr> 10186<tr>
10187<td>Installs files under 10187<td>Installs files under
10188 <code class="filename">share/mime/packages</code>.</td> 10188 <code class="filename">share/mime/packages</code>.</td>
10189<td>See <a class="xref" href="#mime-database" title="19.6.14. Packages installing extensions to the MIME database">Section 19.6.14, &#8220;Packages installing extensions to the MIME database&#8221;</a>.</td> 10189<td>See <a class="xref" href="#mime-database" title="19.6.14. Packages installing extensions to the MIME database">Section 19.6.14, &#8220;Packages installing extensions to the MIME database&#8221;</a>.</td>
10190</tr> 10190</tr>
10191<tr> 10191<tr>
10192<td>Installs <code class="filename">.desktop</code> files under 10192<td>Installs <code class="filename">.desktop</code> files under
10193 <code class="filename">share/applications</code> and these include MIME 10193 <code class="filename">share/applications</code> and these include MIME
10194 information.</td> 10194 information.</td>
10195<td>See <a class="xref" href="#desktop-files" title="19.6.20. Packages installing desktop files">Section 19.6.20, &#8220;Packages installing desktop files&#8221;</a>.</td> 10195<td>See <a class="xref" href="#desktop-files" title="19.6.20. Packages installing desktop files">Section 19.6.20, &#8220;Packages installing desktop files&#8221;</a>.</td>
10196</tr> 10196</tr>
10197</tbody> 10197</tbody>
10198</table></div> 10198</table></div>
10199</div> 10199</div>
10200<br class="table-break"> 10200<br class="table-break">
10201</div> 10201</div>
10202<div class="sect1"> 10202<div class="sect1">
10203<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10203<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10204<a name="full-update"></a>23.3. Updating GNOME to a newer version</h2></div></div></div> 10204<a name="full-update"></a>23.3. Updating GNOME to a newer version</h2></div></div></div>
10205<p>When seeing GNOME as a whole, there are two kinds of 10205<p>When seeing GNOME as a whole, there are two kinds of
10206updates:</p> 10206updates:</p>
10207<div class="variablelist"><dl class="variablelist"> 10207<div class="variablelist"><dl class="variablelist">
10208<dt><span class="term">Major update</span></dt> 10208<dt><span class="term">Major update</span></dt>
10209<dd> 10209<dd>
10210<p>Given that there is still a very long way for GNOME 3 (if it 10210<p>Given that there is still a very long way for GNOME 3 (if it
10211 ever appears), we consider a major update one that goes from a 10211 ever appears), we consider a major update one that goes from a
10212 <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one, 10212 <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one,
10213 where <code class="literal">Y</code> is even and greater than 10213 where <code class="literal">Y</code> is even and greater than
10214 <code class="literal">X</code>. These are hard to achieve because they 10214 <code class="literal">X</code>. These are hard to achieve because they
10215 introduce lots of changes in the components' code and almost all 10215 introduce lots of changes in the components' code and almost all
10216 GNOME distfiles are updated to newer versions. Some of them can 10216 GNOME distfiles are updated to newer versions. Some of them can
10217 even break API and ABI compatibility with the previous major 10217 even break API and ABI compatibility with the previous major
10218 version series. As a result, the update needs to be done all at 10218 version series. As a result, the update needs to be done all at
10219 once to minimize breakage.</p> 10219 once to minimize breakage.</p>
10220<p>A major update typically consists of around 80 package 10220<p>A major update typically consists of around 80 package
10221 updates and the addition of some new ones.</p> 10221 updates and the addition of some new ones.</p>
10222</dd> 10222</dd>
10223<dt><span class="term">Minor update</span></dt> 10223<dt><span class="term">Minor update</span></dt>
10224<dd> 10224<dd>
10225<p>We consider a minor update one that goes from a 10225<p>We consider a minor update one that goes from a
10226 <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code> 10226 <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code>
10227 one where <code class="literal">Y</code> is greater than 10227 one where <code class="literal">Y</code> is greater than
10228 <code class="literal">X</code>. These are easy to achieve because they do 10228 <code class="literal">X</code>. These are easy to achieve because they do
10229 not update all GNOME components, can be done in an incremental way 10229 not update all GNOME components, can be done in an incremental way
10230 and do not break API nor ABI compatibility.</p> 10230 and do not break API nor ABI compatibility.</p>
10231<p>A minor update typically consists of around 50 package 10231<p>A minor update typically consists of around 50 package
10232 updates, although the numbers here may vary a lot.</p> 10232 updates, although the numbers here may vary a lot.</p>
10233</dd> 10233</dd>
10234</dl></div> 10234</dl></div>
10235<p>In order to update the GNOME components in pkgsrc to a new stable 10235<p>In order to update the GNOME components in pkgsrc to a new stable
10236release (either major or minor), the following steps should be 10236release (either major or minor), the following steps should be
10237followed:</p> 10237followed:</p>
10238<div class="orderedlist"><ol class="orderedlist" type="1"> 10238<div class="orderedlist"><ol class="orderedlist" type="1">
10239<li class="listitem"> 10239<li class="listitem">
10240<p>Get a list of all the tarballs that form the new release by 10240<p>Get a list of all the tarballs that form the new release by
10241 using the following commands. These will leave the full list of the 10241 using the following commands. These will leave the full list of the
10242 components' distfiles into the <code class="filename">list.txt</code> 10242 components' distfiles into the <code class="filename">list.txt</code>
10243 file:</p> 10243 file:</p>
10244<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \ 10244<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
10245 ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \ 10245 ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
10246 awk '{ print $9 }' &gt;list.txt</code></strong> 10246 awk '{ print $9 }' &gt;list.txt</code></strong>
10247<code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \ 10247<code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
10248 ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \ 10248 ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
10249 awk '{ print $9 }' &gt;&gt;list.txt</code></strong></pre> 10249 awk '{ print $9 }' &gt;&gt;list.txt</code></strong></pre>
10250</li> 10250</li>
10251<li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and 10251<li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and
10252 bump their version to the release you are updating them to. The 10252 bump their version to the release you are updating them to. The
10253 three meta packages should be always consistent with versioning. 10253 three meta packages should be always consistent with versioning.
10254 Obviously remove any <code class="varname">PKGREVISION</code>s that might be 10254 Obviously remove any <code class="varname">PKGREVISION</code>s that might be
10255 in them.</p></li> 10255 in them.</p></li>
10256<li class="listitem"> 10256<li class="listitem">
10257<p>For each meta package, update all its 10257<p>For each meta package, update all its
10258 <code class="varname">DEPENDS</code> lines to match the latest versions as 10258 <code class="varname">DEPENDS</code> lines to match the latest versions as
10259 shown by the above commands. Do <span class="emphasis"><em>not</em></span> list any 10259 shown by the above commands. Do <span class="emphasis"><em>not</em></span> list any
10260 newer version (even if found in the FTP) because the meta packages 10260 newer version (even if found in the FTP) because the meta packages
10261 are supposed to list the exact versions that form a specific GNOME 10261 are supposed to list the exact versions that form a specific GNOME
10262 release. Exceptions are permitted here if a newer version solves a 10262 release. Exceptions are permitted here if a newer version solves a
10263 serious issue in the overall desktop experience; these typically 10263 serious issue in the overall desktop experience; these typically
10264 come in the form of a revision bump in pkgsrc, not in newer versions 10264 come in the form of a revision bump in pkgsrc, not in newer versions
10265 from the developers.</p> 10265 from the developers.</p>
10266<p>Packages not listed in the <code class="filename">list.txt</code> file 10266<p>Packages not listed in the <code class="filename">list.txt</code> file
10267 should be updated to the latest version available (if found in 10267 should be updated to the latest version available (if found in
10268 pkgsrc). This is the case, for example, of the dependencies on the 10268 pkgsrc). This is the case, for example, of the dependencies on the
10269 GNU Autotools in the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a> meta package.</p> 10269 GNU Autotools in the <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a> meta package.</p>
10270</li> 10270</li>
10271<li class="listitem"> 10271<li class="listitem">
10272<p>Generate a patch from the modified meta packages and extract the 10272<p>Generate a patch from the modified meta packages and extract the
10273 list of "new" lines. This will provide you an outline on what 10273 list of "new" lines. This will provide you an outline on what
10274 packages need to be updated in pkgsrc and in what order:</p> 10274 packages need to be updated in pkgsrc and in what order:</p>
10275<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs diff -u gnome-devel gnome-base gnome | grep '^+D' &gt;todo.txt</code></strong></pre> 10275<pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs diff -u gnome-devel gnome-base gnome | grep '^+D' &gt;todo.txt</code></strong></pre>
10276</li> 10276</li>
10277<li class="listitem"><p>For major desktop updates it is recommended to zap all your 10277<li class="listitem"><p>For major desktop updates it is recommended to zap all your
10278 installed packages and start over from scratch at this point.</p></li> 10278 installed packages and start over from scratch at this point.</p></li>
10279<li class="listitem"><p>Now comes the longest step by far: iterate over the contents 10279<li class="listitem"><p>Now comes the longest step by far: iterate over the contents
10280 of <code class="filename">todo.txt</code> and update the packages listed in 10280 of <code class="filename">todo.txt</code> and update the packages listed in
10281 it in order. For major desktop updates none of these should be 10281 it in order. For major desktop updates none of these should be
10282 committed until the entire set is completed because there are chances 10282 committed until the entire set is completed because there are chances
10283 of breaking not-yet-updated packages.</p></li> 10283 of breaking not-yet-updated packages.</p></li>
10284<li class="listitem"><p>Once the packages are up to date and working, commit them to 10284<li class="listitem"><p>Once the packages are up to date and working, commit them to
10285 the tree one by one with appropriate log messages. At the end, 10285 the tree one by one with appropriate log messages. At the end,
10286 commit the three meta package updates and all the corresponding 10286 commit the three meta package updates and all the corresponding
10287 changes to the <code class="filename">doc/CHANGES-&lt;YEAR&gt;</code> and 10287 changes to the <code class="filename">doc/CHANGES-&lt;YEAR&gt;</code> and
10288 <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/doc/TODO?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">pkgsrc/doc/TODO</code></a> files.</p></li> 10288 <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/doc/TODO?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">pkgsrc/doc/TODO</code></a> files.</p></li>
10289</ol></div> 10289</ol></div>
10290</div> 10290</div>
10291<div class="sect1"> 10291<div class="sect1">
10292<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10292<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10293<a name="patching"></a>23.4. Patching guidelines</h2></div></div></div> 10293<a name="patching"></a>23.4. Patching guidelines</h2></div></div></div>
10294<p>GNOME is a very big component in pkgsrc which approaches 100 10294<p>GNOME is a very big component in pkgsrc which approaches 100
10295packages. Please, it is very important that you always, always, 10295packages. Please, it is very important that you always, always,
10296<span class="strong"><strong>always</strong></span> feed back any portability 10296<span class="strong"><strong>always</strong></span> feed back any portability
10297fixes you do to a GNOME package to the mainstream developers (see <a class="xref" href="#components.patches.feedback" title="11.3.5. Feedback to the author">Section 11.3.5, &#8220;Feedback to the author&#8221;</a>). This is the only way to get 10297fixes you do to a GNOME package to the mainstream developers (see <a class="xref" href="#components.patches.feedback" title="11.3.5. Feedback to the author">Section 11.3.5, &#8220;Feedback to the author&#8221;</a>). This is the only way to get
10298their attention on portability issues and to ensure that future versions 10298their attention on portability issues and to ensure that future versions
10299can be built out-of-the box on NetBSD. The less custom patches in 10299can be built out-of-the box on NetBSD. The less custom patches in
10300pkgsrc, the easier further updates are. Those developers in charge of 10300pkgsrc, the easier further updates are. Those developers in charge of
10301issuing major GNOME updates will be grateful if you do that.</p> 10301issuing major GNOME updates will be grateful if you do that.</p>
10302<p>The most common places to report bugs are the <a class="ulink" href="http://bugzilla.gnome.org/" target="_top">GNOME's Bugzilla</a> and the <a class="ulink" href="http://bugzilla.freedesktop.org/" target="_top">freedesktop.org's 10302<p>The most common places to report bugs are the <a class="ulink" href="http://bugzilla.gnome.org/" target="_top">GNOME's Bugzilla</a> and the <a class="ulink" href="http://bugzilla.freedesktop.org/" target="_top">freedesktop.org's
10303Bugzilla</a>. Not all components use these to track bugs, but most 10303Bugzilla</a>. Not all components use these to track bugs, but most
10304of them do. Do not be short on your reports: always provide detailed 10304of them do. Do not be short on your reports: always provide detailed
10305explanations of the current failure, how it can be improved to achieve 10305explanations of the current failure, how it can be improved to achieve
10306maximum portability and, if at all possible, provide a patch against CVS 10306maximum portability and, if at all possible, provide a patch against CVS
10307head. The more verbose you are, the higher chances of your patch being 10307head. The more verbose you are, the higher chances of your patch being
10308accepted.</p> 10308accepted.</p>
10309<p>Also, please avoid using preprocessor magic to fix portability 10309<p>Also, please avoid using preprocessor magic to fix portability
10310issues. While the FreeBSD GNOME people are doing a great job in porting 10310issues. While the FreeBSD GNOME people are doing a great job in porting
10311GNOME to their operating system, the official GNOME sources are now 10311GNOME to their operating system, the official GNOME sources are now
10312plagued by conditionals that check for <code class="varname">__FreeBSD__</code> 10312plagued by conditionals that check for <code class="varname">__FreeBSD__</code>
10313and similar macros. This hurts portability. Please see our patching 10313and similar macros. This hurts portability. Please see our patching
10314guidelines (<a class="xref" href="#components.patches.guidelines" title="11.3.4. Patching guidelines">Section 11.3.4, &#8220;Patching guidelines&#8221;</a>) for more 10314guidelines (<a class="xref" href="#components.patches.guidelines" title="11.3.4. Patching guidelines">Section 11.3.4, &#8220;Patching guidelines&#8221;</a>) for more
10315details.</p> 10315details.</p>
10316</div> 10316</div>
10317</div> 10317</div>
10318</div> 10318</div>
10319<div class="part"> 10319<div class="part">
10320<div class="titlepage"><div><div><h1 class="title"> 10320<div class="titlepage"><div><div><h1 class="title">
10321<a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div> 10321<a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div>
10322<div class="partintro"> 10322<div class="partintro">
10323<div></div> 10323<div></div>
10324<p>This part of the guide deals with everything 10324<p>This part of the guide deals with everything
10325 from the infrastructure that is behind the interfaces described 10325 from the infrastructure that is behind the interfaces described
10326 in the developer's guide. A casual package maintainer should not 10326 in the developer's guide. A casual package maintainer should not
10327 need anything from this part.</p> 10327 need anything from this part.</p>
10328<div class="toc"> 10328<div class="toc">
10329<p><b>Table of Contents</b></p> 10329<p><b>Table of Contents</b></p>
10330<dl> 10330<dl>
10331<dt><span class="chapter"><a href="#infr.design">24. Design of the pkgsrc infrastructure</a></span></dt> 10331<dt><span class="chapter"><a href="#infr.design">24. Design of the pkgsrc infrastructure</a></span></dt>
10332<dd><dl> 10332<dd><dl>
10333<dt><span class="sect1"><a href="#infr.vardef">24.1. The meaning of variable definitions</a></span></dt> 10333<dt><span class="sect1"><a href="#infr.vardef">24.1. The meaning of variable definitions</a></span></dt>
10334<dt><span class="sect1"><a href="#infr.vardef.problems">24.2. Avoiding problems before they arise</a></span></dt> 10334<dt><span class="sect1"><a href="#infr.vardef.problems">24.2. Avoiding problems before they arise</a></span></dt>
10335<dt><span class="sect1"><a href="#infr.var">24.3. Variable evaluation</a></span></dt> 10335<dt><span class="sect1"><a href="#infr.var">24.3. Variable evaluation</a></span></dt>
10336<dd><dl> 10336<dd><dl>
10337<dt><span class="sect2"><a href="#infr.var.load">24.3.1. At load time</a></span></dt> 10337<dt><span class="sect2"><a href="#infr.var.load">24.3.1. At load time</a></span></dt>
10338<dt><span class="sect2"><a href="#infr.var.run">24.3.2. At runtime</a></span></dt> 10338<dt><span class="sect2"><a href="#infr.var.run">24.3.2. At runtime</a></span></dt>
10339</dl></dd> 10339</dl></dd>
10340<dt><span class="sect1"><a href="#infr.varspec">24.4. How can variables be specified?</a></span></dt> 10340<dt><span class="sect1"><a href="#infr.varspec">24.4. How can variables be specified?</a></span></dt>
10341<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt> 10341<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt>
10342<dd><dl> 10342<dd><dl>
10343<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt> 10343<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt>
10344<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt> 10344<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt>
10345</dl></dd> 10345</dl></dd>
10346<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt> 10346<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt>
10347<dd><dl> 10347<dd><dl>
10348<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> 10348<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>
10349<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> 10349<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>
10350</dl></dd> 10350</dl></dd>
10351</dl></dd> 10351</dl></dd>
10352<dt><span class="chapter"><a href="#regression">25. Regression tests</a></span></dt> 10352<dt><span class="chapter"><a href="#regression">25. Regression tests</a></span></dt>
10353<dd><dl> 10353<dd><dl>
10354<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt> 10354<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt>
10355<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt> 10355<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt>
10356<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt> 10356<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt>
10357<dd><dl> 10357<dd><dl>
10358<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt> 10358<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt>
10359<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt> 10359<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt>
10360</dl></dd> 10360</dl></dd>
10361</dl></dd> 10361</dl></dd>
10362<dt><span class="chapter"><a href="#porting">26. Porting pkgsrc</a></span></dt> 10362<dt><span class="chapter"><a href="#porting">26. Porting pkgsrc</a></span></dt>
10363<dd><dl> 10363<dd><dl>
10364<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt> 10364<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt>
10365<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt> 10365<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt>
10366</dl></dd> 10366</dl></dd>
10367</dl> 10367</dl>
10368</div> 10368</div>
10369</div> 10369</div>
10370<div class="chapter"> 10370<div class="chapter">
10371<div class="titlepage"><div><div><h2 class="title"> 10371<div class="titlepage"><div><div><h2 class="title">
10372<a name="infr.design"></a>Chapter 24. Design of the pkgsrc infrastructure</h2></div></div></div> 10372<a name="infr.design"></a>Chapter 24. Design of the pkgsrc infrastructure</h2></div></div></div>
10373<div class="toc"> 10373<div class="toc">
10374<p><b>Table of Contents</b></p> 10374<p><b>Table of Contents</b></p>
10375<dl> 10375<dl>
10376<dt><span class="sect1"><a href="#infr.vardef">24.1. The meaning of variable definitions</a></span></dt> 10376<dt><span class="sect1"><a href="#infr.vardef">24.1. The meaning of variable definitions</a></span></dt>
10377<dt><span class="sect1"><a href="#infr.vardef.problems">24.2. Avoiding problems before they arise</a></span></dt> 10377<dt><span class="sect1"><a href="#infr.vardef.problems">24.2. Avoiding problems before they arise</a></span></dt>
10378<dt><span class="sect1"><a href="#infr.var">24.3. Variable evaluation</a></span></dt> 10378<dt><span class="sect1"><a href="#infr.var">24.3. Variable evaluation</a></span></dt>
10379<dd><dl> 10379<dd><dl>
10380<dt><span class="sect2"><a href="#infr.var.load">24.3.1. At load time</a></span></dt> 10380<dt><span class="sect2"><a href="#infr.var.load">24.3.1. At load time</a></span></dt>
10381<dt><span class="sect2"><a href="#infr.var.run">24.3.2. At runtime</a></span></dt> 10381<dt><span class="sect2"><a href="#infr.var.run">24.3.2. At runtime</a></span></dt>
10382</dl></dd> 10382</dl></dd>
10383<dt><span class="sect1"><a href="#infr.varspec">24.4. How can variables be specified?</a></span></dt> 10383<dt><span class="sect1"><a href="#infr.varspec">24.4. How can variables be specified?</a></span></dt>
10384<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt> 10384<dt><span class="sect1"><a href="#infr.design.intf">24.5. Designing interfaces for Makefile fragments</a></span></dt>
10385<dd><dl> 10385<dd><dl>
10386<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt> 10386<dt><span class="sect2"><a href="#infr.design.intf.proc">24.5.1. Procedures with parameters</a></span></dt>
10387<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt> 10387<dt><span class="sect2"><a href="#infr.design.intf.action">24.5.2. Actions taken on behalf of parameters</a></span></dt>
10388</dl></dd> 10388</dl></dd>
10389<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt> 10389<dt><span class="sect1"><a href="#infr.order">24.6. The order in which files are loaded</a></span></dt>
10390<dd><dl> 10390<dd><dl>
10391<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> 10391<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>
10392<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> 10392<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>
10393</dl></dd> 10393</dl></dd>
10394</dl> 10394</dl>
10395</div> 10395</div>
10396<p>The pkgsrc infrastructure consists of many small Makefile 10396<p>The pkgsrc infrastructure consists of many small Makefile
10397 fragments. Each such fragment needs a properly specified 10397 fragments. Each such fragment needs a properly specified
10398 interface. This chapter explains how such an interface looks 10398 interface. This chapter explains how such an interface looks
10399 like.</p> 10399 like.</p>
10400<div class="sect1"> 10400<div class="sect1">
10401<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10401<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10402<a name="infr.vardef"></a>24.1. The meaning of variable definitions</h2></div></div></div> 10402<a name="infr.vardef"></a>24.1. The meaning of variable definitions</h2></div></div></div>
10403<p>Whenever a variable is defined in the pkgsrc 10403<p>Whenever a variable is defined in the pkgsrc
10404 infrastructure, the location and the way of definition provide 10404 infrastructure, the location and the way of definition provide
10405 much information about the intended use of that variable. 10405 much information about the intended use of that variable.
10406 Additionally, more documentation may be found in a header 10406 Additionally, more documentation may be found in a header
10407 comment or in this pkgsrc guide.</p> 10407 comment or in this pkgsrc guide.</p>
10408<p>A special file is 10408<p>A special file is
10409 <code class="filename">mk/defaults/mk.conf</code>, which lists all 10409 <code class="filename">mk/defaults/mk.conf</code>, which lists all
10410 variables that are intended to be user-defined. They are either 10410 variables that are intended to be user-defined. They are either
10411 defined using the <code class="literal">?=</code> operator or they are 10411 defined using the <code class="literal">?=</code> operator or they are
10412 left undefined because defining them to anything would 10412 left undefined because defining them to anything would
10413 effectively mean <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. All these variables may be 10413 effectively mean <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. All these variables may be
10414 overridden by the pkgsrc user in the <code class="varname">MAKECONF</code> 10414 overridden by the pkgsrc user in the <code class="varname">MAKECONF</code>
10415 file.</p> 10415 file.</p>
10416<p>Outside this file, the following conventions apply: 10416<p>Outside this file, the following conventions apply:
10417 Variables that are defined using the <code class="literal">?=</code> 10417 Variables that are defined using the <code class="literal">?=</code>
10418 operator may be overridden by a package.</p> 10418 operator may be overridden by a package.</p>
10419<p>Variables that are defined using the <code class="literal">=</code> 10419<p>Variables that are defined using the <code class="literal">=</code>
10420 operator may be used read-only at run-time.</p> 10420 operator may be used read-only at run-time.</p>
10421<p>Variables whose name starts with an underscore must not be 10421<p>Variables whose name starts with an underscore must not be
10422 accessed outside the pkgsrc infrastructure at all. They may 10422 accessed outside the pkgsrc infrastructure at all. They may
10423 change without further notice.</p> 10423 change without further notice.</p>
10424<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 10424<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
10425<h3 class="title">Note</h3> 10425<h3 class="title">Note</h3>
10426<p>These conventions are currently not applied 10426<p>These conventions are currently not applied
10427 consistently to the complete pkgsrc 10427 consistently to the complete pkgsrc
10428 infrastructure.</p> 10428 infrastructure.</p>
10429</div> 10429</div>
10430</div> 10430</div>
10431<div class="sect1"> 10431<div class="sect1">
10432<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10432<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10433<a name="infr.vardef.problems"></a>24.2. Avoiding problems before they arise</h2></div></div></div> 10433<a name="infr.vardef.problems"></a>24.2. Avoiding problems before they arise</h2></div></div></div>
10434<p>All variables that contain lists of things should default 10434<p>All variables that contain lists of things should default
10435 to being empty. Two examples that do not follow this rule are 10435 to being empty. Two examples that do not follow this rule are
10436 <code class="varname">USE_LANGUAGES</code> and 10436 <code class="varname">USE_LANGUAGES</code> and
10437 <code class="varname">DISTFILES</code>. These variables cannot simply be 10437 <code class="varname">DISTFILES</code>. These variables cannot simply be
10438 modified using the <code class="literal">+=</code> operator in package 10438 modified using the <code class="literal">+=</code> operator in package
10439 <code class="filename">Makefile</code>s (or other files included by 10439 <code class="filename">Makefile</code>s (or other files included by
10440 them), since there is no guarantee whether the variable is 10440 them), since there is no guarantee whether the variable is
10441 already set or not, and what its value is. In the case of 10441 already set or not, and what its value is. In the case of
10442 <code class="varname">DISTFILES</code>, the packages <span class="quote">&#8220;<span class="quote">know</span>&#8221;</span> 10442 <code class="varname">DISTFILES</code>, the packages <span class="quote">&#8220;<span class="quote">know</span>&#8221;</span>
10443 the default value and just define it as in the following 10443 the default value and just define it as in the following
10444 example.</p> 10444 example.</p>
10445<pre class="programlisting"> 10445<pre class="programlisting">
10446DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz 10446DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
10447</pre> 10447</pre>
10448<p>Because of the selection of this default value, the same 10448<p>Because of the selection of this default value, the same
10449 value appears in many package Makefiles. Similarly for 10449 value appears in many package Makefiles. Similarly for
10450 <code class="varname">USE_LANGUAGES</code>, but in this case the default 10450 <code class="varname">USE_LANGUAGES</code>, but in this case the default
10451 value (<span class="quote">&#8220;<span class="quote"><code class="literal">c</code></span>&#8221;</span>) is so short that it 10451 value (<span class="quote">&#8220;<span class="quote"><code class="literal">c</code></span>&#8221;</span>) is so short that it
10452 doesn't stand out. Nevertheless it is mentioned in many 10452 doesn't stand out. Nevertheless it is mentioned in many
10453 files.</p> 10453 files.</p>
10454</div> 10454</div>
10455<div class="sect1"> 10455<div class="sect1">
10456<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10456<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10457<a name="infr.var"></a>24.3. Variable evaluation</h2></div></div></div> 10457<a name="infr.var"></a>24.3. Variable evaluation</h2></div></div></div>
10458<div class="sect2"> 10458<div class="sect2">
10459<div class="titlepage"><div><div><h3 class="title"> 10459<div class="titlepage"><div><div><h3 class="title">
10460<a name="infr.var.load"></a>24.3.1. At load time</h3></div></div></div> 10460<a name="infr.var.load"></a>24.3.1. At load time</h3></div></div></div>
10461<p>Variable evaluation takes place either at load time or at 10461<p>Variable evaluation takes place either at load time or at
10462 runtime, depending on the context in which they occur. The 10462 runtime, depending on the context in which they occur. The
10463 contexts where variables are evaluated at load time are:</p> 10463 contexts where variables are evaluated at load time are:</p>
10464<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 10464<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
10465<li class="listitem"><p>The right hand side of the <code class="literal">:=</code> 10465<li class="listitem"><p>The right hand side of the <code class="literal">:=</code>
10466 and <code class="literal">!=</code> operators,</p></li> 10466 and <code class="literal">!=</code> operators,</p></li>
10467<li class="listitem"><p>Make directives like <code class="literal">.if</code> or 10467<li class="listitem"><p>Make directives like <code class="literal">.if</code> or
10468 <code class="literal">.for</code>,</p></li> 10468 <code class="literal">.for</code>,</p></li>
10469<li class="listitem"><p>Dependency lines.</p></li> 10469<li class="listitem"><p>Dependency lines.</p></li>
10470</ul></div> 10470</ul></div>
10471<p>A special exception are references to the iteration 10471<p>A special exception are references to the iteration
10472 variables of <code class="literal">.for</code> loops, which are expanded 10472 variables of <code class="literal">.for</code> loops, which are expanded
10473 inline, no matter in which context they appear.</p> 10473 inline, no matter in which context they appear.</p>
10474<p>As the values of variables may change during load time, 10474<p>As the values of variables may change during load time,
10475 care must be taken not to evaluate them by accident. Typical 10475 care must be taken not to evaluate them by accident. Typical
10476 examples for variables that should not be evaluated at load time 10476 examples for variables that should not be evaluated at load time
10477 are <code class="varname">DEPENDS</code> and 10477 are <code class="varname">DEPENDS</code> and
10478 <code class="varname">CONFIGURE_ARGS</code>. To make the effect more 10478 <code class="varname">CONFIGURE_ARGS</code>. To make the effect more
10479 clear, here is an example:</p> 10479 clear, here is an example:</p>
10480<pre class="programlisting"> 10480<pre class="programlisting">
10481CONFIGURE_ARGS= # none 10481CONFIGURE_ARGS= # none
10482CFLAGS= -O 10482CFLAGS= -O
10483CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q} 10483CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
10484 10484
10485CONFIGURE_ARGS:= ${CONFIGURE_ARGS} 10485CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
10486 10486
10487CFLAGS+= -Wall 10487CFLAGS+= -Wall
10488 </pre> 10488 </pre>
10489<p>This code shows how the use of the <code class="literal">:=</code> 10489<p>This code shows how the use of the <code class="literal">:=</code>
10490 operator can quickly lead to unexpected results. The first 10490 operator can quickly lead to unexpected results. The first
10491 paragraph is fairly common code. The second paragraph evaluates 10491 paragraph is fairly common code. The second paragraph evaluates
10492 the <code class="varname">CONFIGURE_ARGS</code> variable, which results in 10492 the <code class="varname">CONFIGURE_ARGS</code> variable, which results in
10493 <code class="literal">CFLAGS=-O</code>. In the third paragraph, the 10493 <code class="literal">CFLAGS=-O</code>. In the third paragraph, the
10494 <code class="literal">-Wall</code> is appended to the 10494 <code class="literal">-Wall</code> is appended to the
10495 <code class="varname">CFLAGS</code>, but this addition will not appear in 10495 <code class="varname">CFLAGS</code>, but this addition will not appear in
10496 <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three 10496 <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three
10497 paragraphs from above typically occur in completely unrelated 10497 paragraphs from above typically occur in completely unrelated
10498 files.</p> 10498 files.</p>
10499</div> 10499</div>
10500<div class="sect2"> 10500<div class="sect2">
10501<div class="titlepage"><div><div><h3 class="title"> 10501<div class="titlepage"><div><div><h3 class="title">
10502<a name="infr.var.run"></a>24.3.2. At runtime</h3></div></div></div> 10502<a name="infr.var.run"></a>24.3.2. At runtime</h3></div></div></div>
10503<p>After all the files have been loaded, the values of the 10503<p>After all the files have been loaded, the values of the
10504 variables cannot be changed anymore. Variables that are used in 10504 variables cannot be changed anymore. Variables that are used in
10505 the shell commands are expanded at this point.</p> 10505 the shell commands are expanded at this point.</p>
10506</div> 10506</div>
10507</div> 10507</div>
10508<div class="sect1"> 10508<div class="sect1">
10509<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10509<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10510<a name="infr.varspec"></a>24.4. How can variables be specified?</h2></div></div></div> 10510<a name="infr.varspec"></a>24.4. How can variables be specified?</h2></div></div></div>
10511<p>There are many ways in which the definition and use of a 10511<p>There are many ways in which the definition and use of a
10512 variable can be restricted in order to detect bugs and 10512 variable can be restricted in order to detect bugs and
10513 violations of the (mostly unwritten) policies. See the 10513 violations of the (mostly unwritten) policies. See the
10514 <code class="literal">pkglint</code> developer's documentation for further 10514 <code class="literal">pkglint</code> developer's documentation for further
10515 details.</p> 10515 details.</p>
10516</div> 10516</div>
10517<div class="sect1"> 10517<div class="sect1">
10518<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10518<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10519<a name="infr.design.intf"></a>24.5. Designing interfaces for Makefile fragments</h2></div></div></div> 10519<a name="infr.design.intf"></a>24.5. Designing interfaces for Makefile fragments</h2></div></div></div>
10520<p>Most of the <code class="filename">.mk</code> files fall into one 10520<p>Most of the <code class="filename">.mk</code> files fall into one
10521 of the following classes. Cases where a file falls into more 10521 of the following classes. Cases where a file falls into more
10522 than one class should be avoided as it often leads to subtle 10522 than one class should be avoided as it often leads to subtle
10523 bugs.</p> 10523 bugs.</p>
10524<div class="sect2"> 10524<div class="sect2">
10525<div class="titlepage"><div><div><h3 class="title"> 10525<div class="titlepage"><div><div><h3 class="title">
10526<a name="infr.design.intf.proc"></a>24.5.1. Procedures with parameters</h3></div></div></div> 10526<a name="infr.design.intf.proc"></a>24.5.1. Procedures with parameters</h3></div></div></div>
10527<p>In a traditional imperative programming language some of 10527<p>In a traditional imperative programming language some of
10528 the <code class="filename">.mk</code> files could be described as 10528 the <code class="filename">.mk</code> files could be described as
10529 procedures. They take some input parameters and&mdash;after 10529 procedures. They take some input parameters and&mdash;after
10530 inclusion&mdash;provide a result in output parameters. Since all 10530 inclusion&mdash;provide a result in output parameters. Since all
10531 variables in <code class="filename">Makefile</code>s have global scope 10531 variables in <code class="filename">Makefile</code>s have global scope
10532 care must be taken not to use parameter names that have already 10532 care must be taken not to use parameter names that have already
10533 another meaning. For example, <code class="varname">PKGNAME</code> is a 10533 another meaning. For example, <code class="varname">PKGNAME</code> is a
10534 bad choice for a parameter name.</p> 10534 bad choice for a parameter name.</p>
10535<p>Procedures are completely evaluated at preprocessing time. 10535<p>Procedures are completely evaluated at preprocessing time.
10536 That is, when calling a procedure all input parameters must be 10536 That is, when calling a procedure all input parameters must be
10537 completely resolvable. For example, 10537 completely resolvable. For example,
10538 <code class="varname">CONFIGURE_ARGS</code> should never be an input 10538 <code class="varname">CONFIGURE_ARGS</code> should never be an input
10539 parameter since it is very likely that further text will be 10539 parameter since it is very likely that further text will be
10540 added after calling the procedure, which would effectively apply 10540 added after calling the procedure, which would effectively apply
10541 the procedure to only a part of the variable. Also, references 10541 the procedure to only a part of the variable. Also, references
10542 to other variables wit will be modified after calling the 10542 to other variables wit will be modified after calling the
10543 procedure.</p> 10543 procedure.</p>
10544<p>A procedure can declare its output parameters either as 10544<p>A procedure can declare its output parameters either as
10545 suitable for use in preprocessing directives or as only 10545 suitable for use in preprocessing directives or as only
10546 available at runtime. The latter alternative is for variables 10546 available at runtime. The latter alternative is for variables
10547 that contain references to other runtime variables.</p> 10547 that contain references to other runtime variables.</p>
10548<p>Procedures shall be written such that it is possible to 10548<p>Procedures shall be written such that it is possible to
10549 call the procedure more than once. That is, the file must not 10549 call the procedure more than once. That is, the file must not
10550 contain multiple-inclusion guards.</p> 10550 contain multiple-inclusion guards.</p>
10551<p>Examples for procedures are 10551<p>Examples for procedures are
10552 <code class="filename">mk/bsd.options.mk</code> and 10552 <code class="filename">mk/bsd.options.mk</code> and
10553 <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express 10553 <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express
10554 that the parameters are evaluated at load time, they should be 10554 that the parameters are evaluated at load time, they should be
10555 assigned using the <code class="literal">:=</code> operator, which should 10555 assigned using the <code class="literal">:=</code> operator, which should
10556 be used only for this purpose.</p> 10556 be used only for this purpose.</p>
10557</div> 10557</div>
10558<div class="sect2"> 10558<div class="sect2">
10559<div class="titlepage"><div><div><h3 class="title"> 10559<div class="titlepage"><div><div><h3 class="title">
10560<a name="infr.design.intf.action"></a>24.5.2. Actions taken on behalf of parameters</h3></div></div></div> 10560<a name="infr.design.intf.action"></a>24.5.2. Actions taken on behalf of parameters</h3></div></div></div>
10561<p>Action files take some input parameters and may define 10561<p>Action files take some input parameters and may define
10562 runtime variables. They shall not define loadtime variables. 10562 runtime variables. They shall not define loadtime variables.
10563 There are action files that are included implicitly by the 10563 There are action files that are included implicitly by the
10564 pkgsrc infrastructure, while other must be included 10564 pkgsrc infrastructure, while other must be included
10565 explicitly.</p> 10565 explicitly.</p>
10566<p>An example for action files is 10566<p>An example for action files is
10567 <code class="filename">mk/subst.mk</code>.</p> 10567 <code class="filename">mk/subst.mk</code>.</p>
10568</div> 10568</div>
10569</div> 10569</div>
10570<div class="sect1"> 10570<div class="sect1">
10571<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10571<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10572<a name="infr.order"></a>24.6. The order in which files are loaded</h2></div></div></div> 10572<a name="infr.order"></a>24.6. The order in which files are loaded</h2></div></div></div>
10573<p>Package <code class="filename">Makefile</code>s usually consist of 10573<p>Package <code class="filename">Makefile</code>s usually consist of
10574 a set of variable definitions, and include the file 10574 a set of variable definitions, and include the file
10575 <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line. 10575 <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line.
10576 Before that, they may also include various other 10576 Before that, they may also include various other
10577 <code class="filename">*.mk</code> files if they need to query the 10577 <code class="filename">*.mk</code> files if they need to query the
10578 availability of certain features like the type of compiler or 10578 availability of certain features like the type of compiler or
10579 the X11 implementation. Due to the heavy use of preprocessor 10579 the X11 implementation. Due to the heavy use of preprocessor
10580 directives like <code class="literal">.if</code> and 10580 directives like <code class="literal">.if</code> and
10581 <code class="literal">.for</code>, the order in which the files are loaded 10581 <code class="literal">.for</code>, the order in which the files are loaded
10582 matters.</p> 10582 matters.</p>
10583<p>This section describes at which point the various files 10583<p>This section describes at which point the various files
10584 are loaded and gives reasons for that order.</p> 10584 are loaded and gives reasons for that order.</p>
10585<div class="sect2"> 10585<div class="sect2">
10586<div class="titlepage"><div><div><h3 class="title"> 10586<div class="titlepage"><div><div><h3 class="title">
10587<a name="infr.order.prefs"></a>24.6.1. The order in <code class="filename">bsd.prefs.mk</code> 10587<a name="infr.order.prefs"></a>24.6.1. The order in <code class="filename">bsd.prefs.mk</code>
10588</h3></div></div></div> 10588</h3></div></div></div>
10589<p>The very first action in <code class="filename">bsd.prefs.mk</code> 10589<p>The very first action in <code class="filename">bsd.prefs.mk</code>
10590 is to define some essential variables like 10590 is to define some essential variables like
10591 <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and 10591 <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and
10592 <code class="varname">MACHINE_ARCH</code>.</p> 10592 <code class="varname">MACHINE_ARCH</code>.</p>
10593<p>Then, the user settings are loaded from the file specified 10593<p>Then, the user settings are loaded from the file specified
10594 in <code class="varname">MAKECONF</code>, which is usually <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. 10594 in <code class="varname">MAKECONF</code>, which is usually <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.
10595 After that, those variables 10595 After that, those variables
10596 that have not been overridden by the user are loaded from 10596 that have not been overridden by the user are loaded from
10597 <code class="filename">mk/defaults/mk.conf</code>.</p> 10597 <code class="filename">mk/defaults/mk.conf</code>.</p>
10598<p>After the user settings, the system settings and platform 10598<p>After the user settings, the system settings and platform
10599 settings are loaded, which may override the user 10599 settings are loaded, which may override the user
10600 settings.</p> 10600 settings.</p>
10601<p>Then, the tool definitions are loaded. The tool wrappers 10601<p>Then, the tool definitions are loaded. The tool wrappers
10602 are not yet in effect. This only happens when building a 10602 are not yet in effect. This only happens when building a
10603 package, so the proper variables must be used instead of the 10603 package, so the proper variables must be used instead of the
10604 direct tool names.</p> 10604 direct tool names.</p>
10605<p>As the last steps, some essential variables from the 10605<p>As the last steps, some essential variables from the
10606 wrapper and the package system flavor are loaded, as well as the 10606 wrapper and the package system flavor are loaded, as well as the
10607 variables that have been cached in earlier phases of a package 10607 variables that have been cached in earlier phases of a package
10608 build.</p> 10608 build.</p>
10609</div> 10609</div>
10610<div class="sect2"> 10610<div class="sect2">
10611<div class="titlepage"><div><div><h3 class="title"> 10611<div class="titlepage"><div><div><h3 class="title">
10612<a name="infr.order.pkg"></a>24.6.2. The order in <code class="filename">bsd.pkg.mk</code> 10612<a name="infr.order.pkg"></a>24.6.2. The order in <code class="filename">bsd.pkg.mk</code>
10613</h3></div></div></div> 10613</h3></div></div></div>
10614<p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p> 10614<p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p>
10615<p>Then, the various <code class="filename">*-vars.mk</code> files are 10615<p>Then, the various <code class="filename">*-vars.mk</code> files are
10616 loaded, which fill default values for those variables that have 10616 loaded, which fill default values for those variables that have
10617 not been defined by the package. These variables may later 10617 not been defined by the package. These variables may later
10618 be used even in unrelated files.</p> 10618 be used even in unrelated files.</p>
10619<p>Then, the file <code class="filename">bsd.pkg.error.mk</code> 10619<p>Then, the file <code class="filename">bsd.pkg.error.mk</code>
10620 provides the target <code class="literal">error-check</code> that is added 10620 provides the target <code class="literal">error-check</code> that is added
10621 as a special dependency to all other targets that use 10621 as a special dependency to all other targets that use
10622 <code class="varname">DELAYED_ERROR_MSG</code> or 10622 <code class="varname">DELAYED_ERROR_MSG</code> or
10623 <code class="varname">DELAYED_WARNING_MSG</code>.</p> 10623 <code class="varname">DELAYED_WARNING_MSG</code>.</p>
10624<p>Then, the package-specific hacks from 10624<p>Then, the package-specific hacks from
10625 <code class="filename">hacks.mk</code> are included.</p> 10625 <code class="filename">hacks.mk</code> are included.</p>
10626<p>Then, various other files follow. Most of them don't have 10626<p>Then, various other files follow. Most of them don't have
10627 any dependencies on what they need to have included before or 10627 any dependencies on what they need to have included before or
10628 after them, though some do.</p> 10628 after them, though some do.</p>
10629<p>The code to check <code class="varname">PKG_FAIL_REASON</code> and 10629<p>The code to check <code class="varname">PKG_FAIL_REASON</code> and
10630 <code class="varname">PKG_SKIP_REASON</code> is then executed, which 10630 <code class="varname">PKG_SKIP_REASON</code> is then executed, which
10631 restricts the use of these variables to all the files that have 10631 restricts the use of these variables to all the files that have
10632 been included before. Appearances in later files will be 10632 been included before. Appearances in later files will be
10633 silently ignored.</p> 10633 silently ignored.</p>
10634<p>Then, the files for the main targets are included, in the 10634<p>Then, the files for the main targets are included, in the
10635 order of later execution, though the actual order should not 10635 order of later execution, though the actual order should not
10636 matter.</p> 10636 matter.</p>
10637<p>At last, some more files are included that don't set any 10637<p>At last, some more files are included that don't set any
10638 interesting variables but rather just define make targets to be 10638 interesting variables but rather just define make targets to be
10639 executed.</p> 10639 executed.</p>
10640</div> 10640</div>
10641</div> 10641</div>
10642</div> 10642</div>
10643<div class="chapter"> 10643<div class="chapter">
10644<div class="titlepage"><div><div><h2 class="title"> 10644<div class="titlepage"><div><div><h2 class="title">
10645<a name="regression"></a>Chapter 25. Regression tests</h2></div></div></div> 10645<a name="regression"></a>Chapter 25. Regression tests</h2></div></div></div>
10646<div class="toc"> 10646<div class="toc">
10647<p><b>Table of Contents</b></p> 10647<p><b>Table of Contents</b></p>
10648<dl> 10648<dl>
10649<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt> 10649<dt><span class="sect1"><a href="#regression.descr">25.1. The regression tests framework</a></span></dt>
10650<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt> 10650<dt><span class="sect1"><a href="#regression.run">25.2. Running the regression tests</a></span></dt>
10651<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt> 10651<dt><span class="sect1"><a href="#regression.new">25.3. Adding a new regression test</a></span></dt>
10652<dd><dl> 10652<dd><dl>
10653<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt> 10653<dt><span class="sect2"><a href="#regression.fun.override">25.3.1. Overridable functions</a></span></dt>
10654<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt> 10654<dt><span class="sect2"><a href="#regression.fun.helper">25.3.2. Helper functions</a></span></dt>
10655</dl></dd> 10655</dl></dd>
10656</dl> 10656</dl>
10657</div> 10657</div>
10658<p>The pkgsrc infrastructure consists of a large codebase, 10658<p>The pkgsrc infrastructure consists of a large codebase,
10659 and there are many corners where every little bit of a file is 10659 and there are many corners where every little bit of a file is
10660 well thought out, making pkgsrc likely to fail as soon as 10660 well thought out, making pkgsrc likely to fail as soon as
10661 anything is changed near those parts. To prevent most changes 10661 anything is changed near those parts. To prevent most changes
10662 from breaking anything, a suite of regression tests should go 10662 from breaking anything, a suite of regression tests should go
10663 along with every important part of the pkgsrc infrastructure. 10663 along with every important part of the pkgsrc infrastructure.
10664 This chapter describes how regression tests work in pkgsrc and 10664 This chapter describes how regression tests work in pkgsrc and
10665 how you can add new tests.</p> 10665 how you can add new tests.</p>
10666<div class="sect1"> 10666<div class="sect1">
10667<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10667<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10668<a name="regression.descr"></a>25.1. The regression tests framework</h2></div></div></div> 10668<a name="regression.descr"></a>25.1. The regression tests framework</h2></div></div></div>
10669<p></p> 10669<p></p>
10670</div> 10670</div>
10671<div class="sect1"> 10671<div class="sect1">
10672<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10672<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10673<a name="regression.run"></a>25.2. Running the regression tests</h2></div></div></div> 10673<a name="regression.run"></a>25.2. Running the regression tests</h2></div></div></div>
10674<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 10674<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
10675 provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you 10675 provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
10676 can simply run that command, which will run all tests in the 10676 can simply run that command, which will run all tests in the
10677 <code class="filename">regress</code> category.</p> 10677 <code class="filename">regress</code> category.</p>
10678</div> 10678</div>
10679<div class="sect1"> 10679<div class="sect1">
10680<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10680<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10681<a name="regression.new"></a>25.3. Adding a new regression test</h2></div></div></div> 10681<a name="regression.new"></a>25.3. Adding a new regression test</h2></div></div></div>
10682<p>Every directory in the <code class="filename">regress</code> 10682<p>Every directory in the <code class="filename">regress</code>
10683 category that contains a file called <code class="filename">spec</code> 10683 category that contains a file called <code class="filename">spec</code>
10684 is considered a regression test. This file is a shell program 10684 is considered a regression test. This file is a shell program
10685 that is included by the <span class="command"><strong>pkg_regress</strong></span> command. 10685 that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
10686 The following functions can be overridden to suit your 10686 The following functions can be overridden to suit your
10687 needs.</p> 10687 needs.</p>
10688<div class="sect2"> 10688<div class="sect2">
10689<div class="titlepage"><div><div><h3 class="title"> 10689<div class="titlepage"><div><div><h3 class="title">
10690<a name="regression.fun.override"></a>25.3.1. Overridable functions</h3></div></div></div> 10690<a name="regression.fun.override"></a>25.3.1. Overridable functions</h3></div></div></div>
10691<p>These functions do not take any parameters. They are all 10691<p>These functions do not take any parameters. They are all
10692 called in <span class="quote">&#8220;<span class="quote">set -e</span>&#8221;</span> mode, so you should be careful 10692 called in <span class="quote">&#8220;<span class="quote">set -e</span>&#8221;</span> mode, so you should be careful
10693 to check the exitcodes of any commands you run in the 10693 to check the exitcodes of any commands you run in the
10694 test.</p> 10694 test.</p>
10695<div class="variablelist"><dl class="variablelist"> 10695<div class="variablelist"><dl class="variablelist">
10696<dt><span class="term"><code class="varname">do_setup()</code></span></dt> 10696<dt><span class="term"><code class="varname">do_setup()</code></span></dt>
10697<dd><p>This function prepares the environment for the 10697<dd><p>This function prepares the environment for the
10698 test. By default it does nothing.</p></dd> 10698 test. By default it does nothing.</p></dd>
10699<dt><span class="term"><code class="varname">do_test()</code></span></dt> 10699<dt><span class="term"><code class="varname">do_test()</code></span></dt>
10700<dd><p>This function runs the actual test. By default, 10700<dd><p>This function runs the actual test. By default,
10701 it calls <code class="varname">TEST_MAKE</code> with the arguments 10701 it calls <code class="varname">TEST_MAKE</code> with the arguments
10702 <code class="varname">MAKEARGS_TEST</code> and writes its output including 10702 <code class="varname">MAKEARGS_TEST</code> and writes its output including
10703 error messages into the file 10703 error messages into the file
10704 <code class="varname">TEST_OUTFILE</code>.</p></dd> 10704 <code class="varname">TEST_OUTFILE</code>.</p></dd>
10705<dt><span class="term"><code class="varname">check_result()</code></span></dt> 10705<dt><span class="term"><code class="varname">check_result()</code></span></dt>
10706<dd><p>This function is run after the test and is 10706<dd><p>This function is run after the test and is
10707 typically used to compare the actual output from the one that is 10707 typically used to compare the actual output from the one that is
10708 expected. It can make use of the various helper functions from 10708 expected. It can make use of the various helper functions from
10709 the next section.</p></dd> 10709 the next section.</p></dd>
10710<dt><span class="term"><code class="varname">do_cleanup()</code></span></dt> 10710<dt><span class="term"><code class="varname">do_cleanup()</code></span></dt>
10711<dd><p>This function cleans everything up after the 10711<dd><p>This function cleans everything up after the
10712 test has been run. By default it does nothing.</p></dd> 10712 test has been run. By default it does nothing.</p></dd>
10713</dl></div> 10713</dl></div>
10714</div> 10714</div>
10715<div class="sect2"> 10715<div class="sect2">
10716<div class="titlepage"><div><div><h3 class="title"> 10716<div class="titlepage"><div><div><h3 class="title">
10717<a name="regression.fun.helper"></a>25.3.2. Helper functions</h3></div></div></div> 10717<a name="regression.fun.helper"></a>25.3.2. Helper functions</h3></div></div></div>
10718<div class="variablelist"><dl class="variablelist"> 10718<div class="variablelist"><dl class="variablelist">
10719<dt><span class="term"><code class="varname">exit_status(expected)</code></span></dt> 10719<dt><span class="term"><code class="varname">exit_status(expected)</code></span></dt>
10720<dd><p>This function compares the exitcode of the 10720<dd><p>This function compares the exitcode of the
10721 <span class="command"><strong>do_test()</strong></span> function with its first parameter. 10721 <span class="command"><strong>do_test()</strong></span> function with its first parameter.
10722 If they differ, the test will fail.</p></dd> 10722 If they differ, the test will fail.</p></dd>
10723<dt><span class="term"><code class="varname">output_require(regex...)</code></span></dt> 10723<dt><span class="term"><code class="varname">output_require(regex...)</code></span></dt>
10724<dd><p>This function checks for each of its parameters 10724<dd><p>This function checks for each of its parameters
10725 if the output from <span class="command"><strong>do_test()</strong></span> matches the 10725 if the output from <span class="command"><strong>do_test()</strong></span> matches the
10726 extended regular expression. If it does not, the test will 10726 extended regular expression. If it does not, the test will
10727 fail.</p></dd> 10727 fail.</p></dd>
10728<dt><span class="term"><code class="varname">output_prohibit(regex...)</code></span></dt> 10728<dt><span class="term"><code class="varname">output_prohibit(regex...)</code></span></dt>
10729<dd><p>This function checks for each of its parameters 10729<dd><p>This function checks for each of its parameters
10730 if the output from <span class="command"><strong>do_test()</strong></span> does 10730 if the output from <span class="command"><strong>do_test()</strong></span> does
10731 <span class="emphasis"><em>not</em></span> match the extended regular expression. 10731 <span class="emphasis"><em>not</em></span> match the extended regular expression.
10732 If any of the regular expressions matches, the test will 10732 If any of the regular expressions matches, the test will
10733 fail.</p></dd> 10733 fail.</p></dd>
10734</dl></div> 10734</dl></div>
10735</div> 10735</div>
10736</div> 10736</div>
10737</div> 10737</div>
10738<div class="chapter"> 10738<div class="chapter">
10739<div class="titlepage"><div><div><h2 class="title"> 10739<div class="titlepage"><div><div><h2 class="title">
10740<a name="porting"></a>Chapter 26. Porting pkgsrc</h2></div></div></div> 10740<a name="porting"></a>Chapter 26. Porting pkgsrc</h2></div></div></div>
10741<div class="toc"> 10741<div class="toc">
10742<p><b>Table of Contents</b></p> 10742<p><b>Table of Contents</b></p>
10743<dl> 10743<dl>
10744<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt> 10744<dt><span class="sect1"><a href="#porting.opsys">26.1. Porting pkgsrc to a new operating system</a></span></dt>
10745<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt> 10745<dt><span class="sect1"><a href="#porting.compiler">26.2. Adding support for a new compiler</a></span></dt>
10746</dl> 10746</dl>
10747</div> 10747</div>
10748<p>The pkgsrc system has already been ported to many 10748<p>The pkgsrc system has already been ported to many
10749 operating systems, hardware architectures and compilers. This 10749 operating systems, hardware architectures and compilers. This
10750 chapter explains the necessary steps to make pkgsrc even more 10750 chapter explains the necessary steps to make pkgsrc even more
10751 portable.</p> 10751 portable.</p>
10752<div class="sect1"> 10752<div class="sect1">
10753<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10753<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10754<a name="porting.opsys"></a>26.1. Porting pkgsrc to a new operating system</h2></div></div></div> 10754<a name="porting.opsys"></a>26.1. Porting pkgsrc to a new operating system</h2></div></div></div>
10755<p>To port pkgsrc to a new operating system (called 10755<p>To port pkgsrc to a new operating system (called
10756 <code class="literal">MyOS</code> in this example), you need to touch the 10756 <code class="literal">MyOS</code> in this example), you need to touch the
10757 following files:</p> 10757 following files:</p>
10758<div class="variablelist"><dl class="variablelist"> 10758<div class="variablelist"><dl class="variablelist">
10759<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> 10759<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>
10760<dd><p>This file contains some basic definitions, for 10760<dd><p>This file contains some basic definitions, for
10761 example the name of the C 10761 example the name of the C
10762 compiler.</p></dd> 10762 compiler.</p></dd>
10763<dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt> 10763<dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt>
10764<dd><p>Insert code that defines the variables 10764<dd><p>Insert code that defines the variables
10765 <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>, 10765 <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>,
10766 <code class="varname">LOWER_OS_VERSION</code>, 10766 <code class="varname">LOWER_OS_VERSION</code>,
10767 <code class="varname">LOWER_VENDOR</code>, 10767 <code class="varname">LOWER_VENDOR</code>,
10768 <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>, 10768 <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>,
10769 <code class="varname">APPEND_ELF</code>, and the other variables that 10769 <code class="varname">APPEND_ELF</code>, and the other variables that
10770 appear in this file.</p></dd> 10770 appear in this file.</p></dd>
10771<dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt> 10771<dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
10772<dd><p>This file contains the platform-specific 10772<dd><p>This file contains the platform-specific
10773 definitions that are used by pkgsrc. Start by copying one of the 10773 definitions that are used by pkgsrc. Start by copying one of the
10774 other files and edit it to your 10774 other files and edit it to your
10775 needs.</p></dd> 10775 needs.</p></dd>
10776<dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.pkg.dist</code></span></dt> 10776<dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.pkg.dist</code></span></dt>
10777<dd><p>This file contains a list of directories, 10777<dd><p>This file contains a list of directories,
10778 together with their permission bits and ownership. These 10778 together with their permission bits and ownership. These
10779 directories will be created automatically with every package 10779 directories will be created automatically with every package
10780 that explicitly sets <code class="varname">USE_MTREE</code>. This feature will 10780 that explicitly sets <code class="varname">USE_MTREE</code>. This feature will
10781 be removed.</p></dd> 10781 be removed.</p></dd>
10782<dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.x11.dist</code></span></dt> 10782<dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.x11.dist</code></span></dt>
10783<dd><p>Just copy one of the pre-existing x11.dist files 10783<dd><p>Just copy one of the pre-existing x11.dist files
10784 to your 10784 to your
10785 <code class="filename"><em class="replaceable"><code>MyOS</code></em>.x11.dist</code>.</p></dd> 10785 <code class="filename"><em class="replaceable"><code>MyOS</code></em>.x11.dist</code>.</p></dd>
10786<dt><span class="term"><code class="filename">mk/tools/bootstrap.mk</code></span></dt> 10786<dt><span class="term"><code class="filename">mk/tools/bootstrap.mk</code></span></dt>
10787<dd><p>On some operating systems, the tools that are 10787<dd><p>On some operating systems, the tools that are
10788 provided with the base system are not good enough for pkgsrc. 10788 provided with the base system are not good enough for pkgsrc.
10789 For example, there are many versions of <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> that have a 10789 For example, there are many versions of <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?sed+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> that have a
10790 narrow limit on the line length they can process. Therefore 10790 narrow limit on the line length they can process. Therefore
10791 pkgsrc brings its own tools, which can be enabled 10791 pkgsrc brings its own tools, which can be enabled
10792 here.</p></dd> 10792 here.</p></dd>
10793<dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt> 10793<dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
10794<dd><p>This file defines the paths to all the tools 10794<dd><p>This file defines the paths to all the tools
10795 that are needed by one or the other package in pkgsrc, as well 10795 that are needed by one or the other package in pkgsrc, as well
10796 as by pkgsrc itself. Find out where these tools are on your 10796 as by pkgsrc itself. Find out where these tools are on your
10797 platform and add them.</p></dd> 10797 platform and add them.</p></dd>
10798</dl></div> 10798</dl></div>
10799<p>Now, you should be able to build some basic packages, like 10799<p>Now, you should be able to build some basic packages, like
10800 <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> 10800 <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>
10801</div> 10801</div>
10802<div class="sect1"> 10802<div class="sect1">
10803<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10803<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10804<a name="porting.compiler"></a>26.2. Adding support for a new compiler</h2></div></div></div> 10804<a name="porting.compiler"></a>26.2. Adding support for a new compiler</h2></div></div></div>
10805<p>TODO</p> 10805<p>TODO</p>
10806</div> 10806</div>
10807</div> 10807</div>
10808</div> 10808</div>
10809<div class="appendix"> 10809<div class="appendix">
10810<div class="titlepage"><div><div><h1 class="title"> 10810<div class="titlepage"><div><div><h1 class="title">
10811<a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div> 10811<a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
10812<div class="toc"> 10812<div class="toc">
10813<p><b>Table of Contents</b></p> 10813<p><b>Table of Contents</b></p>
10814<dl> 10814<dl>
10815<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt> 10815<dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
10816<dd><dl> 10816<dd><dl>
10817<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt> 10817<dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
10818<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt> 10818<dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
10819<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt> 10819<dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
10820<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> 10820<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>
10821</dl></dd> 10821</dl></dd>
10822<dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt> 10822<dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
10823</dl> 10823</dl>
10824</div> 10824</div>
10825<p>We checked to find a piece of software that wasn't in the packages 10825<p>We checked to find a piece of software that wasn't in the packages
10826 collection, and picked GNU bison. Quite why someone would want to have 10826 collection, and picked GNU bison. Quite why someone would want to have
10827 <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already 10827 <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
10828 present in the tree is beyond us, but it's useful for the purposes of 10828 present in the tree is beyond us, but it's useful for the purposes of
10829 this exercise.</p> 10829 this exercise.</p>
10830<div class="sect1"> 10830<div class="sect1">
10831<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10831<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10832<a name="example-files"></a>A.1. files</h2></div></div></div> 10832<a name="example-files"></a>A.1. files</h2></div></div></div>
10833<div class="sect2"> 10833<div class="sect2">
10834<div class="titlepage"><div><div><h3 class="title"> 10834<div class="titlepage"><div><div><h3 class="title">
10835<a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div> 10835<a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
10836<pre class="programlisting"> 10836<pre class="programlisting">
10837# $NetBSD$ 10837# $NetBSD$
10838# 10838#
10839 10839
10840DISTNAME= bison-1.25 10840DISTNAME= bison-1.25
10841CATEGORIES= devel 10841CATEGORIES= devel
10842MASTER_SITES= ${MASTER_SITE_GNU} 10842MASTER_SITES= ${MASTER_SITE_GNU}
10843 10843
10844MAINTAINER= pkgsrc-users@NetBSD.org 10844MAINTAINER= pkgsrc-users@NetBSD.org
10845HOMEPAGE= http://www.gnu.org/software/bison/bison.html 10845HOMEPAGE= http://www.gnu.org/software/bison/bison.html
10846COMMENT= GNU yacc clone 10846COMMENT= GNU yacc clone
10847 10847
10848GNU_CONFIGURE= yes 10848GNU_CONFIGURE= yes
10849INFO_FILES= yes 10849INFO_FILES= yes
10850 10850
10851.include "../../mk/bsd.pkg.mk" 10851.include "../../mk/bsd.pkg.mk"
10852</pre> 10852</pre>
10853</div> 10853</div>
10854<div class="sect2"> 10854<div class="sect2">
10855<div class="titlepage"><div><div><h3 class="title"> 10855<div class="titlepage"><div><div><h3 class="title">
10856<a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div> 10856<a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
10857<pre class="programlisting"> 10857<pre class="programlisting">
10858GNU version of yacc. Can make re-entrant parsers, and numerous other 10858GNU version of yacc. Can make re-entrant parsers, and numerous other
10859improvements. Why you would want this when Berkeley <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part 10859improvements. Why you would want this when Berkeley <a class="citerefentry" href="http://netbsd.gw.com/cgi-bin/man-cgi?yacc+1+NetBSD-5.0.1+i386"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
10860of the NetBSD source tree is beyond me. 10860of the NetBSD source tree is beyond me.
10861</pre> 10861</pre>
10862</div> 10862</div>
10863<div class="sect2"> 10863<div class="sect2">
10864<div class="titlepage"><div><div><h3 class="title"> 10864<div class="titlepage"><div><div><h3 class="title">
10865<a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div> 10865<a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
10866<pre class="programlisting"> 10866<pre class="programlisting">
10867@comment $NetBSD$ 10867@comment $NetBSD$
10868bin/bison 10868bin/bison
10869man/man1/bison.1.gz 10869man/man1/bison.1.gz
10870share/bison.simple 10870share/bison.simple
10871share/bison.hairy 10871share/bison.hairy
10872</pre> 10872</pre>
10873</div> 10873</div>
10874<div class="sect2"> 10874<div class="sect2">
10875<div class="titlepage"><div><div><h3 class="title"> 10875<div class="titlepage"><div><div><h3 class="title">
10876<a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span> 10876<a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with <span class="command"><strong>pkglint</strong></span>
10877</h3></div></div></div> 10877</h3></div></div></div>
10878<p>The NetBSD package system comes with 10878<p>The NetBSD package system comes with
10879 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a> 10879 <a href="ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>
10880 which helps to check the contents of these 10880 which helps to check the contents of these
10881 files. After installation it is quite easy to use, just change to the 10881 files. After installation it is quite easy to use, just change to the
10882 directory of the package you wish to examine and execute 10882 directory of the package you wish to examine and execute
10883 <span class="command"><strong>pkglint</strong></span>:</p> 10883 <span class="command"><strong>pkglint</strong></span>:</p>
10884<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong> 10884<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
10885looks fine.</pre> 10885looks fine.</pre>
10886<p>Depending on the supplied command line arguments (see pkglint(1)), 10886<p>Depending on the supplied command line arguments (see pkglint(1)),
10887 more checks will be performed. Use e.g. <span class="command"><strong>pkglint -Call 10887 more checks will be performed. Use e.g. <span class="command"><strong>pkglint -Call
10888 -Wall</strong></span> for a very thorough check.</p> 10888 -Wall</strong></span> for a very thorough check.</p>
10889</div> 10889</div>
10890</div> 10890</div>
10891<div class="sect1"> 10891<div class="sect1">
10892<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 10892<div class="titlepage"><div><div><h2 class="title" style="clear: both">
10893<a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div> 10893<a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
10894<p>Create the directory where the package lives, 10894<p>Create the directory where the package lives,
10895 plus any auxiliary directories:</p> 10895 plus any auxiliary directories:</p>
10896<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong> 10896<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10897<code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong> 10897<code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
10898<code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong> 10898<code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
10899<code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre> 10899<code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
10900<p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and 10900<p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
10901 <code class="filename">PLIST</code> (see <a class="xref" href="#components" title="Chapter 11. Package components - files, directories and contents">Chapter 11, <i>Package components - files, directories and contents</i></a>) 10901 <code class="filename">PLIST</code> (see <a class="xref" href="#components" title="Chapter 11. Package components - files, directories and contents">Chapter 11, <i>Package components - files, directories and contents</i></a>)
10902 then continue with fetching the distfile:</p> 10902 then continue with fetching the distfile:</p>
10903<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong> 10903<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
10904&gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system. 10904&gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
10905&gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//. 10905&gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10906Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) 10906Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10907ftp: Error retrieving file: 500 Internal error 10907ftp: Error retrieving file: 500 Internal error
10908 10908
10909&gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//. 10909&gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10910Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) 10910Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10911ftp: Error retrieving file: 500 Internal error 10911ftp: Error retrieving file: 500 Internal error
10912 10912
10913&gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//. 10913&gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10914Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) 10914Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10915Successfully retrieved file.</pre> 10915Successfully retrieved file.</pre>
10916<p>Generate the checksum of the distfile into 10916<p>Generate the checksum of the distfile into
10917 <code class="filename">distinfo</code>:</p> 10917 <code class="filename">distinfo</code>:</p>
10918<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre> 10918<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
10919<p>Now compile:</p> 10919<p>Now compile:</p>
10920<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong> 10920<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
10921&gt;&gt; Checksum OK for bison-1.25.tar.gz. 10921&gt;&gt; Checksum OK for bison-1.25.tar.gz.
10922===&gt; Extracting for bison-1.25 10922===&gt; Extracting for bison-1.25
10923===&gt; Patching for bison-1.25 10923===&gt; Patching for bison-1.25
10924===&gt; Ignoring empty patch directory 10924===&gt; Ignoring empty patch directory
10925===&gt; Configuring for bison-1.25 10925===&gt; Configuring for bison-1.25
10926creating cache ./config.cache 10926creating cache ./config.cache
10927checking for gcc... cc 10927checking for gcc... cc
10928checking whether we are using GNU C... yes 10928checking whether we are using GNU C... yes
10929checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin 10929checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
10930checking how to run the C preprocessor... cc -E 10930checking how to run the C preprocessor... cc -E
10931checking for minix/config.h... no 10931checking for minix/config.h... no
10932checking for POSIXized ISC... no 10932checking for POSIXized ISC... no
10933checking whether cross-compiling... no 10933checking whether cross-compiling... no
10934checking for ANSI C header files... yes 10934checking for ANSI C header files... yes
10935checking for string.h... yes 10935checking for string.h... yes
10936checking for stdlib.h... yes 10936checking for stdlib.h... yes
10937checking for memory.h... yes 10937checking for memory.h... yes
10938checking for working const... yes 10938checking for working const... yes
10939checking for working alloca.h... no 10939checking for working alloca.h... no
10940checking for alloca... yes 10940checking for alloca... yes
10941checking for strerror... yes 10941checking for strerror... yes
10942updating cache ./config.cache 10942updating cache ./config.cache
10943creating ./config.status 10943creating ./config.status
10944creating Makefile 10944creating Makefile
10945===&gt; Building for bison-1.25 10945===&gt; Building for bison-1.25
10946cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c 10946cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g LR0.c
10947cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c 10947cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g allocate.c
10948cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c 10948cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g closure.c
10949cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c 10949cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g conflicts.c
10950cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c 10950cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g derives.c
10951cc -c -DXPFILE=\"/usr/pkg/share/bison.simple\" -DXPFILE1=\"/usr/pkg/share/bison.hairy\" -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -g ./files.c 10951cc -c -DXPFILE=\"/usr/pkg/share/bison.simple\" -DXPFILE1=\"/usr/pkg/share/bison.hairy\" -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -g ./files.c
10952cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c 10952cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getargs.c
10953cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c 10953cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g gram.c
10954cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c 10954cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lalr.c
10955cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c 10955cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g lex.c
10956cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c 10956cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g main.c
10957cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c 10957cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g nullable.c
10958cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c 10958cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g output.c
10959cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c 10959cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g print.c
10960cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c 10960cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reader.c
10961cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c 10961cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g reduce.c
10962cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c 10962cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g symtab.c
10963cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c 10963cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g warshall.c
10964cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c 10964cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g version.c
10965cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c 10965cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt.c
10966cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt1.c 10966cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include -g getopt1.c
10967cc -g -o bison LR0.o allocate.o closure.o conflicts.o derives.o files.o getargs.o gram.o lalr.o lex.o main.o nullable.o output.o print.o reader.o reduce.o symtab.o warshall.o version.o getopt.o getopt1.o 10967cc -g -o bison LR0.o allocate.o closure.o conflicts.o derives.o files.o getargs.o gram.o lalr.o lex.o main.o nullable.o output.o print.o reader.o reduce.o symtab.o warshall.o version.o getopt.o getopt1.o
10968./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp() 10968./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
10969rm -f bison.s1 10969rm -f bison.s1
10970sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1</pre> 10970sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1</pre>
10971<p>Everything seems OK, so install the files:</p> 10971<p>Everything seems OK, so install the files:</p>
10972<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong> 10972<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
10973&gt;&gt; Checksum OK for bison-1.25.tar.gz. 10973&gt;&gt; Checksum OK for bison-1.25.tar.gz.
10974===&gt; Installing for bison-1.25 10974===&gt; Installing for bison-1.25
10975sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1 10975sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
10976rm -f /usr/pkg/bin/bison 10976rm -f /usr/pkg/bin/bison
10977cd /usr/pkg/share; rm -f bison.simple bison.hairy 10977cd /usr/pkg/share; rm -f bison.simple bison.hairy
10978rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info* 10978rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
10979install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison 10979install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
10980/usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple 10980/usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
10981/usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy 10981/usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
10982cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done 10982cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
10983/usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1 10983/usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
10984===&gt; Registering installation for bison-1.25</pre> 10984===&gt; Registering installation for bison-1.25</pre>
10985<p>You can now use bison, and also - if you decide so - remove it with 10985<p>You can now use bison, and also - if you decide so - remove it with
10986 <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a 10986 <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
10987 binary package, do this now:</p> 10987 binary package, do this now:</p>
10988<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong> 10988<pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
10989&gt;&gt; Checksum OK for bison-1.25.tar.gz. 10989&gt;&gt; Checksum OK for bison-1.25.tar.gz.
10990===&gt; Building package for bison-1.25 10990===&gt; Building package for bison-1.25
10991Creating package bison-1.25.tgz 10991Creating package bison-1.25.tgz
10992Registering depends:. 10992Registering depends:.
10993Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre> 10993Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
10994<p>Now that you don't need the source and object files 10994<p>Now that you don't need the source and object files

cvs diff -r1.164 -r1.165 pkgsrc/doc/pkgsrc.txt (switch to unified diff)

--- pkgsrc/doc/pkgsrc.txt 2013/07/30 03:37:12 1.164
+++ pkgsrc/doc/pkgsrc.txt 2013/07/30 07:14:50 1.165
@@ -3728,2001 +3728,2001 @@ broken and couldn't have ever worked, bu @@ -3728,2001 +3728,2001 @@ broken and couldn't have ever worked, bu
3728quite large, I didn't want to fix it. So I added the following to the package 3728quite large, I didn't want to fix it. So I added the following to the package
3729Makefile and tried again: 3729Makefile and tried again:
3730 3730
3731CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0 3731CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
3732BUILDLINK_TRANSFORM+= -l:IDL:IDL-2 3732BUILDLINK_TRANSFORM+= -l:IDL:IDL-2
3733 3733
3734The latter line is needed because the package expects the library libIDL.so, 3734The latter line is needed because the package expects the library libIDL.so,
3735but only libIDL-2.so is available. So I told the compiler wrapper to rewrite 3735but only libIDL-2.so is available. So I told the compiler wrapper to rewrite
3736that on the fly. 3736that on the fly.
3737 3737
3738The next problem was related to a recent change of the FreeType interface. I 3738The next problem was related to a recent change of the FreeType interface. I
3739looked up in www/seamonkey which patch files were relevant for this issue and 3739looked up in www/seamonkey which patch files were relevant for this issue and
3740copied them to the patches directory. Then I retried, fixed the patches so that 3740copied them to the patches directory. Then I retried, fixed the patches so that
3741they applied cleanly and retried again. This time, everything worked. 3741they applied cleanly and retried again. This time, everything worked.
3742 3742
374310.2.1.3. Installing the package 374310.2.1.3. Installing the package
3744 3744
3745$ bmake CHECK_FILES=no install 3745$ bmake CHECK_FILES=no install
3746[...] 3746[...]
3747$ bmake print-PLIST >PLIST 3747$ bmake print-PLIST >PLIST
3748$ bmake deinstall 3748$ bmake deinstall
3749$ bmake install 3749$ bmake install
3750 3750
3751Chapter 11. Package components - files, directories and contents 3751Chapter 11. Package components - files, directories and contents
3752 3752
3753Table of Contents 3753Table of Contents
3754 3754
375511.1. Makefile 375511.1. Makefile
375611.2. distinfo 375611.2. distinfo
375711.3. patches/* 375711.3. patches/*
3758 3758
3759 11.3.1. Structure of a single patch file 3759 11.3.1. Structure of a single patch file
3760 11.3.2. Creating patch files 3760 11.3.2. Creating patch files
3761 11.3.3. Sources where the patch files come from 3761 11.3.3. Sources where the patch files come from
3762 11.3.4. Patching guidelines 3762 11.3.4. Patching guidelines
3763 11.3.5. Feedback to the author 3763 11.3.5. Feedback to the author
3764 3764
376511.4. Other mandatory files 376511.4. Other mandatory files
376611.5. Optional files 376611.5. Optional files
3767 3767
3768 11.5.1. Files affecting the binary package 3768 11.5.1. Files affecting the binary package
3769 11.5.2. Files affecting the build process 3769 11.5.2. Files affecting the build process
3770 11.5.3. Files affecting nothing at all 3770 11.5.3. Files affecting nothing at all
3771 3771
377211.6. work* 377211.6. work*
377311.7. files/* 377311.7. files/*
3774 3774
3775Whenever you're preparing a package, there are a number of files involved which 3775Whenever you're preparing a package, there are a number of files involved which
3776are described in the following sections. 3776are described in the following sections.
3777 3777
377811.1. Makefile 377811.1. Makefile
3779 3779
3780Building, installation and creation of a binary package are all controlled by 3780Building, installation and creation of a binary package are all controlled by
3781the package's Makefile. The Makefile describes various things about a package, 3781the package's Makefile. The Makefile describes various things about a package,
3782for example from where to get it, how to configure, build, and install it. 3782for example from where to get it, how to configure, build, and install it.
3783 3783
3784A package Makefile contains several sections that describe the package. 3784A package Makefile contains several sections that describe the package.
3785 3785
3786In the first section there are the following variables, which should appear 3786In the first section there are the following variables, which should appear
3787exactly in the order given here. The order and grouping of the variables is 3787exactly in the order given here. The order and grouping of the variables is
3788mostly historical and has no further meaning. 3788mostly historical and has no further meaning.
3789 3789
3790 * DISTNAME is the basename of the distribution file to be downloaded from the 3790 * DISTNAME is the basename of the distribution file to be downloaded from the
3791 package's website. 3791 package's website.
3792 3792
3793 * PKGNAME is the name of the package, as used by pkgsrc. You only need to 3793 * PKGNAME is the name of the package, as used by pkgsrc. You only need to
3794 provide it if DISTNAME (which is the default) is not a good name for the 3794 provide it if DISTNAME (which is the default) is not a good name for the
3795 package in pkgsrc. Usually it is the pkgsrc directory name together with 3795 package in pkgsrc. Usually it is the pkgsrc directory name together with
3796 the version number. It must match the regular expression ^[A-Za-z0-9] 3796 the version number. It must match the regular expression ^[A-Za-z0-9]
3797 [A-Za-z0-9-_.+]*$, that is, it starts with a letter or digit, and contains 3797 [A-Za-z0-9-_.+]*$, that is, it starts with a letter or digit, and contains
3798 only letters, digits, dashes, underscores, dots and plus signs. 3798 only letters, digits, dashes, underscores, dots and plus signs.
3799 3799
3800 * SVR4_PKGNAME is the name of the package file to create if the PKGNAME isn't 3800 * SVR4_PKGNAME is the name of the package file to create if the PKGNAME isn't
3801 unique on a SVR4 system. The default is PKGNAME, which may be shortened 3801 unique on a SVR4 system. The default is PKGNAME, which may be shortened
3802 when you use pkgtools/gensolpkg. Only add SVR4_PKGNAME if PKGNAME does not 3802 when you use pkgtools/gensolpkg. Only add SVR4_PKGNAME if PKGNAME does not
3803 produce an unique package name on a SVR4 system. The length of SVR4_PKGNAME 3803 produce an unique package name on a SVR4 system. The length of SVR4_PKGNAME
3804 is limited to 5 characters. 3804 is limited to 5 characters.
3805 3805
3806 * CATEGORIES is a list of categories which the package fits in. You can 3806 * CATEGORIES is a list of categories which the package fits in. You can
3807 choose any of the top-level directories of pkgsrc for it. 3807 choose any of the top-level directories of pkgsrc for it.
3808 3808
3809 Currently the following values are available for CATEGORIES. If more than 3809 Currently the following values are available for CATEGORIES. If more than
3810 one is used, they need to be separated by spaces: 3810 one is used, they need to be separated by spaces:
3811 3811
3812 archivers cross geography meta-pkgs security 3812 archivers cross geography meta-pkgs security
3813 audio databases graphics misc shells 3813 audio databases graphics misc shells
3814 benchmarks devel ham multimedia sysutils 3814 benchmarks devel ham multimedia sysutils
3815 biology editors inputmethod net textproc 3815 biology editors inputmethod net textproc
3816 cad emulators lang news time 3816 cad emulators lang news time
3817 chat finance mail parallel wm 3817 chat finance mail parallel wm
3818 comms fonts math pkgtools www 3818 comms fonts math pkgtools www
3819 converters games mbone print x11 3819 converters games mbone print x11
3820 3820
3821 * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES 3821 * MASTER_SITES, DYNAMIC_MASTER_SITES, DIST_SUBDIR, EXTRACT_SUFX and DISTFILES
3822 are discussed in detail in Section 17.5, "The fetch phase". 3822 are discussed in detail in Section 17.5, "The fetch phase".
3823 3823
3824The second section contains information about separately downloaded patches, if 3824The second section contains information about separately downloaded patches, if
3825any. 3825any.
3826 3826
3827 * PATCHFILES: Name(s) of additional files that contain distribution patches. 3827 * PATCHFILES: Name(s) of additional files that contain distribution patches.
3828 There is no default. pkgsrc will look for them at PATCH_SITES. They will 3828 There is no default. pkgsrc will look for them at PATCH_SITES. They will
3829 automatically be uncompressed before patching if the names end with .gz or 3829 automatically be uncompressed before patching if the names end with .gz or
3830 .Z. 3830 .Z.
3831 3831
3832 * PATCH_SITES: Primary location(s) for distribution patch files (see 3832 * PATCH_SITES: Primary location(s) for distribution patch files (see
3833 PATCHFILES below) if not found locally. 3833 PATCHFILES below) if not found locally.
3834 3834
3835The third section contains the following variables. 3835The third section contains the following variables.
3836 3836
3837 * MAINTAINER is the email address of the person who feels responsible for 3837 * MAINTAINER is the email address of the person who feels responsible for
3838 this package, and who is most likely to look at problems or questions 3838 this package, and who is most likely to look at problems or questions
3839 regarding this package which have been reported with send-pr(1). Other 3839 regarding this package which have been reported with send-pr(1). Other
3840 developers may contact the MAINTAINER before making changes to the package, 3840 developers may contact the MAINTAINER before making changes to the package,
3841 but are not required to do so. When packaging a new program, set MAINTAINER 3841 but are not required to do so. When packaging a new program, set MAINTAINER
3842 to yourself. If you really can't maintain the package for future updates, 3842 to yourself. If you really can't maintain the package for future updates,
3843 set it to <pkgsrc-users@NetBSD.org>. 3843 set it to <pkgsrc-users@NetBSD.org>.
3844 3844
3845 * OWNER should be used instead of MAINTAINER when you do not want other 3845 * OWNER should be used instead of MAINTAINER when you do not want other
3846 developers to update or change the package without contacting you first. A 3846 developers to update or change the package without contacting you first. A
3847 package Makefile should contain one of MAINTAINER or OWNER, but not both. 3847 package Makefile should contain one of MAINTAINER or OWNER, but not both.
3848 3848
3849 * HOMEPAGE is a URL where users can find more information about the package. 3849 * HOMEPAGE is a URL where users can find more information about the package.
3850 3850
3851 * COMMENT is a one-line description of the package (should not include the 3851 * COMMENT is a one-line description of the package (should not include the
3852 package name). 3852 package name).
3853 3853
3854Other variables that affect the build: 3854Other variables that affect the build:
3855 3855
3856 * WRKSRC: The directory where the interesting distribution files of the 3856 * WRKSRC: The directory where the interesting distribution files of the
3857 package are found. The default is ${WRKDIR}/${DISTNAME}, which works for 3857 package are found. The default is ${WRKDIR}/${DISTNAME}, which works for
3858 most packages. 3858 most packages.
3859 3859
3860 If a package doesn't create a subdirectory for itself (most GNU software 3860 If a package doesn't create a subdirectory for itself (most GNU software
3861 does, for instance), but extracts itself in the current directory, you 3861 does, for instance), but extracts itself in the current directory, you
3862 should set WRKSRC=${WRKDIR}. 3862 should set WRKSRC=${WRKDIR}.
3863 3863
3864 If a package doesn't create a subdirectory with the name of DISTNAME but 3864 If a package doesn't create a subdirectory with the name of DISTNAME but
3865 some different name, set WRKSRC to point to the proper name in ${WRKDIR}, 3865 some different name, set WRKSRC to point to the proper name in ${WRKDIR},
3866 for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for 3866 for example WRKSRC=${WRKDIR}/${DISTNAME}/unix. See lang/tcl and x11/tk for
3867 other examples. 3867 other examples.
3868 3868
3869 The name of the working directory created by pkgsrc is taken from the 3869 The name of the working directory created by pkgsrc is taken from the
3870 WRKDIR_BASENAME variable. By default, its value is work. If you want to use 3870 WRKDIR_BASENAME variable. By default, its value is work. If you want to use
3871 the same pkgsrc tree for building different kinds of binary packages, you 3871 the same pkgsrc tree for building different kinds of binary packages, you
3872 can change the variable according to your needs. Two other variables handle 3872 can change the variable according to your needs. Two other variables handle
3873 common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is 3873 common cases of setting WRKDIR_BASENAME individually. If OBJHOSTNAME is
3874 defined in mk.conf, the first component of the host's name is attached to 3874 defined in mk.conf, the first component of the host's name is attached to
3875 the directory name. If OBJMACHINE is defined, the platform name is 3875 the directory name. If OBJMACHINE is defined, the platform name is
3876 attached, which might look like work.i386 or work.sparc. 3876 attached, which might look like work.i386 or work.sparc.
3877 3877
3878Please pay attention to the following gotchas: 3878Please pay attention to the following gotchas:
3879 3879
3880 * Add MANCOMPRESSED if man pages are installed in compressed form by the 3880 * Add MANCOMPRESSED if man pages are installed in compressed form by the
3881 package. For packages using BSD-style makefiles which honor MANZ, there is 3881 package. For packages using BSD-style makefiles which honor MANZ, there is
3882 MANCOMPRESSED_IF_MANZ. 3882 MANCOMPRESSED_IF_MANZ.
3883 3883
3884 * Replace /usr/local with "${PREFIX}" in all files (see patches, below). 3884 * Replace /usr/local with "${PREFIX}" in all files (see patches, below).
3885 3885
3886 * If the package installs any info files, see Section 19.6.7, "Packages 3886 * If the package installs any info files, see Section 19.6.7, "Packages
3887 installing info files". 3887 installing info files".
3888 3888
388911.2. distinfo 388911.2. distinfo
3890 3890
3891The distinfo file contains the message digest, or checksum, of each distfile 3891The distinfo file contains the message digest, or checksum, of each distfile
3892needed for the package. This ensures that the distfiles retrieved from the 3892needed for the package. This ensures that the distfiles retrieved from the
3893Internet have not been corrupted during transfer or altered by a malign force 3893Internet have not been corrupted during transfer or altered by a malign force
3894to introduce a security hole. Due to recent rumor about weaknesses of digest 3894to introduce a security hole. Due to recent rumor about weaknesses of digest
3895algorithms, all distfiles are protected using both SHA1 and RMD160 message 3895algorithms, all distfiles are protected using both SHA1 and RMD160 message
3896digests, as well as the file size. 3896digests, as well as the file size.
3897 3897
3898The distinfo file also contains the checksums for all the patches found in the 3898The distinfo file also contains the checksums for all the patches found in the
3899patches directory (see Section 11.3, "patches/*"). 3899patches directory (see Section 11.3, "patches/*").
3900 3900
3901To regenerate the distinfo file, use the make makedistinfo or make mdi command. 3901To regenerate the distinfo file, use the make makedistinfo or make mdi command.
3902 3902
3903Some packages have different sets of distfiles depending on the platform, for 3903Some packages have different sets of distfiles depending on the platform, for
3904example lang/openjdk7. These are kept in the same distinfo file and care should 3904example lang/openjdk7. These are kept in the same distinfo file and care should
3905be taken when upgrading such a package to ensure distfile information is not 3905be taken when upgrading such a package to ensure distfile information is not
3906lost. 3906lost.
3907 3907
390811.3. patches/* 390811.3. patches/*
3909 3909
3910Many packages still don't work out-of-the box on the various platforms that are 3910Many packages still don't work out-of-the box on the various platforms that are
3911supported by pkgsrc. Therefore, a number of custom patch files are needed to 3911supported by pkgsrc. Therefore, a number of custom patch files are needed to
3912make the package work. These patch files are found in the patches/ directory. 3912make the package work. These patch files are found in the patches/ directory.
3913 3913
3914In the patch phase, these patches are applied to the files in WRKSRC directory 3914In the patch phase, these patches are applied to the files in WRKSRC directory
3915after extracting them, in alphabetic order. 3915after extracting them, in alphabetic order.
3916 3916
391711.3.1. Structure of a single patch file 391711.3.1. Structure of a single patch file
3918 3918
3919The patch-* files should be in diff -bu format, and apply without a fuzz to 3919The patch-* files should be in diff -bu format, and apply without a fuzz to
3920avoid problems. (To force patches to apply with fuzz you can set 3920avoid problems. (To force patches to apply with fuzz you can set
3921PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for 3921PATCH_FUZZ_FACTOR=-F2). Furthermore, each patch should contain only changes for
3922a single file, and no file should be patched by more than one patch file. This 3922a single file, and no file should be patched by more than one patch file. This
3923helps to keep future modifications simple. 3923helps to keep future modifications simple.
3924 3924
3925Each patch file is structured as follows: In the first line, there is the RCS 3925Each patch file is structured as follows: In the first line, there is the RCS
3926Id of the patch itself. The second line should be empty for aesthetic reasons. 3926Id of the patch itself. The second line should be empty for aesthetic reasons.
3927After that, there should be a comment for each change that the patch does. 3927After that, there should be a comment for each change that the patch does.
3928There are a number of standard cases: 3928There are a number of standard cases:
3929 3929
3930 * Patches for commonly known vulnerabilities should mention the vulnerability 3930 * Patches for commonly known vulnerabilities should mention the vulnerability
3931 ID (CAN, CVE). 3931 ID (CAN, CVE).
3932 3932
3933 * Patches that change source code should mention the platform and other 3933 * Patches that change source code should mention the platform and other
3934 environment (for example, the compiler) that the patch is needed for. 3934 environment (for example, the compiler) that the patch is needed for.
3935 3935
3936In all, the patch should be commented so that any developer who knows the code 3936In all, the patch should be commented so that any developer who knows the code
3937of the application can make some use of the patch. Special care should be taken 3937of the application can make some use of the patch. Special care should be taken
3938for the upstream developers, since we generally want that they accept our 3938for the upstream developers, since we generally want that they accept our
3939patches, so we have less work in the future. 3939patches, so we have less work in the future.
3940 3940
394111.3.2. Creating patch files 394111.3.2. Creating patch files
3942 3942
3943One important thing to mention is to pay attention that no RCS IDs get stored 3943One important thing to mention is to pay attention that no RCS IDs get stored
3944in the patch files, as these will cause problems when later checked into the 3944in the patch files, as these will cause problems when later checked into the
3945NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to 3945NetBSD CVS tree. Use the pkgdiff command from the pkgtools/pkgdiff package to
3946avoid these problems. 3946avoid these problems.
3947 3947
3948For even more automation, we recommend using mkpatches from the same package to 3948For even more automation, we recommend using mkpatches from the same package to
3949make a whole set of patches. You just have to backup files before you edit them 3949make a whole set of patches. You just have to backup files before you edit them
3950to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using  3950to filename.orig, e.g. with cp -p filename filename.orig or, easier, by using
3951pkgvi again from the same package. If you upgrade a package this way, you can 3951pkgvi again from the same package. If you upgrade a package this way, you can
3952easily compare the new set of patches with the previously existing one with  3952easily compare the new set of patches with the previously existing one with
3953patchdiff. The files in patches are replaced by new files, so carefully check 3953patchdiff. The files in patches are replaced by new files, so carefully check
3954if you want to take all the changes. 3954if you want to take all the changes.
3955 3955
3956When you have finished a package, remember to generate the checksums for the 3956When you have finished a package, remember to generate the checksums for the
3957patch files by using the make makepatchsum command, see Section 11.2, 3957patch files by using the make makepatchsum command, see Section 11.2,
3958"distinfo". 3958"distinfo".
3959 3959
3960When adding a patch that corrects a problem in the distfile (rather than e.g. 3960When adding a patch that corrects a problem in the distfile (rather than e.g.
3961enforcing pkgsrc's view of where man pages should go), send the patch as a bug 3961enforcing pkgsrc's view of where man pages should go), send the patch as a bug
3962report to the maintainer. This benefits non-pkgsrc users of the package, and 3962report to the maintainer. This benefits non-pkgsrc users of the package, and
3963usually makes it possible to remove the patch in future version. 3963usually makes it possible to remove the patch in future version.
3964 3964
3965The file names of the patch files are usually of the form patch- 3965The file names of the patch files are usually of the form patch-
3966path_to_file__with__underscores.c. Many packages still use the previous 3966path_to_file__with__underscores.c. Many packages still use the previous
3967convention patch-[a-z][a-z], but new patches should be of the form containing 3967convention patch-[a-z][a-z], but new patches should be of the form containing
3968the filename. mkpatches included in pkgtools/pkgdiff takes care of the name 3968the filename. mkpatches included in pkgtools/pkgdiff takes care of the name
3969automatically. 3969automatically.
3970 3970
397111.3.3. Sources where the patch files come from 397111.3.3. Sources where the patch files come from
3972 3972
3973If you want to share patches between multiple packages in pkgsrc, e.g. because 3973If you want to share patches between multiple packages in pkgsrc, e.g. because
3974they use the same distfiles, set PATCHDIR to the path where the patch files can 3974they use the same distfiles, set PATCHDIR to the path where the patch files can
3975be found, e.g.: 3975be found, e.g.:
3976 3976
3977PATCHDIR= ${.CURDIR}/../xemacs/patches 3977PATCHDIR= ${.CURDIR}/../xemacs/patches
3978 3978
3979Patch files that are distributed by the author or other maintainers can be 3979Patch files that are distributed by the author or other maintainers can be
3980listed in PATCHFILES. 3980listed in PATCHFILES.
3981 3981
3982If it is desired to store any patches that should not be committed into pkgsrc, 3982If it is desired to store any patches that should not be committed into pkgsrc,
3983they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The 3983they can be kept outside the pkgsrc tree in the $LOCALPATCHES directory. The
3984directory tree there is expected to have the same "category/package" structure 3984directory tree there is expected to have the same "category/package" structure
3985as pkgsrc, and patches are expected to be stored inside these dirs (also known 3985as pkgsrc, and patches are expected to be stored inside these dirs (also known
3986as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch 3986as $LOCALPATCHES/$PKGPATH). For example, if you want to keep a private patch
3987for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All 3987for pkgsrc/graphics/png, keep it in $LOCALPATCHES/graphics/png/mypatch. All
3988files in the named directory are expected to be patch files, and they are 3988files in the named directory are expected to be patch files, and they are
3989applied after pkgsrc patches are applied. 3989applied after pkgsrc patches are applied.
3990 3990
399111.3.4. Patching guidelines 399111.3.4. Patching guidelines
3992 3992
3993When fixing a portability issue in the code do not use preprocessor magic to 3993When fixing a portability issue in the code do not use preprocessor magic to
3994check for the current operating system nor platform. Doing so hurts portability 3994check for the current operating system nor platform. Doing so hurts portability
3995to other platforms because the OS-specific details are not abstracted 3995to other platforms because the OS-specific details are not abstracted
3996appropriately. 3996appropriately.
3997 3997
3998The general rule to follow is: instead of checking for the operating system the 3998The general rule to follow is: instead of checking for the operating system the
3999application is being built on, check for the specific features you need. For 3999application is being built on, check for the specific features you need. For
4000example, instead of assuming that kqueue is available under NetBSD and using 4000example, instead of assuming that kqueue is available under NetBSD and using
4001the __NetBSD__ macro to conditionalize kqueue support, add a check that detects 4001the __NetBSD__ macro to conditionalize kqueue support, add a check that detects
4002kqueue itself ? yes, this generally involves patching the configure script. 4002kqueue itself ? yes, this generally involves patching the configure script.
4003There is absolutely nothing that prevents some OSes from adopting interfaces 4003There is absolutely nothing that prevents some OSes from adopting interfaces
4004from other OSes (e.g. Linux implementing kqueue), something that the above 4004from other OSes (e.g. Linux implementing kqueue), something that the above
4005checks cannot take into account. 4005checks cannot take into account.
4006 4006
4007Of course, checking for features generally involves more work on the 4007Of course, checking for features generally involves more work on the
4008developer's side, but the resulting changes are cleaner and there are chances 4008developer's side, but the resulting changes are cleaner and there are chances
4009they will work on many other platforms. Not to mention that there are higher 4009they will work on many other platforms. Not to mention that there are higher
4010chances of being later integrated into the mainstream sources. Remember: It 4010chances of being later integrated into the mainstream sources. Remember: It
4011doesn't work unless it is right! 4011doesn't work unless it is right!
4012 4012
4013Some typical examples: 4013Some typical examples:
4014 4014
4015Table 11.1. Patching examples 4015Table 11.1. Patching examples
4016 4016
4017+-------------------------------------------------------------------------------------------+ 4017+-------------------------------------------------------------------------------------------+
4018| Where | Incorrect | Correct | 4018| Where | Incorrect | Correct |
4019|---------+--------------------------+------------------------------------------------------| 4019|---------+--------------------------+------------------------------------------------------|
4020| |case ${target_os} in | | 4020| |case ${target_os} in | |
4021|configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)| 4021|configure|netbsd*) have_kvm=yes ;; |AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)|
4022|script |*) have_kvm=no ;; | | 4022|script |*) have_kvm=no ;; | |
4023| |esac | | 4023| |esac | |
4024|---------+--------------------------+------------------------------------------------------| 4024|---------+--------------------------+------------------------------------------------------|
4025|C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) | 4025|C source |#if defined(__NetBSD__) |#if defined(HAVE_SYS_EVENT_H) |
4026|file |# include <sys/event.h> |# include <sys/event.h> | 4026|file |# include <sys/event.h> |# include <sys/event.h> |
4027| |#endif |#endif | 4027| |#endif |#endif |
4028|---------+--------------------------+------------------------------------------------------| 4028|---------+--------------------------+------------------------------------------------------|
4029| |int |int | 4029| |int |int |
4030| |monitor_file(...) |monitor_file(...) | 4030| |monitor_file(...) |monitor_file(...) |
4031| |{ |{ | 4031| |{ |{ |
4032| |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) | 4032| |#if defined(__NetBSD__) |#if defined(HAVE_KQUEUE) |
4033|C source | int fd = kqueue();| int fd = kqueue(); | 4033|C source | int fd = kqueue();| int fd = kqueue(); |
4034|file | ... | ... | 4034|file | ... | ... |
4035| |#else |#else | 4035| |#else |#else |
4036| | ... | ... | 4036| | ... | ... |
4037| |#endif |#endif | 4037| |#endif |#endif |
4038| |} |} | 4038| |} |} |
4039+-------------------------------------------------------------------------------------------+ 4039+-------------------------------------------------------------------------------------------+
4040 4040
4041 4041
4042For more information, please read the Making packager-friendly software article 4042For more information, please read the Making packager-friendly software article
4043(part 1, part 2). It summarizes multiple details on how to make software easier 4043(part 1, part 2). It summarizes multiple details on how to make software easier
4044to package; all the suggestions in it were collected from our experience in 4044to package; all the suggestions in it were collected from our experience in
4045pkgsrc work, so they are possibly helpful when creating patches too. 4045pkgsrc work, so they are possibly helpful when creating patches too.
4046 4046
404711.3.5. Feedback to the author 404711.3.5. Feedback to the author
4048 4048
4049Always, always, always feed back any portability fixes or improvements you do 4049Always, always, always feed back any portability fixes or improvements you do
4050to a package to the mainstream developers. This is the only way to get their 4050to a package to the mainstream developers. This is the only way to get their
4051attention on portability issues and to ensure that future versions can be built 4051attention on portability issues and to ensure that future versions can be built
4052out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will 4052out-of-the box on NetBSD. Furthermore, any user that gets newer distfiles will
4053get the fixes straight from the packaged code. 4053get the fixes straight from the packaged code.
4054 4054
4055This generally involves cleaning up the patches (because sometimes the patches 4055This generally involves cleaning up the patches (because sometimes the patches
4056that are added to pkgsrc are quick hacks), filing bug reports in the 4056that are added to pkgsrc are quick hacks), filing bug reports in the
4057appropriate trackers for the projects and working with the mainstream authors 4057appropriate trackers for the projects and working with the mainstream authors
4058to accept your changes. It is extremely important that you do it so that the 4058to accept your changes. It is extremely important that you do it so that the
4059packages in pkgsrc are kept simple and thus further changes can be done without 4059packages in pkgsrc are kept simple and thus further changes can be done without
4060much hassle. 4060much hassle.
4061 4061
4062When you have done this, please add a URL to the upstream bug report to the 4062When you have done this, please add a URL to the upstream bug report to the
4063patch comment. 4063patch comment.
4064 4064
4065Support the idea of free software! 4065Support the idea of free software!
4066 4066
406711.4. Other mandatory files 406711.4. Other mandatory files
4068 4068
4069DESCR 4069DESCR
4070 4070
4071 A multi-line description of the piece of software. This should include any 4071 A multi-line description of the piece of software. This should include any
4072 credits where they are due. Please bear in mind that others do not share 4072 credits where they are due. Please bear in mind that others do not share
4073 your sense of humour (or spelling idiosyncrasies), and that others will 4073 your sense of humour (or spelling idiosyncrasies), and that others will
4074 read everything that you write here. 4074 read everything that you write here.
4075 4075
4076PLIST 4076PLIST
4077 4077
4078 This file governs the files that are installed on your system: all the 4078 This file governs the files that are installed on your system: all the
4079 binaries, manual pages, etc. There are other directives which may be 4079 binaries, manual pages, etc. There are other directives which may be
4080 entered in this file, to control the creation and deletion of directories, 4080 entered in this file, to control the creation and deletion of directories,
4081 and the location of inserted files. See Chapter 13, PLIST issues for more 4081 and the location of inserted files. See Chapter 13, PLIST issues for more
4082 information. 4082 information.
4083 4083
408411.5. Optional files 408411.5. Optional files
4085 4085
408611.5.1. Files affecting the binary package 408611.5.1. Files affecting the binary package
4087 4087
4088INSTALL 4088INSTALL
4089 4089
4090 This shell script is invoked twice by pkg_add(1). First time after package 4090 This shell script is invoked twice by pkg_add(1). First time after package
4091 extraction and before files are moved in place, the second time after the 4091 extraction and before files are moved in place, the second time after the
4092 files to install are moved in place. This can be used to do any custom 4092 files to install are moved in place. This can be used to do any custom
4093 procedures not possible with @exec commands in PLIST. See pkg_add(1) and 4093 procedures not possible with @exec commands in PLIST. See pkg_add(1) and
4094 pkg_create(1) for more information. See also Section 15.1, "Files and 4094 pkg_create(1) for more information. See also Section 15.1, "Files and
4095 directories outside the installation prefix". Please note that you can 4095 directories outside the installation prefix". Please note that you can
4096 modify variables in it easily by using FILES_SUBST in the package's 4096 modify variables in it easily by using FILES_SUBST in the package's
4097 Makefile: 4097 Makefile:
4098 4098
4099 FILES_SUBST+= SOMEVAR="somevalue" 4099 FILES_SUBST+= SOMEVAR="somevalue"
4100 4100
4101 replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default, 4101 replaces "@SOMEVAR@" with "somevalue" in the INSTALL. By default,
4102 substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a 4102 substitution is performed for PREFIX, LOCALBASE, X11BASE, VARBASE, and a
4103 few others, type make help topic=FILES_SUBST for a complete list. 4103 few others, type make help topic=FILES_SUBST for a complete list.
4104 4104
4105DEINSTALL 4105DEINSTALL
4106 4106
4107 This script is executed before and after any files are removed. It is this 4107 This script is executed before and after any files are removed. It is this
4108 script's responsibility to clean up any additional messy details around the 4108 script's responsibility to clean up any additional messy details around the
4109 package's installation, since all pkg_delete knows is how to delete the 4109 package's installation, since all pkg_delete knows is how to delete the
4110 files created in the original distribution. See pkg_delete(1) and 4110 files created in the original distribution. See pkg_delete(1) and
4111 pkg_create(1) for more information. The same methods to replace variables 4111 pkg_create(1) for more information. The same methods to replace variables
4112 can be used as for the INSTALL file. 4112 can be used as for the INSTALL file.
4113 4113
4114MESSAGE 4114MESSAGE
4115 4115
4116 This file is displayed after installation of the package. Useful for things 4116 This file is displayed after installation of the package. Useful for things
4117 like legal notices on almost-free software and hints for updating config 4117 like legal notices on almost-free software and hints for updating config
4118 files after installing modules for apache, PHP etc. Please note that you 4118 files after installing modules for apache, PHP etc. Please note that you
4119 can modify variables in it easily by using MESSAGE_SUBST in the package's 4119 can modify variables in it easily by using MESSAGE_SUBST in the package's
4120 Makefile: 4120 Makefile:
4121 4121
4122 MESSAGE_SUBST+= SOMEVAR="somevalue" 4122 MESSAGE_SUBST+= SOMEVAR="somevalue"
4123 4123
4124 replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution 4124 replaces "${SOMEVAR}" with "somevalue" in MESSAGE. By default, substitution
4125 is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11PREFIX, X11BASE, 4125 is performed for PKGNAME, PKGBASE, PREFIX, LOCALBASE, X11PREFIX, X11BASE,
4126 PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER. 4126 PKG_SYSCONFDIR, ROOT_GROUP, and ROOT_USER.
4127 4127
4128 You can display a different or additional files by setting the MESSAGE_SRC 4128 You can display a different or additional files by setting the MESSAGE_SRC
4129 variable. Its default is MESSAGE, if the file exists. 4129 variable. Its default is MESSAGE, if the file exists.
4130 4130
4131ALTERNATIVES 4131ALTERNATIVES
4132 4132
4133 FIXME: There is no documentation on the alternatives framework. 4133 FIXME: There is no documentation on the alternatives framework.
4134 4134
413511.5.2. Files affecting the build process 413511.5.2. Files affecting the build process
4136 4136
4137Makefile.common 4137Makefile.common
4138 4138
4139 This file contains arbitrary things that could also go into a Makefile, but 4139 This file contains arbitrary things that could also go into a Makefile, but
4140 its purpose is to be used by more than one package. This file should only 4140 its purpose is to be used by more than one package. This file should only
4141 be used when the packages that will use the file are known in advance. For 4141 be used when the packages that will use the file are known in advance. For
4142 other purposes it is often better to write a *.mk file and give it a good 4142 other purposes it is often better to write a *.mk file and give it a good
4143 name that describes what it does. 4143 name that describes what it does.
4144 4144
4145buildlink3.mk 4145buildlink3.mk
4146 4146
4147 This file contains the dependency information for the buildlink3 framework 4147 This file contains the dependency information for the buildlink3 framework
4148 (see Chapter 14, Buildlink methodology). 4148 (see Chapter 14, Buildlink methodology).
4149 4149
4150hacks.mk 4150hacks.mk
4151 4151
4152 This file contains workarounds for compiler bugs and similar things. It is 4152 This file contains workarounds for compiler bugs and similar things. It is
4153 included automatically by the pkgsrc infrastructure, so you don't need an 4153 included automatically by the pkgsrc infrastructure, so you don't need an
4154 extra .include line for it. 4154 extra .include line for it.
4155 4155
4156options.mk 4156options.mk
4157 4157
4158 This file contains the code for the package-specific options (see 4158 This file contains the code for the package-specific options (see
4159 Chapter 16, Options handling) that can be selected by the user. If a 4159 Chapter 16, Options handling) that can be selected by the user. If a
4160 package has only one or two options, it is equally acceptable to put the 4160 package has only one or two options, it is equally acceptable to put the
4161 code directly into the Makefile. 4161 code directly into the Makefile.
4162 4162
416311.5.3. Files affecting nothing at all 416311.5.3. Files affecting nothing at all
4164 4164
4165README* 4165README*
4166 4166
4167 These files do not take place in the creation of a package and thus are 4167 These files do not take place in the creation of a package and thus are
4168 purely informative to the package developer. 4168 purely informative to the package developer.
4169 4169
4170TODO 4170TODO
4171 4171
4172 This file contains things that need to be done to make the package even 4172 This file contains things that need to be done to make the package even
4173 better. 4173 better.
4174 4174
417511.6. work* 417511.6. work*
4176 4176
4177When you type make, the distribution files are unpacked into the directory 4177When you type make, the distribution files are unpacked into the directory
4178denoted by WRKDIR. It can be removed by running make clean. Besides the 4178denoted by WRKDIR. It can be removed by running make clean. Besides the
4179sources, this directory is also used to keep various timestamp files. The 4179sources, this directory is also used to keep various timestamp files. The
4180directory gets removed completely on clean. The default is ${.CURDIR}/work or $ 4180directory gets removed completely on clean. The default is ${.CURDIR}/work or $
4181{.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set. 4181{.CURDIR}/work.${MACHINE_ARCH} if OBJMACHINE is set.
4182 4182
418311.7. files/* 418311.7. files/*
4184 4184
4185If you have any files that you wish to be placed in the package prior to 4185If you have any files that you wish to be placed in the package prior to
4186configuration or building, you could place these files here and use a ${CP} 4186configuration or building, you could place these files here and use a ${CP}
4187command in the "pre-configure" target to achieve this. Alternatively, you could 4187command in the "pre-configure" target to achieve this. Alternatively, you could
4188simply diff the file against /dev/null and use the patch mechanism to manage 4188simply diff the file against /dev/null and use the patch mechanism to manage
4189the creation of this file. 4189the creation of this file.
4190 4190
4191If you want to share files in this way with other packages, set the FILESDIR 4191If you want to share files in this way with other packages, set the FILESDIR
4192variable to point to the other package's files directory, e.g.: 4192variable to point to the other package's files directory, e.g.:
4193 4193
4194FILESDIR=${.CURDIR}/../xemacs/files 4194FILESDIR=${.CURDIR}/../xemacs/files
4195 4195
4196Chapter 12. Programming in Makefiles 4196Chapter 12. Programming in Makefiles
4197 4197
4198Table of Contents 4198Table of Contents
4199 4199
420012.1. Caveats 420012.1. Caveats
420112.2. Makefile variables 420112.2. Makefile variables
4202 4202
4203 12.2.1. Naming conventions 4203 12.2.1. Naming conventions
4204 4204
420512.3. Code snippets 420512.3. Code snippets
4206 4206
4207 12.3.1. Adding things to a list 4207 12.3.1. Adding things to a list
4208 12.3.2. Converting an internal list into an external list 4208 12.3.2. Converting an internal list into an external list
4209 12.3.3. Passing variables to a shell command 4209 12.3.3. Passing variables to a shell command
4210 12.3.4. Quoting guideline 4210 12.3.4. Quoting guideline
4211 12.3.5. Workaround for a bug in BSD Make 4211 12.3.5. Workaround for a bug in BSD Make
4212 4212
4213Pkgsrc consists of many Makefile fragments, each of which forms a well-defined 4213Pkgsrc consists of many Makefile fragments, each of which forms a well-defined
4214part of the pkgsrc system. Using the make(1) system as a programming language 4214part of the pkgsrc system. Using the make(1) system as a programming language
4215for a big system like pkgsrc requires some discipline to keep the code correct 4215for a big system like pkgsrc requires some discipline to keep the code correct
4216and understandable. 4216and understandable.
4217 4217
4218The basic ingredients for Makefile programming are variables (which are 4218The basic ingredients for Makefile programming are variables (which are
4219actually macros) and shell commands. Among these shell commands may even be 4219actually macros) and shell commands. Among these shell commands may even be
4220more complex ones like awk(1) programs. To make sure that every shell command 4220more complex ones like awk(1) programs. To make sure that every shell command
4221runs as intended it is necessary to quote all variables correctly when they are 4221runs as intended it is necessary to quote all variables correctly when they are
4222used. 4222used.
4223 4223
4224This chapter describes some patterns, that appear quite often in Makefiles, 4224This chapter describes some patterns, that appear quite often in Makefiles,
4225including the pitfalls that come along with them. 4225including the pitfalls that come along with them.
4226 4226
422712.1. Caveats 422712.1. Caveats
4228 4228
4229 * When you are creating a file as a target of a rule, always write the data 4229 * When you are creating a file as a target of a rule, always write the data
4230 to a temporary file first and finally rename that file. Otherwise there 4230 to a temporary file first and finally rename that file. Otherwise there
4231 might occur an error in the middle of generating the file, and when the 4231 might occur an error in the middle of generating the file, and when the
4232 user runs make(1) for the second time, the file exists and will not be 4232 user runs make(1) for the second time, the file exists and will not be
4233 regenerated properly. Example: 4233 regenerated properly. Example:
4234 4234
4235 wrong: 4235 wrong:
4236 @echo "line 1" > ${.TARGET} 4236 @echo "line 1" > ${.TARGET}
4237 @echo "line 2" >> ${.TARGET} 4237 @echo "line 2" >> ${.TARGET}
4238 @false 4238 @false
4239 4239
4240 correct: 4240 correct:
4241 @echo "line 1" > ${.TARGET}.tmp 4241 @echo "line 1" > ${.TARGET}.tmp
4242 @echo "line 2" >> ${.TARGET}.tmp 4242 @echo "line 2" >> ${.TARGET}.tmp
4243 @false 4243 @false
4244 @mv ${.TARGET}.tmp ${.TARGET} 4244 @mv ${.TARGET}.tmp ${.TARGET}
4245 4245
4246 When you run make wrong twice, the file wrong will exist, although there 4246 When you run make wrong twice, the file wrong will exist, although there
4247 was an error message in the first run. On the other hand, running make 4247 was an error message in the first run. On the other hand, running make
4248 correct gives an error message twice, as expected. 4248 correct gives an error message twice, as expected.
4249 4249
4250 You might remember that make(1) sometimes removes ${.TARGET} in case of 4250 You might remember that make(1) sometimes removes ${.TARGET} in case of
4251 error, but this only happens when it is interrupted, for example by 4251 error, but this only happens when it is interrupted, for example by
4252 pressing ^C. This does not happen when one of the commands fails (like 4252 pressing ^C. This does not happen when one of the commands fails (like
4253 false(1) above). 4253 false(1) above).
4254 4254
425512.2. Makefile variables 425512.2. Makefile variables
4256 4256
4257Makefile variables contain strings that can be processed using the five 4257Makefile variables contain strings that can be processed using the five
4258operators ``='', ``+='', ``?='', ``:='', and ``!='', which are described in the 4258operators ``='', ``+='', ``?='', ``:='', and ``!='', which are described in the
4259make(1) man page. 4259make(1) man page.
4260 4260
4261When a variable's value is parsed from a Makefile, the hash character ``#'' and 4261When a variable's value is parsed from a Makefile, the hash character ``#'' and
4262the backslash character ``\'' are handled specially. If a backslash is followed 4262the backslash character ``\'' are handled specially. If a backslash is followed
4263by a newline, any whitespace immediately in front of the backslash, the 4263by a newline, any whitespace immediately in front of the backslash, the
4264backslash, the newline, and any whitespace immediately behind the newline are 4264backslash, the newline, and any whitespace immediately behind the newline are
4265replaced with a single space. A backslash character and an immediately 4265replaced with a single space. A backslash character and an immediately
4266following hash character are replaced with a single hash character. Otherwise, 4266following hash character are replaced with a single hash character. Otherwise,
4267the backslash is passed as is. In a variable assignment, any hash character 4267the backslash is passed as is. In a variable assignment, any hash character
4268that is not preceded by a backslash starts a comment that continues upto the 4268that is not preceded by a backslash starts a comment that continues upto the
4269end of the logical line. 4269end of the logical line.
4270 4270
4271Note: Because of this parsing algorithm the only way to create a variable 4271Note: Because of this parsing algorithm the only way to create a variable
4272consisting of a single backslash is using the ``!='' operator, for example: 4272consisting of a single backslash is using the ``!='' operator, for example:
4273BACKSLASH!=echo "\\". 4273BACKSLASH!=echo "\\".
4274 4274
4275So far for defining variables. The other thing you can do with variables is 4275So far for defining variables. The other thing you can do with variables is
4276evaluating them. A variable is evaluated when it is part of the right side of 4276evaluating them. A variable is evaluated when it is part of the right side of
4277the ``:='' or the ``!='' operator, or directly before executing a shell command 4277the ``:='' or the ``!='' operator, or directly before executing a shell command
4278which the variable is part of. In all other cases, make(1) performs lazy 4278which the variable is part of. In all other cases, make(1) performs lazy
4279evaluation, that is, variables are not evaluated until there's no other way. 4279evaluation, that is, variables are not evaluated until there's no other way.
4280The ``modifiers'' mentioned in the man page also evaluate the variable. 4280The ``modifiers'' mentioned in the man page also evaluate the variable.
4281 4281
4282Some of the modifiers split the string into words and then operate on the 4282Some of the modifiers split the string into words and then operate on the
4283words, others operate on the string as a whole. When a string is split into 4283words, others operate on the string as a whole. When a string is split into
4284words, it is split as you would expect it from sh(1). 4284words, it is split as you would expect it from sh(1).
4285 4285
4286No rule without exception?the .for loop does not follow the shell quoting rules 4286No rule without exception?the .for loop does not follow the shell quoting rules
4287but splits at sequences of whitespace. 4287but splits at sequences of whitespace.
4288 4288
4289There are several types of variables that should be handled differently. 4289There are several types of variables that should be handled differently.
4290Strings and two types of lists. 4290Strings and two types of lists.
4291 4291
4292 * Strings can contain arbitrary characters. Nevertheless, you should restrict 4292 * Strings can contain arbitrary characters. Nevertheless, you should restrict
4293 yourself to only using printable characters. Examples are PREFIX and 4293 yourself to only using printable characters. Examples are PREFIX and
4294 COMMENT. 4294 COMMENT.
4295 4295
4296 * Internal lists are lists that are never exported to any shell command. 4296 * Internal lists are lists that are never exported to any shell command.
4297 Their elements are separated by whitespace. Therefore, the elements 4297 Their elements are separated by whitespace. Therefore, the elements
4298 themselves cannot have embedded whitespace. Any other characters are 4298 themselves cannot have embedded whitespace. Any other characters are
4299 allowed. Internal lists can be used in .for loops. Examples are DEPENDS and 4299 allowed. Internal lists can be used in .for loops. Examples are DEPENDS and
4300 BUILD_DEPENDS. 4300 BUILD_DEPENDS.
4301 4301
4302 * External lists are lists that may be exported to a shell command. Their 4302 * External lists are lists that may be exported to a shell command. Their
4303 elements can contain any characters, including whitespace. That's why they 4303 elements can contain any characters, including whitespace. That's why they
4304 cannot be used in .for loops. Examples are DISTFILES and MASTER_SITES. 4304 cannot be used in .for loops. Examples are DISTFILES and MASTER_SITES.
4305 4305
430612.2.1. Naming conventions 430612.2.1. Naming conventions
4307 4307
4308 * All variable names starting with an underscore are reserved for use by the 4308 * All variable names starting with an underscore are reserved for use by the
4309 pkgsrc infrastructure. They shall not be used by package Makefiles. 4309 pkgsrc infrastructure. They shall not be used by package Makefiles.
4310 4310
4311 * In .for loops you should use lowercase variable names for the iteration 4311 * In .for loops you should use lowercase variable names for the iteration
4312 variables. 4312 variables.
4313 4313
4314 * All list variables should have a ``plural'' name, e.g. PKG_OPTIONS or 4314 * All list variables should have a ``plural'' name, e.g. PKG_OPTIONS or
4315 DISTFILES. 4315 DISTFILES.
4316 4316
431712.3. Code snippets 431712.3. Code snippets
4318 4318
4319This section presents you with some code snippets you should use in your own 4319This section presents you with some code snippets you should use in your own
4320code. If you don't find anything appropriate here, you should test your code 4320code. If you don't find anything appropriate here, you should test your code
4321and add it here. 4321and add it here.
4322 4322
432312.3.1. Adding things to a list 432312.3.1. Adding things to a list
4324 4324
4325STRING= foo * bar `date` 4325STRING= foo * bar `date`
4326INT_LIST= # empty 4326INT_LIST= # empty
4327ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache 4327ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache
4328EXT_LIST= # empty 4328EXT_LIST= # empty
4329ANOTHER_EXT_LIST= a=b c=d 4329ANOTHER_EXT_LIST= a=b c=d
4330 4330
4331INT_LIST+= ${STRING} # 1 4331INT_LIST+= ${STRING} # 1
4332INT_LIST+= ${ANOTHER_INT_LIST} # 2 4332INT_LIST+= ${ANOTHER_INT_LIST} # 2
4333EXT_LIST+= ${STRING:Q} # 3 4333EXT_LIST+= ${STRING:Q} # 3
4334EXT_LIST+= ${ANOTHER_EXT_LIST} # 4 4334EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
4335 4335
4336When you add a string to an external list (example 3), it must be quoted. In 4336When you add a string to an external list (example 3), it must be quoted. In
4337all other cases, you must not add a quoting level. You must not merge internal 4337all other cases, you must not add a quoting level. You must not merge internal
4338and external lists, unless you are sure that all entries are correctly 4338and external lists, unless you are sure that all entries are correctly
4339interpreted in both lists. 4339interpreted in both lists.
4340 4340
434112.3.2. Converting an internal list into an external list 434112.3.2. Converting an internal list into an external list
4342 4342
4343EXT_LIST= # empty 4343EXT_LIST= # empty
4344.for i in ${INT_LIST} 4344.for i in ${INT_LIST}
4345EXT_LIST+= ${i:Q}"" 4345EXT_LIST+= ${i:Q}""
4346.endfor 4346.endfor
4347 4347
4348This code converts the internal list INT_LIST into the external list EXT_LIST. 4348This code converts the internal list INT_LIST into the external list EXT_LIST.
4349As the elements of an internal list are unquoted they must be quoted here. The 4349As the elements of an internal list are unquoted they must be quoted here. The
4350reason for appending "" is explained below. 4350reason for appending "" is explained below.
4351 4351
435212.3.3. Passing variables to a shell command 435212.3.3. Passing variables to a shell command
4353 4353
4354Sometimes you may want to print an arbitrary string. There are many ways to get 4354Sometimes you may want to print an arbitrary string. There are many ways to get
4355it wrong and only few that can handle every nastiness. 4355it wrong and only few that can handle every nastiness.
4356 4356
4357STRING= foo bar < > * `date` $$HOME ' " 4357STRING= foo bar < > * `date` $$HOME ' "
4358EXT_LIST= string=${STRING:Q} x=second\ item 4358EXT_LIST= string=${STRING:Q} x=second\ item
4359 4359
4360all: 4360all:
4361 echo ${STRING} # 1 4361 echo ${STRING} # 1
4362 echo "${STRING}" # 2 4362 echo "${STRING}" # 2
4363 echo "${STRING:Q}" # 3 4363 echo "${STRING:Q}" # 3
4364 echo ${STRING:Q} # 4 4364 echo ${STRING:Q} # 4
4365 echo x${STRING:Q} | sed 1s,.,, # 5 4365 echo x${STRING:Q} | sed 1s,.,, # 5
4366 printf "%s\\n" ${STRING:Q}"" # 6 4366 printf "%s\\n" ${STRING:Q}"" # 6
4367 env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"' 4367 env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
4368 4368
4369Example 1 leads to a syntax error in the shell, as the characters are just 4369Example 1 leads to a syntax error in the shell, as the characters are just
4370copied. 4370copied.
4371 4371
4372Example 2 leads to a syntax error too, and if you leave out the last " 4372Example 2 leads to a syntax error too, and if you leave out the last "
4373character from ${STRING}, date(1) will be executed. The $HOME shell variable 4373character from ${STRING}, date(1) will be executed. The $HOME shell variable
4374would be evaluated, too. 4374would be evaluated, too.
4375 4375
4376Example 3 outputs each space character preceded by a backslash (or not), 4376Example 3 outputs each space character preceded by a backslash (or not),
4377depending on the implementation of the echo(1) command. 4377depending on the implementation of the echo(1) command.
4378 4378
4379Example 4 handles correctly every string that does not start with a dash. In 4379Example 4 handles correctly every string that does not start with a dash. In
4380that case, the result depends on the implementation of the echo(1) command. As 4380that case, the result depends on the implementation of the echo(1) command. As
4381long as you can guarantee that your input does not start with a dash, this form 4381long as you can guarantee that your input does not start with a dash, this form
4382is appropriate. 4382is appropriate.
4383 4383
4384Example 5 handles even the case of a leading dash correctly. 4384Example 5 handles even the case of a leading dash correctly.
4385 4385
4386Example 6 also works with every string and is the light-weight solution, since 4386Example 6 also works with every string and is the light-weight solution, since
4387it does not involve a pipe, which has its own problems. 4387it does not involve a pipe, which has its own problems.
4388 4388
4389The EXT_LIST does not need to be quoted because the quoting has already been 4389The EXT_LIST does not need to be quoted because the quoting has already been
4390done when adding elements to the list. 4390done when adding elements to the list.
4391 4391
4392As internal lists shall not be passed to the shell, there is no example for it. 4392As internal lists shall not be passed to the shell, there is no example for it.
4393 4393
439412.3.4. Quoting guideline 439412.3.4. Quoting guideline
4395 4395
4396There are many possible sources of wrongly quoted variables. This section lists 4396There are many possible sources of wrongly quoted variables. This section lists
4397some of the commonly known ones. 4397some of the commonly known ones.
4398 4398
4399 * Whenever you use the value of a list, think about what happens to leading 4399 * Whenever you use the value of a list, think about what happens to leading
4400 or trailing whitespace. If the list is a well-formed shell expression, you 4400 or trailing whitespace. If the list is a well-formed shell expression, you
4401 can apply the :M* modifier to strip leading and trailing whitespace from 4401 can apply the :M* modifier to strip leading and trailing whitespace from
4402 each word. The :M operator first splits its argument according to the rules 4402 each word. The :M operator first splits its argument according to the rules
4403 of the shell, and then creates a new list consisting of all words that 4403 of the shell, and then creates a new list consisting of all words that
4404 match the shell glob expression *, that is: all. One class of situations 4404 match the shell glob expression *, that is: all. One class of situations
4405 where this is needed is when adding a variable like CPPFLAGS to 4405 where this is needed is when adding a variable like CPPFLAGS to
4406 CONFIGURE_ARGS. If the configure script invokes other configure scripts, it 4406 CONFIGURE_ARGS. If the configure script invokes other configure scripts, it
4407 strips the leading and trailing whitespace from the variable and then 4407 strips the leading and trailing whitespace from the variable and then
4408 passes it to the other configure scripts. But these configure scripts 4408 passes it to the other configure scripts. But these configure scripts
4409 expect the (child) CPPFLAGS variable to be the same as the parent CPPFLAGS. 4409 expect the (child) CPPFLAGS variable to be the same as the parent CPPFLAGS.
4410 That's why we better pass the CPPFLAGS value properly trimmed. And here is 4410 That's why we better pass the CPPFLAGS value properly trimmed. And here is
4411 how we do it: 4411 how we do it:
4412 4412
4413 CPPFLAGS= # empty 4413 CPPFLAGS= # empty
4414 CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\" 4414 CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\"
4415 CPPFLAGS+= ${MY_CPPFLAGS} 4415 CPPFLAGS+= ${MY_CPPFLAGS}
4416 4416
4417 CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q} 4417 CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
4418 4418
4419 all: 4419 all:
4420 echo x${CPPFLAGS:Q}x # leading and trailing whitespace 4420 echo x${CPPFLAGS:Q}x # leading and trailing whitespace
4421 echo x${CONFIGURE_ARGS}x # properly trimmed 4421 echo x${CONFIGURE_ARGS}x # properly trimmed
4422 4422
4423 * The example above contains one bug: The ${PREFIX} is a properly quoted 4423 * The example above contains one bug: The ${PREFIX} is a properly quoted
4424 shell expression, but there is the C compiler after it, which also expects 4424 shell expression, but there is the C compiler after it, which also expects
4425 a properly quoted string (this time in C syntax). The version above is 4425 a properly quoted string (this time in C syntax). The version above is
4426 therefore only correct if ${PREFIX} does not have embedded backslashes or 4426 therefore only correct if ${PREFIX} does not have embedded backslashes or
4427 double quotes. If you want to allow these, you have to add another layer of 4427 double quotes. If you want to allow these, you have to add another layer of
4428 quoting to each variable that is used as a C string literal. You cannot use 4428 quoting to each variable that is used as a C string literal. You cannot use
4429 the :Q operator for it, as this operator only works for the shell. 4429 the :Q operator for it, as this operator only works for the shell.
4430 4430
4431 * Whenever a variable can be empty, the :Q operator can have surprising 4431 * Whenever a variable can be empty, the :Q operator can have surprising
4432 results. Here are two completely different cases which can be solved with 4432 results. Here are two completely different cases which can be solved with
4433 the same trick. 4433 the same trick.
4434 4434
4435 EMPTY= # empty 4435 EMPTY= # empty
4436 empty_test: 4436 empty_test:
4437 for i in a ${EMPTY:Q} c; do \ 4437 for i in a ${EMPTY:Q} c; do \
4438 echo "$$i"; \ 4438 echo "$$i"; \
4439 done 4439 done
4440 4440
4441 for_test: 4441 for_test:
4442 .for i in a:\ a:\test.txt 4442 .for i in a:\ a:\test.txt
4443 echo ${i:Q} 4443 echo ${i:Q}
4444 echo "foo" 4444 echo "foo"
4445 .endfor 4445 .endfor
4446 4446
4447 The first example will only print two of the three lines we might have 4447 The first example will only print two of the three lines we might have
4448 expected. This is because ${EMPTY:Q} expands to the empty string, which the 4448 expected. This is because ${EMPTY:Q} expands to the empty string, which the
4449 shell cannot see. The workaround is to write ${EMPTY:Q}"". This pattern can 4449 shell cannot see. The workaround is to write ${EMPTY:Q}"". This pattern can
4450 be often found as ${TEST} -z ${VAR:Q} or as ${TEST} -f ${FNAME:Q} (both of 4450 be often found as ${TEST} -z ${VAR:Q} or as ${TEST} -f ${FNAME:Q} (both of
4451 these are wrong). 4451 these are wrong).
4452 4452
4453 The second example will only print three lines instead of four. The first 4453 The second example will only print three lines instead of four. The first
4454 line looks like a:\ echo foo. This is because the backslash of the value a: 4454 line looks like a:\ echo foo. This is because the backslash of the value a:
4455 \ is interpreted as a line-continuation by make(1), which makes the second 4455 \ is interpreted as a line-continuation by make(1), which makes the second
4456 line the arguments of the echo(1) command from the first line. To avoid 4456 line the arguments of the echo(1) command from the first line. To avoid
4457 this, write ${i:Q}"". 4457 this, write ${i:Q}"".
4458 4458
445912.3.5. Workaround for a bug in BSD Make 445912.3.5. Workaround for a bug in BSD Make
4460 4460
4461The pkgsrc bmake program does not handle the following assignment correctly. In 4461The pkgsrc bmake program does not handle the following assignment correctly. In
4462case _othervar_ contains a ``-'' character, one of the closing braces is 4462case _othervar_ contains a ``-'' character, one of the closing braces is
4463included in ${VAR} after this code executes. 4463included in ${VAR} after this code executes.
4464 4464
4465VAR:= ${VAR:N${_othervar_:C/-//}} 4465VAR:= ${VAR:N${_othervar_:C/-//}}
4466 4466
4467For a more complex code snippet and a workaround, see the package regress/ 4467For a more complex code snippet and a workaround, see the package regress/
4468make-quoting, testcase bug1. 4468make-quoting, testcase bug1.
4469 4469
4470Chapter 13. PLIST issues 4470Chapter 13. PLIST issues
4471 4471
4472Table of Contents 4472Table of Contents
4473 4473
447413.1. RCS ID 447413.1. RCS ID
447513.2. Semi-automatic PLIST generation 447513.2. Semi-automatic PLIST generation
447613.3. Tweaking output of make print-PLIST 447613.3. Tweaking output of make print-PLIST
447713.4. Variable substitution in PLIST 447713.4. Variable substitution in PLIST
447813.5. Man page compression 447813.5. Man page compression
447913.6. Changing PLIST source with PLIST_SRC 447913.6. Changing PLIST source with PLIST_SRC
448013.7. Platform-specific and differing PLISTs 448013.7. Platform-specific and differing PLISTs
448113.8. Sharing directories between packages 448113.8. Sharing directories between packages
4482 4482
4483The PLIST file contains a package's "packing list", i.e. a list of files that 4483The PLIST file contains a package's "packing list", i.e. a list of files that
4484belong to the package (relative to the ${PREFIX} directory it's been installed 4484belong to the package (relative to the ${PREFIX} directory it's been installed
4485in) plus some additional statements - see the pkg_create(1) man page for a full 4485in) plus some additional statements - see the pkg_create(1) man page for a full
4486list. This chapter addresses some issues that need attention when dealing with 4486list. This chapter addresses some issues that need attention when dealing with
4487the PLIST file (or files, see below!). 4487the PLIST file (or files, see below!).
4488 4488
448913.1. RCS ID 448913.1. RCS ID
4490 4490
4491Be sure to add a RCS ID line as the first thing in any PLIST file you write: 4491Be sure to add a RCS ID line as the first thing in any PLIST file you write:
4492 4492
4493@comment $NetBSD$ 4493@comment $NetBSD$
4494 4494
4495 4495
449613.2. Semi-automatic PLIST generation 449613.2. Semi-automatic PLIST generation
4497 4497
4498You can use the make print-PLIST command to output a PLIST that matches any new 4498You can use the make print-PLIST command to output a PLIST that matches any new
4499files since the package was extracted. See Section 17.17, "Other helpful 4499files since the package was extracted. See Section 17.17, "Other helpful
4500targets" for more information on this target. 4500targets" for more information on this target.
4501 4501
450213.3. Tweaking output of make print-PLIST 450213.3. Tweaking output of make print-PLIST
4503 4503
4504If you have used any of the *-dirs packages, as explained in Section 13.8, 4504If you have used any of the *-dirs packages, as explained in Section 13.8,
4505"Sharing directories between packages", you may have noticed that make 4505"Sharing directories between packages", you may have noticed that make
4506print-PLIST outputs a set of @comments instead of real @dirrm lines. You can 4506print-PLIST outputs a set of @comments instead of real @dirrm lines. You can
4507also do this for specific directories and files, so that the results of that 4507also do this for specific directories and files, so that the results of that
4508command are very close to reality. This helps a lot during the update of 4508command are very close to reality. This helps a lot during the update of
4509packages. 4509packages.
4510 4510
4511The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are 4511The PRINT_PLIST_AWK variable takes a set of AWK patterns and actions that are
4512used to filter the output of print-PLIST. You can append any chunk of AWK 4512used to filter the output of print-PLIST. You can append any chunk of AWK
4513scripting you like to it, but be careful with quoting. 4513scripting you like to it, but be careful with quoting.
4514 4514
4515For example, to get all files inside the libdata/foo directory removed from the 4515For example, to get all files inside the libdata/foo directory removed from the
4516resulting PLIST: 4516resulting PLIST:
4517 4517
4518PRINT_PLIST_AWK+= /^libdata\/foo/ { next; } 4518PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
4519 4519
4520 4520
4521And to get all the @dirrm lines referring to a specific (shared) directory 4521And to get all the @dirrm lines referring to a specific (shared) directory
4522converted to @comments: 4522converted to @comments:
4523 4523
4524PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; } 4524PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
4525 4525
4526 4526
452713.4. Variable substitution in PLIST 452713.4. Variable substitution in PLIST
4528 4528
4529A number of variables are substituted automatically in PLISTs when a package is 4529A number of variables are substituted automatically in PLISTs when a package is
4530installed on a system. This includes the following variables: 4530installed on a system. This includes the following variables:
4531 4531
4532${MACHINE_ARCH}, ${MACHINE_GNU_ARCH} 4532${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}
4533 4533
4534 Some packages like emacs and perl embed information about which 4534 Some packages like emacs and perl embed information about which
4535 architecture they were built on into the pathnames where they install their 4535 architecture they were built on into the pathnames where they install their
4536 files. To handle this case, PLIST will be preprocessed before actually 4536 files. To handle this case, PLIST will be preprocessed before actually
4537 used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p 4537 used, and the symbol "${MACHINE_ARCH}" will be replaced by what uname -p
4538 gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in 4538 gives. The same is done if the string ${MACHINE_GNU_ARCH} is embedded in
4539 PLIST somewhere - use this on packages that have GNU autoconf-created 4539 PLIST somewhere - use this on packages that have GNU autoconf-created
4540 configure scripts. 4540 configure scripts.
4541 4541
4542 Legacy note 4542 Legacy note
4543 4543
4544 There used to be a symbol "$ARCH" that was replaced by the output of uname 4544 There used to be a symbol "$ARCH" that was replaced by the output of uname
4545 -m, but that's no longer supported and has been removed. 4545 -m, but that's no longer supported and has been removed.
4546 4546
4547${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION} 4547${OPSYS}, ${LOWER_OPSYS}, ${OS_VERSION}
4548 4548
4549 Some packages want to embed the OS name and version into some paths. To do 4549 Some packages want to embed the OS name and version into some paths. To do
4550 this, use these variables in the PLIST: 4550 this, use these variables in the PLIST:
4551 4551
4552 + ${OPSYS} - output of "uname -s" 4552 + ${OPSYS} - output of "uname -s"
4553 4553
4554 + ${LOWER_OPSYS} - lowercase common name (eg. "solaris") 4554 + ${LOWER_OPSYS} - lowercase common name (eg. "solaris")
4555 4555
4556 + ${OS_VERSION} - "uname -r" 4556 + ${OS_VERSION} - "uname -r"
4557 4557
4558For a complete list of values which are replaced by default, please look in 4558For a complete list of values which are replaced by default, please look in
4559bsd.pkg.mk (and search for PLIST_SUBST). 4559bsd.pkg.mk (and search for PLIST_SUBST).
4560 4560
4561If you want to change other variables not listed above, you can add variables 4561If you want to change other variables not listed above, you can add variables
4562and their expansions to this variable in the following way, similar to 4562and their expansions to this variable in the following way, similar to
4563MESSAGE_SUBST (see Section 11.5, "Optional files"): 4563MESSAGE_SUBST (see Section 11.5, "Optional files"):
4564 4564
4565PLIST_SUBST+= SOMEVAR="somevalue" 4565PLIST_SUBST+= SOMEVAR="somevalue"
4566 4566
4567 4567
4568This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue". 4568This replaces all occurrences of "${SOMEVAR}" in the PLIST with "somevalue".
4569 4569
4570The PLIST_VARS variable can be used to simplify the common case of 4570The PLIST_VARS variable can be used to simplify the common case of
4571conditionally including some PLIST entries. It can be done by adding 4571conditionally including some PLIST entries. It can be done by adding
4572PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the 4572PLIST_VARS+=foo and setting the corresponding PLIST.foo variable to yes if the
4573entry should be included. This will substitute "${PLIST.foo}" in the PLIST with 4573entry should be included. This will substitute "${PLIST.foo}" in the PLIST with
4574either """" or ""@comment "". For example, in Makefile: 4574either """" or ""@comment "". For example, in Makefile:
4575 4575
4576PLIST_VARS+= foo 4576PLIST_VARS+= foo
4577.if condition 4577.if condition
4578PLIST.foo= yes 4578PLIST.foo= yes
4579.else 4579.else
4580 4580
4581 4581
4582And then in PLIST: 4582And then in PLIST:
4583 4583
4584@comment $NetBSD$ 4584@comment $NetBSD$
4585bin/bar 4585bin/bar
4586man/man1/bar.1 4586man/man1/bar.1
4587${PLIST.foo}bin/foo 4587${PLIST.foo}bin/foo
4588${PLIST.foo}man/man1/foo.1 4588${PLIST.foo}man/man1/foo.1
4589${PLIST.foo}share/bar/foo.data 4589${PLIST.foo}share/bar/foo.data
4590${PLIST.foo}@dirrm share/bar 4590${PLIST.foo}@dirrm share/bar
4591 4591
4592 4592
459313.5. Man page compression 459313.5. Man page compression
4594 4594
4595Man pages should be installed in compressed form if MANZ is set (in 4595Man pages should be installed in compressed form if MANZ is set (in
4596bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the 4596bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST file, the
4597suffix ".gz" is appended/removed automatically for man pages according to MANZ 4597suffix ".gz" is appended/removed automatically for man pages according to MANZ
4598and MANCOMPRESSED being set or not, see above for details. This modification of 4598and MANCOMPRESSED being set or not, see above for details. This modification of
4599the PLIST file is done on a copy of it, not PLIST itself. 4599the PLIST file is done on a copy of it, not PLIST itself.
4600 4600
460113.6. Changing PLIST source with PLIST_SRC 460113.6. Changing PLIST source with PLIST_SRC
4602 4602
4603To use one or more files as source for the PLIST used in generating the binary 4603To use one or more files as source for the PLIST used in generating the binary
4604package, set the variable PLIST_SRC to the names of that file(s). The files are 4604package, set the variable PLIST_SRC to the names of that file(s). The files are
4605later concatenated using cat(1), and the order of things is important. The 4605later concatenated using cat(1), and the order of things is important. The
4606default for PLIST_SRC is ${PKGDIR}/PLIST. 4606default for PLIST_SRC is ${PKGDIR}/PLIST.
4607 4607
460813.7. Platform-specific and differing PLISTs 460813.7. Platform-specific and differing PLISTs
4609 4609
4610Some packages decide to install a different set of files based on the operating 4610Some packages decide to install a different set of files based on the operating
4611system being used. These differences can be automatically handled by using the 4611system being used. These differences can be automatically handled by using the
4612following files: 4612following files:
4613 4613
4614 * PLIST.common 4614 * PLIST.common
4615 4615
4616 * PLIST.${OPSYS} 4616 * PLIST.${OPSYS}
4617 4617
4618 * PLIST.${MACHINE_ARCH} 4618 * PLIST.${MACHINE_ARCH}
4619 4619
4620 * PLIST.${OPSYS}-${MACHINE_ARCH} 4620 * PLIST.${OPSYS}-${MACHINE_ARCH}
4621 4621
4622 * PLIST.common_end 4622 * PLIST.common_end
4623 4623
462413.8. Sharing directories between packages 462413.8. Sharing directories between packages
4625 4625
4626A "shared directory" is a directory where multiple (and unrelated) packages 4626A "shared directory" is a directory where multiple (and unrelated) packages
4627install files. These directories were problematic because you had to add 4627install files. These directories were problematic because you had to add
4628special tricks in the PLIST to conditionally remove them, or have some 4628special tricks in the PLIST to conditionally remove them, or have some
4629centralized package handle them. 4629centralized package handle them.
4630 4630
4631In pkgsrc, it is now easy: Each package should create directories and install 4631In pkgsrc, it is now easy: Each package should create directories and install
4632files as needed; pkg_delete will remove any directories left empty after 4632files as needed; pkg_delete will remove any directories left empty after
4633uninstalling a package. 4633uninstalling a package.
4634 4634
4635If a package needs an empty directory to work, create the directory during 4635If a package needs an empty directory to work, create the directory during
4636installation as usual, and also add an entry to the PLIST: 4636installation as usual, and also add an entry to the PLIST:
4637 4637
4638@pkgdir path/to/empty/directory 4638@pkgdir path/to/empty/directory
4639 4639
4640 4640
4641Chapter 14. Buildlink methodology 4641Chapter 14. Buildlink methodology
4642 4642
4643Table of Contents 4643Table of Contents
4644 4644
464514.1. Converting packages to use buildlink3 464514.1. Converting packages to use buildlink3
464614.2. Writing buildlink3.mk files 464614.2. Writing buildlink3.mk files
4647 4647
4648 14.2.1. Anatomy of a buildlink3.mk file 4648 14.2.1. Anatomy of a buildlink3.mk file
4649 14.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in 4649 14.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
4650 buildlink3.mk files 4650 buildlink3.mk files
4651 4651
465214.3. Writing builtin.mk files 465214.3. Writing builtin.mk files
4653 4653
4654 14.3.1. Anatomy of a builtin.mk file 4654 14.3.1. Anatomy of a builtin.mk file
4655 14.3.2. Global preferences for native or pkgsrc software 4655 14.3.2. Global preferences for native or pkgsrc software
4656 4656
4657Buildlink is a framework in pkgsrc that controls what headers and libraries are 4657Buildlink is a framework in pkgsrc that controls what headers and libraries are
4658seen by a package's configure and build processes. This is implemented in a two 4658seen by a package's configure and build processes. This is implemented in a two
4659step process: 4659step process:
4660 4660
4661 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by 4661 1. Symlink headers and libraries for dependencies into BUILDLINK_DIR, which by
4662 default is a subdirectory of WRKDIR. 4662 default is a subdirectory of WRKDIR.
4663 4663
4664 2. Create wrapper scripts that are used in place of the normal compiler tools 4664 2. Create wrapper scripts that are used in place of the normal compiler tools
4665 that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into 4665 that translate -I${LOCALBASE}/include and -L${LOCALBASE}/lib into
4666 references to BUILDLINK_DIR. The wrapper scripts also make native compiler 4666 references to BUILDLINK_DIR. The wrapper scripts also make native compiler
4667 on some operating systems look like GCC, so that packages that expect GCC 4667 on some operating systems look like GCC, so that packages that expect GCC
4668 won't require modifications to build with those native compilers. 4668 won't require modifications to build with those native compilers.
4669 4669
4670This normalizes the environment in which a package is built so that the package 4670This normalizes the environment in which a package is built so that the package
4671may be built consistently despite what other software may be installed. Please 4671may be built consistently despite what other software may be installed. Please
4672note that the normal system header and library paths, e.g. /usr/include, /usr/ 4672note that the normal system header and library paths, e.g. /usr/include, /usr/
4673lib, etc., are always searched -- buildlink3 is designed to insulate the 4673lib, etc., are always searched -- buildlink3 is designed to insulate the
4674package build from non-system-supplied software. 4674package build from non-system-supplied software.
4675 4675
467614.1. Converting packages to use buildlink3 467614.1. Converting packages to use buildlink3
4677 4677
4678The process of converting packages to use the buildlink3 framework ("bl3ifying" 4678The process of converting packages to use the buildlink3 framework ("bl3ifying"
4679) is fairly straightforward. The things to keep in mind are: 4679) is fairly straightforward. The things to keep in mind are:
4680 4680
4681 1. Ensure that the build always calls the wrapper scripts instead of the 4681 1. Ensure that the build always calls the wrapper scripts instead of the
4682 actual toolchain. Some packages are tricky, and the only way to know for 4682 actual toolchain. Some packages are tricky, and the only way to know for
4683 sure is the check ${WRKDIR}/.work.log to see if the wrappers are being 4683 sure is the check ${WRKDIR}/.work.log to see if the wrappers are being
4684 invoked. 4684 invoked.
4685 4685
4686 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs, 4686 2. Don't override PREFIX from within the package Makefile, e.g. Java VMs,
4687 standalone shells, etc., because the code to symlink files into $ 4687 standalone shells, etc., because the code to symlink files into $
4688 {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname". 4688 {BUILDLINK_DIR} looks for files relative to "pkg_info -qp pkgname".
4689 4689
4690 3. Remember that only the buildlink3.mk files that you list in a package's 4690 3. Remember that only the buildlink3.mk files that you list in a package's
4691 Makefile are added as dependencies for that package. 4691 Makefile are added as dependencies for that package.
4692 4692
4693If a dependency on a particular package is required for its libraries and 4693If a dependency on a particular package is required for its libraries and
4694headers, then we replace: 4694headers, then we replace:
4695 4695
4696DEPENDS+= foo>=1.1.0:../../category/foo 4696DEPENDS+= foo>=1.1.0:../../category/foo
4697 4697
4698with 4698with
4699 4699
4700.include "../../category/foo/buildlink3.mk" 4700.include "../../category/foo/buildlink3.mk"
4701 4701
4702The buildlink3.mk files usually define the required dependencies. If you need a 4702The buildlink3.mk files usually define the required dependencies. If you need a
4703newer version of the dependency when using buildlink3.mk files, then you can 4703newer version of the dependency when using buildlink3.mk files, then you can
4704define it in your Makefile; for example: 4704define it in your Makefile; for example:
4705 4705
4706BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0 4706BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
4707.include "../../category/foo/buildlink3.mk" 4707.include "../../category/foo/buildlink3.mk"
4708 4708
4709There are several buildlink3.mk files in pkgsrc/mk that handle special package 4709There are several buildlink3.mk files in pkgsrc/mk that handle special package
4710issues: 4710issues:
4711 4711
4712 * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB 4712 * bdb.buildlink3.mk chooses either the native or a pkgsrc Berkeley DB
4713 implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT. 4713 implementation based on the values of BDB_ACCEPTED and BDB_DEFAULT.
4714 4714
4715 * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses, 4715 * curses.buildlink3.mk: If the system comes with neither Curses nor NCurses,
4716 this will take care to install the devel/ncurses package. 4716 this will take care to install the devel/ncurses package.
4717 4717
4718 * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding 4718 * krb5.buildlink3.mk uses the value of KRB5_ACCEPTED to choose between adding
4719 a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5 4719 a dependency on Heimdal or MIT-krb5 for packages that require a Kerberos 5
4720 implementation. 4720 implementation.
4721 4721
4722 * motif.buildlink3.mk checks for a system-provided Motif installation or adds 4722 * motif.buildlink3.mk checks for a system-provided Motif installation or adds
4723 a dependency on x11/lesstif, x11/motif or x11/openmotif. The user can set 4723 a dependency on x11/lesstif, x11/motif or x11/openmotif. The user can set
4724 MOTIF_TYPE to "dt", "lesstif", "motif" or "openmotif" to choose which Motif 4724 MOTIF_TYPE to "dt", "lesstif", "motif" or "openmotif" to choose which Motif
4725 version will be used. 4725 version will be used.
4726 4726
4727 * readline.buildlink3.mk checks for a system-provided GNU readline or ediline 4727 * readline.buildlink3.mk checks for a system-provided GNU readline or
4728 (libedit) installation, or adds a dependency on devel/readline, devel/ 4728 editline (libedit) installation, or adds a dependency on devel/readline,
4729 editline. The user can set READLINE_DEFAULT to choose readline 4729 devel/editline. The user can set READLINE_DEFAULT to choose readline
4730 implementation. If your package really needs GNU readline library, its 4730 implementation. If your package really needs GNU readline library, its
4731 Makefile should include devel/readline/buildlink3.mk instead of 4731 Makefile should include devel/readline/buildlink3.mk instead of
4732 readline.buildlink3.mk. 4732 readline.buildlink3.mk.
4733 4733
4734 * oss.buildlink3.mk defines several variables that may be used by packages 4734 * oss.buildlink3.mk defines several variables that may be used by packages
4735 that use the Open Sound System (OSS) API. 4735 that use the Open Sound System (OSS) API.
4736 4736
4737 * pgsql.buildlink3.mk will accept any of the Postgres versions in the 4737 * pgsql.buildlink3.mk will accept any of the Postgres versions in the
4738 variable PGSQL_VERSIONS_ACCEPTED and default to the version 4738 variable PGSQL_VERSIONS_ACCEPTED and default to the version
4739 PGSQL_VERSION_DEFAULT. See the file for more information. 4739 PGSQL_VERSION_DEFAULT. See the file for more information.
4740 4740
4741 * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native 4741 * pthread.buildlink3.mk uses the value of PTHREAD_OPTS and checks for native
4742 pthreads or adds a dependency on devel/pth as needed. 4742 pthreads or adds a dependency on devel/pth as needed.
4743 4743
4744 * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena 4744 * xaw.buildlink3.mk uses the value of XAW_TYPE to choose a particular Athena
4745 widgets library. 4745 widgets library.
4746 4746
4747The comments in those buildlink3.mk files provide a more complete description 4747The comments in those buildlink3.mk files provide a more complete description
4748of how to use them properly. 4748of how to use them properly.
4749 4749
475014.2. Writing buildlink3.mk files 475014.2. Writing buildlink3.mk files
4751 4751
4752A package's buildlink3.mk file is included by Makefiles to indicate the need to 4752A package's buildlink3.mk file is included by Makefiles to indicate the need to
4753compile and link against header files and libraries provided by the package. A 4753compile and link against header files and libraries provided by the package. A
4754buildlink3.mk file should always provide enough information to add the correct 4754buildlink3.mk file should always provide enough information to add the correct
4755type of dependency relationship and include any other buildlink3.mk files that 4755type of dependency relationship and include any other buildlink3.mk files that
4756it needs to find headers and libraries that it needs in turn. 4756it needs to find headers and libraries that it needs in turn.
4757 4757
4758To generate an initial buildlink3.mk file for further editing, Rene Hexel's 4758To generate an initial buildlink3.mk file for further editing, Rene Hexel's
4759pkgtools/createbuildlink package is highly recommended. For most packages, the 4759pkgtools/createbuildlink package is highly recommended. For most packages, the
4760following command will generate a good starting point for buildlink3.mk files: 4760following command will generate a good starting point for buildlink3.mk files:
4761 4761
4762% cd pkgsrc/category/pkgdir 4762% cd pkgsrc/category/pkgdir
4763% createbuildlink >buildlink3.mk 4763% createbuildlink >buildlink3.mk
4764 4764
4765 4765
476614.2.1. Anatomy of a buildlink3.mk file 476614.2.1. Anatomy of a buildlink3.mk file
4767 4767
4768The following real-life example buildlink3.mk is taken from pkgsrc/graphics/ 4768The following real-life example buildlink3.mk is taken from pkgsrc/graphics/
4769tiff: 4769tiff:
4770 4770
4771# $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $ 4771# $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
4772 4772
4773BUILDLINK_TREE+= tiff 4773BUILDLINK_TREE+= tiff
4774 4774
4775.if !defined(TIFF_BUILDLINK3_MK) 4775.if !defined(TIFF_BUILDLINK3_MK)
4776TIFF_BUILDLINK3_MK:= 4776TIFF_BUILDLINK3_MK:=
4777 4777
4778BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1 4778BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
4779BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1 4779BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
4780BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff 4780BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
4781 4781
4782.include "../../devel/zlib/buildlink3.mk" 4782.include "../../devel/zlib/buildlink3.mk"
4783.include "../../graphics/jpeg/buildlink3.mk" 4783.include "../../graphics/jpeg/buildlink3.mk"
4784.endif # TIFF_BUILDLINK3_MK 4784.endif # TIFF_BUILDLINK3_MK
4785 4785
4786BUILDLINK_TREE+= -tiff 4786BUILDLINK_TREE+= -tiff
4787 4787
4788The header and footer manipulate BUILDLINK_TREE, which is common across all 4788The header and footer manipulate BUILDLINK_TREE, which is common across all
4789buildlink3.mk files and is used to track the dependency tree. 4789buildlink3.mk files and is used to track the dependency tree.
4790 4790
4791The main section is protected from multiple inclusion and controls how the 4791The main section is protected from multiple inclusion and controls how the
4792dependency on pkg is added. Several important variables are set in the section: 4792dependency on pkg is added. Several important variables are set in the section:
4793 4793
4794 * BUILDLINK_API_DEPENDS.pkg is the actual dependency recorded in the 4794 * BUILDLINK_API_DEPENDS.pkg is the actual dependency recorded in the
4795 installed package; this should always be set using += to ensure that we're 4795 installed package; this should always be set using += to ensure that we're
4796 appending to any pre-existing list of values. This variable should be set 4796 appending to any pre-existing list of values. This variable should be set
4797 to the first version of the package that had an backwards-incompatible API 4797 to the first version of the package that had an backwards-incompatible API
4798 change. 4798 change.
4799 4799
4800 * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory. 4800 * BUILDLINK_PKGSRCDIR.pkg is the location of the pkg pkgsrc directory.
4801 4801
4802 * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use 4802 * BUILDLINK_DEPMETHOD.pkg (not shown above) controls whether we use
4803 BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency 4803 BUILD_DEPENDS or DEPENDS to add the dependency on pkg. The build dependency
4804 is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the 4804 is selected by setting BUILDLINK_DEPMETHOD.pkg to "build". By default, the
4805 full dependency is used. 4805 full dependency is used.
4806 4806
4807 * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists 4807 * BUILDLINK_INCDIRS.pkg and BUILDLINK_LIBDIRS.pkg (not shown above) are lists
4808 of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and 4808 of subdirectories of ${BUILDLINK_PREFIX.pkg} to add to the header and
4809 library search paths. These default to "include" and "lib" respectively. 4809 library search paths. These default to "include" and "lib" respectively.
4810 4810
4811 * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags 4811 * BUILDLINK_CPPFLAGS.pkg (not shown above) is the list of preprocessor flags
4812 to add to CPPFLAGS, which are passed on to the configure and build phases. 4812 to add to CPPFLAGS, which are passed on to the configure and build phases.
4813 The "-I" option should be avoided and instead be handled using 4813 The "-I" option should be avoided and instead be handled using
4814 BUILDLINK_INCDIRS.pkg as above. 4814 BUILDLINK_INCDIRS.pkg as above.
4815 4815
4816The following variables are all optionally defined within this second section 4816The following variables are all optionally defined within this second section
4817(protected against multiple inclusion) and control which package files are 4817(protected against multiple inclusion) and control which package files are
4818symlinked into ${BUILDLINK_DIR} and how their names are transformed during the 4818symlinked into ${BUILDLINK_DIR} and how their names are transformed during the
4819symlinking: 4819symlinking:
4820 4820
4821 * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $ 4821 * BUILDLINK_FILES.pkg (not shown above) is a shell glob pattern relative to $
4822 {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/ 4822 {BUILDLINK_PREFIX.pkg} to be symlinked into ${BUILDLINK_DIR}, e.g. include/
4823 *.h. 4823 *.h.
4824 4824
4825 * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs 4825 * BUILDLINK_FILES_CMD.pkg (not shown above) is a shell pipeline that outputs
4826 to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The 4826 to stdout a list of files relative to ${BUILDLINK_PREFIX.pkg}. The
4827 resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this 4827 resulting files are to be symlinked into ${BUILDLINK_DIR}. By default, this
4828 takes the +CONTENTS of a pkg and filters it through $ 4828 takes the +CONTENTS of a pkg and filters it through $
4829 {BUILDLINK_CONTENTS_FILTER.pkg}. 4829 {BUILDLINK_CONTENTS_FILTER.pkg}.
4830 4830
4831 * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that 4831 * BUILDLINK_CONTENTS_FILTER.pkg (not shown above) is a filter command that
4832 filters +CONTENTS input into a list of files relative to $ 4832 filters +CONTENTS input into a list of files relative to $
4833 {BUILDLINK_PREFIX.pkg} on stdout. By default for overwrite packages, 4833 {BUILDLINK_PREFIX.pkg} on stdout. By default for overwrite packages,
4834 BUILDLINK_CONTENTS_FILTER.pkg outputs the contents of the include and lib 4834 BUILDLINK_CONTENTS_FILTER.pkg outputs the contents of the include and lib
4835 directories in the package +CONTENTS, and for pkgviews packages, it outputs 4835 directories in the package +CONTENTS, and for pkgviews packages, it outputs
4836 any libtool archives in lib directories. 4836 any libtool archives in lib directories.
4837 4837
4838 * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments 4838 * BUILDLINK_FNAME_TRANSFORM.pkg (not shown above) is a list of sed arguments
4839 used to transform the name of the source filename into a destination 4839 used to transform the name of the source filename into a destination
4840 filename, e.g. -e "s|/curses.h|/ncurses.h|g". 4840 filename, e.g. -e "s|/curses.h|/ncurses.h|g".
4841 4841
4842This section can additionally include any buildlink3.mk needed for pkg's 4842This section can additionally include any buildlink3.mk needed for pkg's
4843library dependencies. Including these buildlink3.mk files means that the 4843library dependencies. Including these buildlink3.mk files means that the
4844headers and libraries for these dependencies are also symlinked into $ 4844headers and libraries for these dependencies are also symlinked into $
4845{BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies 4845{BUILDLINK_DIR} whenever the pkg buildlink3.mk file is included. Dependencies
4846are only added for directly include buildlink3.mk files. 4846are only added for directly include buildlink3.mk files.
4847 4847
4848When providing a buildlink3.mk and including other buildlink3.mk files in it, 4848When providing a buildlink3.mk and including other buildlink3.mk files in it,
4849please only add necessary ones, i.e., those whose libraries or header files are 4849please only add necessary ones, i.e., those whose libraries or header files are
4850automatically exposed when the package is use. 4850automatically exposed when the package is use.
4851 4851
4852In particular, if only an executable (bin/foo) is linked against a library, 4852In particular, if only an executable (bin/foo) is linked against a library,
4853that library does not need to be propagated in the buildlink3.mk file. 4853that library does not need to be propagated in the buildlink3.mk file.
4854 4854
4855The following steps should help you decide if a buildlink3.mk file needs to be 4855The following steps should help you decide if a buildlink3.mk file needs to be
4856included: 4856included:
4857 4857
4858 * Look at the installed header files: What headers do they include? The 4858 * Look at the installed header files: What headers do they include? The
4859 packages providing these files must be buildlinked. 4859 packages providing these files must be buildlinked.
4860 4860
4861 * Run ldd on all installed libraries and look against what other libraries 4861 * Run ldd on all installed libraries and look against what other libraries
4862 they link. Some of the packages providing these probably need to be 4862 they link. Some of the packages providing these probably need to be
4863 buildlinked; however, it's not automatic, since e.g. GTK on some systems 4863 buildlinked; however, it's not automatic, since e.g. GTK on some systems
4864 pulls in the X libraries, so they will show up in the ldd output, while on 4864 pulls in the X libraries, so they will show up in the ldd output, while on
4865 others (like OS X) it won't. ldd output can thus only be used as a hint. 4865 others (like OS X) it won't. ldd output can thus only be used as a hint.
4866 4866
486714.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in 486714.2.2. Updating BUILDLINK_API_DEPENDS.pkg and BUILDLINK_ABI_DEPENDS.pkg in
4868buildlink3.mk files 4868buildlink3.mk files
4869 4869
4870These two variables differ in that one describes source compatibility (API) and 4870These two variables differ in that one describes source compatibility (API) and
4871the other binary compatibility (ABI). The difference is that a change in the 4871the other binary compatibility (ABI). The difference is that a change in the
4872API breaks compilation of programs while changes in the ABI stop compiled 4872API breaks compilation of programs while changes in the ABI stop compiled
4873programs from running. 4873programs from running.
4874 4874
4875Changes to the BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk file 4875Changes to the BUILDLINK_API_DEPENDS.pkg variable in a buildlink3.mk file
4876happen very rarely. One possible reason is that all packages depending on this 4876happen very rarely. One possible reason is that all packages depending on this
4877already need a newer version. In case it is bumped see the description below. 4877already need a newer version. In case it is bumped see the description below.
4878 4878
4879The most common example of an ABI change is that the major version of a shared 4879The most common example of an ABI change is that the major version of a shared
4880library is increased. In this case, BUILDLINK_ABI_DEPENDS.pkg should be 4880library is increased. In this case, BUILDLINK_ABI_DEPENDS.pkg should be
4881adjusted to require at least the new package version. Then the packages that 4881adjusted to require at least the new package version. Then the packages that
4882depend on this package need their PKGREVISIONs increased and, if they have 4882depend on this package need their PKGREVISIONs increased and, if they have
4883buildlink3.mk files, their BUILDLINK_ABI_DEPENDS.pkg adjusted, too. This is 4883buildlink3.mk files, their BUILDLINK_ABI_DEPENDS.pkg adjusted, too. This is
4884needed so pkgsrc will require the correct package dependency and not settle for 4884needed so pkgsrc will require the correct package dependency and not settle for
4885an older one when building the source. 4885an older one when building the source.
4886 4886
4887See Section 19.1.6, "Handling dependencies" for more information about 4887See Section 19.1.6, "Handling dependencies" for more information about
4888dependencies on other packages, including the BUILDLINK_ABI_DEPENDS and 4888dependencies on other packages, including the BUILDLINK_ABI_DEPENDS and
4889ABI_DEPENDS definitions. 4889ABI_DEPENDS definitions.
4890 4890
4891Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or 4891Please take careful consideration before adjusting BUILDLINK_API_DEPENDS.pkg or
4892BUILDLINK_ABI_DEPENDS.pkg as we don't want to cause unneeded package deletions 4892BUILDLINK_ABI_DEPENDS.pkg as we don't want to cause unneeded package deletions
4893and rebuilds. In many cases, new versions of packages work just fine with older 4893and rebuilds. In many cases, new versions of packages work just fine with older
4894dependencies. 4894dependencies.
4895 4895
4896Also it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to 4896Also it is not needed to set BUILDLINK_ABI_DEPENDS.pkg when it is identical to
4897BUILDLINK_API_DEPENDS.pkg. 4897BUILDLINK_API_DEPENDS.pkg.
4898 4898
489914.3. Writing builtin.mk files 489914.3. Writing builtin.mk files
4900 4900
4901Some packages in pkgsrc install headers and libraries that coincide with 4901Some packages in pkgsrc install headers and libraries that coincide with
4902headers and libraries present in the base system. Aside from a buildlink3.mk 4902headers and libraries present in the base system. Aside from a buildlink3.mk
4903file, these packages should also include a builtin.mk file that includes the 4903file, these packages should also include a builtin.mk file that includes the
4904necessary checks to decide whether using the built-in software or the pkgsrc 4904necessary checks to decide whether using the built-in software or the pkgsrc
4905software is appropriate. 4905software is appropriate.
4906 4906
4907The only requirements of a builtin.mk file for pkg are: 4907The only requirements of a builtin.mk file for pkg are:
4908 4908
4909 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included. 4909 1. It should set USE_BUILTIN.pkg to either "yes" or "no" after it is included.
4910 4910
4911 2. It should not override any USE_BUILTIN.pkg which is already set before the 4911 2. It should not override any USE_BUILTIN.pkg which is already set before the
4912 builtin.mk file is included. 4912 builtin.mk file is included.
4913 4913
4914 3. It should be written to allow multiple inclusion. This is very important 4914 3. It should be written to allow multiple inclusion. This is very important
4915 and takes careful attention to Makefile coding. 4915 and takes careful attention to Makefile coding.
4916 4916
491714.3.1. Anatomy of a builtin.mk file 491714.3.1. Anatomy of a builtin.mk file
4918 4918
4919The following is the recommended template for builtin.mk files: 4919The following is the recommended template for builtin.mk files:
4920 4920
4921.if !defined(IS_BUILTIN.foo) 4921.if !defined(IS_BUILTIN.foo)
4922# 4922#
4923# IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo" 4923# IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
4924# genuinely exists in the system or not. 4924# genuinely exists in the system or not.
4925# 4925#
4926IS_BUILTIN.foo?= no 4926IS_BUILTIN.foo?= no
4927 4927
4928# BUILTIN_PKG.foo should be set here if "foo" is built-in and its package 4928# BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
4929# version can be determined. 4929# version can be determined.
4930# 4930#
4931. if !empty(IS_BUILTIN.foo:M[yY][eE][sS]) 4931. if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
4932BUILTIN_PKG.foo?= foo-1.0 4932BUILTIN_PKG.foo?= foo-1.0
4933. endif 4933. endif
4934.endif # IS_BUILTIN.foo 4934.endif # IS_BUILTIN.foo
4935 4935
4936.if !defined(USE_BUILTIN.foo) 4936.if !defined(USE_BUILTIN.foo)
4937USE_BUILTIN.foo?= ${IS_BUILTIN.foo} 4937USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
4938. if defined(BUILTIN_PKG.foo) 4938. if defined(BUILTIN_PKG.foo)
4939. for _depend_ in ${BUILDLINK_API_DEPENDS.foo} 4939. for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
4940. if !empty(USE_BUILTIN.foo:M[yY][eE][sS]) 4940. if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
4941USE_BUILTIN.foo!= \ 4941USE_BUILTIN.foo!= \
4942 ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \ 4942 ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
4943 && ${ECHO} "yes" || ${ECHO} "no" 4943 && ${ECHO} "yes" || ${ECHO} "no"
4944. endif 4944. endif
4945. endfor 4945. endfor
4946. endif 4946. endif
4947.endif # USE_BUILTIN.foo 4947.endif # USE_BUILTIN.foo
4948 4948
4949CHECK_BUILTIN.foo?= no 4949CHECK_BUILTIN.foo?= no
4950.if !empty(CHECK_BUILTIN.foo:M[nN][oO]) 4950.if !empty(CHECK_BUILTIN.foo:M[nN][oO])
4951# 4951#
4952# Here we place code that depends on whether USE_BUILTIN.foo is set to 4952# Here we place code that depends on whether USE_BUILTIN.foo is set to
4953# "yes" or "no". 4953# "yes" or "no".
4954# 4954#
4955.endif # CHECK_BUILTIN.foo 4955.endif # CHECK_BUILTIN.foo
4956 4956
4957The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the 4957The first section sets IS_BUILTIN.pkg depending on if pkg really exists in the
4958base system. This should not be a base system software with similar 4958base system. This should not be a base system software with similar
4959functionality to pkg; it should only be "yes" if the actual package is included 4959functionality to pkg; it should only be "yes" if the actual package is included
4960as part of the base system. This variable is only used internally within the 4960as part of the base system. This variable is only used internally within the
4961builtin.mk file. 4961builtin.mk file.
4962 4962
4963The second section sets BUILTIN_PKG.pkg to the version of pkg in the base 4963The second section sets BUILTIN_PKG.pkg to the version of pkg in the base
4964system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used 4964system if it exists (if IS_BUILTIN.pkg is "yes"). This variable is only used
4965internally within the builtin.mk file. 4965internally within the builtin.mk file.
4966 4966
4967The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files. 4967The third section sets USE_BUILTIN.pkg and is required in all builtin.mk files.
4968The code in this section must make the determination whether the built-in 4968The code in this section must make the determination whether the built-in
4969software is adequate to satisfy the dependencies listed in 4969software is adequate to satisfy the dependencies listed in
4970BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg 4970BUILDLINK_API_DEPENDS.pkg. This is typically done by comparing BUILTIN_PKG.pkg
4971against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg  4971against each of the dependencies in BUILDLINK_API_DEPENDS.pkg. USE_BUILTIN.pkg
4972must be set to the correct value by the end of the builtin.mk file. Note that 4972must be set to the correct value by the end of the builtin.mk file. Note that
4973USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make 4973USE_BUILTIN.pkg may be "yes" even if IS_BUILTIN.pkg is "no" because we may make
4974the determination that the built-in version of the software is similar enough 4974the determination that the built-in version of the software is similar enough
4975to be used as a replacement. 4975to be used as a replacement.
4976 4976
4977The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses 4977The last section is guarded by CHECK_BUILTIN.pkg, and includes code that uses
4978the value of USE_BUILTIN.pkg set in the previous section. This typically 4978the value of USE_BUILTIN.pkg set in the previous section. This typically
4979includes, e.g., adding additional dependency restrictions and listing 4979includes, e.g., adding additional dependency restrictions and listing
4980additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg). 4980additional files to symlink into ${BUILDLINK_DIR} (via BUILDLINK_FILES.pkg).
4981 4981
498214.3.2. Global preferences for native or pkgsrc software 498214.3.2. Global preferences for native or pkgsrc software
4983 4983
4984When building packages, it's possible to choose whether to set a global 4984When building packages, it's possible to choose whether to set a global
4985preference for using either the built-in (native) version or the pkgsrc version 4985preference for using either the built-in (native) version or the pkgsrc version
4986of software to satisfy a dependency. This is controlled by setting 4986of software to satisfy a dependency. This is controlled by setting
4987PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", " 4987PREFER_PKGSRC and PREFER_NATIVE. These variables take values of either "yes", "
4988no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc 4988no", or a list of packages. PREFER_PKGSRC tells pkgsrc to use the pkgsrc
4989versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in 4989versions of software, while PREFER_NATIVE tells pkgsrc to use the built-in
4990versions. Preferences are determined by the most specific instance of the 4990versions. Preferences are determined by the most specific instance of the
4991package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in 4991package in either PREFER_PKGSRC or PREFER_NATIVE. If a package is specified in
4992neither or in both variables, then PREFER_PKGSRC has precedence over 4992neither or in both variables, then PREFER_PKGSRC has precedence over
4993PREFER_NATIVE. For example, to require using pkgsrc versions of software for 4993PREFER_NATIVE. For example, to require using pkgsrc versions of software for
4994all but the most basic bits on a NetBSD system, you can set: 4994all but the most basic bits on a NetBSD system, you can set:
4995 4995
4996PREFER_PKGSRC= yes 4996PREFER_PKGSRC= yes
4997PREFER_NATIVE= getopt skey tcp_wrappers 4997PREFER_NATIVE= getopt skey tcp_wrappers
4998 4998
4999A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise 4999A package must have a builtin.mk file to be listed in PREFER_NATIVE, otherwise
5000it is simply ignored in that list. 5000it is simply ignored in that list.
5001 5001
5002Chapter 15. The pkginstall framework 5002Chapter 15. The pkginstall framework
5003 5003
5004Table of Contents 5004Table of Contents
5005 5005
500615.1. Files and directories outside the installation prefix 500615.1. Files and directories outside the installation prefix
5007 5007
5008 15.1.1. Directory manipulation 5008 15.1.1. Directory manipulation
5009 15.1.2. File manipulation 5009 15.1.2. File manipulation
5010 5010
501115.2. Configuration files 501115.2. Configuration files
5012 5012
5013 15.2.1. How PKG_SYSCONFDIR is set 5013 15.2.1. How PKG_SYSCONFDIR is set
5014 15.2.2. Telling the software where configuration files are 5014 15.2.2. Telling the software where configuration files are
5015 15.2.3. Patching installations 5015 15.2.3. Patching installations
5016 15.2.4. Disabling handling of configuration files 5016 15.2.4. Disabling handling of configuration files
5017 5017
501815.3. System startup scripts 501815.3. System startup scripts
5019 5019
5020 15.3.1. Disabling handling of system startup scripts 5020 15.3.1. Disabling handling of system startup scripts
5021 5021
502215.4. System users and groups 502215.4. System users and groups
502315.5. System shells 502315.5. System shells
5024 5024
5025 15.5.1. Disabling shell registration 5025 15.5.1. Disabling shell registration
5026 5026
502715.6. Fonts 502715.6. Fonts
5028 5028
5029 15.6.1. Disabling automatic update of the fonts databases 5029 15.6.1. Disabling automatic update of the fonts databases
5030 5030
5031This chapter describes the framework known as pkginstall, whose key features 5031This chapter describes the framework known as pkginstall, whose key features
5032are: 5032are:
5033 5033
5034 * Generic installation and manipulation of directories and files outside the 5034 * Generic installation and manipulation of directories and files outside the
5035 pkgsrc-handled tree, LOCALBASE. 5035 pkgsrc-handled tree, LOCALBASE.
5036 5036
5037 * Automatic handling of configuration files during installation, provided 5037 * Automatic handling of configuration files during installation, provided
5038 that packages are correctly designed. 5038 that packages are correctly designed.
5039 5039
5040 * Generation and installation of system startup scripts. 5040 * Generation and installation of system startup scripts.
5041 5041
5042 * Registration of system users and groups. 5042 * Registration of system users and groups.
5043 5043
5044 * Registration of system shells. 5044 * Registration of system shells.
5045 5045
5046 * Automatic updating of fonts databases. 5046 * Automatic updating of fonts databases.
5047 5047
5048The following sections inspect each of the above points in detail. 5048The following sections inspect each of the above points in detail.
5049 5049
5050You may be thinking that many of the things described here could be easily done 5050You may be thinking that many of the things described here could be easily done
5051with simple code in the package's post-installation target (post-install). This 5051with simple code in the package's post-installation target (post-install). This
5052is incorrect, as the code in them is only executed when building from source. 5052is incorrect, as the code in them is only executed when building from source.
5053Machines using binary packages could not benefit from it at all (as the code 5053Machines using binary packages could not benefit from it at all (as the code
5054itself could be unavailable). Therefore, the only way to achieve any of the 5054itself could be unavailable). Therefore, the only way to achieve any of the
5055items described above is by means of the installation scripts, which are 5055items described above is by means of the installation scripts, which are
5056automatically generated by pkginstall. 5056automatically generated by pkginstall.
5057 5057
505815.1. Files and directories outside the installation prefix 505815.1. Files and directories outside the installation prefix
5059 5059
5060As you already know, the PLIST file holds a list of files and directories that 5060As you already know, the PLIST file holds a list of files and directories that
5061belong to a package. The names used in it are relative to the installation 5061belong to a package. The names used in it are relative to the installation
5062prefix (${PREFIX}), which means that it cannot register files outside this 5062prefix (${PREFIX}), which means that it cannot register files outside this
5063directory (absolute path names are not allowed). Despite this restriction, some 5063directory (absolute path names are not allowed). Despite this restriction, some
5064packages need to install files outside this location; e.g., under ${VARBASE} or 5064packages need to install files outside this location; e.g., under ${VARBASE} or
5065${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during 5065${PKG_SYSCONFDIR}. The only way to achieve this is to create such files during
5066installation time by using installation scripts. 5066installation time by using installation scripts.
5067 5067
5068The generic installation scripts are shell scripts that can contain arbitrary 5068The generic installation scripts are shell scripts that can contain arbitrary
5069code. The list of scripts to execute is taken from the INSTALL_FILE variable, 5069code. The list of scripts to execute is taken from the INSTALL_FILE variable,
5070which defaults to INSTALL. A similar variable exists for package removal 5070which defaults to INSTALL. A similar variable exists for package removal
5071(DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary 5071(DEINSTALL_FILE, whose default is DEINSTALL). These scripts can run arbitrary
5072commands, so they have the potential to create and manage files anywhere in the 5072commands, so they have the potential to create and manage files anywhere in the
5073file system. 5073file system.
5074 5074
5075Using these general installation files is not recommended, but may be needed in 5075Using these general installation files is not recommended, but may be needed in
5076some special cases. One reason for avoiding them is that the user has to trust 5076some special cases. One reason for avoiding them is that the user has to trust
5077the packager that there is no unwanted or simply erroneous code included in the 5077the packager that there is no unwanted or simply erroneous code included in the
5078installation script. Also, previously there were many similar scripts for the 5078installation script. Also, previously there were many similar scripts for the
5079same functionality, and fixing a common error involved finding and changing all 5079same functionality, and fixing a common error involved finding and changing all
5080of them. 5080of them.
5081 5081
5082The pkginstall framework offers another, standardized way. It provides generic 5082The pkginstall framework offers another, standardized way. It provides generic
5083scripts to abstract the manipulation of such files and directories based on 5083scripts to abstract the manipulation of such files and directories based on
5084variables set in the package's Makefile. The rest of this section describes 5084variables set in the package's Makefile. The rest of this section describes
5085these variables. 5085these variables.
5086 5086
508715.1.1. Directory manipulation 508715.1.1. Directory manipulation
5088 5088
5089The following variables can be set to request the creation of directories 5089The following variables can be set to request the creation of directories
5090anywhere in the file system: 5090anywhere in the file system:
5091 5091
5092 * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created 5092 * MAKE_DIRS and OWN_DIRS contain a list of directories that should be created
5093 and should attempt to be destroyed by the installation scripts. The 5093 and should attempt to be destroyed by the installation scripts. The
5094 difference between the two is that the latter prompts the administrator to 5094 difference between the two is that the latter prompts the administrator to
5095 remove any directories that may be left after deinstallation (because they 5095 remove any directories that may be left after deinstallation (because they
5096 were not empty), while the former does not. 5096 were not empty), while the former does not.
5097 5097
5098 * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing 5098 * MAKE_DIRS_PERMS and OWN_DIRS_PERMS contain a list of tuples describing
5099 which directories should be created and should attempt to be destroyed by 5099 which directories should be created and should attempt to be destroyed by
5100 the installation scripts. Each tuple holds the following values, separated 5100 the installation scripts. Each tuple holds the following values, separated
5101 by spaces: the directory name, its owner, its group and its numerical mode. 5101 by spaces: the directory name, its owner, its group and its numerical mode.
5102 For example: 5102 For example:
5103 5103
5104 MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700 5104 MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
5105 5105
5106 The difference between the two is exactly the same as their non-PERMS 5106 The difference between the two is exactly the same as their non-PERMS
5107 counterparts. 5107 counterparts.
5108 5108
510915.1.2. File manipulation 510915.1.2. File manipulation
5110 5110
5111Creating non-empty files outside the installation prefix is tricky because the 5111Creating non-empty files outside the installation prefix is tricky because the
5112PLIST forces all files to be inside it. To overcome this problem, the only 5112PLIST forces all files to be inside it. To overcome this problem, the only
5113solution is to extract the file in the known place (i.e., inside the 5113solution is to extract the file in the known place (i.e., inside the
5114installation prefix) and copy it to the appropriate location during 5114installation prefix) and copy it to the appropriate location during
5115installation (done by the installation scripts generated by pkginstall). We 5115installation (done by the installation scripts generated by pkginstall). We
5116will call the former the master file in the following paragraphs, which 5116will call the former the master file in the following paragraphs, which
5117describe the variables that can be used to automatically and consistently 5117describe the variables that can be used to automatically and consistently
5118handle files outside the installation prefix: 5118handle files outside the installation prefix:
5119 5119
5120 * CONF_FILES and REQD_FILES are pairs of master and target files. During 5120 * CONF_FILES and REQD_FILES are pairs of master and target files. During
5121 installation time, the master file is copied to the target one if and only 5121 installation time, the master file is copied to the target one if and only
5122 if the latter does not exist. Upon deinstallation, the target file is 5122 if the latter does not exist. Upon deinstallation, the target file is
5123 removed provided that it was not modified by the installation. 5123 removed provided that it was not modified by the installation.
5124 5124
5125 The difference between the two is that the latter prompts the administrator 5125 The difference between the two is that the latter prompts the administrator
5126 to remove any files that may be left after deinstallation (because they 5126 to remove any files that may be left after deinstallation (because they
5127 were not empty), while the former does not. 5127 were not empty), while the former does not.
5128 5128
5129 * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master 5129 * CONF_FILES_PERMS and REQD_FILES_PERMS contain tuples describing master
5130 files as well as their target locations. For each of them, it also 5130 files as well as their target locations. For each of them, it also
5131 specifies their owner, their group and their numeric permissions, in this 5131 specifies their owner, their group and their numeric permissions, in this
5132 order. For example: 5132 order. For example:
5133 5133
5134 REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700 5134 REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
5135 5135
5136 The difference between the two is exactly the same as their non-PERMS 5136 The difference between the two is exactly the same as their non-PERMS
5137 counterparts. 5137 counterparts.
5138 5138
513915.2. Configuration files 513915.2. Configuration files
5140 5140
5141Configuration files are special in the sense that they are installed in their 5141Configuration files are special in the sense that they are installed in their
5142own specific directory, PKG_SYSCONFDIR, and need special treatment during 5142own specific directory, PKG_SYSCONFDIR, and need special treatment during
5143installation (most of which is automated by pkginstall). The main concept you 5143installation (most of which is automated by pkginstall). The main concept you
5144must bear in mind is that files marked as configuration files are automatically 5144must bear in mind is that files marked as configuration files are automatically
5145copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation 5145copied to the right place (somewhere inside PKG_SYSCONFDIR) during installation
5146if and only if they didn't exist before. Similarly, they will not be removed if 5146if and only if they didn't exist before. Similarly, they will not be removed if
5147they have local modifications. This ensures that administrators never lose any 5147they have local modifications. This ensures that administrators never lose any
5148custom changes they may have made. 5148custom changes they may have made.
5149 5149
515015.2.1. How PKG_SYSCONFDIR is set 515015.2.1. How PKG_SYSCONFDIR is set
5151 5151
5152As said before, the PKG_SYSCONFDIR variable specifies where configuration files 5152As said before, the PKG_SYSCONFDIR variable specifies where configuration files
5153shall be installed. Its contents are set based upon the following variables: 5153shall be installed. Its contents are set based upon the following variables:
5154 5154
5155 * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/ 5155 * PKG_SYSCONFBASE: The configuration's root directory. Defaults to ${PREFIX}/
5156 etc although it may be overridden by the user to point to his preferred 5156 etc although it may be overridden by the user to point to his preferred
5157 location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly. 5157 location (e.g., /etc, /etc/pkg, etc.). Packages must not use it directly.
5158 5158
5159 * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the 5159 * PKG_SYSCONFSUBDIR: A subdirectory of PKG_SYSCONFBASE under which the
5160 configuration files for the package being built shall be installed. The 5160 configuration files for the package being built shall be installed. The
5161 definition of this variable only makes sense in the package's Makefile 5161 definition of this variable only makes sense in the package's Makefile
5162 (i.e., it is not user-customizable). 5162 (i.e., it is not user-customizable).
5163 5163
5164 As an example, consider the Apache package, www/apache2, which places its 5164 As an example, consider the Apache package, www/apache2, which places its
5165 configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This 5165 configuration files under the httpd/ subdirectory of PKG_SYSCONFBASE. This
5166 should be set in the package Makefile. 5166 should be set in the package Makefile.
5167 5167
5168 * PKG_SYSCONFVAR: Specifies the name of the variable that holds this 5168 * PKG_SYSCONFVAR: Specifies the name of the variable that holds this
5169 package's configuration directory (if different from PKG_SYSCONFBASE). It 5169 package's configuration directory (if different from PKG_SYSCONFBASE). It
5170 defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR. 5170 defaults to PKGBASE's value, and is always prefixed with PKG_SYSCONFDIR.
5171 5171
5172 * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the 5172 * PKG_SYSCONFDIR.${PKG_SYSCONFVAR}: Holds the directory where the
5173 configuration files for the package identified by PKG_SYSCONFVAR's shall be 5173 configuration files for the package identified by PKG_SYSCONFVAR's shall be
5174 placed. 5174 placed.
5175 5175
5176Based on the above variables, pkginstall determines the value of 5176Based on the above variables, pkginstall determines the value of
5177PKG_SYSCONFDIR, which is the only variable that can be used within a package to 5177PKG_SYSCONFDIR, which is the only variable that can be used within a package to
5178refer to its configuration directory. The algorithm used to set its value is 5178refer to its configuration directory. The algorithm used to set its value is
5179basically the following: 5179basically the following:
5180 5180
5181 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used. 5181 1. If PKG_SYSCONFDIR.${PKG_SYSCONFVAR} is set, its value is used.
5182 5182
5183 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the 5183 2. If the previous variable is not defined but PKG_SYSCONFSUBDIR is set in the
5184 package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$ 5184 package's Makefile, the resulting value is ${PKG_SYSCONFBASE}/$
5185 {PKG_SYSCONFSUBDIR}. 5185 {PKG_SYSCONFSUBDIR}.
5186 5186
5187 3. Otherwise, it is set to ${PKG_SYSCONFBASE}. 5187 3. Otherwise, it is set to ${PKG_SYSCONFBASE}.
5188 5188
5189It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to 5189It is worth mentioning that ${PKG_SYSCONFDIR} is automatically added to
5190OWN_DIRS. See Section 15.1.1, "Directory manipulation" what this means. This 5190OWN_DIRS. See Section 15.1.1, "Directory manipulation" what this means. This
5191does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be 5191does not apply to subdirectories of ${PKG_SYSCONFDIR}, they still have to be
5192created with OWN_DIRS or MAKE_DIRS. 5192created with OWN_DIRS or MAKE_DIRS.
5193 5193
519415.2.2. Telling the software where configuration files are 519415.2.2. Telling the software where configuration files are
5195 5195
5196Given that pkgsrc (and users!) expect configuration files to be in a known 5196Given that pkgsrc (and users!) expect configuration files to be in a known
5197place, you need to teach each package where it shall install its files. In some 5197place, you need to teach each package where it shall install its files. In some
5198cases you will have to patch the package Makefiles to achieve it. If you are 5198cases you will have to patch the package Makefiles to achieve it. If you are
5199lucky, though, it may be as easy as passing an extra flag to the configuration 5199lucky, though, it may be as easy as passing an extra flag to the configuration
5200script; this is the case of GNU Autoconf- generated files: 5200script; this is the case of GNU Autoconf- generated files:
5201 5201
5202CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} 5202CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
5203 5203
5204Note that this specifies where the package has to look for its configuration 5204Note that this specifies where the package has to look for its configuration
5205files, not where they will be originally installed (although the difference is 5205files, not where they will be originally installed (although the difference is
5206never explicit, unfortunately). 5206never explicit, unfortunately).
5207 5207
520815.2.3. Patching installations 520815.2.3. Patching installations
5209 5209
5210As said before, pkginstall automatically handles configuration files. This 5210As said before, pkginstall automatically handles configuration files. This
5211means that the packages themselves must not touch the contents of $ 5211means that the packages themselves must not touch the contents of $
5212{PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts 5212{PKG_SYSCONFDIR} directly. Bad news is that many software installation scripts
5213will, out of the box, mess with the contents of that directory. So what is the 5213will, out of the box, mess with the contents of that directory. So what is the
5214correct procedure to fix this issue? 5214correct procedure to fix this issue?
5215 5215
5216You must teach the package (usually by manually patching it) to install any 5216You must teach the package (usually by manually patching it) to install any
5217configuration files under the examples hierarchy, share/examples/${PKGBASE}/. 5217configuration files under the examples hierarchy, share/examples/${PKGBASE}/.
5218This way, the PLIST registers them and the administrator always has the 5218This way, the PLIST registers them and the administrator always has the
5219original copies available. 5219original copies available.
5220 5220
5221Once the required configuration files are in place (i.e., under the examples 5221Once the required configuration files are in place (i.e., under the examples
5222hierarchy), the pkginstall framework can use them as master copies during the 5222hierarchy), the pkginstall framework can use them as master copies during the
5223package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this, 5223package installation to update what is in ${PKG_SYSCONFDIR}. To achieve this,
5224the variables CONF_FILES and CONF_FILES_PERMS are used. Check out 5224the variables CONF_FILES and CONF_FILES_PERMS are used. Check out
5225Section 15.1.2, "File manipulation" for information about their syntax and 5225Section 15.1.2, "File manipulation" for information about their syntax and
5226their purpose. Here is an example, taken from the mail/mutt package: 5226their purpose. Here is an example, taken from the mail/mutt package:
5227 5227
5228EGDIR= ${PREFIX}/share/doc/mutt/samples 5228EGDIR= ${PREFIX}/share/doc/mutt/samples
5229CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc 5229CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
5230 5230
5231Note that the EGDIR variable is specific to that package and has no meaning 5231Note that the EGDIR variable is specific to that package and has no meaning
5232outside it. 5232outside it.
5233 5233
523415.2.4. Disabling handling of configuration files 523415.2.4. Disabling handling of configuration files
5235 5235
5236The automatic copying of config files can be toggled by setting the environment 5236The automatic copying of config files can be toggled by setting the environment
5237variable PKG_CONFIG prior to package installation. 5237variable PKG_CONFIG prior to package installation.
5238 5238
523915.3. System startup scripts 523915.3. System startup scripts
5240 5240
5241System startup scripts are special files because they must be installed in a 5241System startup scripts are special files because they must be installed in a
5242place known by the underlying OS, usually outside the installation prefix. 5242place known by the underlying OS, usually outside the installation prefix.
5243Therefore, the same rules described in Section 15.1, "Files and directories 5243Therefore, the same rules described in Section 15.1, "Files and directories
5244outside the installation prefix" apply, and the same solutions can be used. 5244outside the installation prefix" apply, and the same solutions can be used.
5245However, pkginstall provides a special mechanism to handle these files. 5245However, pkginstall provides a special mechanism to handle these files.
5246 5246
5247In order to provide system startup scripts, the package has to: 5247In order to provide system startup scripts, the package has to:
5248 5248
5249 1. Store the script inside ${FILESDIR}, with the .sh suffix appended. 5249 1. Store the script inside ${FILESDIR}, with the .sh suffix appended.
5250 Considering the print/cups package as an example, it has a cupsd.sh in its 5250 Considering the print/cups package as an example, it has a cupsd.sh in its
5251 files directory. 5251 files directory.
5252 5252
5253 2. Tell pkginstall to handle it, appending the name of the script, without its 5253 2. Tell pkginstall to handle it, appending the name of the script, without its
5254 extension, to the RCD_SCRIPTS variable. Continuing the previous example: 5254 extension, to the RCD_SCRIPTS variable. Continuing the previous example:
5255 5255
5256 RCD_SCRIPTS+= cupsd 5256 RCD_SCRIPTS+= cupsd
5257 5257
5258Once this is done, pkginstall will do the following steps for each script in an 5258Once this is done, pkginstall will do the following steps for each script in an
5259automated fashion: 5259automated fashion:
5260 5260
5261 1. Process the file found in the files directory applying all the 5261 1. Process the file found in the files directory applying all the
5262 substitutions described in the FILES_SUBST variable. 5262 substitutions described in the FILES_SUBST variable.
5263 5263
5264 2. Copy the script from the files directory to the examples hierarchy, $ 5264 2. Copy the script from the files directory to the examples hierarchy, $
5265 {PREFIX}/share/examples/rc.d/. Note that this master file must be 5265 {PREFIX}/share/examples/rc.d/. Note that this master file must be
5266 explicitly registered in the PLIST. 5266 explicitly registered in the PLIST.
5267 5267
5268 3. Add code to the installation scripts to copy the startup script from the 5268 3. Add code to the installation scripts to copy the startup script from the
5269 examples hierarchy into the system-wide startup scripts directory. 5269 examples hierarchy into the system-wide startup scripts directory.
5270 5270
527115.3.1. Disabling handling of system startup scripts 527115.3.1. Disabling handling of system startup scripts
5272 5272
5273The automatic copying of config files can be toggled by setting the environment 5273The automatic copying of config files can be toggled by setting the environment
5274variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts 5274variable PKG_RCD_SCRIPTS prior to package installation. Note that the scripts
5275will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/ 5275will be always copied inside the examples hierarchy, ${PREFIX}/share/examples/
5276rc.d/, no matter what the value of this variable is. 5276rc.d/, no matter what the value of this variable is.
5277 5277
527815.4. System users and groups 527815.4. System users and groups
5279 5279
5280If a package needs to create special users and/or groups during installation, 5280If a package needs to create special users and/or groups during installation,
5281it can do so by using the pkginstall framework. 5281it can do so by using the pkginstall framework.
5282 5282
5283Users can be created by adding entries to the PKG_USERS variable. Each entry 5283Users can be created by adding entries to the PKG_USERS variable. Each entry
5284has the following syntax: 5284has the following syntax:
5285 5285
5286user:group 5286user:group
5287 5287
5288Further specification of user details may be done by setting per-user 5288Further specification of user details may be done by setting per-user
5289variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the 5289variables. PKG_UID.user is the numeric UID for the user. PKG_GECOS.user is the
5290user's description or comment. PKG_HOME.user is the user's home directory, and 5290user's description or comment. PKG_HOME.user is the user's home directory, and
5291defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell, 5291defaults to /nonexistent if not specified. PKG_SHELL.user is the user's shell,
5292and defaults to /sbin/nologin if not specified. 5292and defaults to /sbin/nologin if not specified.
5293 5293
5294Similarly, groups can be created by adding entries to the PKG_GROUPS variable, 5294Similarly, groups can be created by adding entries to the PKG_GROUPS variable,
5295whose syntax is: 5295whose syntax is:
5296 5296
5297group 5297group
5298 5298
5299The numeric GID of the group may be set by defining PKG_GID.group. 5299The numeric GID of the group may be set by defining PKG_GID.group.
5300 5300
5301If a package needs to create the users and groups at an earlier stage, then it 5301If a package needs to create the users and groups at an earlier stage, then it
5302can set USERGROUP_PHASE to either configure or build to indicate the phase 5302can set USERGROUP_PHASE to either configure or build to indicate the phase
5303before which the users and groups are created. In this case, the numeric UIDs 5303before which the users and groups are created. In this case, the numeric UIDs
5304and GIDs of the created users and groups are automatically hardcoded into the 5304and GIDs of the created users and groups are automatically hardcoded into the
5305final installation scripts. 5305final installation scripts.
5306 5306
530715.5. System shells 530715.5. System shells
5308 5308
5309Packages that install system shells should register them in the shell database, 5309Packages that install system shells should register them in the shell database,
5310/etc/shells, to make things easier to the administrator. This must be done from 5310/etc/shells, to make things easier to the administrator. This must be done from
5311the installation scripts to keep binary packages working on any system. 5311the installation scripts to keep binary packages working on any system.
5312pkginstall provides an easy way to accomplish this task. 5312pkginstall provides an easy way to accomplish this task.
5313 5313
5314When a package provides a shell interpreter, it has to set the PKG_SHELL 5314When a package provides a shell interpreter, it has to set the PKG_SHELL
5315variable to its absolute file name. This will add some hooks to the 5315variable to its absolute file name. This will add some hooks to the
5316installation scripts to handle it. Consider the following example, taken from 5316installation scripts to handle it. Consider the following example, taken from
5317shells/zsh: 5317shells/zsh:
5318 5318
5319PKG_SHELL= ${PREFIX}/bin/zsh 5319PKG_SHELL= ${PREFIX}/bin/zsh
5320 5320
532115.5.1. Disabling shell registration 532115.5.1. Disabling shell registration
5322 5322
5323The automatic registration of shell interpreters can be disabled by the 5323The automatic registration of shell interpreters can be disabled by the
5324administrator by setting the PKG_REGISTER_SHELLS environment variable to NO. 5324administrator by setting the PKG_REGISTER_SHELLS environment variable to NO.
5325 5325
532615.6. Fonts 532615.6. Fonts
5327 5327
5328Packages that install X11 fonts should update the database files that index the 5328Packages that install X11 fonts should update the database files that index the
5329fonts within each fonts directory. This can easily be accomplished within the 5329fonts within each fonts directory. This can easily be accomplished within the
5330pkginstall framework. 5330pkginstall framework.
5331 5331
5332When a package installs X11 fonts, it must list the directories in which fonts 5332When a package installs X11 fonts, it must list the directories in which fonts
5333are installed in the FONTS_DIRS.type variables, where type can be one of "ttf", 5333are installed in the FONTS_DIRS.type variables, where type can be one of "ttf",
5334"type1" or "x11". This will add hooks to the installation scripts to run the 5334"type1" or "x11". This will add hooks to the installation scripts to run the
5335appropriate commands to update the fonts database files within each of those 5335appropriate commands to update the fonts database files within each of those
5336directories. For convenience, if the directory path is relative, it is taken to 5336directories. For convenience, if the directory path is relative, it is taken to
5337be relative to the package's installation prefix. Consider the following 5337be relative to the package's installation prefix. Consider the following
5338example, taken from fonts/dbz-ttf: 5338example, taken from fonts/dbz-ttf:
5339 5339
5340FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF 5340FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
5341 5341
534215.6.1. Disabling automatic update of the fonts databases 534215.6.1. Disabling automatic update of the fonts databases
5343 5343
5344The automatic update of fonts databases can be disabled by the administrator by 5344The automatic update of fonts databases can be disabled by the administrator by
5345setting the PKG_UPDATE_FONTS_DB environment variable to NO. 5345setting the PKG_UPDATE_FONTS_DB environment variable to NO.
5346 5346
5347Chapter 16. Options handling 5347Chapter 16. Options handling
5348 5348
5349Table of Contents 5349Table of Contents
5350 5350
535116.1. Global default options 535116.1. Global default options
535216.2. Converting packages to use bsd.options.mk 535216.2. Converting packages to use bsd.options.mk
535316.3. Option Names 535316.3. Option Names
535416.4. Determining the options of dependencies 535416.4. Determining the options of dependencies
5355 5355
5356Many packages have the ability to be built to support different sets of 5356Many packages have the ability to be built to support different sets of
5357features. bsd.options.mk is a framework in pkgsrc that provides generic 5357features. bsd.options.mk is a framework in pkgsrc that provides generic
5358handling of those options that determine different ways in which the packages 5358handling of those options that determine different ways in which the packages
5359can be built. It's possible for the user to specify exactly which sets of 5359can be built. It's possible for the user to specify exactly which sets of
5360options will be built into a package or to allow a set of global default 5360options will be built into a package or to allow a set of global default
5361options apply. 5361options apply.
5362 5362
5363There are two broad classes of behaviors that one might want to control via 5363There are two broad classes of behaviors that one might want to control via
5364options. One is whether some particular feature is enabled in a program that 5364options. One is whether some particular feature is enabled in a program that
5365will be built anyway, often by including or not including a dependency on some 5365will be built anyway, often by including or not including a dependency on some
5366other package. The other is whether or not an additional program will be built 5366other package. The other is whether or not an additional program will be built
5367as part of the package. Generally, it is better to make a split package for 5367as part of the package. Generally, it is better to make a split package for
5368such additional programs instead of using options, because it enables binary 5368such additional programs instead of using options, because it enables binary
5369packages to be built which can then be added separately. For example, the foo 5369packages to be built which can then be added separately. For example, the foo
5370package might have minimal dependencies (those packages without which foo 5370package might have minimal dependencies (those packages without which foo
5371doesn't make sense), and then the foo-gfoo package might include the GTK 5371doesn't make sense), and then the foo-gfoo package might include the GTK
5372frontend program gfoo. This is better than including a gtk option to foo that 5372frontend program gfoo. This is better than including a gtk option to foo that
5373adds gfoo, because either that option is default, in which case binary users 5373adds gfoo, because either that option is default, in which case binary users
5374can't get foo without gfoo, or not default, in which case they can't get gfoo. 5374can't get foo without gfoo, or not default, in which case they can't get gfoo.
5375With split packages, they can install foo without having GTK, and later decide 5375With split packages, they can install foo without having GTK, and later decide
5376to install gfoo (pulling in GTK at that time). This is an advantage to source 5376to install gfoo (pulling in GTK at that time). This is an advantage to source
5377users too, avoiding the need for rebuilds. 5377users too, avoiding the need for rebuilds.
5378 5378
5379Plugins with widely varying dependencies should usually be split instead of 5379Plugins with widely varying dependencies should usually be split instead of
5380options. 5380options.
5381 5381
5382It is often more work to maintain split packages, especially if the upstream 5382It is often more work to maintain split packages, especially if the upstream
5383package does not support this. The decision of split vs. option should be made 5383package does not support this. The decision of split vs. option should be made
5384based on the likelihood that users will want or object to the various pieces, 5384based on the likelihood that users will want or object to the various pieces,
5385the size of the dependencies that are included, and the amount of work. 5385the size of the dependencies that are included, and the amount of work.
5386 5386
5387A further consideration is licensing. Non-free parts, or parts that depend on 5387A further consideration is licensing. Non-free parts, or parts that depend on
5388non-free dependencies (especially plugins) should almost always be split if 5388non-free dependencies (especially plugins) should almost always be split if
5389feasible. 5389feasible.
5390 5390
539116.1. Global default options 539116.1. Global default options
5392 5392
5393Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of 5393Global default options are listed in PKG_DEFAULT_OPTIONS, which is a list of
5394the options that should be built into every package if that option is 5394the options that should be built into every package if that option is
5395supported. This variable should be set in mk.conf. 5395supported. This variable should be set in mk.conf.
5396 5396
539716.2. Converting packages to use bsd.options.mk 539716.2. Converting packages to use bsd.options.mk
5398 5398
5399The following example shows how bsd.options.mk should be used by the 5399The following example shows how bsd.options.mk should be used by the
5400hypothetical ``wibble'' package, either in the package Makefile, or in a file, 5400hypothetical ``wibble'' package, either in the package Makefile, or in a file,
5401e.g. options.mk, that is included by the main package Makefile. 5401e.g. options.mk, that is included by the main package Makefile.
5402 5402
5403PKG_OPTIONS_VAR= PKG_OPTIONS.wibble 5403PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
5404PKG_SUPPORTED_OPTIONS= wibble-foo ldap 5404PKG_SUPPORTED_OPTIONS= wibble-foo ldap
5405PKG_OPTIONS_OPTIONAL_GROUPS= database 5405PKG_OPTIONS_OPTIONAL_GROUPS= database
5406PKG_OPTIONS_GROUP.database= mysql pgsql 5406PKG_OPTIONS_GROUP.database= mysql pgsql
5407PKG_SUGGESTED_OPTIONS= wibble-foo 5407PKG_SUGGESTED_OPTIONS= wibble-foo
5408PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap 5408PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
5409PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo 5409PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
5410 5410
5411.include "../../mk/bsd.prefs.mk" 5411.include "../../mk/bsd.prefs.mk"
5412 5412
5413# this package was previously named wibble2 5413# this package was previously named wibble2
5414.if defined(PKG_OPTIONS.wibble2) 5414.if defined(PKG_OPTIONS.wibble2)
5415PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2} 5415PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
5416PKG_OPTIONS_DEPRECATED_WARNINGS+= \ 5416PKG_OPTIONS_DEPRECATED_WARNINGS+= \
5417 "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead." 5417 "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
5418.endif 5418.endif
5419 5419
5420.include "../../mk/bsd.options.mk" 5420.include "../../mk/bsd.options.mk"
5421 5421
5422# Package-specific option-handling 5422# Package-specific option-handling
5423 5423
5424### 5424###
5425### FOO support 5425### FOO support
5426### 5426###
5427.if !empty(PKG_OPTIONS:Mwibble-foo) 5427.if !empty(PKG_OPTIONS:Mwibble-foo)
5428CONFIGURE_ARGS+= --enable-foo 5428CONFIGURE_ARGS+= --enable-foo
5429.endif 5429.endif
5430 5430
5431### 5431###
5432### LDAP support 5432### LDAP support
5433### 5433###
5434.if !empty(PKG_OPTIONS:Mldap) 5434.if !empty(PKG_OPTIONS:Mldap)
5435. include "../../databases/openldap-client/buildlink3.mk" 5435. include "../../databases/openldap-client/buildlink3.mk"
5436CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client} 5436CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
5437.endif 5437.endif
5438 5438
5439### 5439###
5440### database support 5440### database support
5441### 5441###
5442.if !empty(PKG_OPTIONS:Mmysql) 5442.if !empty(PKG_OPTIONS:Mmysql)
5443. include "../../mk/mysql.buildlink3.mk" 5443. include "../../mk/mysql.buildlink3.mk"
5444.endif 5444.endif
5445.if !empty(PKG_OPTIONS:Mpgsql) 5445.if !empty(PKG_OPTIONS:Mpgsql)
5446. include "../../mk/pgsql.buildlink3.mk" 5446. include "../../mk/pgsql.buildlink3.mk"
5447.endif 5447.endif
5448 5448
5449The first section contains the information about which build options are 5449The first section contains the information about which build options are
5450supported by the package, and any default options settings if needed. 5450supported by the package, and any default options settings if needed.
5451 5451
5452 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set 5452 1. PKG_OPTIONS_VAR is the name of the make(1) variable that the user can set
5453 to override the default options. It should be set to PKG_OPTIONS.pkgbase. 5453 to override the default options. It should be set to PKG_OPTIONS.pkgbase.
5454 Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at 5454 Do not set it to PKG_OPTIONS.${PKGBASE}, since PKGBASE is not defined at
5455 the point where the options are processed. 5455 the point where the options are processed.
5456 5456
5457 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package. 5457 2. PKG_SUPPORTED_OPTIONS is a list of build options supported by the package.
5458 5458
5459 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually 5459 3. PKG_OPTIONS_OPTIONAL_GROUPS is a list of names of groups of mutually
5460 exclusive options. The options in each group are listed in 5460 exclusive options. The options in each group are listed in
5461 PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from 5461 PKG_OPTIONS_GROUP.groupname. The most specific setting of any option from
5462 the group takes precedence over all other options in the group. Options 5462 the group takes precedence over all other options in the group. Options
5463 from the groups will be automatically added to PKG_SUPPORTED_OPTIONS. 5463 from the groups will be automatically added to PKG_SUPPORTED_OPTIONS.
5464 5464
5465 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but 5465 4. PKG_OPTIONS_REQUIRED_GROUPS is like PKG_OPTIONS_OPTIONAL_GROUPS, but
5466 building the packages will fail if no option from the group is selected. 5466 building the packages will fail if no option from the group is selected.
5467 5467
5468 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least 5468 5. PKG_OPTIONS_NONEMPTY_SETS is a list of names of sets of options. At least
5469 one option from each set must be selected. The options in each set are 5469 one option from each set must be selected. The options in each set are
5470 listed in PKG_OPTIONS_SET.setname. Options from the sets will be 5470 listed in PKG_OPTIONS_SET.setname. Options from the sets will be
5471 automatically added to PKG_SUPPORTED_OPTIONS. Building the package will 5471 automatically added to PKG_SUPPORTED_OPTIONS. Building the package will
5472 fail if no option from the set is selected. 5472 fail if no option from the set is selected.
5473 5473
5474 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by 5474 6. PKG_SUGGESTED_OPTIONS is a list of build options which are enabled by
5475 default. 5475 default.
5476 5476
5477 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map 5477 7. PKG_OPTIONS_LEGACY_VARS is a list of "USE_VARIABLE:option" pairs that map
5478 legacy mk.conf variables to their option counterparts. Pairs should be 5478 legacy mk.conf variables to their option counterparts. Pairs should be
5479 added with "+=" to keep the listing of global legacy variables. A warning 5479 added with "+=" to keep the listing of global legacy variables. A warning
5480 will be issued if the user uses a legacy variable. 5480 will be issued if the user uses a legacy variable.
5481 5481
5482 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map 5482 8. PKG_OPTIONS_LEGACY_OPTS is a list of "old-option:new-option" pairs that map
5483 options that have been renamed to their new counterparts. Pairs should be 5483 options that have been renamed to their new counterparts. Pairs should be
5484 added with "+=" to keep the listing of global legacy options. A warning 5484 added with "+=" to keep the listing of global legacy options. A warning
5485 will be issued if the user uses a legacy option. 5485 will be issued if the user uses a legacy option.
5486 5486
5487 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables 5487 9. PKG_LEGACY_OPTIONS is a list of options implied by deprecated variables
5488 used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor 5488 used. This can be used for cases that neither PKG_OPTIONS_LEGACY_VARS nor
5489 PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed. 5489 PKG_OPTIONS_LEGACY_OPTS can handle, e. g. when PKG_OPTIONS_VAR is renamed.
5490 5490
549110. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated 549110. PKG_OPTIONS_DEPRECATED_WARNINGS is a list of warnings about deprecated
5492 variables or options used, and what to use instead. 5492 variables or options used, and what to use instead.
5493 5493
5494A package should never modify PKG_DEFAULT_OPTIONS or the variable named in 5494A package should never modify PKG_DEFAULT_OPTIONS or the variable named in
5495PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of 5495PKG_OPTIONS_VAR. These are strictly user-settable. To suggest a default set of
5496options, use PKG_SUGGESTED_OPTIONS. 5496options, use PKG_SUGGESTED_OPTIONS.
5497 5497
5498PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of 5498PKG_OPTIONS_VAR must be defined before including bsd.options.mk. If none of
5499PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and 5499PKG_SUPPORTED_OPTIONS, PKG_OPTIONS_OPTIONAL_GROUPS, and
5500PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific 5500PKG_OPTIONS_REQUIRED_GROUPS are defined (as can happen with platform-specific
5501options if none of them is supported on the current platform), PKG_OPTIONS is 5501options if none of them is supported on the current platform), PKG_OPTIONS is
5502set to the empty list and the package is otherwise treated as not using the 5502set to the empty list and the package is otherwise treated as not using the
5503options framework. 5503options framework.
5504 5504
5505After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the 5505After the inclusion of bsd.options.mk, the variable PKG_OPTIONS contains the
5506list of selected build options, properly filtered to remove unsupported and 5506list of selected build options, properly filtered to remove unsupported and
5507duplicate options. 5507duplicate options.
5508 5508
5509The remaining sections contain the logic that is specific to each option. The 5509The remaining sections contain the logic that is specific to each option. The
5510correct way to check for an option is to check whether it is listed in 5510correct way to check for an option is to check whether it is listed in
5511PKG_OPTIONS: 5511PKG_OPTIONS:
5512 5512
5513.if !empty(PKG_OPTIONS:Moption) 5513.if !empty(PKG_OPTIONS:Moption)
5514 5514
551516.3. Option Names 551516.3. Option Names
5516 5516
5517Options that enable similar features in different packages (like optional 5517Options that enable similar features in different packages (like optional
5518support for a library) should use a common name in all packages that support it 5518support for a library) should use a common name in all packages that support it
5519(like the name of the library). If another package already has an option with 5519(like the name of the library). If another package already has an option with
5520the same meaning, use the same name. 5520the same meaning, use the same name.
5521 5521
5522Options that enable features specific to one package, where it's unlikely that 5522Options that enable features specific to one package, where it's unlikely that
5523another (unrelated) package has the same (or a similar) optional feature, 5523another (unrelated) package has the same (or a similar) optional feature,
5524should use a name prefixed with pkgname-. 5524should use a name prefixed with pkgname-.
5525 5525
5526If a group of related packages share an optional feature specific to that 5526If a group of related packages share an optional feature specific to that
5527group, prefix it with the name of the "main" package (e. g. 5527group, prefix it with the name of the "main" package (e. g.
5528djbware-errno-hack). 5528djbware-errno-hack).
5529 5529
5530For new options, add a line to mk/defaults/options.description. Lines have two 5530For new options, add a line to mk/defaults/options.description. Lines have two
5531fields, separated by tab. The first field is the option name, the second its 5531fields, separated by tab. The first field is the option name, the second its
5532description. The description should be a whole sentence (starting with an 5532description. The description should be a whole sentence (starting with an
5533uppercase letter and ending with a period) that describes what enabling the 5533uppercase letter and ending with a period) that describes what enabling the
5534option does. E. g. "Enable ispell support." The file is sorted by option names. 5534option does. E. g. "Enable ispell support." The file is sorted by option names.
5535 5535
553616.4. Determining the options of dependencies 553616.4. Determining the options of dependencies
5537 5537
5538When writing buildlink3.mk files, it is often necessary to list different 5538When writing buildlink3.mk files, it is often necessary to list different
5539dependencies based on the options with which the package was built. For 5539dependencies based on the options with which the package was built. For
5540querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used. 5540querying these options, the file pkgsrc/mk/pkg-build-options.mk should be used.
5541A typical example looks like this: 5541A typical example looks like this:
5542 5542
5543pkgbase := libpurple 5543pkgbase := libpurple
5544.include "../../mk/pkg-build-options.mk" 5544.include "../../mk/pkg-build-options.mk"
5545 5545
5546.if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus) 5546.if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
5547... 5547...
5548.endif 5548.endif
5549 5549
5550Including pkg-build-options.mk here will set the variable 5550Including pkg-build-options.mk here will set the variable
5551PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package, 5551PKG_BUILD_OPTIONS.libpurple to the build options of the libpurple package,
5552which can then be queried like PKG_OPTIONS in the options.mk file. See the file 5552which can then be queried like PKG_OPTIONS in the options.mk file. See the file
5553pkg-build-options.mk for more details. 5553pkg-build-options.mk for more details.
5554 5554
5555Chapter 17. The build process 5555Chapter 17. The build process
5556 5556
5557Table of Contents 5557Table of Contents
5558 5558
555917.1. Introduction 555917.1. Introduction
556017.2. Program location 556017.2. Program location
556117.3. Directories used during the build process 556117.3. Directories used during the build process
556217.4. Running a phase 556217.4. Running a phase
556317.5. The fetch phase 556317.5. The fetch phase
5564 5564
5565 17.5.1. What to fetch and where to get it from 5565 17.5.1. What to fetch and where to get it from
5566 17.5.2. How are the files fetched? 5566 17.5.2. How are the files fetched?
5567 5567
556817.6. The checksum phase 556817.6. The checksum phase
556917.7. The extract phase 556917.7. The extract phase
557017.8. The patch phase 557017.8. The patch phase
557117.9. The tools phase 557117.9. The tools phase
557217.10. The wrapper phase 557217.10. The wrapper phase
557317.11. The configure phase 557317.11. The configure phase
557417.12. The build phase 557417.12. The build phase
557517.13. The test phase 557517.13. The test phase
557617.14. The install phase 557617.14. The install phase
557717.15. The package phase 557717.15. The package phase
557817.16. Cleaning up 557817.16. Cleaning up
557917.17. Other helpful targets 557917.17. Other helpful targets
5580 5580
558117.1. Introduction 558117.1. Introduction
5582 5582
5583This chapter gives a detailed description on how a package is built. Building a 5583This chapter gives a detailed description on how a package is built. Building a
5584package is separated into different phases (for example fetch, build, install), 5584package is separated into different phases (for example fetch, build, install),
5585all of which are described in the following sections. Each phase is split into 5585all of which are described in the following sections. Each phase is split into
5586so-called stages, which take the name of the containing phase, prefixed by one 5586so-called stages, which take the name of the containing phase, prefixed by one
5587of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the 5587of pre-, do- or post-. (Examples are pre-configure, post-build.) Most of the
5588actual work is done in the do-* stages. 5588actual work is done in the do-* stages.
5589 5589
5590Never override the regular targets (like fetch), if you have to, override the 5590Never override the regular targets (like fetch), if you have to, override the
5591do-* ones instead. 5591do-* ones instead.
5592 5592
5593The basic steps for building a program are always the same. First the program's 5593The basic steps for building a program are always the same. First the program's
5594source (distfile) must be brought to the local system and then extracted. After 5594source (distfile) must be brought to the local system and then extracted. After
5595any pkgsrc-specific patches to compile properly are applied, the software can 5595any pkgsrc-specific patches to compile properly are applied, the software can
5596be configured, then built (usually by compiling), and finally the generated 5596be configured, then built (usually by compiling), and finally the generated
5597binaries, etc. can be put into place on the system. 5597binaries, etc. can be put into place on the system.
5598 5598
5599To get more details about what is happening at each step, you can set the 5599To get more details about what is happening at each step, you can set the
5600PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in 5600PKG_VERBOSE variable, or the PATCH_DEBUG variable if you are just interested in
5601more details about the patch step. 5601more details about the patch step.
5602 5602
560317.2. Program location 560317.2. Program location
5604 5604
5605Before outlining the process performed by the NetBSD package system in the next 5605Before outlining the process performed by the NetBSD package system in the next
5606section, here's a brief discussion on where programs are installed, and which 5606section, here's a brief discussion on where programs are installed, and which
5607variables influence this. 5607variables influence this.
5608 5608
5609The automatic variable PREFIX indicates where all files of the final program 5609The automatic variable PREFIX indicates where all files of the final program
5610shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for 5610shall be installed. It is usually set to LOCALBASE (/usr/pkg), or CROSSBASE for
5611pkgs in the cross category. The value of PREFIX needs to be put into the 5611pkgs in the cross category. The value of PREFIX needs to be put into the
5612various places in the program's source where paths to these files are encoded. 5612various places in the program's source where paths to these files are encoded.
5613See Section 11.3, "patches/*" and Section 19.3.1, "Shared libraries - libtool" 5613See Section 11.3, "patches/*" and Section 19.3.1, "Shared libraries - libtool"
5614for more details. 5614for more details.
5615 5615
5616When choosing which of these variables to use, follow the following rules: 5616When choosing which of these variables to use, follow the following rules:
5617 5617
5618 * PREFIX always points to the location where the current pkg will be 5618 * PREFIX always points to the location where the current pkg will be
5619 installed. When referring to a pkg's own installation path, use "${PREFIX}" 5619 installed. When referring to a pkg's own installation path, use "${PREFIX}"
5620 . 5620 .
5621 5621
5622 * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct 5622 * LOCALBASE is where all non-X11 pkgs are installed. If you need to construct
5623 a -I or -L argument to the compiler to find includes and libraries 5623 a -I or -L argument to the compiler to find includes and libraries
5624 installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE 5624 installed by another non-X11 pkg, use "${LOCALBASE}". The name LOCALBASE
5625 stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc 5625 stems from FreeBSD, which installed all packages in /usr/local. As pkgsrc
5626 leaves /usr/local for the system administrator, this variable is a 5626 leaves /usr/local for the system administrator, this variable is a
5627 misnomer. 5627 misnomer.
5628 5628
5629 * X11BASE is where the actual X11 distribution (from xsrc, etc.) is 5629 * X11BASE is where the actual X11 distribution (from xsrc, etc.) is
5630 installed. When looking for standard X11 includes (not those installed by a 5630 installed. When looking for standard X11 includes (not those installed by a
5631 package), use "${X11BASE}". 5631 package), use "${X11BASE}".
5632 5632
5633 * X11-based packages are special in that they may be installed in either 5633 * X11-based packages are special in that they may be installed in either
5634 X11BASE or LOCALBASE. 5634 X11BASE or LOCALBASE.
5635 5635
5636 Usually, X11 packages should be installed under LOCALBASE whenever 5636 Usually, X11 packages should be installed under LOCALBASE whenever
5637 possible. Note that you will need to include ../../mk/x11.buildlink3.mk in 5637 possible. Note that you will need to include ../../mk/x11.buildlink3.mk in
5638 them to request the presence of X11 and to get the right compilation flags. 5638 them to request the presence of X11 and to get the right compilation flags.
5639 5639
5640 Even though, there are some packages that cannot be installed under 5640 Even though, there are some packages that cannot be installed under
5641 LOCALBASE: those that come with app-defaults files. These packages are 5641 LOCALBASE: those that come with app-defaults files. These packages are
5642 special and they must be placed under X11BASE. To accomplish this, set 5642 special and they must be placed under X11BASE. To accomplish this, set
5643 either USE_X11BASE or USE_IMAKE in your package. 5643 either USE_X11BASE or USE_IMAKE in your package.
5644 5644
5645 Some notes: If you need to find includes or libraries installed by a pkg 5645 Some notes: If you need to find includes or libraries installed by a pkg
5646 that has USE_IMAKE or USE_X11BASE in its pkg Makefile, you need to look in  5646 that has USE_IMAKE or USE_X11BASE in its pkg Makefile, you need to look in
5647 both ${X11BASE} and ${LOCALBASE}. To force installation of all X11 packages 5647 both ${X11BASE} and ${LOCALBASE}. To force installation of all X11 packages
5648 in LOCALBASE, the pkgtools/xpkgwedge package is enabled by default. 5648 in LOCALBASE, the pkgtools/xpkgwedge package is enabled by default.
5649 5649
5650 * X11PREFIX should be used to refer to the installed location of an X11 5650 * X11PREFIX should be used to refer to the installed location of an X11
5651 package. X11PREFIX will be set to X11BASE if xpkgwedge is not installed, 5651 package. X11PREFIX will be set to X11BASE if xpkgwedge is not installed,
5652 and to LOCALBASE if xpkgwedge is installed. 5652 and to LOCALBASE if xpkgwedge is installed.
5653 5653
5654 * If xpkgwedge is installed, it is possible to have some packages installed 5654 * If xpkgwedge is installed, it is possible to have some packages installed
5655 in X11BASE and some in LOCALBASE. To determine the prefix of an installed 5655 in X11BASE and some in LOCALBASE. To determine the prefix of an installed
5656 package, the EVAL_PREFIX definition can be used. It takes pairs in the 5656 package, the EVAL_PREFIX definition can be used. It takes pairs in the
5657 format "DIRNAME=<package>", and the make(1) variable DIRNAME will be set to 5657 format "DIRNAME=<package>", and the make(1) variable DIRNAME will be set to
5658 the prefix of the installed package <package>, or "${X11PREFIX}" if the 5658 the prefix of the installed package <package>, or "${X11PREFIX}" if the
5659 package is not installed. 5659 package is not installed.
5660 5660
5661 This is best illustrated by example. 5661 This is best illustrated by example.
5662 5662
5663 The following lines are taken from pkgsrc/wm/scwm/Makefile: 5663 The following lines are taken from pkgsrc/wm/scwm/Makefile:
5664 5664
5665 EVAL_PREFIX+= GTKDIR=gtk+ 5665 EVAL_PREFIX+= GTKDIR=gtk+
5666 CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q} 5666 CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q}
5667 CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q} 5667 CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q}
5668 CONFIGURE_ARGS+= --enable-multibyte 5668 CONFIGURE_ARGS+= --enable-multibyte
5669 5669
5670 Specific defaults can be defined for the packages evaluated using 5670 Specific defaults can be defined for the packages evaluated using
5671 EVAL_PREFIX, by using a definition of the form: 5671 EVAL_PREFIX, by using a definition of the form:
5672 5672
5673 GTKDIR_DEFAULT= ${LOCALBASE} 5673 GTKDIR_DEFAULT= ${LOCALBASE}
5674 5674
5675 where GTKDIR corresponds to the first definition in the EVAL_PREFIX pair. 5675 where GTKDIR corresponds to the first definition in the EVAL_PREFIX pair.
5676 5676
5677 * Within ${PREFIX}, packages should install files according to hier(7), with 5677 * Within ${PREFIX}, packages should install files according to hier(7), with
5678 the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/ 5678 the exception that manual pages go into ${PREFIX}/man, not ${PREFIX}/share/
5679 man. 5679 man.
5680 5680
568117.3. Directories used during the build process 568117.3. Directories used during the build process
5682 5682
5683When building a package, various directories are used to store source files, 5683When building a package, various directories are used to store source files,
5684temporary files, pkgsrc-internal files, and so on. These directories are 5684temporary files, pkgsrc-internal files, and so on. These directories are
5685explained here. 5685explained here.
5686 5686
5687Some of the directory variables contain relative pathnames. There are two 5687Some of the directory variables contain relative pathnames. There are two
5688common base directories for these relative directories: PKGSRCDIR/PKGPATH is 5688common base directories for these relative directories: PKGSRCDIR/PKGPATH is
5689used for directories that are pkgsrc-specific. WRKSRC is used for directories 5689used for directories that are pkgsrc-specific. WRKSRC is used for directories
5690inside the package itself. 5690inside the package itself.
5691 5691
5692PKGSRCDIR 5692PKGSRCDIR
5693 5693
5694 This is an absolute pathname that points to the pkgsrc root directory. 5694 This is an absolute pathname that points to the pkgsrc root directory.
5695 Generally, you don't need it. 5695 Generally, you don't need it.
5696 5696
5697PKGDIR 5697PKGDIR
5698 5698
5699 This is an absolute pathname that points to the current package. 5699 This is an absolute pathname that points to the current package.
5700 5700
5701PKGPATH 5701PKGPATH
5702 5702
5703 This is a pathname relative to PKGSRCDIR that points to the current 5703 This is a pathname relative to PKGSRCDIR that points to the current
5704 package. 5704 package.
5705 5705
5706WRKDIR 5706WRKDIR
5707 5707
5708 This is an absolute pathname pointing to the directory where all work takes 5708 This is an absolute pathname pointing to the directory where all work takes
5709 place. The distfiles are extracted to this directory. It also contains 5709 place. The distfiles are extracted to this directory. It also contains
5710 temporary directories and log files used by the various pkgsrc frameworks, 5710 temporary directories and log files used by the various pkgsrc frameworks,
5711 like buildlink or the wrappers. 5711 like buildlink or the wrappers.
5712 5712
5713WRKSRC 5713WRKSRC
5714 5714
5715 This is an absolute pathname pointing to the directory where the distfiles 5715 This is an absolute pathname pointing to the directory where the distfiles
5716 are extracted. It is usually a direct subdirectory of WRKDIR, and often 5716 are extracted. It is usually a direct subdirectory of WRKDIR, and often
5717 it's the only directory entry that isn't hidden. This variable may be 5717 it's the only directory entry that isn't hidden. This variable may be
5718 changed by a package Makefile. 5718 changed by a package Makefile.
5719 5719
5720The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and 5720The CREATE_WRKDIR_SYMLINK definition takes either the value yes or no and
5721defaults to no. It indicates whether a symbolic link to the WRKDIR is to be 5721defaults to no. It indicates whether a symbolic link to the WRKDIR is to be
5722created in the pkgsrc entry's directory. If users would like to have their 5722created in the pkgsrc entry's directory. If users would like to have their
5723pkgsrc trees behave in a read-only manner, then the value of 5723pkgsrc trees behave in a read-only manner, then the value of
5724CREATE_WRKDIR_SYMLINK should be set to no. 5724CREATE_WRKDIR_SYMLINK should be set to no.
5725 5725
572617.4. Running a phase 572617.4. Running a phase
5727 5727
5728You can run a particular phase by typing make phase, where phase is the name of 5728You can run a particular phase by typing make phase, where phase is the name of