| @@ -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, “<code class="filename">distinfo</code>”</a>.</p> | | 4539 | makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="11.2. distinfo">Section 11.2, “<code class="filename">distinfo</code>”</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"> |
4562 | PATCHDIR= ${.CURDIR}/../xemacs/patches | | 4562 | PATCHDIR= ${.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">“<span class="quote">category/package</span>”</span> structure as pkgsrc, and | | 4571 | <span class="quote">“<span class="quote">category/package</span>”</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 — | | 4593 | kqueue support, add a check that detects kqueue itself — |
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"> |
4624 | case ${target_os} in | | 4624 | case ${target_os} in |
4625 | netbsd*) have_kvm=yes ;; | | 4625 | netbsd*) have_kvm=yes ;; |
4626 | *) have_kvm=no ;; | | 4626 | *) have_kvm=no ;; |
4627 | esac | | 4627 | esac |
4628 | </pre> | | 4628 | </pre> |
4629 | </td> | | 4629 | </td> |
4630 | <td> | | 4630 | <td> |
4631 | <pre class="programlisting"> | | 4631 | <pre class="programlisting"> |
4632 | AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no) | | 4632 | AC_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 <sys/event.h> | | 4641 | # include <sys/event.h> |
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 <sys/event.h> | | 4648 | # include <sys/event.h> |
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"> |
4657 | int | | 4657 | int |
4658 | monitor_file(...) | | 4658 | monitor_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"> |
4671 | int | | 4671 | int |
4672 | monitor_file(...) | | 4672 | monitor_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, “Files and directories outside the installation prefix”</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, “Files and directories outside the installation prefix”</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"> |
4756 | FILES_SUBST+= SOMEVAR="somevalue" | | 4756 | FILES_SUBST+= SOMEVAR="somevalue" |
4757 | </pre> | | 4757 | </pre> |
4758 | <p>replaces "@SOMEVAR@" with <span class="quote">“<span class="quote">somevalue</span>”</span> in the | | 4758 | <p>replaces "@SOMEVAR@" with <span class="quote">“<span class="quote">somevalue</span>”</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"> |
4785 | MESSAGE_SUBST+= SOMEVAR="somevalue" | | 4785 | MESSAGE_SUBST+= SOMEVAR="somevalue" |
4786 | </pre> | | 4786 | </pre> |
4787 | <p>replaces "${SOMEVAR}" with <span class="quote">“<span class="quote">somevalue</span>”</span> in | | 4787 | <p>replaces "${SOMEVAR}" with <span class="quote">“<span class="quote">somevalue</span>”</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">“<span class="quote">pre-configure</span>”</span> target to achieve | | 4871 | <span class="quote">“<span class="quote">pre-configure</span>”</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"> |
4880 | FILESDIR=${.CURDIR}/../xemacs/files | | 4880 | FILESDIR=${.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"> |
4928 | wrong: | | 4928 | wrong: |
4929 | @echo "line 1" > ${.TARGET} | | 4929 | @echo "line 1" > ${.TARGET} |
4930 | @echo "line 2" >> ${.TARGET} | | 4930 | @echo "line 2" >> ${.TARGET} |
4931 | @false | | 4931 | @false |
4932 | | | 4932 | |
4933 | correct: | | 4933 | correct: |
4934 | @echo "line 1" > ${.TARGET}.tmp | | 4934 | @echo "line 1" > ${.TARGET}.tmp |
4935 | @echo "line 2" >> ${.TARGET}.tmp | | 4935 | @echo "line 2" >> ${.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—the <span class="command"><strong>.for</strong></span> | | 4983 | <p>No rule without exception—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"> |
5035 | STRING= foo * bar `date` | | 5035 | STRING= foo * bar `date` |
5036 | INT_LIST= # empty | | 5036 | INT_LIST= # empty |
5037 | ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache | | 5037 | ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache |
5038 | EXT_LIST= # empty | | 5038 | EXT_LIST= # empty |
5039 | ANOTHER_EXT_LIST= a=b c=d | | 5039 | ANOTHER_EXT_LIST= a=b c=d |
5040 | | | 5040 | |
5041 | INT_LIST+= ${STRING} # 1 | | 5041 | INT_LIST+= ${STRING} # 1 |
5042 | INT_LIST+= ${ANOTHER_INT_LIST} # 2 | | 5042 | INT_LIST+= ${ANOTHER_INT_LIST} # 2 |
5043 | EXT_LIST+= ${STRING:Q} # 3 | | 5043 | EXT_LIST+= ${STRING:Q} # 3 |
5044 | EXT_LIST+= ${ANOTHER_EXT_LIST} # 4 | | 5044 | EXT_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"> |
5056 | EXT_LIST= # empty | | 5056 | EXT_LIST= # empty |
5057 | .for i in ${INT_LIST} | | 5057 | .for i in ${INT_LIST} |
5058 | EXT_LIST+= ${i:Q}"" | | 5058 | EXT_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"> |
5074 | STRING= foo bar < > * `date` $$HOME ' " | | 5074 | STRING= foo bar < > * `date` $$HOME ' " |
5075 | EXT_LIST= string=${STRING:Q} x=second\ item | | 5075 | EXT_LIST= string=${STRING:Q} x=second\ item |
5076 | | | 5076 | |
5077 | all: | | 5077 | all: |
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"> |
5137 | CPPFLAGS= # empty | | 5137 | CPPFLAGS= # empty |
5138 | CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\" | | 5138 | CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\" |
5139 | CPPFLAGS+= ${MY_CPPFLAGS} | | 5139 | CPPFLAGS+= ${MY_CPPFLAGS} |
5140 | | | 5140 | |
5141 | CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q} | | 5141 | CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q} |
5142 | | | 5142 | |
5143 | all: | | 5143 | all: |
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"> |
5165 | EMPTY= # empty | | 5165 | EMPTY= # empty |
5166 | empty_test: | | 5166 | empty_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 | |
5171 | for_test: | | 5171 | for_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"> |
5202 | VAR:= ${VAR:N${_othervar_:C/-//}} | | 5202 | VAR:= ${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">“<span class="quote">packing list</span>”</span>, i.e. a list of files that belong to | | 5227 | <span class="quote">“<span class="quote">packing list</span>”</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, “Other helpful targets”</a> for | | 5248 | was extracted. See <a class="xref" href="#build.helpful-targets" title="17.17. Other helpful targets">Section 17.17, “Other helpful targets”</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, “Sharing directories between packages”</a>, you may have noticed that | | 5256 | <a class="xref" href="#faq.common-dirs" title="13.8. Sharing directories between packages">Section 13.8, “Sharing directories between packages”</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"> |
5271 | PRINT_PLIST_AWK+= /^libdata\/foo/ { next; } | | 5271 | PRINT_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"> |
5277 | PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; } | | 5277 | PRINT_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">“<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>”</span> will be | | 5294 | <span class="quote">“<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>”</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">“<span class="quote"><code class="varname">$ARCH</code></span>”</span> that | | 5303 | <span class="quote">“<span class="quote"><code class="varname">$ARCH</code></span>”</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">“<span class="quote"><span class="command"><strong>uname -s</strong></span></span>”</span></p></li> | | 5316 | <li class="listitem"><p><code class="varname">${OPSYS}</code> - output of <span class="quote">“<span class="quote"><span class="command"><strong>uname -s</strong></span></span>”</span></p></li> |
5317 | <li class="listitem"><p><code class="varname">${LOWER_OPSYS}</code> - lowercase common name (eg. <span class="quote">“<span class="quote">solaris</span>”</span>)</p></li> | | 5317 | <li class="listitem"><p><code class="varname">${LOWER_OPSYS}</code> - lowercase common name (eg. <span class="quote">“<span class="quote">solaris</span>”</span>)</p></li> |
5318 | <li class="listitem"><p><code class="varname">${OS_VERSION}</code> - <span class="quote">“<span class="quote"><span class="command"><strong>uname -r</strong></span></span>”</span></p></li> | | 5318 | <li class="listitem"><p><code class="varname">${OS_VERSION}</code> - <span class="quote">“<span class="quote"><span class="command"><strong>uname -r</strong></span></span>”</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, “Optional files”</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, “Optional files”</a>):</p> |
5328 | <pre class="programlisting"> | | 5328 | <pre class="programlisting"> |
5329 | PLIST_SUBST+= SOMEVAR="somevalue" | | 5329 | PLIST_SUBST+= SOMEVAR="somevalue" |
5330 | </pre> | | 5330 | </pre> |
5331 | <p>This replaces all occurrences of <span class="quote">“<span class="quote">${SOMEVAR}</span>”</span> | | 5331 | <p>This replaces all occurrences of <span class="quote">“<span class="quote">${SOMEVAR}</span>”</span> |
5332 | in the <code class="filename">PLIST</code> with | | 5332 | in the <code class="filename">PLIST</code> with |
5333 | <span class="quote">“<span class="quote">somevalue</span>”</span>.</p> | | 5333 | <span class="quote">“<span class="quote">somevalue</span>”</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">“<span class="quote"><code class="varname">${PLIST.foo}</code></span>”</span> | | 5340 | This will substitute <span class="quote">“<span class="quote"><code class="varname">${PLIST.foo}</code></span>”</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">“<span class="quote"><code class="literal">""</code></span>”</span> or | | 5342 | <span class="quote">“<span class="quote"><code class="literal">""</code></span>”</span> or |
5343 | <span class="quote">“<span class="quote"><code class="literal">"@comment "</code></span>”</span>. | | 5343 | <span class="quote">“<span class="quote"><code class="literal">"@comment "</code></span>”</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"> |
5346 | PLIST_VARS+= foo | | 5346 | PLIST_VARS+= foo |
5347 | .if <em class="replaceable"><code>condition</code></em> | | 5347 | .if <em class="replaceable"><code>condition</code></em> |
5348 | PLIST.foo= yes | | 5348 | PLIST.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$ |
5354 | bin/bar | | 5354 | bin/bar |
5355 | man/man1/bar.1 | | 5355 | man/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">“<span class="quote">.gz</span>”</span> is | | 5368 | <code class="filename">PLIST</code> file, the suffix <span class="quote">“<span class="quote">.gz</span>”</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">“<span class="quote">shared directory</span>”</span> is a directory where | | 5403 | <p>A <span class="quote">“<span class="quote">shared directory</span>”</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">“<span class="quote">bl3ifying</span>”</span>) is fairly straightforward. | | 5472 | framework (<span class="quote">“<span class="quote">bl3ifying</span>”</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">“<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>”</span>. | | 5484 | relative to <span class="quote">“<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>”</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"> |
5494 | DEPENDS+= foo>=1.1.0:../../category/foo | | 5494 | DEPENDS+= foo>=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"> |
5504 | BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0 | | 5504 | BUILDLINK_API_DEPENDS.foo+= foo>=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">“<span class="quote">dt</span>”</span>, | | 5525 | <code class="varname">MOTIF_TYPE</code> to <span class="quote">“<span class="quote">dt</span>”</span>, |
5526 | <span class="quote">“<span class="quote">lesstif</span>”</span>, <span class="quote">“<span class="quote">motif</span>”</span> or | | 5526 | <span class="quote">“<span class="quote">lesstif</span>”</span>, <span class="quote">“<span class="quote">motif</span>”</span> or |
5527 | <span class="quote">“<span class="quote">openmotif</span>”</span> to choose | | 5527 | <span class="quote">“<span class="quote">openmotif</span>”</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 >buildlink3.mk</code></strong> | | 5574 | <code class="prompt">%</code> createbuildlink >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 | |
5585 | BUILDLINK_TREE+= tiff | | 5585 | BUILDLINK_TREE+= tiff |
5586 | | | 5586 | |
5587 | .if !defined(TIFF_BUILDLINK3_MK) | | 5587 | .if !defined(TIFF_BUILDLINK3_MK) |
5588 | TIFF_BUILDLINK3_MK:= | | 5588 | TIFF_BUILDLINK3_MK:= |
5589 | | | 5589 | |
5590 | BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1 | | 5590 | BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1 |
5591 | BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1 | | 5591 | BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1 |
5592 | BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff | | 5592 | BUILDLINK_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 | |
5598 | BUILDLINK_TREE+= -tiff | | 5598 | BUILDLINK_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">“<span class="quote">build</span>”</span>. By default, the full dependency is | | 5626 | to <span class="quote">“<span class="quote">build</span>”</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">“<span class="quote">include</span>”</span> and <span class="quote">“<span class="quote">lib</span>”</span> | | 5634 | default to <span class="quote">“<span class="quote">include</span>”</span> and <span class="quote">“<span class="quote">lib</span>”</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">“<span class="quote">-I</span>”</span> option | | 5639 | configure and build phases. The <span class="quote">“<span class="quote">-I</span>”</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, “Handling dependencies”</a> for | | 5751 | <p>See <a class="xref" href="#dependencies" title="19.1.6. Handling dependencies">Section 19.1.6, “Handling dependencies”</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">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</span> | | 5783 | to either <span class="quote">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</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 | # |
5804 | IS_BUILTIN.foo?= no | | 5804 | IS_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]) |
5810 | BUILTIN_PKG.foo?= foo-1.0 | | 5810 | BUILTIN_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) |
5815 | USE_BUILTIN.foo?= ${IS_BUILTIN.foo} | | 5815 | USE_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]) |
5819 | USE_BUILTIN.foo!= \ | | 5819 | USE_BUILTIN.foo!= \ |
5820 | ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \ | | 5820 | ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \ |
5821 | && ${ECHO} "yes" || ${ECHO} "no" | | 5821 | && ${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 | |
5827 | CHECK_BUILTIN.foo?= no | | 5827 | CHECK_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">“<span class="quote">yes</span>”</span> if the actual package is | | 5840 | it should only be <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">yes</span>”</span>). This variable is only used internally | | 5849 | is <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">yes</span>”</span> even if | | 5866 | may be <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">no</span>”</span> because we may make the determination | | 5868 | is <span class="quote">“<span class="quote">no</span>”</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">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">no</span>”</span>, or a list of | | 5889 | of either <span class="quote">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">no</span>”</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"> |
5903 | PREFER_PKGSRC= yes | | 5903 | PREFER_PKGSRC= yes |
5904 | PREFER_NATIVE= getopt skey tcp_wrappers | | 5904 | PREFER_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 |
5954 | easily done with simple code in the package's post-installation target | | 5954 | easily 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>, |
5956 | as the code in them is only executed when building from source. Machines | | 5956 | as the code in them is only executed when building from source. Machines |
5957 | using binary packages could not benefit from it at all (as the code itself | | 5957 | using binary packages could not benefit from it at all (as the code itself |
5958 | could be unavailable). Therefore, the only way to achieve any of the items | | 5958 | could be unavailable). Therefore, the only way to achieve any of the items |
5959 | described above is by means of the installation scripts, which are | | 5959 | described above is by means of the installation scripts, which are |
5960 | automatically generated by pkginstall.</p> | | 5960 | automatically 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 |
5965 | of files and directories that belong to a package. The names used in it | | 5965 | of files and directories that belong to a package. The names used in it |
5966 | are relative to the installation prefix (<code class="filename">${PREFIX}</code>), | | 5966 | are relative to the installation prefix (<code class="filename">${PREFIX}</code>), |
5967 | which means that it cannot register files outside this directory (absolute | | 5967 | which means that it cannot register files outside this directory (absolute |
5968 | path names are not allowed). Despite this restriction, some packages need | | 5968 | path names are not allowed). Despite this restriction, some packages need |
5969 | to install files outside this location; e.g., under | | 5969 | to 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 |
5972 | is to create such files during installation time by using | | 5972 | is to create such files during installation time by using |
5973 | installation scripts.</p> | | 5973 | installation scripts.</p> |
5974 | <p>The generic installation scripts are shell scripts that can | | 5974 | <p>The generic installation scripts are shell scripts that can |
5975 | contain arbitrary code. The list of scripts to execute is taken from | | 5975 | contain arbitrary code. The list of scripts to execute is taken from |
5976 | the <code class="varname">INSTALL_FILE</code> variable, which defaults to | | 5976 | the <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 |
5978 | removal (<code class="varname">DEINSTALL_FILE</code>, whose default is | | 5978 | removal (<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 |
5980 | commands, so they have the potential to create and manage files | | 5980 | commands, so they have the potential to create and manage files |
5981 | anywhere in the file system.</p> | | 5981 | anywhere 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 |
5983 | may be needed in some special cases. One reason for avoiding them is | | 5983 | may be needed in some special cases. One reason for avoiding them is |
5984 | that the user has to trust the packager that there is no unwanted or | | 5984 | that the user has to trust the packager that there is no unwanted or |
5985 | simply erroneous code included in the installation script. Also, | | 5985 | simply erroneous code included in the installation script. Also, |
5986 | previously there were many similar scripts for the same functionality, | | 5986 | previously there were many similar scripts for the same functionality, |
5987 | and fixing a common error involved finding and changing all of | | 5987 | and fixing a common error involved finding and changing all of |
5988 | them.</p> | | 5988 | them.</p> |
5989 | <p>The pkginstall framework offers another, standardized way. It | | 5989 | <p>The pkginstall framework offers another, standardized way. It |
5990 | provides generic scripts to abstract the manipulation of such files | | 5990 | provides generic scripts to abstract the manipulation of such files |
5991 | and directories based on variables set in the package's | | 5991 | and 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 |
5993 | these variables.</p> | | 5993 | these 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 |
5998 | directories anywhere in the file system:</p> | | 5998 | directories 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"> |
6014 | MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700 | | 6014 | MAKE_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 |
6025 | because the <code class="filename">PLIST</code> forces all files to be inside it. | | 6025 | because the <code class="filename">PLIST</code> forces all files to be inside it. |
6026 | To overcome this problem, the only solution is to extract the file in the | | 6026 | To overcome this problem, the only solution is to extract the file in the |
6027 | known place (i.e., inside the installation prefix) and copy it to the | | 6027 | known place (i.e., inside the installation prefix) and copy it to the |
6028 | appropriate location during installation (done by the installation scripts | | 6028 | appropriate location during installation (done by the installation scripts |
6029 | generated by pkginstall). We will call the former the <span class="emphasis"><em>master | | 6029 | generated by pkginstall). We will call the former the <span class="emphasis"><em>master |
6030 | file</em></span> in the following paragraphs, which describe the variables | | 6030 | file</em></span> in the following paragraphs, which describe the variables |
6031 | that can be used to automatically and consistently handle files outside the | | 6031 | that can be used to automatically and consistently handle files outside the |
6032 | installation prefix:</p> | | 6032 | installation 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"> |
6053 | REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700 | | 6053 | REQD_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 |
6065 | in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and | | 6065 | in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and |
6066 | need special treatment during installation (most of which is automated by | | 6066 | need special treatment during installation (most of which is automated by |
6067 | pkginstall). The main concept you must bear in mind is that files marked | | 6067 | pkginstall). The main concept you must bear in mind is that files marked |
6068 | as configuration files are automatically copied to the right place (somewhere | | 6068 | as configuration files are automatically copied to the right place (somewhere |
6069 | inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if | | 6069 | inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if |
6070 | and only if</em></span> they didn't exist before. Similarly, they will not | | 6070 | and only if</em></span> they didn't exist before. Similarly, they will not |
6071 | be removed if they have local modifications. This ensures that | | 6071 | be removed if they have local modifications. This ensures that |
6072 | administrators never lose any custom changes they may have made.</p> | | 6072 | administrators 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 |
6077 | specifies where configuration files shall be installed. Its contents are | | 6077 | specifies where configuration files shall be installed. Its contents are |
6078 | set based upon the following variables:</p> | | 6078 | set 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> |
6109 | variable that can be used within a package to refer to its configuration | | 6109 | variable that can be used within a package to refer to its configuration |
6110 | directory. The algorithm used to set its value is basically the | | 6110 | directory. The algorithm used to set its value is basically the |
6111 | following:</p> | | 6111 | following:</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 |
6123 | automatically 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, “Directory manipulation”</a> what this means. This does not apply to | | 6123 | automatically 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, “Directory manipulation”</a> what this means. This does not apply to |
6124 | subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to | | 6124 | subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to |
6125 | be created with OWN_DIRS or MAKE_DIRS.</p> | | 6125 | be 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 |
6131 | known place, you need to teach each package where it shall install its | | 6131 | known place, you need to teach each package where it shall install its |
6132 | files. In some cases you will have to patch the package Makefiles to | | 6132 | files. In some cases you will have to patch the package Makefiles to |
6133 | achieve it. If you are lucky, though, it may be as easy as passing an | | 6133 | achieve it. If you are lucky, though, it may be as easy as passing an |
6134 | extra flag to the configuration script; this is the case of GNU Autoconf- | | 6134 | extra flag to the configuration script; this is the case of GNU Autoconf- |
6135 | generated files:</p> | | 6135 | generated files:</p> |
6136 | <pre class="programlisting"> | | 6136 | <pre class="programlisting"> |
6137 | CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} | | 6137 | CONFIGURE_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 |
6140 | for</em></span> its configuration files, not where they will be originally | | 6140 | for</em></span> its configuration files, not where they will be originally |
6141 | installed (although the difference is never explicit, | | 6141 | installed (although the difference is never explicit, |
6142 | unfortunately).</p> | | 6142 | unfortunately).</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. |
6148 | This means that <span class="strong"><strong>the packages themselves must not | | 6148 | This means that <span class="strong"><strong>the packages themselves must not |
6149 | touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code> | | 6149 | touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code> |
6150 | directly</strong></span>. Bad news is that many software installation scripts | | 6150 | directly</strong></span>. Bad news is that many software installation scripts |
6151 | will, out of the box, mess with the contents of that directory. So what is | | 6151 | will, out of the box, mess with the contents of that directory. So what is |
6152 | the correct procedure to fix this issue?</p> | | 6152 | the 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 |
6154 | install any configuration files under the examples hierarchy, | | 6154 | install 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 |
6157 | has the original copies available.</p> | | 6157 | has 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 |
6159 | examples hierarchy), the pkginstall framework can use them as master copies | | 6159 | examples hierarchy), the pkginstall framework can use them as master copies |
6160 | during the package installation to update what is in | | 6160 | during 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 |
6163 | used. Check out <a class="xref" href="#files-outside-prefix" title="15.1.2. File manipulation">Section 15.1.2, “File manipulation”</a> for information | | 6163 | used. Check out <a class="xref" href="#files-outside-prefix" title="15.1.2. File manipulation">Section 15.1.2, “File manipulation”</a> for information |
6164 | about their syntax and their purpose. Here is an example, taken from the | | 6164 | about 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"> |
6167 | EGDIR= ${PREFIX}/share/doc/mutt/samples | | 6167 | EGDIR= ${PREFIX}/share/doc/mutt/samples |
6168 | CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc | | 6168 | CONF_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 |
6171 | package and has no meaning outside it.</p> | | 6171 | package 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 |
6177 | environment variable <code class="varname">PKG_CONFIG</code> prior to package | | 6177 | environment variable <code class="varname">PKG_CONFIG</code> prior to package |
6178 | installation.</p> | | 6178 | installation.</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 |
6185 | installed in a place known by the underlying OS, usually outside the | | 6185 | installed in a place known by the underlying OS, usually outside the |
6186 | installation 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, “Files and directories outside the installation prefix”</a> apply, and the same solutions | | 6186 | installation 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, “Files and directories outside the installation prefix”</a> apply, and the same solutions |
6187 | can be used. However, pkginstall provides a special mechanism to handle | | 6187 | can be used. However, pkginstall provides a special mechanism to handle |
6188 | these files.</p> | | 6188 | these 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 |
6190 | to:</p> | | 6190 | to:</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"> |
6201 | RCD_SCRIPTS+= cupsd | | 6201 | RCD_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 |
6206 | script in an automated fashion:</p> | | 6206 | script 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 |
6223 | environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package | | 6223 | environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package |
6224 | installation. Note that the scripts will be always copied inside the | | 6224 | installation. Note that the scripts will be always copied inside the |
6225 | examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no | | 6225 | examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no |
6226 | matter what the value of this variable is.</p> | | 6226 | matter 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 |
6233 | installation, it can do so by using the pkginstall framework.</p> | | 6233 | installation, 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 |
6236 | syntax:</p> | | 6236 | syntax:</p> |
6237 | <pre class="programlisting"> | | 6237 | <pre class="programlisting"> |
6238 | user:group | | 6238 | user: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 |
6241 | per-user variables. | | 6241 | per-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 |
6243 | numeric UID for the user. | | 6243 | numeric 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 |
6245 | user's description or comment. | | 6245 | user'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 |
6247 | user's home directory, and defaults to | | 6247 | user'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 |
6250 | user's shell, and defaults to <code class="filename">/sbin/nologin</code> if | | 6250 | user's shell, and defaults to <code class="filename">/sbin/nologin</code> if |
6251 | not specified.</p> | | 6251 | not 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"> |
6255 | group | | 6255 | group |
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 |
6260 | stage, then it can set <code class="varname">USERGROUP_PHASE</code> to | | 6260 | stage, then it can set <code class="varname">USERGROUP_PHASE</code> to |
6261 | either <code class="literal">configure</code> or <code class="literal">build</code> to | | 6261 | either <code class="literal">configure</code> or <code class="literal">build</code> to |
6262 | indicate the phase before which the users and groups are created. In | | 6262 | indicate the phase before which the users and groups are created. In |
6263 | this case, the numeric UIDs and GIDs of the created users and groups | | 6263 | this case, the numeric UIDs and GIDs of the created users and groups |
6264 | are automatically hardcoded into the final installation scripts.</p> | | 6264 | are 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 |
6270 | database, <code class="filename">/etc/shells</code>, to make things easier to the | | 6270 | database, <code class="filename">/etc/shells</code>, to make things easier to the |
6271 | administrator. This must be done from the installation scripts to keep | | 6271 | administrator. This must be done from the installation scripts to keep |
6272 | binary packages working on any system. pkginstall provides an easy way to | | 6272 | binary packages working on any system. pkginstall provides an easy way to |
6273 | accomplish this task.</p> | | 6273 | accomplish 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 |
6276 | add some hooks to the installation scripts to handle it. Consider the | | 6276 | add some hooks to the installation scripts to handle it. Consider the |
6277 | following 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> | | 6277 | following 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"> |
6279 | PKG_SHELL= ${PREFIX}/bin/zsh | | 6279 | PKG_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 |
6285 | the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code> | | 6285 | the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code> |
6286 | environment variable to <code class="literal">NO</code>.</p> | | 6286 | environment 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 |
6293 | that index the fonts within each fonts directory. This can easily be | | 6293 | that index the fonts within each fonts directory. This can easily be |
6294 | accomplished within the pkginstall framework.</p> | | 6294 | accomplished 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 |
6296 | which fonts are installed in the | | 6296 | which 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, |
6298 | where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">“<span class="quote">ttf</span>”</span>, | | 6298 | where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">“<span class="quote">ttf</span>”</span>, |
6299 | <span class="quote">“<span class="quote">type1</span>”</span> or <span class="quote">“<span class="quote">x11</span>”</span>. This will add hooks to the | | 6299 | <span class="quote">“<span class="quote">type1</span>”</span> or <span class="quote">“<span class="quote">x11</span>”</span>. This will add hooks to the |
6300 | installation scripts to run the appropriate commands to update the fonts | | 6300 | installation scripts to run the appropriate commands to update the fonts |
6301 | database files within each of those directories. For convenience, if the | | 6301 | database files within each of those directories. For convenience, if the |
6302 | directory path is relative, it is taken to be relative to the package's | | 6302 | directory path is relative, it is taken to be relative to the package's |
6303 | installation 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> | | 6303 | installation 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"> |
6305 | FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF | | 6305 | FONTS_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 |
6311 | the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code> | | 6311 | the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code> |
6312 | environment variable to <code class="literal">NO</code>.</p> | | 6312 | environment 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 |
6329 | sets of features. <code class="filename">bsd.options.mk</code> is a framework | | 6329 | sets of features. <code class="filename">bsd.options.mk</code> is a framework |
6330 | in pkgsrc that provides generic handling of those options that | | 6330 | in pkgsrc that provides generic handling of those options that |
6331 | determine different ways in which the packages can be built. It's | | 6331 | determine different ways in which the packages can be built. It's |
6332 | possible for the user to specify exactly which sets of options will be | | 6332 | possible for the user to specify exactly which sets of options will be |
6333 | built into a package or to allow a set of global default options | | 6333 | built into a package or to allow a set of global default options |
6334 | apply.</p> | | 6334 | apply.</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 |
6336 | control via options. One is whether some particular feature is | | 6336 | control via options. One is whether some particular feature is |
6337 | enabled in a program that will be built anyway, often by including or | | 6337 | enabled in a program that will be built anyway, often by including or |
6338 | not including a dependency on some other package. The other is | | 6338 | not including a dependency on some other package. The other is |
6339 | whether or not an additional program will be built as part of the | | 6339 | whether or not an additional program will be built as part of the |
6340 | package. Generally, it is better to make a split package for such | | 6340 | package. Generally, it is better to make a split package for such |
6341 | additional programs instead of using options, because it enables | | 6341 | additional programs instead of using options, because it enables |
6342 | binary packages to be built which can then be added separately. For | | 6342 | binary packages to be built which can then be added separately. For |
6343 | example, the foo package might have minimal dependencies (those | | 6343 | example, the foo package might have minimal dependencies (those |
6344 | packages without which foo doesn't make sense), and then the foo-gfoo | | 6344 | packages without which foo doesn't make sense), and then the foo-gfoo |
6345 | package might include the GTK frontend program gfoo. This is better | | 6345 | package might include the GTK frontend program gfoo. This is better |
6346 | than including a gtk option to foo that adds gfoo, because either that | | 6346 | than including a gtk option to foo that adds gfoo, because either that |
6347 | option is default, in which case binary users can't get foo without | | 6347 | option is default, in which case binary users can't get foo without |
6348 | gfoo, or not default, in which case they can't get gfoo. With split | | 6348 | gfoo, or not default, in which case they can't get gfoo. With split |
6349 | packages, they can install foo without having GTK, and later decide to | | 6349 | packages, they can install foo without having GTK, and later decide to |
6350 | install gfoo (pulling in GTK at that time). This is an advantage to | | 6350 | install gfoo (pulling in GTK at that time). This is an advantage to |
6351 | source users too, avoiding the need for rebuilds.</p> | | 6351 | source 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 |
6353 | instead of options.</p> | | 6353 | instead 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 |
6355 | the upstream package does not support this. The decision of split | | 6355 | the upstream package does not support this. The decision of split |
6356 | vs. option should be made based on the likelihood that users will want | | 6356 | vs. option should be made based on the likelihood that users will want |
6357 | or object to the various pieces, the size of the dependencies that are | | 6357 | or object to the various pieces, the size of the dependencies that are |
6358 | included, and the amount of work.</p> | | 6358 | included, 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 |
6360 | that depend on non-free dependencies (especially plugins) should | | 6360 | that depend on non-free dependencies (especially plugins) should |
6361 | almost always be split if feasible.</p> | | 6361 | almost 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 |
6367 | that should be built into every package if that option is supported. | | 6367 | that should be built into every package if that option is supported. |
6368 | This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p> | | 6368 | This 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 |
6376 | by the hypothetical ``wibble'' package, either in the package | | 6376 | by 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, |
6378 | e.g. <code class="filename">options.mk</code>, that is included by the | | 6378 | e.g. <code class="filename">options.mk</code>, that is included by the |
6379 | main package <code class="filename">Makefile</code>.</p> | | 6379 | main package <code class="filename">Makefile</code>.</p> |
6380 | <pre class="programlisting"> | | 6380 | <pre class="programlisting"> |
6381 | PKG_OPTIONS_VAR= PKG_OPTIONS.wibble | | 6381 | PKG_OPTIONS_VAR= PKG_OPTIONS.wibble |
6382 | PKG_SUPPORTED_OPTIONS= wibble-foo ldap | | 6382 | PKG_SUPPORTED_OPTIONS= wibble-foo ldap |
6383 | PKG_OPTIONS_OPTIONAL_GROUPS= database | | 6383 | PKG_OPTIONS_OPTIONAL_GROUPS= database |
6384 | PKG_OPTIONS_GROUP.database= mysql pgsql | | 6384 | PKG_OPTIONS_GROUP.database= mysql pgsql |
6385 | PKG_SUGGESTED_OPTIONS= wibble-foo | | 6385 | PKG_SUGGESTED_OPTIONS= wibble-foo |
6386 | PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap | | 6386 | PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap |
6387 | PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo | | 6387 | PKG_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) |
6393 | PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2} | | 6393 | PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2} |
6394 | PKG_OPTIONS_DEPRECATED_WARNINGS+= \ | | 6394 | PKG_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) |
6406 | CONFIGURE_ARGS+= --enable-foo | | 6406 | CONFIGURE_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" |
6414 | CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client} | | 6414 | CONFIGURE_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 |
6428 | options are supported by the package, and any default options settings | | 6428 | options are supported by the package, and any default options settings |
6429 | if needed.</p> | | 6429 | if 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 |
6433 | options. It should be set to | | 6433 | options. It should be set to |
6434 | PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to | | 6434 | PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to |
6435 | PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined | | 6435 | PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined |
6436 | at the point where the options are processed.</p></li> | | 6436 | at 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 |
6438 | build options supported by the package.</p></li> | | 6438 | build 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 |
6440 | list of names of groups of mutually exclusive options. The options in | | 6440 | list of names of groups of mutually exclusive options. The options in |
6441 | each group are listed in | | 6441 | each 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>. |
6443 | The most specific setting of any option from the group takes | | 6443 | The most specific setting of any option from the group takes |
6444 | precedence over all other options in the group. Options from the | | 6444 | precedence over all other options in the group. Options from the |
6445 | groups will be automatically added to | | 6445 | groups 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 |
6449 | packages will fail if no option from the group is | | 6449 | packages will fail if no option from the group is |
6450 | selected.</p></li> | | 6450 | selected.</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 |
6452 | of names of sets of options. At least one option from each set must | | 6452 | of names of sets of options. At least one option from each set must |
6453 | be selected. The options in each set are listed in | | 6453 | be 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>. |
6455 | Options from the sets will be automatically added to | | 6455 | Options 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 |
6457 | fail if no option from the set is selected.</p></li> | | 6457 | fail 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 |
6459 | build options which are enabled by default.</p></li> | | 6459 | build 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 |
6461 | of | | 6461 | of |
6462 | <span class="quote">“<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”</span> | | 6462 | <span class="quote">“<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”</span> |
6463 | pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to | | 6463 | pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to |
6464 | their option counterparts. Pairs should be added with | | 6464 | their option counterparts. Pairs should be added with |
6465 | <span class="quote">“<span class="quote">+=</span>”</span> to keep the listing of global legacy variables. A | | 6465 | <span class="quote">“<span class="quote">+=</span>”</span> to keep the listing of global legacy variables. A |
6466 | warning will be issued if the user uses a legacy | | 6466 | warning will be issued if the user uses a legacy |
6467 | variable.</p></li> | | 6467 | variable.</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 |
6469 | of | | 6469 | of |
6470 | <span class="quote">“<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”</span> | | 6470 | <span class="quote">“<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”</span> |
6471 | pairs that map options that have been renamed to their new | | 6471 | pairs that map options that have been renamed to their new |
6472 | counterparts. Pairs should be added with <span class="quote">“<span class="quote">+=</span>”</span> to keep | | 6472 | counterparts. Pairs should be added with <span class="quote">“<span class="quote">+=</span>”</span> to keep |
6473 | the listing of global legacy options. A warning will be issued if | | 6473 | the listing of global legacy options. A warning will be issued if |
6474 | the user uses a legacy option.</p></li> | | 6474 | the 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 |
6476 | options implied by deprecated variables used. This can be used for | | 6476 | options implied by deprecated variables used. This can be used for |
6477 | cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor | | 6477 | cases 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 |
6481 | a list of warnings about deprecated variables or options used, and | | 6481 | a list of warnings about deprecated variables or options used, and |
6482 | what to use instead.</p></li> | | 6482 | what 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. |
6487 | To suggest a default set of options, use | | 6487 | To 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 |
6490 | including <code class="filename">bsd.options.mk</code>. If none of | | 6490 | including <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 |
6494 | happen with platform-specific options if none of them is supported on | | 6494 | happen with platform-specific options if none of them is supported on |
6495 | the current platform), <code class="varname">PKG_OPTIONS</code> is set to the | | 6495 | the current platform), <code class="varname">PKG_OPTIONS</code> is set to the |
6496 | empty list and the package is otherwise treated as not using the | | 6496 | empty list and the package is otherwise treated as not using the |
6497 | options framework.</p> | | 6497 | options 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 |
6499 | variable <code class="varname">PKG_OPTIONS</code> contains the list of selected | | 6499 | variable <code class="varname">PKG_OPTIONS</code> contains the list of selected |
6500 | build options, properly filtered to remove unsupported and duplicate | | 6500 | build options, properly filtered to remove unsupported and duplicate |
6501 | options.</p> | | 6501 | options.</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 |
6503 | each option. The correct way to check for an option is to check | | 6503 | each option. The correct way to check for an option is to check |
6504 | whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p> | | 6504 | whether 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 |
6513 | optional support for a library) should use a common name in all | | 6513 | optional support for a library) should use a common name in all |
6514 | packages that support it (like the name of the library). If another | | 6514 | packages that support it (like the name of the library). If another |
6515 | package already has an option with the same meaning, use the same | | 6515 | package already has an option with the same meaning, use the same |
6516 | name.</p> | | 6516 | name.</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 |
6518 | unlikely that another (unrelated) package has the same (or a similar) | | 6518 | unlikely that another (unrelated) package has the same (or a similar) |
6519 | optional feature, should use a name prefixed with | | 6519 | optional 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 |
6522 | specific to that group, prefix it with the name of the | | 6522 | specific to that group, prefix it with the name of the |
6523 | <span class="quote">“<span class="quote">main</span>”</span> package | | 6523 | <span class="quote">“<span class="quote">main</span>”</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 |
6527 | fields, separated by tab. The first field is the option name, the | | 6527 | fields, separated by tab. The first field is the option name, the |
6528 | second its description. The description should be a whole sentence | | 6528 | second 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">“<span class="quote">DIRNAME=<package></span>”</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">“<span class="quote">DIRNAME=<package></span>”</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 <package>, or | | 6686 | of the installed package <package>, or |
6687 | <span class="quote">“<span class="quote">${X11PREFIX}</span>”</span> if the package is not | | 6687 | <span class="quote">“<span class="quote">${X11PREFIX}</span>”</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"> |
6693 | EVAL_PREFIX+= GTKDIR=gtk+ | | 6693 | EVAL_PREFIX+= GTKDIR=gtk+ |
6694 | CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q} | | 6694 | CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q} |
6695 | CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q} | | 6695 | CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q} |
6696 | CONFIGURE_ARGS+= --enable-multibyte | | 6696 | CONFIGURE_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"> |
6702 | GTKDIR_DEFAULT= ${LOCALBASE} | | 6702 | GTKDIR_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"> |
6795 | DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz | | 6795 | DISTFILES= ${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"> |
6807 | DISTFILES= ${DISTNAME}${EXTRACT_SUFX} | | 6807 | DISTFILES= ${DISTNAME}${EXTRACT_SUFX} |
6808 | DISTFILES+= foo-file.tar.gz | | 6808 | DISTFILES+= foo-file.tar.gz |
6809 | SITES.foo-file.tar.gz= \ | | 6809 | SITES.foo-file.tar.gz= \ |
6810 | http://www.somewhere.com/somehow/ \ | | 6810 | http://www.somewhere.com/somehow/ \ |
6811 | http://www.somewhereelse.com/mirror/somehow/ | | 6811 | http://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"> |
6823 | MASTER_SITES= http://www.example.com/download.cgi?file= | | 6823 | MASTER_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"> |
6869 | MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/} | | 6869 | MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/} |
6870 | MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/} | | 6870 | MASTER_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">“<span class="quote">${RESTRICTED}</span>”</span>) will not have their distfiles | | 6905 | <span class="quote">“<span class="quote">${RESTRICTED}</span>”</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, “patches/*”</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, “patches/*”</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">“<span class="quote">yes</span>”</span>. If the configure script is a GNU autoconf | | 7037 | <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">yes</span>”</span> instead. What happens in the | | 7039 | <span class="quote">“<span class="quote">yes</span>”</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 | && cd ${d} \ | | 7044 | && cd ${d} \ |
7045 | && env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS} | | 7045 | && 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">“<span class="quote">.</span>”</span>) is a list of pathnames relative to | | 7049 | <span class="quote">“<span class="quote">.</span>”</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">“<span class="quote">./configure</span>”</span>) and | | 7056 | <span class="quote">“<span class="quote">./configure</span>”</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">“<span class="quote">yes</span>”</span>. (If you only want the package installed in | | 7068 | <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">yes</span>”</span>. | | 7075 | setting <code class="varname">USE_CMAKE</code> to <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">.</span>”</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p> | | 7081 | <span class="quote">“<span class="quote">.</span>”</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">“<span class="quote">yes</span>”</span>.</p> | | 7083 | <code class="varname">NO_CONFIGURE</code> to <span class="quote">“<span class="quote">yes</span>”</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 | && cd ${d} \ | | 7093 | && cd ${d} \ |
7094 | && env ${MAKE_ENV} \ | | 7094 | && 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">“<span class="quote">.</span>”</span>) is a list of pathnames relative to | | 7101 | <span class="quote">“<span class="quote">.</span>”</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">“<span class="quote">gmake</span>”</span> if <code class="varname">USE_TOOLS</code> contains | | 7112 | <span class="quote">“<span class="quote">gmake</span>”</span> if <code class="varname">USE_TOOLS</code> contains |
7113 | <span class="quote">“<span class="quote">gmake</span>”</span>, <span class="quote">“<span class="quote">make</span>”</span> otherwise. The | | 7113 | <span class="quote">“<span class="quote">gmake</span>”</span>, <span class="quote">“<span class="quote">make</span>”</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">“<span class="quote">Makefile</span>”</span>, and <code class="varname">BUILD_TARGET</code> | | 7115 | <span class="quote">“<span class="quote">Makefile</span>”</span>, and <code class="varname">BUILD_TARGET</code> |
7116 | defaults to <span class="quote">“<span class="quote">all</span>”</span>.</p> | | 7116 | defaults to <span class="quote">“<span class="quote">all</span>”</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">“<span class="quote">yes</span>”</span>.</p> | | 7118 | <code class="varname">NO_BUILD</code> to <span class="quote">“<span class="quote">yes</span>”</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 | && cd ${d} \ | | 7138 | && cd ${d} \ |
7139 | && env ${MAKE_ENV} \ | | 7139 | && 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">“<span class="quote">install</span>”</span> by default, plus | | 7149 | is <span class="quote">“<span class="quote">install</span>”</span> by default, plus |
7150 | <span class="quote">“<span class="quote">install.man</span>”</span> if <code class="varname">USE_IMAKE</code> is | | 7150 | <span class="quote">“<span class="quote">install.man</span>”</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">“<span class="quote">yes</span>”</span>. This is | | 7206 | set <code class="varname">NO_INSTALL</code> to <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">pre-</span>”</span> and <span class="quote">“<span class="quote">post-</span>”</span> used as a | | 7240 | <span class="quote">“<span class="quote">pre-</span>”</span> and <span class="quote">“<span class="quote">post-</span>”</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">“<span class="quote">already installed</span>”</span> flag.</p> | | 7260 | ignore the <span class="quote">“<span class="quote">already installed</span>”</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">“<span class="quote">package</span>”</span> and <span class="quote">“<span class="quote">update</span>”</span>, | | 7265 | <span class="quote">“<span class="quote">package</span>”</span> and <span class="quote">“<span class="quote">update</span>”</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">“<span class="quote">-R</span>”</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">“<span class="quote">-R</span>”</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">“<span class="quote">update</span>”</span> target to | | 7310 | <p>You can use the <span class="quote">“<span class="quote">update</span>”</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">“<span class="quote">install</span>”</span> otherwise for | | 7334 | set, <span class="quote">“<span class="quote">install</span>”</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">“<span class="quote">package</span>”</span> or | | 7336 | targets are <span class="quote">“<span class="quote">package</span>”</span> or |
7337 | <span class="quote">“<span class="quote">bin-install</span>”</span>. Do not set this to | | 7337 | <span class="quote">“<span class="quote">bin-install</span>”</span>. Do not set this to |
7338 | <span class="quote">“<span class="quote">update</span>”</span> or you will get stuck in an | | 7338 | <span class="quote">“<span class="quote">update</span>”</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">“<span class="quote">clean-update</span>”</span> target below) | | 7345 | (see the <span class="quote">“<span class="quote">clean-update</span>”</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">“<span class="quote">clean-update</span>”</span> target (see below) was | | 7354 | <span class="quote">“<span class="quote">clean-update</span>”</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">“<span class="quote">update</span>”</span> for the update target, | | 7360 | <span class="quote">“<span class="quote">update</span>”</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">“<span class="quote">readme</span>”</span> target (see above), but is to be | | 7486 | <span class="quote">“<span class="quote">readme</span>”</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">“<span class="quote">show-host-specific-pkgs</span>”</span> target.</p></dd> | | 7516 | <span class="quote">“<span class="quote">show-host-specific-pkgs</span>”</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">“<span class="quote">make install</span>”</span> from a new or | | 7529 | <p>After a <span class="quote">“<span class="quote">make install</span>”</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">“<span class="quote">find | | 7542 | <code class="filename">PLIST</code>, as the <span class="quote">“<span class="quote">find |
7543 | -newer</span>”</span> command used by this target won't catch | | 7543 | -newer</span>”</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, “Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>”</a> for more | | 7545 | <p>See <a class="xref" href="#print-PLIST" title="13.3. Tweaking output of make print-PLIST">Section 13.3, “Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>”</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, “Configuration”</a>). | | 7554 | properly. See <a class="xref" href="#binary.configuration" title="7.3.1. Configuration">Section 7.3.1, “Configuration”</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">“<span class="quote">up-to-date</span>”</span> to be installed via | | 7569 | <span class="quote">“<span class="quote">up-to-date</span>”</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 |
7597 | by pkgsrc and also for individual packages to define what commands | | 7597 | by pkgsrc and also for individual packages to define what commands |
7598 | are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>) | | 7598 | are needed for building a package (like <code class="varname">BUILD_DEPENDS</code>) |
7599 | or for later run-time of an installed packaged (such as | | 7599 | or for later run-time of an installed packaged (such as |
7600 | <code class="varname">DEPENDS</code>). | | 7600 | <code class="varname">DEPENDS</code>). |
7601 | If the native system provides an adequate tool, then in many cases, a pkgsrc | | 7601 | If the native system provides an adequate tool, then in many cases, a pkgsrc |
7602 | package will not be used.</p> | | 7602 | package 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 |
7604 | made available in a directory (as symlinks or wrapper scripts) | | 7604 | made available in a directory (as symlinks or wrapper scripts) |
7605 | that is early in the executable search path. Just like the buildlink | | 7605 | that is early in the executable search path. Just like the buildlink |
7606 | system, this helps with consistent builds.</p> | | 7606 | system, 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, |
7608 | perl, GNU make (gmake) or yacc may be needed.</p> | | 7608 | perl, 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 |
7610 | tool may be inefficient for building a package with pkgsrc. | | 7610 | tool may be inefficient for building a package with pkgsrc. |
7611 | For example, a package may need GNU awk, bison (instead of | | 7611 | For example, a package may need GNU awk, bison (instead of |
7612 | yacc) or a better sed.</p> | | 7612 | yacc) 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, |
7620 | such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>, | | 7620 | such 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. |
7622 | These can be seen by running: | | 7622 | These 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 |
7625 | then the <code class="varname">USE_TOOLS</code> variable can be used | | 7625 | then the <code class="varname">USE_TOOLS</code> variable can be used |
7626 | to define the tools needed.</p> | | 7626 | to 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 |
7632 | run-time (and becomes a DEPENDS). | | 7632 | run-time (and becomes a DEPENDS). |
7633 | The default is a build dependency which can be set with | | 7633 | The 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 |
7635 | and pkg-config:build.)</p> | | 7635 | and pkg-config:build.)</p> |
7636 | <pre class="programlisting"> | | 7636 | <pre class="programlisting"> |
7637 | USE_TOOLS+= gmake perl:run pkg-config | | 7637 | USE_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 |
7641 | which contains the full path to the appropriate tool. For example, | | 7641 | which contains the full path to the appropriate tool. For example, |
7642 | <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span> | | 7642 | <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span> |
7643 | on Linux systems.</p> | | 7643 | on 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 |
7645 | tool at run-time, then just use <code class="varname">DEPENDS</code> instead. | | 7645 | tool 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 |
7652 | at (or create) the corresponding platform specific make file fragment under | | 7652 | at (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 |
7654 | the name of the common tools. For example:</p> | | 7654 | the 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) |
7657 | TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat | | 7657 | TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat |
7658 | .elif exists(/usr/bin/bzip2) | | 7658 | .elif exists(/usr/bin/bzip2) |
7659 | TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd | | 7659 | TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd |
7660 | .endif | | 7660 | .endif |
7661 | | | 7661 | |
7662 | TOOLS_PLATFORM.true?= true # shell builtin | | 7662 | TOOLS_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">“<span class="quote">...</span>”</span></a></span></dt> | | 7769 | <dt><span class="sect2"><a href="#undefined-reference">19.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</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"> |
7859 | INTERACTIVE_STAGE= build | | 7859 | INTERACTIVE_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"> |
7863 | INTERACTIVE_STAGE= configure install | | 7863 | INTERACTIVE_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"> |
7953 | LICENSE= xv-license | | 7953 | LICENSE= 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 | ===> xv-3.10anb9 has an unacceptable license: xv-license. | | 7960 | ===> xv-3.10anb9 has an unacceptable license: xv-license. |
7961 | ===> To view the license, enter "/usr/bin/make show-license". | | 7961 | ===> To view the license, enter "/usr/bin/make show-license". |
7962 | ===> To indicate acceptance, add this line to your /etc/mk.conf: | | 7962 | ===> To indicate acceptance, add this line to your /etc/mk.conf: |
7963 | ===> ACCEPTABLE_LICENSES+=xv-license | | 7963 | ===> 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"> |
7972 | ACCEPTABLE_LICENSES+=xv-license | | 7972 | ACCEPTABLE_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 | <pre-req-package-name>:../../<category>/<pre-req-package> | | 8096 | <pre-req-package-name>:../../<category>/<pre-req-package> |
8097 | </pre> | | 8097 | </pre> |
8098 | <p>Please note that the <span class="quote">“<span class="quote">pre-req-package-name</span>”</span> | | 8098 | <p>Please note that the <span class="quote">“<span class="quote">pre-req-package-name</span>”</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"> |
8126 | BUILD_DEPENDS+= scons-[0-9]*:../../devel/scons | | 8126 | BUILD_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"> |
8143 | DEPENDS+= teTeX-[0-9]*:../../print/teTeX | | 8143 | DEPENDS+= 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">“<span class="quote">-[0-9]*</span>”</span> should be used instead of | | 8152 | <p>The <span class="quote">“<span class="quote">-[0-9]*</span>”</span> should be used instead of |
8153 | <span class="quote">“<span class="quote">-*</span>”</span> to avoid potentially ambiguous matches | | 8153 | <span class="quote">“<span class="quote">-*</span>”</span> to avoid potentially ambiguous matches |
8154 | such as <span class="quote">“<span class="quote">tk-postgresql</span>”</span> matching a | | 8154 | such as <span class="quote">“<span class="quote">tk-postgresql</span>”</span> matching a |
8155 | <span class="quote">“<span class="quote">tk-*</span>”</span> <code class="varname">DEPENDS</code>.</p> | | 8155 | <span class="quote">“<span class="quote">tk-*</span>”</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"> |
8160 | DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick | | 8160 | DEPENDS+= ImageMagick>=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, “Handling packages with security problems”</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, “Handling packages with security problems”</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"> |
8195 | CONFLICTS= Xaw-Xpm-[0-9]* | | 8195 | CONFLICTS= 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"> |
8199 | CONFLICTS= Xaw3d-[0-9]* | | 8199 | CONFLICTS= 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">“<span class="quote">Xaw3d-1.5</span>”</span> e.g. will automatically | | 8203 | string. <span class="quote">“<span class="quote">Xaw3d-1.5</span>”</span> e.g. will automatically |
8204 | conflict with the older version <span class="quote">“<span class="quote">Xaw3d-1.3</span>”</span>.</p> | | 8204 | conflict with the older version <span class="quote">“<span class="quote">Xaw3d-1.3</span>”</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">“<span class="quote">yes</span>”</span>. This variable is not currently used by any of | | 8224 | <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">preserved</span>”</span> package will | | 8241 | <span class="quote">“<span class="quote">preserved</span>”</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">“<span class="quote">-f</span>”</span> option is used.</p> | | 8243 | <span class="quote">“<span class="quote">-f</span>”</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">“<span class="quote">nb1</span>”</span>, <span class="quote">“<span class="quote">nb2</span>”</span>, ... suffix can be used | | 8268 | <span class="quote">“<span class="quote">nb1</span>”</span>, <span class="quote">“<span class="quote">nb2</span>”</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">“<span class="quote">nb</span>”</span> is treated like a | | 8270 | (2, ...). The <span class="quote">“<span class="quote">nb</span>”</span> is treated like a |
8271 | <span class="quote">“<span class="quote">.</span>”</span> by the package tools. e.g.</p> | | 8271 | <span class="quote">“<span class="quote">.</span>”</span> by the package tools. e.g.</p> |
8272 | <pre class="programlisting"> | | 8272 | <pre class="programlisting"> |
8273 | DISTNAME= foo-17.42 | | 8273 | DISTNAME= foo-17.42 |
8274 | PKGREVISION= 9 | | 8274 | PKGREVISION= 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">“<span class="quote">foo-17.42nb9</span>”</span>. If you want to use the original | | 8277 | <span class="quote">“<span class="quote">foo-17.42nb9</span>”</span>. If you want to use the original |
8278 | value of <code class="varname">PKGNAME</code> without the <span class="quote">“<span class="quote">nbX</span>”</span> | | 8278 | value of <code class="varname">PKGNAME</code> without the <span class="quote">“<span class="quote">nbX</span>”</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"> |
8285 | DISTNAME= foo-17.43 | | 8285 | DISTNAME= 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"> |
8332 | SUBST_CLASSES+= fix-paths | | 8332 | SUBST_CLASSES+= fix-paths |
8333 | SUBST_STAGE.fix-paths= pre-configure | | 8333 | SUBST_STAGE.fix-paths= pre-configure |
8334 | SUBST_MESSAGE.fix-paths= Fixing absolute paths. | | 8334 | SUBST_MESSAGE.fix-paths= Fixing absolute paths. |
8335 | SUBST_FILES.fix-paths= src/*.c | | 8335 | SUBST_FILES.fix-paths= src/*.c |
8336 | SUBST_FILES.fix-paths+= scripts/*.sh | | 8336 | SUBST_FILES.fix-paths+= scripts/*.sh |
8337 | SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' | | 8337 | SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' |
8338 | SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' | | 8338 | SUBST_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"> |
8402 | FETCH_MESSAGE= "Please download the files" | | 8402 | FETCH_MESSAGE= "Please download the files" |
8403 | FETCH_MESSAGE+= " "${DISTFILES:Q} | | 8403 | FETCH_MESSAGE+= " "${DISTFILES:Q} |
8404 | FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." | | 8404 | FETCH_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, “How to handle incrementing versions when fixing an existing package”</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, “How to handle incrementing versions when fixing an existing package”</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">“<span class="quote">knows</span>”</span> how to build | | 8455 | can help here, as it just <span class="quote">“<span class="quote">knows</span>”</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">“<span class="quote">${LIBTOOL} --mode=compile | | 8463 | <li class="listitem"><p>For library objects, use <span class="quote">“<span class="quote">${LIBTOOL} --mode=compile |
8464 | ${CC}</span>”</span> in place of <span class="quote">“<span class="quote">${CC}</span>”</span>. You could even | | 8464 | ${CC}</span>”</span> in place of <span class="quote">“<span class="quote">${CC}</span>”</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">“<span class="quote">ar</span>”</span>, <span class="quote">“<span class="quote">ranlib</span>”</span>, and <span class="quote">“<span class="quote">ld | | 8471 | <span class="quote">“<span class="quote">ar</span>”</span>, <span class="quote">“<span class="quote">ranlib</span>”</span>, and <span class="quote">“<span class="quote">ld |
8472 | -Bshareable</span>”</span> commands, and instead use:</p> | | 8472 | -Bshareable</span>”</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">“<span class="quote">-version-info</span>”</span>, especially when major and | | 8488 | <span class="quote">“<span class="quote">-version-info</span>”</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"> |
8493 | So, libtool library versions are described by three integers: | | 8493 | So, libtool library versions are described by three integers: |
8494 | | | 8494 | |
8495 | CURRENT | | 8495 | CURRENT |
8496 | The most recent interface number that this library implements. | | 8496 | The most recent interface number that this library implements. |
8497 | | | 8497 | |
8498 | REVISION | | 8498 | REVISION |
8499 | The implementation number of the CURRENT interface. | | 8499 | The implementation number of the CURRENT interface. |
8500 | | | 8500 | |
8501 | AGE | | 8501 | AGE |
8502 | The difference between the newest and oldest interfaces that | | 8502 | The difference between the newest and oldest interfaces that |
8503 | this library implements. In other words, the library implements | | 8503 | this library implements. In other words, the library implements |
8504 | all the interface numbers in the range from number `CURRENT - | | 8504 | all the interface numbers in the range from number `CURRENT - |
8505 | AGE' to `CURRENT'. | | 8505 | AGE' to `CURRENT'. |
8506 | | | 8506 | |
8507 | If two libraries have identical CURRENT and AGE numbers, then the | | 8507 | If two libraries have identical CURRENT and AGE numbers, then the |
8508 | dynamic linker chooses the library with the greater REVISION number. | | 8508 | dynamic linker chooses the library with the greater REVISION number. |
8509 | </pre> | | 8509 | </pre> |
8510 | <p>The <span class="quote">“<span class="quote">-release</span>”</span> option will produce | | 8510 | <p>The <span class="quote">“<span class="quote">-release</span>”</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">“<span class="quote">libfoo-release.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>”</span> | | 8513 | <span class="quote">“<span class="quote">libfoo-release.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>”</span> |
8514 | will have a symlink of | | 8514 | will have a symlink of |
8515 | <span class="quote">“<span class="quote">libfoo.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>”</span> | | 8515 | <span class="quote">“<span class="quote">libfoo.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>”</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">“<span class="quote">-rpath argument</span>”</span> is the install | | 8518 | <p>The <span class="quote">“<span class="quote">-rpath argument</span>”</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">“<span class="quote">-module | | 8527 | shared libraries, use <span class="quote">“<span class="quote">-module |
8528 | -avoid-version</span>”</span> to prevent them getting version | | 8528 | -avoid-version</span>”</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">“<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">“<span class="quote">${LIBTOOL} |
8537 | --mode=link</span>”</span>, and it will find the correct | | 8537 | --mode=link</span>”</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">“<span class="quote">-L../somelib</span>”</span>), because it | | 8540 | -L (such as <span class="quote">“<span class="quote">-L../somelib</span>”</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">“<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">“<span class="quote">${LIBTOOL} |
8555 | --mode=install</span>”</span>, and change the library name to | | 8555 | --mode=install</span>”</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">“<span class="quote">libtool */libtool | | 8580 | default, it is set to <span class="quote">“<span class="quote">libtool */libtool |
8581 | */*/libtool</span>”</span>. If this does not match the location of the | | 8581 | */*/libtool</span>”</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"> |
8619 | AUTOCONF_REQD= 2.50 # if default version is not good enough | | 8619 | AUTOCONF_REQD= 2.50 # if default version is not good enough |
8620 | USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 | | 8620 | USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 |
8621 | ... | | 8621 | ... |
8622 | | | 8622 | |
8623 | pre-configure: | | 8623 | pre-configure: |
8624 | cd ${WRKSRC} && autoconf | | 8624 | cd ${WRKSRC} && 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"> |
8630 | AUTOMAKE_REQD= 1.7.1 # if default version is not good enough | | 8630 | AUTOMAKE_REQD= 1.7.1 # if default version is not good enough |
8631 | USE_TOOLS+= automake # use "automake14" for automake-1.4 | | 8631 | USE_TOOLS+= automake # use "automake14" for automake-1.4 |
8632 | ... | | 8632 | ... |
8633 | | | 8633 | |
8634 | pre-configure: | | 8634 | pre-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">“<span class="quote">c</span>”</span>, <span class="quote">“<span class="quote">c++</span>”</span>, and | | 8663 | currently are <span class="quote">“<span class="quote">c</span>”</span>, <span class="quote">“<span class="quote">c++</span>”</span>, and |
8664 | <span class="quote">“<span class="quote">fortran</span>”</span> (and any combination). The default is | | 8664 | <span class="quote">“<span class="quote">fortran</span>”</span> (and any combination). The default is |
8665 | <span class="quote">“<span class="quote">c</span>”</span>. Packages using GNU configure scripts, even if | | 8665 | <span class="quote">“<span class="quote">c</span>”</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">“<span class="quote">run</span>”</span>, then | | 8679 | <code class="varname">USE_JAVA</code> is set to <span class="quote">“<span class="quote">run</span>”</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">“<span class="quote">yes</span>”</span>, which also adds a build dependency on the | | 8681 | <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">1.4</span>”</span>, and | | 8685 | are <span class="quote">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">1.4</span>”</span>, and |
8686 | <span class="quote">“<span class="quote">1.5</span>”</span>. <span class="quote">“<span class="quote">yes</span>”</span> accepts any Java2 | | 8686 | <span class="quote">“<span class="quote">1.5</span>”</span>. <span class="quote">“<span class="quote">yes</span>”</span> accepts any Java2 |
8687 | implementation, <span class="quote">“<span class="quote">1.4</span>”</span> insists on versions 1.4 or | | 8687 | implementation, <span class="quote">“<span class="quote">1.4</span>”</span> insists on versions 1.4 or |
8688 | above, and <span class="quote">“<span class="quote">1.5</span>”</span> only accepts versions 1.5 or | | 8688 | above, and <span class="quote">“<span class="quote">1.5</span>”</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">“<span class="quote">perl</span>”</span> to the <code class="varname">USE_TOOLS</code> variable | | 8702 | <span class="quote">“<span class="quote">perl</span>”</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"> |
8781 | Cygwin __CYGWIN__ | | 8781 | Cygwin __CYGWIN__ |
8782 | DragonFly __DragonFly__ | | 8782 | DragonFly __DragonFly__ |
8783 | FreeBSD __FreeBSD__ | | 8783 | FreeBSD __FreeBSD__ |
8784 | Haiku __HAIKU__ | | 8784 | Haiku __HAIKU__ |
8785 | Interix __INTERIX | | 8785 | Interix __INTERIX |
8786 | IRIX __sgi (TODO: get a definite source for this) | | 8786 | IRIX __sgi (TODO: get a definite source for this) |
8787 | Linux linux, __linux, __linux__ | | 8787 | Linux linux, __linux, __linux__ |
8788 | MirBSD __MirBSD__ (__OpenBSD__ is also defined) | | 8788 | MirBSD __MirBSD__ (__OpenBSD__ is also defined) |
8789 | Minix3 __minix | | 8789 | Minix3 __minix |
8790 | NetBSD __NetBSD__ | | 8790 | NetBSD __NetBSD__ |
8791 | OpenBSD __OpenBSD__ | | 8791 | OpenBSD __OpenBSD__ |
8792 | Solaris sun, __sun | | 8792 | Solaris 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"> |
8799 | i386 i386, __i386, __i386__ | | 8799 | i386 i386, __i386, __i386__ |
8800 | MIPS __mips | | 8800 | MIPS __mips |
8801 | SPARC sparc, __sparc | | 8801 | SPARC 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"> |
8808 | GCC __GNUC__ (major version), __GNUC_MINOR__ | | 8808 | GCC __GNUC__ (major version), __GNUC_MINOR__ |
8809 | MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) | | 8809 | MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) |
8810 | SunPro __SUNPRO_C (0x570 for Sun C 5.7) | | 8810 | SunPro __SUNPRO_C (0x570 for Sun C 5.7) |
8811 | SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) | | 8811 | SunPro 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">“<span class="quote">...</span>”</span> | | 8832 | <a name="undefined-reference"></a>19.5.3. Undefined reference to <span class="quote">“<span class="quote">...</span>”</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 |
8897 | possibility. That compiler cannot handle the following code:</p> | | 8897 | possibility. That compiler cannot handle the following code:</p> |
8898 | <pre class="programlisting"> | | 8898 | <pre class="programlisting"> |
8899 | extern int extern_func(int); | | 8899 | extern int extern_func(int); |
8900 | | | 8900 | |
8901 | static inline int | | 8901 | static inline int |
8902 | inline_func(int x) | | 8902 | inline_func(int x) |
8903 | { | | 8903 | { |
8904 | return extern_func(x); | | 8904 | return extern_func(x); |
8905 | } | | 8905 | } |
8906 | | | 8906 | |
8907 | int main(void) | | 8907 | int 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 |
8913 | that function is never used. This code then refers to | | 8913 | that 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 |
8915 | solve this problem you can try to tell the package to disable inlining | | 8915 | solve this problem you can try to tell the package to disable inlining |
8916 | of functions.</p> | | 8916 | of 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">“<span class="quote">datasize</span>”</span> and <span class="quote">“<span class="quote">stacksize</span>”</span> (or both). | | 8926 | <span class="quote">“<span class="quote">datasize</span>”</span> and <span class="quote">“<span class="quote">stacksize</span>”</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">“<span class="quote"><code class="literal">dir1 | | 8947 | <p>You can also just append <span class="quote">“<span class="quote"><code class="literal">dir1 |
8948 | dir2</code></span>”</span> to the | | 8948 | dir2</code></span>”</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">“<span class="quote">--with-html-dir</span>”</span> option. Sometimes using this flag | | 8961 | <span class="quote">“<span class="quote">--with-html-dir</span>”</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">“<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>”</span>. | | 8977 | <span class="quote">“<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>”</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">“<span class="quote">destdir</span>”</span>) or the package can | | 9007 | install as root (<span class="quote">“<span class="quote">destdir</span>”</span>) or the package can |
9008 | install as non-root user (<span class="quote">“<span class="quote">user-destdir</span>”</span>).</p> | | 9008 | install as non-root user (<span class="quote">“<span class="quote">user-destdir</span>”</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">“<span class="quote">none</span>”</span>, <span class="quote">“<span class="quote">destdir</span>”</span>, or | | 9011 | set to <span class="quote">“<span class="quote">none</span>”</span>, <span class="quote">“<span class="quote">destdir</span>”</span>, or |
9012 | <span class="quote">“<span class="quote">user-destdir</span>”</span>. By default <code class="varname">PKG_DESTDIR_SUPPORT</code> | | 9012 | <span class="quote">“<span class="quote">user-destdir</span>”</span>. By default <code class="varname">PKG_DESTDIR_SUPPORT</code> |
9013 | is set to <span class="quote">“<span class="quote">user-destdir</span>”</span> to help catching more | | 9013 | is set to <span class="quote">“<span class="quote">user-destdir</span>”</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"> |
9038 | REPLACE_INTERPRETER+= tcl | | 9038 | REPLACE_INTERPRETER+= tcl |
9039 | REPLACE.tcl.old= .*/bin/tclsh | | 9039 | REPLACE.tcl.old= .*/bin/tclsh |
9040 | REPLACE.tcl.new= ${PREFIX}/bin/tclsh | | 9040 | REPLACE.tcl.new= ${PREFIX}/bin/tclsh |
9041 | REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, | | 9041 | REPLACE_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"> |
9072 | PERL5_PACKLIST= auto/Pg/.packlist | | 9072 | PERL5_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">“<span class="quote">makeinfo</span>”</span> or <span class="quote">“<span class="quote">install-info</span>”</span> | | 9095 | <span class="quote">“<span class="quote">makeinfo</span>”</span> or <span class="quote">“<span class="quote">install-info</span>”</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">“<span class="quote">install-info</span>”</span> command used for the info | | 9100 | file. The <span class="quote">“<span class="quote">install-info</span>”</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">“<span class="quote">info</span>”</span> and can be overridden by the user.</p> | | 9107 | <span class="quote">“<span class="quote">info</span>”</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">“<span class="quote">makeinfo</span>”</span> command | | 9111 | <p>A package which needs the <span class="quote">“<span class="quote">makeinfo</span>”</span> command |
9112 | at build time must add <span class="quote">“<span class="quote">makeinfo</span>”</span> to | | 9112 | at build time must add <span class="quote">“<span class="quote">makeinfo</span>”</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">“<span class="quote">makeinfo</span>”</span> command is needed it | | 9114 | version of the <span class="quote">“<span class="quote">makeinfo</span>”</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">“<span class="quote"><code class="filename">man</code></span>”</span>. Another often-used value | | 9147 | <span class="quote">“<span class="quote"><code class="filename">man</code></span>”</span>. Another often-used value |
9148 | is <span class="quote">“<span class="quote"><code class="filename">share/man</code></span>”</span>.</p> | | 9148 | is <span class="quote">“<span class="quote"><code class="filename">share/man</code></span>”</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">“<span class="quote">yes</span>”</span>, by default will use the | | 9161 | <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">no</span>”</span>. | | 9168 | to <span class="quote">“<span class="quote">no</span>”</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, “Man page compression”</a> for | | 9172 | <p>See <a class="xref" href="#manpage-compression" title="13.5. Man page compression">Section 13.5, “Man page compression”</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, “How do I change the location of configuration files?”</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, “How do I change the location of configuration files?”</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">“<span class="quote">ttf</span>”</span>, <span class="quote">“<span class="quote">type1</span>”</span> or <span class="quote">“<span class="quote">x11</span>”</span>. | | 9240 | <span class="quote">“<span class="quote">ttf</span>”</span>, <span class="quote">“<span class="quote">type1</span>”</span> or <span class="quote">“<span class="quote">x11</span>”</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, “<code class="filename">Makefile</code>”</a>.</p></li> | | 9506 | necessary; see <a class="xref" href="#components.Makefile" title="11.1. Makefile">Section 11.1, “<code class="filename">Makefile</code>”</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 >PLIST</code></strong> | | 9510 | <code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST >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, “Uploading results of a bulk build”</a>.</p> | | 9572 | see <a class="xref" href="#bulk-upload" title="7.3.8. Uploading results of a bulk build">Section 7.3.8, “Uploading results of a bulk build”</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">“<span class="quote">pkg</span>”</span>, the synopsis should include the package name | | 9591 | <span class="quote">“<span class="quote">pkg</span>”</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">“<span class="quote">fix</span>”</span> field.</p> | | 9595 | go into the <span class="quote">“<span class="quote">fix</span>”</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">“<span class="quote">pkgsrc work-in-progress</span>”</span>); see the | | 9600 | pkgsrc-wip (<span class="quote">“<span class="quote">pkgsrc work-in-progress</span>”</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">“<span class="quote">cvs add</span>”</span> the files. | | 9648 | <p>When the package is finished, <span class="quote">“<span class="quote">cvs add</span>”</span> the files. |
9649 | Start by adding the directory and then files in the directory. Don't | | 9649 | Start by adding the directory and then files in the directory. Don't |
9650 | forget to add the new package to the category's | | 9650 | forget 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; |
9652 | you can check by running <span class="quote">“<span class="quote">cvs status</span>”</span>. An example:</p> | | 9652 | you can check by running <span class="quote">“<span class="quote">cvs status</span>”</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">“<span class="quote">cvs import</span>”</span> was suggested, but it was | | 9670 | <p>Previously, <span class="quote">“<span class="quote">cvs import</span>”</span> was suggested, but it was |
9671 | much easier to get wrong than <span class="quote">“<span class="quote">cvs add</span>”</span>.</p> | | 9671 | much easier to get wrong than <span class="quote">“<span class="quote">cvs add</span>”</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">“<span class="quote">successor</span>”</span> in the | | 9709 | <p>Note that <span class="quote">“<span class="quote">successor</span>”</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">“<span class="quote">../package</span>”</span> | | 9730 | <code class="varname">DEPENDS</code> paths that just did <span class="quote">“<span class="quote">../package</span>”</span> |
9731 | instead of <span class="quote">“<span class="quote">../../category/package</span>”</span>.</p></li> | | 9731 | instead of <span class="quote">“<span class="quote">../../category/package</span>”</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 |
9734 | pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools | | 9734 | pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools |
9735 | for doing an update using pkgsrc building; for example, it can | | 9735 | for doing an update using pkgsrc building; for example, it can |
9736 | search 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> | | 9736 | search 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 |
9738 | new <code class="varname">PKGPATH</code> for that moved package. Note that | | 9738 | new <code class="varname">PKGPATH</code> for that moved package. Note that |
9739 | it may have multiple matches, so the tool should also check on the | | 9739 | it 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> |
9741 | probably has no value unless <code class="varname">SUPERSEDES</code> is not | | 9741 | probably has no value unless <code class="varname">SUPERSEDES</code> is not |
9742 | set, i.e. <code class="varname">PKGBASE</code> stays the same. </p></li> | | 9742 | set, 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 |
9744 | place.</p></li> | | 9744 | place.</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 |
9806 | do?</a> | | 9806 | do?</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">“<span class="quote">wrapper</span>”</span> phase and later. To | | 9891 | available in the <span class="quote">“<span class="quote">wrapper</span>”</span> phase and later. To |
9892 | <span class="quote">“<span class="quote">simulate</span>”</span> the wrapper phase, append | | 9892 | <span class="quote">“<span class="quote">simulate</span>”</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">“<span class="quote">implicitly | | 9981 | <li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">“<span class="quote">implicitly |
9982 | documented</span>”</span>, that is the documentation exists only in the | | 9982 | documented</span>”</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 |
9998 | do?</p></td> | | 9998 | do?</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 |
10004 | anyway.</p> | | 10004 | anyway.</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 | — it contains a list of suggested new packages and a list of | | 10011 | — 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 |
10037 | site</a>:</p> | | 10037 | site</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 |
10043 | a complete GNOME environment <span class="emphasis"><em>under many different | | 10043 | a complete GNOME environment <span class="emphasis"><em>under many different |
10044 | platforms</em></span>. We can say with confidence that pkgsrc is one of | | 10044 | platforms</em></span>. We can say with confidence that pkgsrc is one of |
10045 | the most advanced build and packaging systems for GNOME due to its | | 10045 | the most advanced build and packaging systems for GNOME due to its |
10046 | included technologies buildlink3, the wrappers and tools framework and | | 10046 | included technologies buildlink3, the wrappers and tools framework and |
10047 | automatic configuration file management. Lots of efforts are put into | | 10047 | automatic configuration file management. Lots of efforts are put into |
10048 | achieving a completely clean deinstallation of installed software | | 10048 | achieving a completely clean deinstallation of installed software |
10049 | components.</p> | | 10049 | components.</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, |
10051 | the above also means that great efforts are put into making GNOME work | | 10051 | the above also means that great efforts are put into making GNOME work |
10052 | under this operating system. Recently, <a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted | | 10052 | under this operating system. Recently, <a class="ulink" href="http://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted |
10053 | pkgsrc as its preferred packaging system, contributing lots of | | 10053 | pkgsrc as its preferred packaging system, contributing lots of |
10054 | portability fixes to make GNOME build and install under it.</p> | | 10054 | portability 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 |
10056 | interested in helping our GNOME porting and packaging efforts. It | | 10056 | interested in helping our GNOME porting and packaging efforts. It |
10057 | provides instructions on how to manage the existing packages and some | | 10057 | provides instructions on how to manage the existing packages and some |
10058 | important information regarding their internals.</p> | | 10058 | important 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 |
10097 | sorted in a way that eases updates: a package may depend on other | | 10097 | sorted in a way that eases updates: a package may depend on other |
10098 | packages listed before it but not on any listed after it. It is very | | 10098 | packages listed before it but not on any listed after it. It is very |
10099 | important to keep this order to ease updates so... <span class="emphasis"><em>do not | | 10099 | important to keep this order to ease updates so... <span class="emphasis"><em>do not |
10100 | change it to alphabetical sorting!</em></span></p> | | 10100 | change 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 |
10106 | set of tools as their build system. Things get different with the new | | 10106 | set of tools as their build system. Things get different with the new |
10107 | bindings to other languages (such as Python), but the following will | | 10107 | bindings to other languages (such as Python), but the following will |
10108 | give you a general idea on the minimum required tools:</p> | | 10108 | give 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"> |
10115 | GNU_CONFIGURE=yes | | 10115 | GNU_CONFIGURE=yes |
10116 | USE_LIBTOOL=yes | | 10116 | USE_LIBTOOL=yes |
10117 | USE_TOOLS+=gmake | | 10117 | USE_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/<package-name></code>) is correct | | 10142 | (<code class="filename">share/gtk-doc/<package-name></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 |
10151 | files under the installation prefix to maintain databases. In this | | 10151 | files under the installation prefix to maintain databases. In this |
10152 | context, shared means that those exact same directories and files are | | 10152 | context, shared means that those exact same directories and files are |
10153 | used among several different packages, leading to conflicts in the | | 10153 | used 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 |
10155 | handle the most common cases, so you have to forget about using | | 10155 | handle 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 |
10157 | omitting shared files from them. If you find yourself doing those, | | 10157 | omitting 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 |
10160 | using shared directories or files. For each of them, the appropriate | | 10160 | using shared directories or files. For each of them, the appropriate |
10161 | solution is given. After applying the solution be sure to | | 10161 | solution 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, “Packages installing scrollkeeper/rarian data files”</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, “Packages installing scrollkeeper/rarian data files”</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, “Packages installing hicolor theme icons”</a>.</td> | | 10184 | <td>See <a class="xref" href="#hicolor-theme" title="19.6.19. Packages installing hicolor theme icons">Section 19.6.19, “Packages installing hicolor theme icons”</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, “Packages installing extensions to the MIME database”</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, “Packages installing extensions to the MIME database”</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, “Packages installing desktop files”</a>.</td> | | 10195 | <td>See <a class="xref" href="#desktop-files" title="19.6.20. Packages installing desktop files">Section 19.6.20, “Packages installing desktop files”</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 |
10206 | updates:</p> | | 10206 | updates:</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 |
10236 | release (either major or minor), the following steps should be | | 10236 | release (either major or minor), the following steps should be |
10237 | followed:</p> | | 10237 | followed:</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 }' >list.txt</code></strong> | | 10246 | awk '{ print $9 }' >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 }' >>list.txt</code></strong></pre> | | 10249 | awk '{ print $9 }' >>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' >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' >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-<YEAR></code> and | | 10287 | changes to the <code class="filename">doc/CHANGES-<YEAR></code> and |
10288 | <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/doc/TODO?rev=HEAD&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&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 |
10295 | packages. Please, it is very important that you always, always, | | 10295 | packages. 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 |
10297 | fixes 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, “Feedback to the author”</a>). This is the only way to get | | 10297 | fixes 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, “Feedback to the author”</a>). This is the only way to get |
10298 | their attention on portability issues and to ensure that future versions | | 10298 | their attention on portability issues and to ensure that future versions |
10299 | can be built out-of-the box on NetBSD. The less custom patches in | | 10299 | can be built out-of-the box on NetBSD. The less custom patches in |
10300 | pkgsrc, the easier further updates are. Those developers in charge of | | 10300 | pkgsrc, the easier further updates are. Those developers in charge of |
10301 | issuing major GNOME updates will be grateful if you do that.</p> | | 10301 | issuing 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 |
10303 | Bugzilla</a>. Not all components use these to track bugs, but most | | 10303 | Bugzilla</a>. Not all components use these to track bugs, but most |
10304 | of them do. Do not be short on your reports: always provide detailed | | 10304 | of them do. Do not be short on your reports: always provide detailed |
10305 | explanations of the current failure, how it can be improved to achieve | | 10305 | explanations of the current failure, how it can be improved to achieve |
10306 | maximum portability and, if at all possible, provide a patch against CVS | | 10306 | maximum portability and, if at all possible, provide a patch against CVS |
10307 | head. The more verbose you are, the higher chances of your patch being | | 10307 | head. The more verbose you are, the higher chances of your patch being |
10308 | accepted.</p> | | 10308 | accepted.</p> |
10309 | <p>Also, please avoid using preprocessor magic to fix portability | | 10309 | <p>Also, please avoid using preprocessor magic to fix portability |
10310 | issues. While the FreeBSD GNOME people are doing a great job in porting | | 10310 | issues. While the FreeBSD GNOME people are doing a great job in porting |
10311 | GNOME to their operating system, the official GNOME sources are now | | 10311 | GNOME to their operating system, the official GNOME sources are now |
10312 | plagued by conditionals that check for <code class="varname">__FreeBSD__</code> | | 10312 | plagued by conditionals that check for <code class="varname">__FreeBSD__</code> |
10313 | and similar macros. This hurts portability. Please see our patching | | 10313 | and similar macros. This hurts portability. Please see our patching |
10314 | guidelines (<a class="xref" href="#components.patches.guidelines" title="11.3.4. Patching guidelines">Section 11.3.4, “Patching guidelines”</a>) for more | | 10314 | guidelines (<a class="xref" href="#components.patches.guidelines" title="11.3.4. Patching guidelines">Section 11.3.4, “Patching guidelines”</a>) for more |
10315 | details.</p> | | 10315 | details.</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">“<span class="quote">yes</span>”</span>. All these variables may be | | 10413 | effectively mean <span class="quote">“<span class="quote">yes</span>”</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">“<span class="quote">know</span>”</span> | | 10442 | <code class="varname">DISTFILES</code>, the packages <span class="quote">“<span class="quote">know</span>”</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"> |
10446 | DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz | | 10446 | DISTFILES= ${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">“<span class="quote"><code class="literal">c</code></span>”</span>) is so short that it | | 10451 | value (<span class="quote">“<span class="quote"><code class="literal">c</code></span>”</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"> |
10481 | CONFIGURE_ARGS= # none | | 10481 | CONFIGURE_ARGS= # none |
10482 | CFLAGS= -O | | 10482 | CFLAGS= -O |
10483 | CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q} | | 10483 | CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q} |
10484 | | | 10484 | |
10485 | CONFIGURE_ARGS:= ${CONFIGURE_ARGS} | | 10485 | CONFIGURE_ARGS:= ${CONFIGURE_ARGS} |
10486 | | | 10486 | |
10487 | CFLAGS+= -Wall | | 10487 | CFLAGS+= -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—after | | 10529 | procedures. They take some input parameters and—after |
10530 | inclusion—provide a result in output parameters. Since all | | 10530 | inclusion—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">“<span class="quote">set -e</span>”</span> mode, so you should be careful | | 10692 | called in <span class="quote">“<span class="quote">set -e</span>”</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 | |
10840 | DISTNAME= bison-1.25 | | 10840 | DISTNAME= bison-1.25 |
10841 | CATEGORIES= devel | | 10841 | CATEGORIES= devel |
10842 | MASTER_SITES= ${MASTER_SITE_GNU} | | 10842 | MASTER_SITES= ${MASTER_SITE_GNU} |
10843 | | | 10843 | |
10844 | MAINTAINER= pkgsrc-users@NetBSD.org | | 10844 | MAINTAINER= pkgsrc-users@NetBSD.org |
10845 | HOMEPAGE= http://www.gnu.org/software/bison/bison.html | | 10845 | HOMEPAGE= http://www.gnu.org/software/bison/bison.html |
10846 | COMMENT= GNU yacc clone | | 10846 | COMMENT= GNU yacc clone |
10847 | | | 10847 | |
10848 | GNU_CONFIGURE= yes | | 10848 | GNU_CONFIGURE= yes |
10849 | INFO_FILES= yes | | 10849 | INFO_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"> |
10858 | GNU version of yacc. Can make re-entrant parsers, and numerous other | | 10858 | GNU version of yacc. Can make re-entrant parsers, and numerous other |
10859 | improvements. 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 | | 10859 | improvements. 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 |
10860 | of the NetBSD source tree is beyond me. | | 10860 | of 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$ |
10868 | bin/bison | | 10868 | bin/bison |
10869 | man/man1/bison.1.gz | | 10869 | man/man1/bison.1.gz |
10870 | share/bison.simple | | 10870 | share/bison.simple |
10871 | share/bison.hairy | | 10871 | share/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> |
10885 | looks fine.</pre> | | 10885 | looks 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 | >> bison-1.25.tar.gz doesn't seem to exist on this system. | | 10904 | >> bison-1.25.tar.gz doesn't seem to exist on this system. |
10905 | >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//. | | 10905 | >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//. |
10906 | Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) | | 10906 | Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) |
10907 | ftp: Error retrieving file: 500 Internal error | | 10907 | ftp: Error retrieving file: 500 Internal error |
10908 | | | 10908 | |
10909 | >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//. | | 10909 | >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//. |
10910 | Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) | | 10910 | Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) |
10911 | ftp: Error retrieving file: 500 Internal error | | 10911 | ftp: Error retrieving file: 500 Internal error |
10912 | | | 10912 | |
10913 | >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//. | | 10913 | >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//. |
10914 | Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) | | 10914 | Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/) |
10915 | Successfully retrieved file.</pre> | | 10915 | Successfully 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 | >> Checksum OK for bison-1.25.tar.gz. | | 10921 | >> Checksum OK for bison-1.25.tar.gz. |
10922 | ===> Extracting for bison-1.25 | | 10922 | ===> Extracting for bison-1.25 |
10923 | ===> Patching for bison-1.25 | | 10923 | ===> Patching for bison-1.25 |
10924 | ===> Ignoring empty patch directory | | 10924 | ===> Ignoring empty patch directory |
10925 | ===> Configuring for bison-1.25 | | 10925 | ===> Configuring for bison-1.25 |
10926 | creating cache ./config.cache | | 10926 | creating cache ./config.cache |
10927 | checking for gcc... cc | | 10927 | checking for gcc... cc |
10928 | checking whether we are using GNU C... yes | | 10928 | checking whether we are using GNU C... yes |
10929 | checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin | | 10929 | checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin |
10930 | checking how to run the C preprocessor... cc -E | | 10930 | checking how to run the C preprocessor... cc -E |
10931 | checking for minix/config.h... no | | 10931 | checking for minix/config.h... no |
10932 | checking for POSIXized ISC... no | | 10932 | checking for POSIXized ISC... no |
10933 | checking whether cross-compiling... no | | 10933 | checking whether cross-compiling... no |
10934 | checking for ANSI C header files... yes | | 10934 | checking for ANSI C header files... yes |
10935 | checking for string.h... yes | | 10935 | checking for string.h... yes |
10936 | checking for stdlib.h... yes | | 10936 | checking for stdlib.h... yes |
10937 | checking for memory.h... yes | | 10937 | checking for memory.h... yes |
10938 | checking for working const... yes | | 10938 | checking for working const... yes |
10939 | checking for working alloca.h... no | | 10939 | checking for working alloca.h... no |
10940 | checking for alloca... yes | | 10940 | checking for alloca... yes |
10941 | checking for strerror... yes | | 10941 | checking for strerror... yes |
10942 | updating cache ./config.cache | | 10942 | updating cache ./config.cache |
10943 | creating ./config.status | | 10943 | creating ./config.status |
10944 | creating Makefile | | 10944 | creating Makefile |
10945 | ===> Building for bison-1.25 | | 10945 | ===> Building for bison-1.25 |
10946 | cc -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 | | 10946 | cc -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 |
10947 | cc -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 | | 10947 | cc -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 |
10948 | cc -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 | | 10948 | cc -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 |
10949 | cc -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 | | 10949 | cc -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 |
10950 | cc -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 | | 10950 | cc -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 |
10951 | cc -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 | | 10951 | cc -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 |
10952 | cc -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 | | 10952 | cc -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 |
10953 | cc -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 | | 10953 | cc -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 |
10954 | cc -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 | | 10954 | cc -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 |
10955 | cc -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 | | 10955 | cc -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 |
10956 | cc -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 | | 10956 | cc -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 |
10957 | cc -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 | | 10957 | cc -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 |
10958 | cc -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 | | 10958 | cc -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 |
10959 | cc -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 | | 10959 | cc -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 |
10960 | cc -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 | | 10960 | cc -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 |
10961 | cc -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 | | 10961 | cc -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 |
10962 | cc -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 | | 10962 | cc -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 |
10963 | cc -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 | | 10963 | cc -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 |
10964 | cc -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 | | 10964 | cc -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 |
10965 | cc -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 | | 10965 | cc -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 |
10966 | cc -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 | | 10966 | cc -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 |
10967 | cc -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 | | 10967 | cc -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() |
10969 | rm -f bison.s1 | | 10969 | rm -f bison.s1 |
10970 | sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1</pre> | | 10970 | sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > 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 | >> Checksum OK for bison-1.25.tar.gz. | | 10973 | >> Checksum OK for bison-1.25.tar.gz. |
10974 | ===> Installing for bison-1.25 | | 10974 | ===> Installing for bison-1.25 |
10975 | sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1 | | 10975 | sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1 |
10976 | rm -f /usr/pkg/bin/bison | | 10976 | rm -f /usr/pkg/bin/bison |
10977 | cd /usr/pkg/share; rm -f bison.simple bison.hairy | | 10977 | cd /usr/pkg/share; rm -f bison.simple bison.hairy |
10978 | rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info* | | 10978 | rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info* |
10979 | install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison | | 10979 | install -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 |
10982 | cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done | | 10982 | cd .; 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 | ===> Registering installation for bison-1.25</pre> | | 10984 | ===> 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 | >> Checksum OK for bison-1.25.tar.gz. | | 10989 | >> Checksum OK for bison-1.25.tar.gz. |
10990 | ===> Building package for bison-1.25 | | 10990 | ===> Building package for bison-1.25 |
10991 | Creating package bison-1.25.tgz | | 10991 | Creating package bison-1.25.tgz |
10992 | Registering depends:. | | 10992 | Registering depends:. |
10993 | Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre> | | 10993 | Creating 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 |