Annotation of htdocs/docs/pkgsrc/pkgsrc.html, revision 1.181

1.1       dsieger     1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                      5: <title>The pkgsrc guide</title>
1.25      spz         6: <link rel="stylesheet" type="text/css" href="/global.css">
1.1       dsieger     7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
                      8: <meta name="description" content="pkgsrc is a centralized package management system for Unix-like operating systems. This guide provides information for users and developers of pkgsrc. It covers installation of binary and source packages, creation of binary and source packages and a high-level overview about the infrastructure.">
                      9: </head>
1.41      asau       10: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book">
1.1       dsieger    11: <div class="titlepage">
                     12: <div>
                     13: <div><h1 class="title">
                     14: <a name="the-pkgsrc-guide"></a>The pkgsrc guide</h1></div>
                     15: <div><h2 class="subtitle">Documentation on the NetBSD packages system</h2></div>
                     16: <div><div class="authorgroup">
                     17: <div class="author">
                     18: <h3 class="author">
                     19: <span class="firstname">Alistair</span> <span class="surname">Crooks</span>
                     20: </h3>
1.10      hubertf    21: <div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p></div></div>
1.1       dsieger    22: </div>
                     23: <div class="author">
                     24: <h3 class="author">
                     25: <span class="firstname">Hubert</span> <span class="surname">Feyrer</span>
                     26: </h3>
1.10      hubertf    27: <div class="affiliation"><div class="address"><p><code class="email">&lt;<a class="email" href="mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p></div></div>
1.1       dsieger    28: </div>
                     29: <h3 class="corpauthor">
                     30:         The pkgsrc Developers
                     31:       </h3>
                     32: </div></div>
1.166     leot       33: <div><p class="copyright">Copyright © 1994-2020 The NetBSD Foundation, Inc</p></div>
                     34: <div><p class="pubdate">$NetBSD: pkgsrc.xml,v 1.36 2020/01/03 15:55:24 leot Exp $</p></div>
1.41      asau       35: <div><div class="abstract">
1.1       dsieger    36: <p class="title"><b>Abstract</b></p>
                     37: <p>pkgsrc is a centralized package management system for
                     38:        Unix-like operating systems. This guide provides information for
                     39:        users and developers of pkgsrc. It covers installation of binary
                     40:        and source packages, creation of binary and source packages and
                     41:        a high-level overview about the infrastructure.</p>
                     42: </div></div>
                     43: </div>
                     44: <hr>
                     45: </div>
                     46: <div class="toc">
                     47: <p><b>Table of Contents</b></p>
1.100     leot       48: <dl class="toc">
1.1       dsieger    49: <dt><span class="chapter"><a href="#introduction">1. What is pkgsrc?</a></span></dt>
                     50: <dd><dl>
                     51: <dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
                     52: <dd><dl>
                     53: <dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt>
                     54: <dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
                     55: </dl></dd>
                     56: <dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt>
                     57: <dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
                     58: <dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd>
                     59: <dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
                     60: </dl></dd>
                     61: <dt><span class="part"><a href="#users-guide">I. The pkgsrc user's guide</a></span></dt>
                     62: <dd><dl>
1.154     rillig     63: <dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt>
                     64: <dt><span class="chapter"><a href="#getting">3. Where to get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       dsieger    65: <dd><dl>
1.154     rillig     66: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.1       dsieger    67: <dd><dl>
1.154     rillig     68: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
                     69: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.1       dsieger    70: </dl></dd>
1.154     rillig     71: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.1       dsieger    72: <dd><dl>
1.154     rillig     73: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
                     74: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.1       dsieger    75: </dl></dd>
                     76: </dl></dd>
1.154     rillig     77: <dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
1.1       dsieger    78: <dd><dl>
1.154     rillig     79: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
                     80: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.1       dsieger    81: </dl></dd>
1.154     rillig     82: <dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
1.1       dsieger    83: <dd><dl>
1.154     rillig     84: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.1       dsieger    85: <dd><dl>
1.154     rillig     86: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
                     87: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
                     88: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
                     89: <dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
                     90: <dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
                     91: <dt><span class="sect2"><a href="#pkg_versions">5.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
                     92: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
1.1       dsieger    93: </dl></dd>
1.154     rillig     94: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.1       dsieger    95: <dd><dl>
1.154     rillig     96: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
                     97: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
                     98: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.1       dsieger    99: </dl></dd>
                    100: </dl></dd>
1.154     rillig    101: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.1       dsieger   102: <dd><dl>
1.154     rillig    103: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
                    104: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
                    105: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
                    106: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1.1       dsieger   107: <dd><dl>
1.154     rillig    108: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
                    109: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
                    110: <dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.1       dsieger   111: </dl></dd>
1.154     rillig    112: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
                    113: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.1       dsieger   114: </dl></dd>
1.154     rillig    115: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.1       dsieger   116: <dd><dl>
1.154     rillig    117: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
                    118: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.6       rillig    119: </dl></dd>
1.154     rillig    120: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.6       rillig    121: builds)</a></span></dt>
1.1       dsieger   122: <dd><dl>
1.154     rillig    123: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.180     rillig    124: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.154     rillig    125: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
                    126: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.178     rillig    127: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
                    128: <dd><dl>
1.179     rillig    129: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
                    130: <dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
1.181   ! rillig    131: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
        !           132: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
        !           133: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
        !           134: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
        !           135: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
        !           136: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
        !           137: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
        !           138: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.178     rillig    139: </dl></dd>
                    140: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
                    141: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.154     rillig    142: </dl></dd>
                    143: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
                    144: <dd><dl>
                    145: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
                    146: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
                    147: </dl></dd>
                    148: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
                    149: <dd><dl>
                    150: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
                    151: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
                    152: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
                    153: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
                    154: <dt><span class="sect1"><a href="#x.org-from-pkgsrc">10.5. How can I install/use modular X.org from pkgsrc?</a></span></dt>
                    155: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
                    156: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
                    157: <dt><span class="sect1"><a href="#passive-ftp">10.8. How do I tell <span class="command"><strong>make fetch</strong></span> to do passive FTP?</a></span></dt>
                    158: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
                    159: <dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
1.23      wiz       160: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
1.154     rillig    161: <dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt>
                    162: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
                    163: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
                    164: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
                    165: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
                    166: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build.  What shall I do?</a></span></dt>
                    167: <dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt>
1.1       dsieger   168: </dl></dd>
                    169: </dl></dd>
                    170: <dt><span class="part"><a href="#developers-guide">II. The pkgsrc developer's guide</a></span></dt>
                    171: <dd><dl>
1.154     rillig    172: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
                    173: <dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt>
1.1       dsieger   174: <dd><dl>
1.154     rillig    175: <dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
1.1       dsieger   176: <dd><dl>
1.154     rillig    177: <dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
                    178: <dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.160     brook     179: <dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt>
                    180: <dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
1.1       dsieger   181: </dl></dd>
1.154     rillig    182: <dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
                    183: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.6       rillig    184: </dl></dd>
1.154     rillig    185: <dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt>
1.6       rillig    186: <dd><dl>
1.154     rillig    187: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
                    188: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
                    189: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
1.6       rillig    190: <dd><dl>
1.154     rillig    191: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
                    192: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
                    193: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
                    194: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
                    195: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
1.6       rillig    196: </dl></dd>
1.154     rillig    197: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
                    198: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
1.6       rillig    199: <dd><dl>
1.154     rillig    200: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
                    201: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
                    202: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.6       rillig    203: </dl></dd>
1.154     rillig    204: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
                    205: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.6       rillig    206: </dl></dd>
1.154     rillig    207: <dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.6       rillig    208: <dd><dl>
1.154     rillig    209: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
                    210: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
                    211: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
                    212: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
1.6       rillig    213: <dd><dl>
1.154     rillig    214: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
                    215: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
                    216: <dt><span class="sect2"><a href="#cflags-gnu-configure">14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
                    217: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.6       rillig    218: </dl></dd>
                    219: </dl></dd>
1.154     rillig    220: <dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt>
1.6       rillig    221: <dd><dl>
1.154     rillig    222: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
                    223: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
                    224: <dt><span class="sect1"><a href="#print-PLIST">15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
                    225: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
                    226: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
                    227: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
                    228: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
                    229: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
                    230: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.6       rillig    231: </dl></dd>
1.154     rillig    232: <dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt>
1.6       rillig    233: <dd><dl>
1.154     rillig    234: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
                    235: <dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.6       rillig    236: <dd><dl>
1.154     rillig    237: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
                    238: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.26      wiz       239:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                    240:       and
                    241:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                    242:       in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.6       rillig    243: </dl></dd>
1.154     rillig    244: <dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.6       rillig    245: <dd><dl>
1.154     rillig    246: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
                    247: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
1.6       rillig    248: </dl></dd>
                    249: </dl></dd>
1.154     rillig    250: <dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt>
1.6       rillig    251: <dd><dl>
1.154     rillig    252: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
                    253: <dd><dl>
                    254: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
                    255: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
                    256: </dl></dd>
                    257: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
                    258: <dd><dl>
                    259: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
                    260: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
                    261: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
                    262: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
                    263: </dl></dd>
                    264: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
                    265: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">17.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
                    266: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
                    267: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
                    268: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
                    269: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
                    270: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">17.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
                    271: </dl></dd>
                    272: <dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt>
                    273: <dd><dl>
                    274: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
                    275: <dt><span class="sect1"><a href="#converting-to-options">18.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
                    276: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
                    277: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
                    278: </dl></dd>
                    279: <dt><span class="chapter"><a href="#build">19. The build process</a></span></dt>
                    280: <dd><dl>
                    281: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
                    282: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
                    283: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
                    284: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
                    285: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                    286: <dd><dl>
                    287: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
                    288: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
                    289: </dl></dd>
                    290: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
                    291: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
                    292: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
                    293: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
                    294: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
                    295: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                    296: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                    297: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
                    298: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                    299: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
                    300: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
                    301: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
                    302: </dl></dd>
                    303: <dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt>
                    304: <dd><dl>
                    305: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
                    306: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
                    307: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
                    308: </dl></dd>
                    309: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
                    310: <dd><dl>
                    311: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
                    312: <dd><dl>
                    313: <dt><span class="sect2"><a href="#pulling-vars-from-etc-mk.conf">21.1.1. How to pull in user-settable variables from <code class="filename">mk.conf</code></a></span></dt>
                    314: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
                    315: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
                    316: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
                    317: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
                    318: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
                    319: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
                    320: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
                    321: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
                    322: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
                    323: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
                    324: </dl></dd>
                    325: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                    326: <dd><dl>
                    327: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
                    328: <dt><span class="sect2"><a href="#modified-distfiles-same-name">21.2.2. How to handle modified distfiles with the 'old' name</a></span></dt>
                    329: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
                    330: </dl></dd>
                    331: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                    332: <dd><dl>
                    333: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
                    334: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
                    335: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
                    336: </dl></dd>
                    337: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
                    338: <dd><dl>
                    339: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
                    340: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
                    341: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
                    342: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
                    343: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
                    344: </dl></dd>
                    345: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                    346: <dd><dl>
                    347: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
                    348: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.172     rillig    349: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
                    350: <dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt>
                    351: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.154     rillig    352: </dl></dd>
                    353: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                    354: <dd><dl>
                    355: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
                    356: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
                    357: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
                    358: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
                    359: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
                    360: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
                    361: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
                    362: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
                    363: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
                    364: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
                    365: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
                    366: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
                    367: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
                    368: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
                    369: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
                    370: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
                    371: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
                    372: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.1       dsieger   373:     emulation</a></span></dt>
1.154     rillig    374: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
                    375: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.1       dsieger   376: </dl></dd>
1.154     rillig    377: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.1       dsieger   378: </dl></dd>
1.154     rillig    379: <dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt>
                    380: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.1       dsieger   381: <dd><dl>
1.154     rillig    382: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
                    383: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
                    384: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
                    385: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
                    386: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
                    387: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
                    388: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
                    389: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
                    390: </dl></dd>
                    391: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
                    392: <dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt>
                    393: <dd><dl>
                    394: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
                    395: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
                    396: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
                    397: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.1       dsieger   398: </dl></dd>
                    399: </dl></dd>
                    400: <dt><span class="part"><a href="#infrastructure">III. The pkgsrc infrastructure internals</a></span></dt>
                    401: <dd><dl>
1.154     rillig    402: <dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt>
1.1       dsieger   403: <dd><dl>
1.154     rillig    404: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
                    405: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
                    406: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.1       dsieger   407: <dd><dl>
1.154     rillig    408: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
                    409: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.1       dsieger   410: </dl></dd>
1.154     rillig    411: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
                    412: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.1       dsieger   413: <dd><dl>
1.154     rillig    414: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
                    415: <dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
1.1       dsieger   416: </dl></dd>
1.154     rillig    417: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.1       dsieger   418: <dd><dl>
1.154     rillig    419: <dt><span class="sect2"><a href="#infr.order.prefs">26.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
                    420: <dt><span class="sect2"><a href="#infr.order.pkg">26.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.1       dsieger   421: </dl></dd>
                    422: </dl></dd>
1.154     rillig    423: <dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt>
1.1       dsieger   424: <dd><dl>
1.154     rillig    425: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
                    426: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.1       dsieger   427: <dd><dl>
1.154     rillig    428: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
                    429: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.1       dsieger   430: </dl></dd>
                    431: </dl></dd>
1.154     rillig    432: <dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt>
                    433: <dd><dl><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
1.1       dsieger   434: </dl></dd>
                    435: <dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt>
                    436: <dd><dl>
                    437: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
                    438: <dd><dl>
                    439: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
                    440: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
                    441: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.172     rillig    442: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
1.1       dsieger   443: </dl></dd>
                    444: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
                    445: </dl></dd>
                    446: <dt><span class="appendix"><a href="#logs">B. Build logs</a></span></dt>
                    447: <dd><dl>
                    448: <dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt>
                    449: <dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt>
                    450: </dl></dd>
                    451: <dt><span class="appendix"><a href="#ftp-layout">C. Directory layout of the pkgsrc FTP server</a></span></dt>
                    452: <dd><dl>
1.23      wiz       453: <dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
                    454: <dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
                    455: <dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
                    456: <dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
                    457: <dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>,
1.148     leot      458: <code class="filename">stable</code>,
1.23      wiz       459: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.1       dsieger   460: source packages</a></span></dt>
                    461: </dl></dd>
1.154     rillig    462: <dt><span class="appendix"><a href="#help-topics">D. Help topics</a></span></dt>
                    463: <dt><span class="appendix"><a href="#editing">E. Editing guidelines for the pkgsrc guide</a></span></dt>
1.1       dsieger   464: <dd><dl>
1.154     rillig    465: <dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
                    466: <dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
1.1       dsieger   467: </dl></dd>
                    468: </dl>
                    469: </div>
                    470: <div class="list-of-tables">
                    471: <p><b>List of Tables</b></p>
                    472: <dl>
                    473: <dt>1.1. <a href="#supported-platforms">Platforms supported by pkgsrc</a>
                    474: </dt>
1.154     rillig    475: <dt>13.1. <a href="#patch-examples">Patching examples</a>
1.1       dsieger   476: </dt>
1.154     rillig    477: <dt>25.1. <a href="#plist-handling">PLIST handling for GNOME packages</a>
1.1       dsieger   478: </dt>
                    479: </dl>
                    480: </div>
1.41      asau      481: <div class="chapter">
                    482: <div class="titlepage"><div><div><h1 class="title">
                    483: <a name="introduction"></a>Chapter 1. What is pkgsrc?</h1></div></div></div>
1.1       dsieger   484: <div class="toc">
                    485: <p><b>Table of Contents</b></p>
1.100     leot      486: <dl class="toc">
1.1       dsieger   487: <dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
                    488: <dd><dl>
                    489: <dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt>
                    490: <dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
                    491: </dl></dd>
                    492: <dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt>
                    493: <dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
                    494: <dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd>
                    495: <dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
                    496: </dl>
                    497: </div>
1.41      asau      498: <div class="sect1">
1.1       dsieger   499: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    500: <a name="introduction-section"></a>1.1. Introduction</h2></div></div></div>
                    501: <p>There is a lot of software freely available for Unix-based
                    502: systems, which is usually available in form of the source code. Before
                    503: such software can be used, it needs to be configured to the local
                    504: system, compiled and installed, and this is exactly what The NetBSD
                    505: Packages Collection (pkgsrc) does. pkgsrc also has some basic commands
                    506: to handle binary packages, so that not every user has to build the
                    507: packages for himself, which is a time-costly task.</p>
                    508: <p>pkgsrc currently contains several thousand packages,
                    509:       including:</p>
1.41      asau      510: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot      511: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/README.html" target="_top"><code class="filename">www/apache24</code></a> - The Apache
1.1       dsieger   512:          web server</p></li>
1.137     leot      513: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> - The Firefox
1.1       dsieger   514:          web browser</p></li>
1.137     leot      515: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/README.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a> - The GNOME
1.1       dsieger   516:          Desktop Environment</p></li>
1.137     leot      517: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a> - The K
1.1       dsieger   518:          Desktop Environment</p></li>
                    519: </ul></div>
1.108     rillig    520: <p>&#8230; just to name a few.</p>
1.1       dsieger   521: <p>pkgsrc has built-in support for handling varying dependencies,
                    522:       such as pthreads and X11, and extended features such as IPv6 support on
                    523:       a range of platforms.</p>
1.41      asau      524: <div class="sect2">
1.1       dsieger   525: <div class="titlepage"><div><div><h3 class="title">
                    526: <a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div>
                    527: <p>
                    528: pkgsrc provides the following key features:
                    529: </p>
1.41      asau      530: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz       531: <li class="listitem"><p>Easy building of software from source as well as the creation
1.1       dsieger   532:   and installation of binary packages. The source and latest
                    533:   patches are retrieved from a master or mirror download site, checksum
                    534:   verified, then built on your system. Support for binary-only
                    535:   distributions is available for both native platforms and NetBSD
                    536:   emulated platforms.</p></li>
1.23      wiz       537: <li class="listitem"><p>All packages are installed in a consistent directory tree,
1.1       dsieger   538:   including binaries, libraries, man pages and other
                    539:   documentation.</p></li>
1.104     sevan     540: <li class="listitem"><p>Tracking of package dependencies automatically, including when
                    541:   performing updates, to ensure required packages are installed. The
                    542:   configuration files of various packages are handled automatically during
                    543:   updates, so local changes are preserved.</p></li>
1.23      wiz       544: <li class="listitem"><p>Like NetBSD, pkgsrc is designed with portability in mind and
1.1       dsieger   545:   consists of highly portable code. This allows the greatest speed of
1.25      spz       546:   development when porting to a new platform. This portability also
1.1       dsieger   547:   ensures that pkgsrc is <span class="emphasis"><em>consistent across all
                    548:   platforms</em></span>.</p></li>
1.23      wiz       549: <li class="listitem"><p>The installation prefix, acceptable software licenses,
1.1       dsieger   550:   international encryption requirements and build-time options for a
                    551:   large number of packages are all set in a simple, central
                    552:   configuration file.</p></li>
1.23      wiz       553: <li class="listitem"><p>The entire source (not including the distribution files) is
1.1       dsieger   554:   freely available under a BSD license, so you may extend and adapt
                    555:   pkgsrc to your needs. Support for local packages and patches is
                    556:   available right out of the box, so you can configure it specifically
                    557:   for your environment.</p></li>
                    558: </ul></div>
                    559: <p>The following principles are basic to pkgsrc:</p>
1.41      asau      560: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz       561: <li class="listitem"><p><span class="quote">&#8220;<span class="quote">It should only work if it's right.</span>&#8221;</span>
1.14      jmcneill  562: &mdash; That means, if a package contains bugs, it's better to find
1.1       dsieger   563: them and to complain about them rather than to just install the package
                    564: and hope that it works. There are numerous checks in pkgsrc that try to
1.175     gutterid  565: find such bugs: static analysis tools (<a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>), build-time checks (portability
1.1       dsieger   566: of shell scripts), and post-installation checks (installed files,
                    567: references to shared libraries, script interpreters).</p></li>
1.23      wiz       568: <li class="listitem"><p><span class="quote">&#8220;<span class="quote">If it works, it should work everywhere</span>&#8221;</span>
1.14      jmcneill  569: &mdash; Like NetBSD has been ported to many hardware architectures,
1.1       dsieger   570: pkgsrc has been ported to many operating systems. Care is taken that
                    571: packages behave the same on all platforms.</p></li>
                    572: </ul></div>
                    573: </div>
1.41      asau      574: <div class="sect2">
1.1       dsieger   575: <div class="titlepage"><div><div><h3 class="title">
                    576: <a name="intro.platforms"></a>1.1.2. Supported platforms</h3></div></div></div>
                    577: <p>pkgsrc consists of both a source distribution and a binary
                    578: distribution for these operating systems. After retrieving the required
                    579: source or binaries, you can be up and running with pkgsrc in just
                    580: minutes!</p>
                    581: <p>pkgsrc was derived from FreeBSD's ports system, and
                    582:       initially developed for NetBSD only. Since then, pkgsrc has
                    583:       grown a lot, and now supports the following platforms:</p>
                    584: <div class="table">
                    585: <a name="supported-platforms"></a><p class="title"><b>Table 1.1. Platforms supported by pkgsrc</b></p>
1.106     tnn       586: <div class="table-contents"><table class="table" summary="Platforms supported by pkgsrc" border="1">
1.1       dsieger   587: <colgroup>
                    588: <col>
                    589: <col>
1.92      sevan     590: <col>
1.1       dsieger   591: </colgroup>
                    592: <thead><tr>
                    593: <th>Platform</th>
                    594: <th>Date Support Added</th>
1.92      sevan     595: <th>Notes</th>
1.1       dsieger   596: </tr></thead>
                    597: <tbody>
                    598: <tr>
1.174     leot      599: <td><a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a></td>
1.1       dsieger   600: <td align="center">Aug 1997</td>
1.92      sevan     601: <td class="auto-generated"> </td>
1.1       dsieger   602: </tr>
                    603: <tr>
1.10      hubertf   604: <td><a class="ulink" href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td>
1.1       dsieger   605: <td align="center">Mar 1999</td>
1.151     sevan     606: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Solaris" target="_top">README.Solaris</a></td>
1.1       dsieger   607: </tr>
                    608: <tr>
1.174     leot      609: <td><a class="ulink" href="https://www.kernel.org/" target="_top">Linux</a></td>
1.1       dsieger   610: <td align="center">Jun 1999</td>
1.151     sevan     611: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Linux" target="_top">README.Linux</a></td>
1.1       dsieger   612: </tr>
                    613: <tr>
                    614: <td>
1.118     sevan     615:           <a class="ulink" href="https://developer.apple.com/macos/" target="_top">Darwin / Mac OS X / OS X / macOS</a>
1.1       dsieger   616:         </td>
                    617: <td align="center">Oct 2001</td>
1.151     sevan     618: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.MacOSX" target="_top">README.MacOSX</a></td>
1.1       dsieger   619: </tr>
                    620: <tr>
1.174     leot      621: <td><a class="ulink" href="https://www.freebsd.org/" target="_top">FreeBSD</a></td>
1.1       dsieger   622: <td align="center">Nov 2002</td>
1.151     sevan     623: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.FreeBSD" target="_top">README.FreeBSD</a></td>
1.1       dsieger   624: </tr>
                    625: <tr>
1.174     leot      626: <td><a class="ulink" href="https://www.openbsd.org/" target="_top">OpenBSD</a></td>
1.1       dsieger   627: <td align="center">Nov 2002</td>
1.151     sevan     628: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OpenBSD" target="_top">README.OpenBSD</a></td>
1.1       dsieger   629: </tr>
                    630: <tr>
1.174     leot      631: <td><a class="ulink" href="https://www.sgi.com/software/irix/" target="_top">IRIX</a></td>
1.1       dsieger   632: <td align="center">Dec 2002</td>
1.92      sevan     633: <td>
1.151     sevan     634:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX" target="_top">README.IRIX</a>
                    635:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX5.3" target="_top">README.IRIX5.3</a>
1.92      sevan     636:        </td>
1.1       dsieger   637: </tr>
                    638: <tr>
                    639: <td>BSD/OS</td>
                    640: <td align="center">Dec 2003</td>
1.92      sevan     641: <td class="auto-generated"> </td>
1.1       dsieger   642: </tr>
                    643: <tr>
1.174     leot      644: <td><a class="ulink" href="https://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td>
1.1       dsieger   645: <td align="center">Dec 2003</td>
1.151     sevan     646: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.AIX" target="_top">README.AIX</a></td>
1.1       dsieger   647: </tr>
                    648: <tr>
                    649: <td>
1.174     leot      650:           <a class="ulink" href="https://www.microsoft.com/windows/sfu/" target="_top">Interix</a>
1.1       dsieger   651:           (Microsoft Windows Services for Unix)
                    652:         </td>
                    653: <td align="center">Mar 2004</td>
1.151     sevan     654: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Interix" target="_top">README.Interix</a></td>
1.1       dsieger   655: </tr>
                    656: <tr>
1.174     leot      657: <td><a class="ulink" href="https://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td>
1.1       dsieger   658: <td align="center">Oct 2004</td>
1.92      sevan     659: <td class="auto-generated"> </td>
1.1       dsieger   660: </tr>
                    661: <tr>
1.10      hubertf   662: <td><a class="ulink" href="http://www.tru64.org/" target="_top">OSF/1</a></td>
1.1       dsieger   663: <td align="center">Nov 2004</td>
1.151     sevan     664: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OSF1" target="_top">README.OSF1</a></td>
1.1       dsieger   665: </tr>
                    666: <tr>
1.174     leot      667: <td><a class="ulink" href="https://www.hp.com/products1/unix/" target="_top">HP-UX</a></td>
1.1       dsieger   668: <td align="center">Apr 2007</td>
1.151     sevan     669: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.HPUX" target="_top">README.HPUX</a></td>
1.1       dsieger   670: </tr>
1.23      wiz       671: <tr>
1.174     leot      672: <td><a class="ulink" href="https://www.haiku-os.org/" target="_top">Haiku</a></td>
1.23      wiz       673: <td align="center">Sep 2010</td>
1.151     sevan     674: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Haiku" target="_top">README.Haiku</a></td>
1.23      wiz       675: </tr>
1.45      obache    676: <tr>
1.174     leot      677: <td><a class="ulink" href="https://www.mirbsd.org/" target="_top">MirBSD</a></td>
1.57      bsiegert  678: <td align="center">Jan 2011</td>
1.92      sevan     679: <td class="auto-generated"> </td>
1.45      obache    680: </tr>
                    681: <tr>
1.174     leot      682: <td><a class="ulink" href="https://www.minix3.org/" target="_top">Minix3</a></td>
1.45      obache    683: <td align="center">Nov 2011</td>
1.151     sevan     684: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Minix3" target="_top">README.Minix3</a></td>
1.45      obache    685: </tr>
                    686: <tr>
1.174     leot      687: <td><a class="ulink" href="https://cygwin.com/" target="_top">Cygwin</a></td>
1.45      obache    688: <td align="center">Mar 2013</td>
1.151     sevan     689: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Cygwin" target="_top">README.Cygwin</a></td>
1.45      obache    690: </tr>
1.58      ryoon     691: <tr>
1.174     leot      692: <td><a class="ulink" href="https://www.debian.org/ports/kfreebsd-gnu/" target="_top">GNU/kFreeBSD</a></td>
1.58      ryoon     693: <td align="center">Jul 2013</td>
1.151     sevan     694: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.GNUkFreeBSD" target="_top">README.GNUkFreeBSD</a></td>
1.58      ryoon     695: </tr>
1.104     sevan     696: <tr>
1.174     leot      697: <td><a class="ulink" href="https://www.bitrig.org/" target="_top">Bitrig</a></td>
1.104     sevan     698: <td align="center">Jun 2014</td>
1.151     sevan     699: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Bitrig" target="_top">README.Bitrig</a></td>
1.104     sevan     700: </tr>
1.1       dsieger   701: </tbody>
                    702: </table></div>
                    703: </div>
                    704: <br class="table-break">
                    705: </div>
                    706: </div>
1.41      asau      707: <div class="sect1">
1.1       dsieger   708: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    709: <a name="overview"></a>1.2. Overview</h2></div></div></div>
                    710: <p>This document is divided into three parts. The first,
1.10      hubertf   711:        <a class="link" href="#users-guide" title="Part I. The pkgsrc user's guide">The pkgsrc user's guide</a>,
1.1       dsieger   712:        describes how one can use one of the packages in the Package
                    713:        Collection, either by installing a precompiled binary package,
                    714:        or by building one's own copy using the NetBSD package system.
1.10      hubertf   715:        The second part, <a class="link" href="#developers-guide" title="Part II. The pkgsrc developer's guide">The pkgsrc developer's guide</a>, explains how to prepare a
1.1       dsieger   716:        package so it can be easily built by other NetBSD users without
                    717:        knowing about the package's building details. The third part,
1.10      hubertf   718:        <a class="link" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">The pkgsrc infrastructure internals</a>
1.1       dsieger   719:        is intended for those who want to understand how pkgsrc is
                    720:        implemented.</p>
                    721: <p>This document is available in various formats:
1.10      hubertf   722:        <span class="simplelist"><a class="ulink" href="index.html" target="_top">HTML</a>, <a class="ulink" href="pkgsrc.pdf" target="_top">PDF</a>, <a class="ulink" href="pkgsrc.ps" target="_top">PS</a>, <a class="ulink" href="pkgsrc.txt" target="_top">TXT</a></span>.</p>
1.1       dsieger   723: </div>
1.41      asau      724: <div class="sect1">
1.1       dsieger   725: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    726: <a name="terminology"></a>1.3. Terminology</h2></div></div></div>
1.23      wiz       727: <p>There has been a lot of talk about <span class="quote">&#8220;<span class="quote">ports</span>&#8221;</span>,
                    728:       <span class="quote">&#8220;<span class="quote">packages</span>&#8221;</span>, etc. so far. Here is a description of all the
1.1       dsieger   729:       terminology used within this document.</p>
1.41      asau      730: <div class="variablelist"><dl class="variablelist">
1.1       dsieger   731: <dt><span class="term">Package</span></dt>
                    732: <dd><p>A set of files and building instructions
                    733:            that describe what's necessary
                    734:            to build a certain piece of software using
                    735:             pkgsrc. Packages are traditionally stored under
1.123     wiz       736:            <code class="filename">/usr/pkgsrc</code>,
                    737:            but may be stored in any location,
                    738:            referred to as <code class="varname">PKGSRCDIR</code>.</p></dd>
1.1       dsieger   739: <dt><span class="term">The NetBSD package system</span></dt>
1.23      wiz       740: <dd><p>This is the former name of <span class="quote">&#8220;<span class="quote">pkgsrc</span>&#8221;</span>.  It
1.1       dsieger   741:          is part of the NetBSD operating system and can be bootstrapped
                    742:          to run on non-NetBSD operating systems as well.  It handles
                    743:          building (compiling), installing, and removing of
                    744:          packages.</p></dd>
                    745: <dt><span class="term">Distfile</span></dt>
                    746: <dd><p>This term describes the file or files that are
                    747:            provided by the author of the piece of software to
                    748:            distribute his work. All the changes necessary to build on
                    749:            NetBSD are reflected in the corresponding package. Usually
                    750:            the distfile is in the form of a compressed tar-archive,
                    751:            but other types are possible, too. Distfiles are usually
                    752:            stored below
                    753:            <code class="filename">/usr/pkgsrc/distfiles</code>.</p></dd>
                    754: <dt><span class="term">Port</span></dt>
                    755: <dd><p>This is the term used by FreeBSD and OpenBSD people
                    756:            for what we call a package.
1.23      wiz       757:            In NetBSD terminology, <span class="quote">&#8220;<span class="quote">port</span>&#8221;</span> refers to a different
1.1       dsieger   758:            architecture.</p></dd>
                    759: <dt><span class="term">Precompiled/binary package</span></dt>
                    760: <dd>
                    761: <p>A set of binaries built with pkgsrc from a distfile
                    762:            and stuffed together in a single <code class="filename">.tgz</code>
                    763:            file so it can be installed on machines of the same
                    764:            machine architecture without the need to
                    765:            recompile. Packages are usually generated in
                    766:            <code class="filename">/usr/pkgsrc/packages</code>; there is also
1.25      spz       767:            an archive on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/" target="_top">ftp.NetBSD.org</a>.</p>
1.23      wiz       768: <p>Sometimes, this is referred to by the term <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> too,
1.1       dsieger   769:            especially in the context of precompiled packages.</p>
                    770: </dd>
                    771: <dt><span class="term">Program</span></dt>
                    772: <dd><p>The piece of software to be installed which will be
                    773:          constructed from all the files in the distfile by the
                    774:          actions defined in the corresponding package.</p></dd>
                    775: </dl></div>
1.41      asau      776: <div class="sect2">
1.1       dsieger   777: <div class="titlepage"><div><div><h3 class="title">
                    778: <a name="term.roles"></a>1.3.1. Roles involved in pkgsrc</h3></div></div></div>
1.41      asau      779: <div class="variablelist"><dl class="variablelist">
1.1       dsieger   780: <dt><span class="term">pkgsrc users</span></dt>
                    781: <dd>
                    782: <p>The
                    783:        pkgsrc users are people who use the packages provided by pkgsrc.
                    784:        Typically they are system administrators. The people using the
1.23      wiz       785:        software that is inside the packages (maybe called <span class="quote">&#8220;<span class="quote">end
                    786:        users</span>&#8221;</span>) are not covered by the pkgsrc guide.</p>
1.1       dsieger   787: <p>There are two kinds of pkgsrc users: Some only want to
                    788:        install pre-built binary packages. Others build the pkgsrc
                    789:        packages from source, either for installing them directly or for
1.10      hubertf   790:        building binary packages themselves. For pkgsrc users <a class="xref" href="#users-guide" title="Part I. The pkgsrc user's guide">Part I, &#8220;The pkgsrc user's guide&#8221;</a> should provide all necessary
1.1       dsieger   791:        documentation.</p>
                    792: </dd>
                    793: <dt><span class="term">package maintainers</span></dt>
                    794: <dd><p>A
1.10      hubertf   795:        package maintainer creates packages as described in <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, &#8220;The pkgsrc developer's guide&#8221;</a>.</p></dd>
1.1       dsieger   796: <dt><span class="term">infrastructure developers</span></dt>
                    797: <dd><p>These people are involved in all those files
                    798:        that live in the <code class="filename">mk/</code> directory and below.
1.10      hubertf   799:        Only these people should need to read through <a class="xref" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">Part III, &#8220;The pkgsrc infrastructure internals&#8221;</a>, though others might be curious,
1.1       dsieger   800:        too.</p></dd>
                    801: </dl></div>
                    802: </div>
                    803: </div>
1.41      asau      804: <div class="sect1">
1.1       dsieger   805: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    806: <a name="typography"></a>1.4. Typography</h2></div></div></div>
                    807: <p>When giving examples for commands, shell prompts are used to
                    808:       show if the command should/can be issued as root, or if
1.23      wiz       809:       <span class="quote">&#8220;<span class="quote">normal</span>&#8221;</span> user privileges are sufficient. We use a
1.115     sevan     810:       <code class="prompt">#</code> for root's shell prompt, a <code class="prompt">%</code> for users'
                    811:       shell prompt, assuming they use the C-shell or tcsh and a <code class="prompt">$</code> for
                    812:       bourne shell and derivatives.</p>
1.1       dsieger   813: </div>
                    814: </div>
1.41      asau      815: <div class="part">
1.1       dsieger   816: <div class="titlepage"><div><div><h1 class="title">
                    817: <a name="users-guide"></a>Part I. The pkgsrc user's guide</h1></div></div></div>
                    818: <div class="toc">
                    819: <p><b>Table of Contents</b></p>
1.100     leot      820: <dl class="toc">
1.154     rillig    821: <dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt>
                    822: <dt><span class="chapter"><a href="#getting">3. Where to get pkgsrc and how to keep it up-to-date</a></span></dt>
1.1       dsieger   823: <dd><dl>
1.154     rillig    824: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.1       dsieger   825: <dd><dl>
1.154     rillig    826: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
                    827: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.1       dsieger   828: </dl></dd>
1.154     rillig    829: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.1       dsieger   830: <dd><dl>
1.154     rillig    831: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
                    832: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.1       dsieger   833: </dl></dd>
                    834: </dl></dd>
1.154     rillig    835: <dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
1.1       dsieger   836: <dd><dl>
1.154     rillig    837: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
                    838: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.1       dsieger   839: </dl></dd>
1.154     rillig    840: <dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
1.1       dsieger   841: <dd><dl>
1.154     rillig    842: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.1       dsieger   843: <dd><dl>
1.154     rillig    844: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
                    845: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
                    846: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
                    847: <dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
                    848: <dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
                    849: <dt><span class="sect2"><a href="#pkg_versions">5.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
                    850: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
1.1       dsieger   851: </dl></dd>
1.154     rillig    852: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.1       dsieger   853: <dd><dl>
1.154     rillig    854: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
                    855: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
                    856: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.1       dsieger   857: </dl></dd>
                    858: </dl></dd>
1.154     rillig    859: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.1       dsieger   860: <dd><dl>
1.154     rillig    861: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
                    862: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
                    863: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
                    864: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1.1       dsieger   865: <dd><dl>
1.154     rillig    866: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
                    867: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
                    868: <dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.1       dsieger   869: </dl></dd>
1.154     rillig    870: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
                    871: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.1       dsieger   872: </dl></dd>
1.154     rillig    873: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.1       dsieger   874: <dd><dl>
1.154     rillig    875: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
                    876: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.6       rillig    877: </dl></dd>
1.154     rillig    878: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.6       rillig    879: builds)</a></span></dt>
1.1       dsieger   880: <dd><dl>
1.154     rillig    881: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.180     rillig    882: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.154     rillig    883: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
                    884: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.178     rillig    885: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
                    886: <dd><dl>
1.179     rillig    887: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
                    888: <dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
1.181   ! rillig    889: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
        !           890: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
        !           891: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
        !           892: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
        !           893: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
        !           894: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
        !           895: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
        !           896: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.178     rillig    897: </dl></dd>
                    898: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
                    899: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.154     rillig    900: </dl></dd>
                    901: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
                    902: <dd><dl>
                    903: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
                    904: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
                    905: </dl></dd>
                    906: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
                    907: <dd><dl>
                    908: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
                    909: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
                    910: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
                    911: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
                    912: <dt><span class="sect1"><a href="#x.org-from-pkgsrc">10.5. How can I install/use modular X.org from pkgsrc?</a></span></dt>
                    913: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
                    914: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
                    915: <dt><span class="sect1"><a href="#passive-ftp">10.8. How do I tell <span class="command"><strong>make fetch</strong></span> to do passive FTP?</a></span></dt>
                    916: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
                    917: <dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
1.23      wiz       918: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
1.154     rillig    919: <dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt>
                    920: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
                    921: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
                    922: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
                    923: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
                    924: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build.  What shall I do?</a></span></dt>
                    925: <dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt>
1.1       dsieger   926: </dl></dd>
                    927: </dl>
                    928: </div>
1.41      asau      929: <div class="chapter">
1.1       dsieger   930: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig    931: <a name="help-user"></a>Chapter 2. Getting help</h2></div></div></div>
                    932: <p>
                    933:        To get help when using pkgsrc, the definitive source is this
                    934:        document, the pkgsrc guide. If you don't find anything here,
                    935:        there are alternatives:
                    936: </p>
                    937: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                    938: <li class="listitem">
                    939: <p>
                    940:        The built-in pkgsrc help, which is available after bootstrapping
                    941:        pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get
                    942:        help for any topic, such as a variable name like
                    943:        <code class="varname">BUILD_DEFS</code>, a make target like
                    944:        <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
                    945:        <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
                    946: <p>The available help topics are listed in <a class="xref" href="#help-topics" title="Appendix D. Help topics">Appendix D, <i>Help topics</i></a>.</p>
                    947: </li>
                    948: <li class="listitem"><p>
1.163     rillig    949:        To see the value of a single variable, run <span class="command"><strong>bmake
                    950:        show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
                    951: </p></li>
                    952: <li class="listitem"><p>
                    953:        To see the values of the most common variables, run
                    954:        <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
                    955:        topic. To see the variables for a single topic, run
                    956:        <span class="command"><strong>bmake
                    957:        show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
                    958:        <span class="command"><strong>bmake show-all-fetch</strong></span>.
                    959: </p></li>
                    960: <li class="listitem"><p>
1.154     rillig    961:        The pkgsrc-users mailing list, to which
                    962:        <a class="ulink" href="https://www.NetBSD.org/mailinglists/#pkgsrc-users" target="_top">you
                    963:        can subscribe</a> and then <a class="ulink" href="mailto:pkgsrc-users@NetBSD.org" target="_top">ask your
                    964:        questions</a>.</p></li>
                    965: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
                    966:        <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
                    967:        or by using a specialized chat program such as
                    968:        <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
                    969:        Pick any user name and join the channel #pkgsrc.</p></li>
                    970: </ul></div>
                    971: </div>
                    972: <div class="chapter">
                    973: <div class="titlepage"><div><div><h2 class="title">
                    974: <a name="getting"></a>Chapter 3. Where to get pkgsrc and how to keep it up-to-date</h2></div></div></div>
1.1       dsieger   975: <div class="toc">
                    976: <p><b>Table of Contents</b></p>
1.100     leot      977: <dl class="toc">
1.154     rillig    978: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.1       dsieger   979: <dd><dl>
1.154     rillig    980: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
                    981: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.1       dsieger   982: </dl></dd>
1.154     rillig    983: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.1       dsieger   984: <dd><dl>
1.154     rillig    985: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
                    986: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.1       dsieger   987: </dl></dd>
                    988: </dl>
                    989: </div>
                    990: <p>Before you download and extract the files, you need to decide
                    991: where you want to extract them. When using pkgsrc as root user, pkgsrc
                    992: is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though
                    993: free to install the sources and binary packages wherever you want in
                    994: your filesystem, provided that the pathname does not contain white-space
                    995: or other characters that are interpreted specially by the shell and some
                    996: other programs. A safe bet is to use only letters, digits, underscores
                    997: and dashes.</p>
1.41      asau      998: <div class="sect1">
1.1       dsieger   999: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1000: <a name="getting-first"></a>3.1. Getting pkgsrc for the first time</h2></div></div></div>
1.1       dsieger  1001: <p>Before you download any pkgsrc files, you should decide
                   1002:        whether you want the <span class="emphasis"><em>current</em></span> branch or the
                   1003:        <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a
                   1004:        quarterly basis from the current branch and only gets modified
                   1005:        for security updates. The names of the stable branches are built
                   1006:        from the year and the quarter, for example
1.174     leot     1007:        <code class="literal">2020Q1</code>.</p>
1.1       dsieger  1008: <p>The second step is to decide <span class="emphasis"><em>how</em></span> you
1.23      wiz      1009:        want to download pkgsrc. You can get it as a tar file or via CVS.
                   1010:        Both ways are described here.</p>
1.51      asau     1011: <p>Note that tar archive contains CVS working copy.
                   1012:        Thus you can switch to using CVS at any later time.</p>
1.41      asau     1013: <div class="sect2">
1.1       dsieger  1014: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1015: <a name="getting-via-tar"></a>3.1.1. As tar archive</h3></div></div></div>
1.1       dsieger  1016: <p>The primary download location for all pkgsrc files is
1.151     sevan    1017:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/" target="_top">https://cdn.NetBSD.org/pub/pkgsrc/</a> or
1.51      asau     1018:        <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>
                   1019:        (it points to the same location).
                   1020:        There are a number of subdirectories for different purposes,
                   1021:        which are described in detail in <a class="xref" href="#ftp-layout" title="Appendix C. Directory layout of the pkgsrc FTP server">Appendix C, <i>Directory layout of the pkgsrc FTP server</i></a>.</p>
                   1022: <p>The tar archive for the current branch is in the directory
1.151     sevan    1023:        <code class="filename">current</code> and is called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.
1.118     sevan    1024:        It is autogenerated weekly.</p>
1.51      asau     1025: <p>To save download time we provide bzip2- and
                   1026:        xz-compressed archives which are published at
1.151     sevan    1027:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.bz2" target="_top"><code class="filename">pkgsrc.tar.bz2</code></a>
1.51      asau     1028:        and
1.151     sevan    1029:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.xz" target="_top"><code class="filename">pkgsrc.tar.xz</code></a>
1.51      asau     1030:        respectively.
                   1031:        </p>
                   1032: <p>You can fetch the same files using FTP.</p>
1.174     leot     1033: <p>The tar file for the stable branch 2020Q1 is in the
                   1034:        directory <code class="filename">pkgsrc-2020Q1</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p>
1.136     leot     1035: <p>To download the latest pkgsrc stable tarball, run:</p>
1.12      weinem   1036: <pre class="screen">
1.174     leot     1037: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2020Q1/pkgsrc.tar.gz</code></strong></pre>
1.78      snj      1038: <p>If you prefer, you can also fetch it using "wget", "curl",
1.51      asau     1039:        or your web browser.</p>
1.12      weinem   1040: <p>Then, extract it with:</p>
1.78      snj      1041: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre>
1.12      weinem   1042: <p>This will create the directory <code class="filename">pkgsrc/</code>
                   1043:        in <code class="filename">/usr/</code> and all the package source will be 
                   1044:        stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                   1045: <p>To download pkgsrc-current, run:</p>
                   1046: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz</code></strong></pre>
1.1       dsieger  1047: </div>
1.41      asau     1048: <div class="sect2">
1.1       dsieger  1049: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1050: <a name="getting-via-cvs"></a>3.1.2. Via anonymous CVS</h3></div></div></div>
1.23      wiz      1051: <p>To fetch a specific pkgsrc stable branch, run:</p>
1.174     leot     1052: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2020Q1 -P pkgsrc</code></strong>
1.23      wiz      1053: </pre>
                   1054: <p>This will create the directory <code class="filename">pkgsrc/</code> 
                   1055:        in your <code class="filename">/usr/</code> directory and all the package source 
                   1056:        will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                   1057: <p>To fetch the pkgsrc current branch, run:</p>
1.39      wiz      1058: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.1       dsieger  1059: </pre>
1.174     leot     1060: <p>Refer to the <a class="ulink" href="https://www.NetBSD.org/mirrors/#anoncvs" target="_top">list of available mirrors</a> to choose a faster CVS mirror, if needed.</p>
1.23      wiz      1061: <p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable. E.g.:</p>
1.39      wiz      1062: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr &amp;&amp; env CVS_RSH=ssh cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.23      wiz      1063: </pre>
                   1064: <p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
                   1065:        For Bourne shells, you can set it in your <code class="filename">.profile</code>
                   1066:        or better globally in <code class="filename">/etc/profile</code>:</p>
                   1067: <pre class="programlisting">
                   1068: # set CVS remote shell command
                   1069: CVS_RSH=ssh
                   1070: export CVS_RSH
                   1071: </pre>
                   1072: <p>By default, CVS doesn't do things like most people would expect it to do.
                   1073:        But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
                   1074:        in your home directory and saving the following lines to it.
                   1075:        This file will save you lots of headache and some bug reports, so we strongly recommend it.
                   1076:        You can find an explanation of this file in the CVS documentation.</p>
1.2       rillig   1077: <pre class="programlisting">
                   1078: # recommended CVS configuration file from the pkgsrc guide
1.155     sevan    1079: cvs -q
1.2       rillig   1080: checkout -P
1.4       rillig   1081: update -dP
                   1082: diff -upN
1.2       rillig   1083: rdiff -u
1.23      wiz      1084: release -d
1.2       rillig   1085: </pre>
1.1       dsieger  1086: </div>
                   1087: </div>
1.41      asau     1088: <div class="sect1">
1.1       dsieger  1089: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1090: <a name="uptodate"></a>3.2. Keeping pkgsrc up-to-date</h2></div></div></div>
1.1       dsieger  1091: <p>The preferred way to keep pkgsrc up-to-date is via CVS
                   1092:        (which also works if you have first installed it via a tar
                   1093:        file). It saves bandwidth and hard disk activity, compared to
                   1094:        downloading the tar file again.</p>
1.41      asau     1095: <div class="sect2">
1.1       dsieger  1096: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1097: <a name="uptodate-tar"></a>3.2.1. Via tar files</h3></div></div></div>
1.41      asau     1098: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  1099: <h3 class="title">Warning</h3>
                   1100: <p>When updating from a tar file, you first need to
                   1101:        completely remove the old pkgsrc directory. Otherwise those
                   1102:        files that have been removed from pkgsrc in the mean time will
                   1103:        not be removed on your local disk, resulting in inconsistencies.
                   1104:        When removing the old files, any changes that you have done to
                   1105:        the pkgsrc files will be lost after updating. Therefore updating
                   1106:        via CVS is strongly recommended.</p>
                   1107: </div>
                   1108: <p>Note that by default the distfiles and the binary packages
                   1109:        are saved in the pkgsrc tree, so don't forget to rescue them
1.78      snj      1110:        before updating. You can also configure pkgsrc to store distfiles
                   1111:         and packages in directories outside the pkgsrc tree by setting the
1.1       dsieger  1112:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.154     rillig   1113:        variables. See <a class="xref" href="#configuring" title="Chapter 6. Configuring pkgsrc">Chapter 6, <i>Configuring pkgsrc</i></a> for the details.</p>
1.1       dsieger  1114: <p>To update pkgsrc from a tar file, download the tar file as
                   1115:        explained above. Then, make sure that you have not made any
                   1116:        changes to the files in the pkgsrc directory. Remove the pkgsrc
                   1117:        directory and extract the new tar file. Done.</p>
                   1118: </div>
1.41      asau     1119: <div class="sect2">
1.1       dsieger  1120: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1121: <a name="uptodate-cvs"></a>3.2.2. Via CVS</h3></div></div></div>
1.25      spz      1122: <p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
                   1123: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; cvs update -dP</code></strong>
                   1124: </pre>
                   1125: <p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable as described above. E.g.:</p>
                   1126: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; env CVS_RSH=ssh cvs up -dP</code></strong>
                   1127: </pre>
1.41      asau     1128: <div class="sect3">
1.1       dsieger  1129: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   1130: <a name="uptodate-cvs-switch"></a>3.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
1.1       dsieger  1131: <p>When updating pkgsrc, the CVS program keeps track of the
                   1132:        branch you selected. But if you, for whatever reason, want to
                   1133:        switch from the stable branch to the current one, you can do it
1.23      wiz      1134:        by adding the option <span class="quote">&#8220;<span class="quote">-A</span>&#8221;</span> after the
                   1135:        <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> keyword. To switch from the current branch
1.1       dsieger  1136:        back to the stable branch, add the
1.174     leot     1137:        <span class="quote">&#8220;<span class="quote">-rpkgsrc-2020Q1</span>&#8221;</span> option.</p>
1.1       dsieger  1138: </div>
1.41      asau     1139: <div class="sect3">
1.1       dsieger  1140: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   1141: <a name="uptodate-cvs-changes"></a>3.2.2.2. What happens to my changes when updating?</h4></div></div></div>
1.1       dsieger  1142: <p>When you update pkgsrc, the CVS program will only touch
                   1143:        those files that are registered in the CVS repository. That
                   1144:        means that any packages that you created on your own will stay
                   1145:        unmodified. If you change files that are managed by CVS, later
                   1146:        updates will try to merge your changes with those that have been
                   1147:        done by others. See the CVS manual, chapter
1.23      wiz      1148:        <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for details.</p>
1.1       dsieger  1149: </div>
                   1150: </div>
                   1151: </div>
                   1152: </div>
1.41      asau     1153: <div class="chapter">
1.1       dsieger  1154: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   1155: <a name="platforms"></a>Chapter 4. Using pkgsrc on systems other than NetBSD</h2></div></div></div>
1.1       dsieger  1156: <div class="toc">
                   1157: <p><b>Table of Contents</b></p>
1.100     leot     1158: <dl class="toc">
1.154     rillig   1159: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
                   1160: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.1       dsieger  1161: </dl>
                   1162: </div>
1.41      asau     1163: <div class="sect1">
1.1       dsieger  1164: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1165: <a name="binarydist"></a>4.1. Binary distribution</h2></div></div></div>
                   1166: <p>See <a class="xref" href="#using-pkg" title="5.1. Using binary packages">Section 5.1, &#8220;Using binary packages&#8221;</a>.</p>
1.1       dsieger  1167: </div>
1.41      asau     1168: <div class="sect1">
1.1       dsieger  1169: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1170: <a name="bootstrapping-pkgsrc"></a>4.2. Bootstrapping pkgsrc</h2></div></div></div>
1.43      asau     1171: <p>pkgsrc can be bootstrapped for use in two different modes:
                   1172:     privileged and unprivileged one. In unprivileged mode in contrast
1.44      asau     1173:     to privileged one all programs are installed under one particular user
1.43      asau     1174:     and cannot utilise privileged operations (packages don't create
                   1175:     special users and all special file permissions like setuid are ignored).
                   1176:     </p>
1.1       dsieger  1177: <p>Installing the bootstrap kit from source should be as simple as:</p>
                   1178: <pre class="screen">
1.60      asau     1179: <code class="prompt">#</code> <strong class="userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc</code></strong>
1.1       dsieger  1180: <code class="prompt">#</code> <strong class="userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1181: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap</code></strong>
                   1182:     </pre>
1.43      asau     1183: <p>To bootstrap in unprivileged mode pass <span class="quote">&#8220;<span class="quote">--unprivileged</span>&#8221;</span> flag to <span class="command"><strong>bootstrap</strong></span></p>
                   1184: <p>By default, in privileged mode pkgsrc uses
                   1185:     <code class="filename">/usr/pkg</code> for <span class="emphasis"><em>prefix</em></span>
                   1186:     where programs will be installed in,
1.118     sevan    1187:     and <code class="filename">/usr/pkg/pkgdb</code> for the package database
1.43      asau     1188:     directory where pkgsrc will do its internal bookkeeping,
                   1189:     <code class="filename">/var</code> is used as <span class="emphasis"><em>varbase</em></span>,
                   1190:     where packages install their persistent data.
                   1191:     In unprivileged mode pkgsrc uses
                   1192:     <code class="filename">~/pkg</code> for <span class="emphasis"><em>prefix</em></span>,
1.118     sevan    1193:     <code class="filename">~/pkg/pkgdb</code> for the package database,
1.43      asau     1194:     and <code class="filename">~/pkg/var</code> for <span class="emphasis"><em>varbase</em></span>.
                   1195:     </p>
                   1196: <p>You can change default layout using command-line arguments.
                   1197:     Run <span class="quote">&#8220;<span class="quote">./bootstrap --help</span>&#8221;</span> to get details.
                   1198:     </p>
1.41      asau     1199: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  1200: <h3 class="title">Note</h3>
1.10      hubertf  1201: <p>The bootstrap installs a <span class="command"><strong>bmake</strong></span> tool.
                   1202:       Use this <span class="command"><strong>bmake</strong></span> when building via pkgsrc.
                   1203:       For examples in this guide, use <span class="command"><strong>bmake</strong></span>
1.23      wiz      1204:       instead of <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span>.</p>
1.1       dsieger  1205: </div>
1.43      asau     1206: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   1207: <h3 class="title">Note</h3>
                   1208: <p>It is possible to bootstrap multiple instances of pkgsrc
                   1209:       using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span>
                   1210:       corresponding to the installation you're working with to build
                   1211:       and install packages.
                   1212:       </p>
                   1213: </div>
1.1       dsieger  1214: </div>
                   1215: </div>
1.41      asau     1216: <div class="chapter">
1.1       dsieger  1217: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   1218: <a name="using"></a>Chapter 5. Using pkgsrc</h2></div></div></div>
1.1       dsieger  1219: <div class="toc">
                   1220: <p><b>Table of Contents</b></p>
1.100     leot     1221: <dl class="toc">
1.154     rillig   1222: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.1       dsieger  1223: <dd><dl>
1.154     rillig   1224: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
                   1225: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
                   1226: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.3. Deinstalling packages</a></span></dt>
                   1227: <dt><span class="sect2"><a href="#using.pkg_info">5.1.4. Getting information about installed packages</a></span></dt>
                   1228: <dt><span class="sect2"><a href="#vulnerabilities">5.1.5. Checking for security vulnerabilities in installed packages</a></span></dt>
                   1229: <dt><span class="sect2"><a href="#pkg_versions">5.1.6. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
                   1230: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.7. Other administrative functions</a></span></dt>
                   1231: </dl></dd>
                   1232: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
                   1233: <dd><dl>
                   1234: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
                   1235: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
                   1236: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.1       dsieger  1237: </dl></dd>
                   1238: </dl>
                   1239: </div>
                   1240: <p>Basically, there are two ways of using pkgsrc. The first
                   1241: is to only install the package tools and to use binary packages
1.23      wiz      1242: that someone else has prepared. This is the <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>
                   1243: in pkgsrc. The second way is to install the <span class="quote">&#8220;<span class="quote">src</span>&#8221;</span>
1.1       dsieger  1244: of pkgsrc, too. Then you are able to build your own packages,
                   1245: and you can still use binary packages from someone else.</p>
1.41      asau     1246: <div class="sect1">
1.1       dsieger  1247: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1248: <a name="using-pkg"></a>5.1. Using binary packages</h2></div></div></div>
1.179     rillig   1249: <p>On the <a class="ulink" href="http://cdn.NetBSD.org/" target="_top">cdn.NetBSD.org</a>
1.151     sevan    1250:   site and mirrors, there are collections of binary packages,
1.9       rillig   1251:   ready to be installed. These binary packages have been built using the
                   1252:   default settings for the directories, that is:</p>
1.41      asau     1253: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      1254: <li class="listitem"><p><code class="filename">/usr/pkg</code> for <code class="varname">LOCALBASE</code>, where most of the files are installed,</p></li>
                   1255: <li class="listitem"><p><code class="filename">/usr/pkg/etc</code> for configuration files,</p></li>
                   1256: <li class="listitem"><p><code class="filename">/var</code> for <code class="varname">VARBASE</code>, where those files are installed that may change after installation.</p></li>
1.9       rillig   1257: </ul></div>
                   1258: <p>If you cannot use these directories for whatever reasons (maybe
                   1259:   because you're not root), you cannot use these binary packages, but
1.154     rillig   1260:   have to build the packages yourself, which is explained in <a class="xref" href="#bootstrapping-pkgsrc" title="4.2. Bootstrapping pkgsrc">Section 4.2, &#8220;Bootstrapping pkgsrc&#8221;</a>.</p>
1.41      asau     1261: <div class="sect2">
1.1       dsieger  1262: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1263: <a name="finding-binary-packages"></a>5.1.1. Finding binary packages</h3></div></div></div>
1.5       weinem   1264: <p>To install binary packages, you first need to know from where
                   1265:     to get them. The first place where you should look is on the main
1.179     rillig   1266:     
                   1267:     pkgsrc FTP server in the directory <a class="ulink" href="http://cdn.NetBSD.org/pub/pkgsrc/packages/" target="_top"><code class="filename">/pub/pkgsrc/packages</code></a>.</p>
1.5       weinem   1268: <p>This directory contains binary packages for multiple
                   1269:     platforms. First, select your operating system. (Ignore the
                   1270:     directories with version numbers attached to it, they just exist for
                   1271:     legacy reasons.) Then, select your hardware architecture, and in the
1.23      wiz      1272:     third step, the OS version and the <span class="quote">&#8220;<span class="quote">version</span>&#8221;</span> of pkgsrc.</p>
1.9       rillig   1273: <p>In this directory, you often find a file called
                   1274:     <code class="filename">bootstrap.tar.gz</code> which contains the package
                   1275:     management tools. If the file is missing, it is likely that your
                   1276:     operating system already provides those tools. Download the file and
                   1277:     extract it in the <code class="filename">/</code> directory. It will create
                   1278:     the directories <code class="filename">/usr/pkg</code> (containing the tools
1.118     sevan    1279:     for managing binary packages and the database of installed packages).</p>
1.1       dsieger  1280: </div>
1.41      asau     1281: <div class="sect2">
1.1       dsieger  1282: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1283: <a name="installing-binary-packages"></a>5.1.2. Installing binary packages</h3></div></div></div>
1.9       rillig   1284: <p>In the directory from the last section, there is a
1.85      wiz      1285:     subdirectory called <code class="filename">All/</code>, which contains all the
1.9       rillig   1286:     binary packages that are available for the platform, excluding those
                   1287:     that may not be distributed via FTP or CDROM (depending on which
1.23      wiz      1288:     medium you are using).</p>
1.9       rillig   1289: <p>To install packages directly from an FTP or HTTP server, run
                   1290:     the following commands in a Bourne-compatible shell (be sure to
1.10      hubertf  1291:     <span class="command"><strong>su</strong></span> to root first):</p>
1.9       rillig   1292: <pre class="screen">
                   1293: <code class="prompt">#</code> <strong class="userinput"><code>PATH="/usr/pkg/sbin:$PATH"</code></strong>
1.179     rillig   1294: 
                   1295: <code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages"</code></strong>
1.169     rillig   1296: <code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="$PKG_PATH/<em class="replaceable"><code>OPSYS</code></em>/<em class="replaceable"><code>ARCH</code></em>/<em class="replaceable"><code>VERSIONS</code></em>/All/"</code></strong>
1.9       rillig   1297: <code class="prompt">#</code> <strong class="userinput"><code>export PATH PKG_PATH</code></strong>
                   1298: </pre>
                   1299: <p>Instead of URLs, you can also use local paths, for example if
                   1300:     you are installing from a set of CDROMs, DVDs or an NFS-mounted
                   1301:     repository. If you want to install packages from multiple sources,
                   1302:     you can separate them by a semicolon in
                   1303:     <code class="varname">PKG_PATH</code>.</p>
                   1304: <p>After these preparations, installing a package is very
                   1305:     easy:</p>
                   1306: <pre class="screen">
1.118     sevan    1307: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add libreoffice</code></strong>
                   1308: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add ap24-php71-*</code></strong>
1.9       rillig   1309: </pre>
1.1       dsieger  1310: <p>Note that any prerequisite packages needed to run the
                   1311:     package in question will be installed, too, assuming they are
                   1312:     present where you install from.</p>
1.23      wiz      1313: <p>Adding packages might install vulnerable packages.
                   1314:     Thus you should run <span class="command"><strong>pkg_admin audit</strong></span>
1.14      jmcneill 1315:     regularly, especially after installing new packages, and verify
                   1316:     that the vulnerabilities are acceptable for your configuration.</p>
1.1       dsieger  1317: <p>After you've installed packages, be sure to have
                   1318:     <code class="filename">/usr/pkg/bin</code> and <code class="filename">/usr/pkg/sbin</code> in your
                   1319:     <code class="varname">PATH</code> so you can actually start the just
                   1320:     installed program.</p>
                   1321: </div>
1.41      asau     1322: <div class="sect2">
1.1       dsieger  1323: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1324: <a name="using.pkg_delete"></a>5.1.3. Deinstalling packages</h3></div></div></div>
1.1       dsieger  1325: <p>To deinstall a package, it does not matter whether it was
                   1326:     installed from source code or from a binary package. The
1.10      hubertf  1327:     <span class="command"><strong>pkg_delete</strong></span> command does not know it anyway.
                   1328:     To delete a package, you can just run <span class="command"><strong>pkg_delete
1.1       dsieger  1329:     <em class="replaceable"><code>package-name</code></em></strong></span>. The package
                   1330:     name can be given with or without version number. Wildcards can
                   1331:     also be used to deinstall a set of packages, for example
                   1332:     <code class="literal">*emacs*</code>. Be sure to include them in quotes,
                   1333:     so that the shell does not expand them before
                   1334:     <code class="literal">pkg_delete</code> sees them.</p>
                   1335: <p>The <code class="option">-r</code> option is very powerful: it
                   1336:     removes all the packages that require the package in question
                   1337:     and then removes the package itself. For example:
                   1338: 
                   1339:     </p>
                   1340: <pre class="screen">
                   1341: <code class="prompt">#</code> <strong class="userinput"><code>pkg_delete -r jpeg</code></strong>
                   1342:     </pre>
                   1343: <p>
                   1344: 
                   1345:     will remove jpeg and all the packages that used it; this allows
                   1346:     upgrading the jpeg package.</p>
                   1347: </div>
1.41      asau     1348: <div class="sect2">
1.1       dsieger  1349: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1350: <a name="using.pkg_info"></a>5.1.4. Getting information about installed packages</h3></div></div></div>
1.10      hubertf  1351: <p>The <span class="command"><strong>pkg_info</strong></span> shows information about
1.1       dsieger  1352:     installed packages or binary package files.</p>
                   1353: </div>
1.41      asau     1354: <div class="sect2">
1.1       dsieger  1355: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1356: <a name="vulnerabilities"></a>5.1.5. Checking for security vulnerabilities in installed packages</h3></div></div></div>
1.1       dsieger  1357: <p>
1.164     leot     1358:       The pkgsrc Security Team and Packages Groups maintain a list of
1.1       dsieger  1359:       known security vulnerabilities to packages which are (or have been)
                   1360:       included in pkgsrc.  The list is available from the NetBSD
1.179     rillig   1361:       
                   1362:       FTP site at <a class="ulink" href="http://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">http://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a>.
1.1       dsieger  1363:     </p>
                   1364: <p>
1.22      jakllsch 1365:       Through <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
1.1       dsieger  1366:       this list can be downloaded
                   1367:       automatically, and a security audit of all packages installed on a system
                   1368:       can take place.
                   1369:     </p>
                   1370: <p>
1.22      jakllsch 1371:       There are two components to auditing.  The first
                   1372:       step, <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
                   1373:       is for downloading
1.1       dsieger  1374:       the list of vulnerabilities from the NetBSD FTP site.  The second
1.22      jakllsch 1375:       step, <span class="command"><strong>pkg_admin audit</strong></span>, checks to see if any of your
1.1       dsieger  1376:       installed packages are vulnerable.  If a package is vulnerable, you
                   1377:       will see output similar to the following:
                   1378:     </p>
                   1379: <pre class="screen">Package samba-2.0.9 has a local-root-shell vulnerability, see
1.174     leot     1380:     https://www.samba.org/samba/whatsnew/macroexploit.html</pre>
1.1       dsieger  1381: <p>
1.22      jakllsch 1382:       You may wish to have the
1.179     rillig   1383:       
                   1384:       <a class="ulink" href="http://ftp.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">vulnerabilities</a>
1.22      jakllsch 1385:       file downloaded daily so that
                   1386:       it remains current.  This may be done by adding an appropriate entry
1.174     leot     1387:       to the root users <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?crontab+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span></a> entry.  For example the entry
1.22      jakllsch 1388:       </p>
                   1389: <pre class="screen">
1.121     sevan    1390: # Download vulnerabilities file
1.118     sevan    1391: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities &gt;/dev/null 2&gt;&amp;1
1.121     sevan    1392: # Audit the installed packages and email results to root
                   1393: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
                   1394:            root &gt;/dev/null 2&gt;&amp;1
1.22      jakllsch 1395:       </pre>
                   1396: <p>
1.118     sevan    1397:       will update the vulnerability list every day at 3AM, followed by an audit
                   1398:       at 3:09AM. The result of the audit are then emailed to root.
1.22      jakllsch 1399: 
1.118     sevan    1400:       On NetBSD this may be accomplished instead by adding the following
                   1401:       line to <code class="filename">/etc/daily.conf</code>:
                   1402:       </p>
                   1403: <pre class="screen">
                   1404: fetch_pkg_vulnerabilities=YES
                   1405:       </pre>
                   1406: <p>
                   1407:       to fetch the vulnerability list from the daily security script. The system
                   1408:       is set to audit the packages by default but can be set explicitly, if
1.123     wiz      1409:       desired (not required), by adding the following line to
1.118     sevan    1410: <code class="filename">/etc/security.conf</code>:
1.22      jakllsch 1411:       </p>
                   1412: <pre class="screen">
1.118     sevan    1413: check_pkg_vulnerabilities=YES
1.22      jakllsch 1414:       </pre>
                   1415: <p>
1.174     leot     1416:       see <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?daily.conf+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">daily.conf</span>(5)</span></a> and <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?security.conf+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">security.conf</span>(5)</span></a> for more details.
1.1       dsieger  1417:     </p>
                   1418: </div>
1.41      asau     1419: <div class="sect2">
1.1       dsieger  1420: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1421: <a name="pkg_versions"></a>5.1.6. Finding if newer versions of your installed packages are in pkgsrc</h3></div></div></div>
1.1       dsieger  1422: <p>
1.137     leot     1423:       Install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/README.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a> and run
1.23      wiz      1424:       <span class="command"><strong>lintpkgsrc</strong></span> with the <span class="quote">&#8220;<span class="quote">-i</span>&#8221;</span>
1.1       dsieger  1425:       argument to check if your packages are up-to-date, e.g.
                   1426:     </p>
                   1427: <pre class="screen">
                   1428: <code class="prompt">%</code> <strong class="userinput"><code>lintpkgsrc -i</code></strong>
                   1429: ...
                   1430: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
                   1431:     </pre>
1.10      hubertf  1432: <p>You can then use <span class="command"><strong>make update</strong></span> to update the
1.1       dsieger  1433:     package on your system and rebuild any dependencies.
                   1434:     </p>
                   1435: </div>
1.41      asau     1436: <div class="sect2">
1.1       dsieger  1437: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1438: <a name="using.pkg_admin"></a>5.1.7. Other administrative functions</h3></div></div></div>
1.10      hubertf  1439: <p>The <span class="command"><strong>pkg_admin</strong></span> executes various
1.1       dsieger  1440:     administrative functions on the package system.</p>
                   1441: </div>
                   1442: </div>
1.41      asau     1443: <div class="sect1">
1.1       dsieger  1444: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1445: <a name="building-packages-from-source"></a>5.2. Building packages from source</h2></div></div></div>
1.1       dsieger  1446: <p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code>
                   1447:   directory now contains a set of packages, organized into
                   1448:   categories. You can browse the online index of packages, or run
1.10      hubertf  1449:   <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code>
1.1       dsieger  1450:   directory to build local <code class="filename">README.html</code> files for
1.137     leot     1451:   all packages, viewable with any web browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/README.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a>.</p>
1.1       dsieger  1452: <p>The default <span class="emphasis"><em>prefix</em></span> for installed packages
                   1453:   is <code class="filename">/usr/pkg</code>. If you wish to change this, you
                   1454:   should do so by setting <code class="varname">LOCALBASE</code> in
1.10      hubertf  1455:   <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. You should not try to use multiple
1.1       dsieger  1456:   different <code class="varname">LOCALBASE</code> definitions on the same
                   1457:   system (inside a chroot is an exception). </p>
                   1458: <p>The rest of this chapter assumes that the package is already
1.10      hubertf  1459:   in pkgsrc. If it is not, see <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, &#8220;The pkgsrc developer's guide&#8221;</a> for
1.1       dsieger  1460:   instructions how to create your own packages.</p>
1.41      asau     1461: <div class="sect2">
1.1       dsieger  1462: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1463: <a name="requirements"></a>5.2.1. Requirements</h3></div></div></div>
1.1       dsieger  1464: <p>To build packages from source, you need a working C
                   1465:     compiler. On NetBSD, you need to install the
1.23      wiz      1466:     <span class="quote">&#8220;<span class="quote">comp</span>&#8221;</span> and the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> distribution
1.1       dsieger  1467:     sets. If you want to build X11-related packages, the
1.23      wiz      1468:     <span class="quote">&#8220;<span class="quote">xbase</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">xcomp</span>&#8221;</span> distribution
1.1       dsieger  1469:     sets are required, too.</p>
                   1470: </div>
1.41      asau     1471: <div class="sect2">
1.1       dsieger  1472: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1473: <a name="fetching-distfiles"></a>5.2.2. Fetching distfiles</h3></div></div></div>
1.1       dsieger  1474: <p>The first step for building a package is downloading the
                   1475:     distfiles (i.e. the unmodified source). If they have not yet been
                   1476:     downloaded, pkgsrc will fetch them automatically.</p>
                   1477: <p>If you have all files that you need in the
                   1478:     <code class="filename">distfiles</code> directory,
                   1479:     you don't need to connect. If the distfiles are on CD-ROM, you can
                   1480:     mount the CD-ROM on <code class="filename">/cdrom</code> and add:
                   1481:     </p>
                   1482: <pre class="screen">DISTDIR=/cdrom/pkgsrc/distfiles</pre>
                   1483: <p>
1.10      hubertf  1484:     to your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.1       dsieger  1485: <p>By default a list of distribution sites will be randomly
                   1486:     intermixed to prevent huge load on servers which holding popular
                   1487:     packages (for example, SourceForge.net mirrors). Thus, every
                   1488:     time when you need to fetch yet another distfile all the mirrors
                   1489:     will be tried in new (random) order. You can turn this feature
                   1490:     off by setting <code class="varname">MASTER_SORT_RANDOM=NO</code> (for
                   1491:     <code class="varname">PKG_DEVELOPER</code>s it's already disabled).</p>
                   1492: <p>You can overwrite some of the major distribution sites to
                   1493:     fit to sites that are close to your own.  By setting one or two
                   1494:     variables you can modify the order in which the master sites are
                   1495:     accessed.  <code class="varname">MASTER_SORT</code> contains a whitespace
                   1496:     delimited list of domain suffixes.
                   1497:     <code class="varname">MASTER_SORT_REGEX</code> is even more flexible, it
                   1498:     contains a whitespace delimited list of regular expressions.  It
                   1499:     has higher priority than <code class="varname">MASTER_SORT</code>.  Have a
                   1500:     look at <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   1501:     some examples.  This may save some of your bandwidth and
                   1502:     time.</p>
                   1503: <p>You can change these settings either in your shell's environment, or,
                   1504:     if you want to keep the settings, by editing the
1.10      hubertf  1505:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file,
1.1       dsieger  1506:     and adding the definitions there.</p>
                   1507: <p>
                   1508:       If a package depends on many other packages (such as
1.137     leot     1509:       <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/README.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a>), the build process may
1.1       dsieger  1510:       alternate between periods of
                   1511:       downloading source, and compiling. To ensure you have all the source
                   1512:       downloaded initially you can run the command:
                   1513:       </p>
                   1514: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch-list | sh</code></strong></pre>
                   1515: <p>
                   1516:       which will output and run a set of shell commands to fetch the
                   1517:       necessary files into the <code class="filename">distfiles</code> directory.  You can
                   1518:       also choose to download the files manually.
                   1519:     </p>
                   1520: </div>
1.41      asau     1521: <div class="sect2">
1.1       dsieger  1522: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1523: <a name="how-to-build-and-install"></a>5.2.3. How to build and install</h3></div></div></div>
1.1       dsieger  1524: <p>
                   1525:       Once the software has downloaded, any patches will be applied, then it
                   1526:       will be compiled for you. This may take some time depending on your
                   1527:       computer, and how many other packages the software depends on and their
                   1528:       compile time.
                   1529:     </p>
1.41      asau     1530: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  1531: <h3 class="title">Note</h3>
                   1532: <p>If using bootstrap or pkgsrc on a non-NetBSD system,
1.10      hubertf  1533:     use the pkgsrc <span class="command"><strong>bmake</strong></span> command instead of
1.23      wiz      1534:     <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> in the examples in this guide.</p>
1.1       dsieger  1535: </div>
                   1536: <p>For example, type</p>
                   1537: <pre class="screen">
                   1538: <code class="prompt">%</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
                   1539: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
                   1540:     </pre>
                   1541: <p>at the shell prompt to build the various components of the
                   1542:     package.</p>
                   1543: <p>The next stage is to actually install the newly compiled
                   1544:     program onto your system. Do this by entering:
                   1545: 
                   1546:     </p>
                   1547: <pre class="screen">
                   1548: <code class="prompt">%</code> <strong class="userinput"><code>make install</code></strong>
                   1549:     </pre>
                   1550: <p>
                   1551: 
                   1552:     while you are still in the directory for whatever package you
                   1553:     are installing.</p>
                   1554: <p>Installing the package on your system may require you to
                   1555:     be root.  However, pkgsrc has a
                   1556:     <span class="emphasis"><em>just-in-time-su</em></span> feature, which allows you
                   1557:     to only become root for the actual installation step.</p>
                   1558: <p>That's it, the software should now be installed and setup for use.
                   1559:     You can now enter:
                   1560: 
                   1561:     </p>
                   1562: <pre class="screen">
                   1563: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong>
                   1564:     </pre>
                   1565: <p>
                   1566: 
                   1567:     to remove the compiled files in the work directory, as you shouldn't need
                   1568:     them any more. If other packages were also added to your system
                   1569:     (dependencies) to allow your program to compile, you can tidy these up
                   1570:     also with the command:</p>
                   1571: <pre class="screen">
                   1572: <code class="prompt">%</code> <strong class="userinput"><code>make clean-depends</code></strong>
                   1573:     </pre>
                   1574: <p>Taking the figlet utility as an example, we can install it on our
1.10      hubertf  1575:     system by building as shown in <a class="xref" href="#logs" title="Appendix B. Build logs">Appendix B, <i>Build logs</i></a>.</p>
1.1       dsieger  1576: <p>The program is installed under the default root of the
                   1577:     packages tree - <code class="filename">/usr/pkg</code>. Should this not
                   1578:     conform to your tastes, set the <code class="varname">LOCALBASE</code>
                   1579:     variable in your environment, and it will use that value as the
                   1580:     root of your packages tree. So, to use
                   1581:     <code class="filename">/usr/local</code>, set
                   1582:     <code class="varname">LOCALBASE=/usr/local</code> in your environment.
                   1583:     Please note that you should use a directory which is dedicated to
                   1584:     packages and not shared with other programs (i.e., do not try and
                   1585:     use <code class="varname">LOCALBASE=/usr</code>).  Also, you should not try
                   1586:     to add any of your own files or directories (such as
                   1587:     <code class="filename">src/</code>, <code class="filename">obj/</code>, or
                   1588:     <code class="filename">pkgsrc/</code>) below the
                   1589:     <code class="varname">LOCALBASE</code> tree.  This is to prevent possible
                   1590:     conflicts between programs and other files installed by the
                   1591:     package system and whatever else may have been installed
                   1592:     there.</p>
1.10      hubertf  1593: <p>Some packages look in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.1       dsieger  1594:     alter some configuration options at build time.  Have a look at
                   1595:     <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to get an overview
                   1596:     of what will be set there by default.  Environment variables such
                   1597:     as <code class="varname">LOCALBASE</code> can be set in
1.10      hubertf  1598:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to save having to remember to
1.1       dsieger  1599:     set them each time you want to use pkgsrc.</p>
1.23      wiz      1600: <p>Occasionally, people want to <span class="quote">&#8220;<span class="quote">look under the
                   1601:     covers</span>&#8221;</span> to see what is going on when a package is building
1.1       dsieger  1602:     or being installed. This may be for debugging purposes, or out of
                   1603:     simple curiosity. A number of utility values have been added to
                   1604:     help with this.</p>
1.23      wiz      1605: <div class="orderedlist"><ol class="orderedlist" type="1">
                   1606: <li class="listitem">
1.174     leot     1607: <p>If you invoke the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> command with
1.1       dsieger  1608:        <code class="varname">PKG_DEBUG_LEVEL=2</code>, then a huge amount of
                   1609:        information will be displayed. For example,</p>
                   1610: <pre class="screen"><strong class="userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong></pre>
                   1611: <p>will show all the commands that are invoked, up to and
1.23      wiz      1612:        including the <span class="quote">&#8220;<span class="quote">patch</span>&#8221;</span> stage.</p>
1.1       dsieger  1613: </li>
1.23      wiz      1614: <li class="listitem">
1.174     leot     1615: <p>If you want to know the value of a certain <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1.1       dsieger  1616:        definition, then the <code class="varname">VARNAME</code> definition
                   1617:        should be used, in conjunction with the show-var
1.174     leot     1618:        target. e.g. to show the expansion of the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1.1       dsieger  1619:        variable <code class="varname">LOCALBASE</code>:</p>
                   1620: <pre class="screen">
                   1621: <code class="prompt">%</code> <strong class="userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
                   1622: /usr/pkg
                   1623: <code class="prompt">%</code>
                   1624:        </pre>
                   1625: </li>
                   1626: </ol></div>
                   1627: <p>If you want to install a binary package that you've either
                   1628:     created yourself (see next section), that you put into
                   1629:     pkgsrc/packages manually or that is located on a remote FTP
                   1630:     server, you can use the "bin-install" target. This target will
1.174     leot     1631:     install a binary package - if available - via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>,
1.10      hubertf  1632:     else do a <span class="command"><strong>make package</strong></span>.  The list of remote FTP
1.1       dsieger  1633:     sites searched is kept in the variable
                   1634:     <code class="varname">BINPKG_SITES</code>, which defaults to
1.174     leot     1635:     ftp.NetBSD.org. Any flags that should be added to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>
1.1       dsieger  1636:     can be put into <code class="varname">BIN_INSTALL_FLAGS</code>.  See
                   1637:     <code class="filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   1638:     details.</p>
                   1639: <p>A final word of warning: If you set up a system that has a
                   1640:     non-standard setting for <code class="varname">LOCALBASE</code>, be sure to
                   1641:     set that before any packages are installed, as you cannot use
                   1642:     several directories for the same purpose. Doing so will result in
                   1643:     pkgsrc not being able to properly detect your installed packages,
                   1644:     and fail miserably. Note also that precompiled binary packages are
                   1645:     usually built with the default <code class="varname">LOCALBASE</code> of
                   1646:     <code class="filename">/usr/pkg</code>, and that you should
                   1647:     <span class="emphasis"><em>not</em></span> install any if you use a non-standard
                   1648:     <code class="varname">LOCALBASE</code>.</p>
                   1649: </div>
                   1650: </div>
                   1651: </div>
1.41      asau     1652: <div class="chapter">
1.1       dsieger  1653: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   1654: <a name="configuring"></a>Chapter 6. Configuring pkgsrc</h2></div></div></div>
1.1       dsieger  1655: <div class="toc">
                   1656: <p><b>Table of Contents</b></p>
1.100     leot     1657: <dl class="toc">
1.154     rillig   1658: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
                   1659: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
                   1660: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
                   1661: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
                   1662: <dd><dl>
                   1663: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
                   1664: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
                   1665: <dt><span class="sect2"><a href="#conf.ldflags">6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.1       dsieger  1666: </dl></dd>
1.154     rillig   1667: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
                   1668: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.1       dsieger  1669: </dl>
                   1670: </div>
1.4       rillig   1671: <a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually
1.1       dsieger  1672: called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for
                   1673: that file depends on the installation. On NetBSD, when you use
1.174     leot     1674: <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> from the base system, it is in the directory
1.1       dsieger  1675: <code class="filename">/etc/</code>. In all other cases the default location is
                   1676: <code class="literal">${PREFIX}/etc/</code>, depending on where you told the
                   1677: bootstrap program to install the binary packages.</p>
                   1678: <p>The format of the configuration file is that of the usual
                   1679: BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration
                   1680: is done by setting variables in this file. Note that you can define all
                   1681: kinds of variables, and no special error checking (for example for
1.112     rillig   1682: spelling mistakes) takes place.</p>
1.41      asau     1683: <div class="sect1">
1.1       dsieger  1684: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1685: <a name="general-configuration"></a>6.1. General configuration</h2></div></div></div>
1.112     rillig   1686: <p>The following variables apply to all
1.1       dsieger  1687:     pkgsrc packages. A complete list of the variables that can be
                   1688:     configured by the user is available in
                   1689:     <code class="filename">mk/defaults/mk.conf</code>, together with some
                   1690:     comments that describe each variable's intent.</p>
1.41      asau     1691: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      1692: <li class="listitem"><p><code class="varname">LOCALBASE</code>: Where
1.1       dsieger  1693:            packages will be installed. The default is
                   1694:            <code class="filename">/usr/pkg</code>. Do not mix binary packages
                   1695:            with different <code class="varname">LOCALBASE</code>s!</p></li>
1.23      wiz      1696: <li class="listitem"><p><code class="varname">CROSSBASE</code>: Where
                   1697:            <span class="quote">&#8220;<span class="quote">cross</span>&#8221;</span> category packages will be
1.1       dsieger  1698:            installed. The default is
                   1699:            <code class="filename">${LOCALBASE}/cross</code>.</p></li>
1.23      wiz      1700: <li class="listitem"><p><code class="varname">X11BASE</code>: Where
1.1       dsieger  1701:            X11 is installed on the system. The default is
1.84      wiz      1702:            <code class="filename">/usr/X11R7</code>.</p></li>
1.23      wiz      1703: <li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the
1.1       dsieger  1704:            downloaded copies of the original source distributions used
                   1705:            for building pkgsrc packages. The default is
                   1706:            <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li>
1.23      wiz      1707: <li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the
1.1       dsieger  1708:            database about installed packages is stored.  The default is
1.118     sevan    1709:            <code class="filename">/usr/pkg/pkgdb</code>.</p></li>
1.23      wiz      1710: <li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>:
1.1       dsieger  1711:            If set, override the packages'
                   1712:            <code class="varname">MASTER_SITES</code> with this value.</p></li>
1.23      wiz      1713: <li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>:
1.1       dsieger  1714:            Backup location(s) for distribution files and patch files
                   1715:            if not found locally or in
                   1716:            <code class="filename">${MASTER_SITES}</code> or
                   1717:            <code class="filename">${PATCH_SITES}</code> respectively.
1.118     sevan    1718:            The defaults is
                   1719:            <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li>
1.23      wiz      1720: <li class="listitem"><p><code class="varname">BINPKG_SITES</code>:
1.1       dsieger  1721:            List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and
                   1722:            <em class="replaceable"><code>arch</code></em> are replaced with OS
1.23      wiz      1723:            release (<span class="quote">&#8220;<span class="quote">2.0</span>&#8221;</span>, etc.) and architecture
                   1724:            (<span class="quote">&#8220;<span class="quote">mipsel</span>&#8221;</span>, etc.).</p></li>
                   1725: <li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
1.22      jakllsch 1726:            List of acceptable licenses. License names are case-sensitive.
                   1727:            Whenever you try to build a package whose license is not in this
                   1728:            list, you will get an error message. If the license condition is
                   1729:            simple enough, the error message will include specific
                   1730:            instructions on how to change this variable.</p></li>
1.1       dsieger  1731: </ul></div>
                   1732: </div>
1.41      asau     1733: <div class="sect1">
1.1       dsieger  1734: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1735: <a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div>
1.108     rillig   1736: <p>
1.1       dsieger  1737:       </p>
1.41      asau     1738: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      1739: <li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
1.1       dsieger  1740:            directory for the binary packages. The default is
                   1741:            <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
1.23      wiz      1742: <li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
1.1       dsieger  1743:            The top level directory where, if defined, the separate
                   1744:            working directories will get created, and symbolically
                   1745:            linked to from <code class="filename">${WRKDIR}</code> (see below).
                   1746:            This is useful for building packages on several
                   1747:            architectures, then <code class="filename">${PKGSRCDIR}</code>
                   1748:            can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
                   1749:            is local to every architecture. (It should be noted that
                   1750:            <code class="varname">PKGSRCDIR</code> should not be set by the user
1.14      jmcneill 1751:            &mdash; it is an internal definition which refers to the
1.1       dsieger  1752:            root of the pkgsrc tree. It is possible to have many
                   1753:            pkgsrc tree instances.)</p></li>
1.23      wiz      1754: <li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
1.1       dsieger  1755:            Directory for local patches that aren't part of pkgsrc.
1.154     rillig   1756:            See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more
1.1       dsieger  1757:            information.</p></li>
1.23      wiz      1758: <li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
1.10      hubertf  1759:            the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
1.1       dsieger  1760:            BSD-style Makefile. If this is not set,
                   1761:            <code class="varname">MAKECONF</code> is set to
                   1762:            <code class="filename">/dev/null</code> to avoid picking up
                   1763:            settings used by builds in <code class="filename">/usr/src</code>.</p></li>
                   1764: </ul></div>
                   1765: </div>
1.41      asau     1766: <div class="sect1">
1.1       dsieger  1767: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1768: <a name="variables-affecting-installation"></a>6.3. Variables affecting the installation process</h2></div></div></div>
1.143     maya     1769: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="varname">PKGSRC_KEEP_BIN_PKGSRC</code>:
                   1770:                 By default, binary packages of built packages are
1.150     leot     1771:                 preserved in <code class="filename">${PACKAGES}/All</code>. Setting
1.143     maya     1772:                this variable to "no" prevents this.</p></li></ul></div>
1.107     jnemeth  1773: <p>Packages have to support installation into a
1.4       rillig   1774:     subdirectory of <code class="varname">WRKDIR</code>. This allows a package
                   1775:     to be built, before the actual filesystem is touched. DESTDIR
                   1776:     support exists in two variations:</p>
1.41      asau     1777: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      1778: <li class="listitem"><p>Basic DESTDIR support means that the package
1.24      wiz      1779:       installation and packaging is still run as root.</p></li>
                   1780: <li class="listitem"><p>Full DESTDIR support can run the complete
                   1781:       build, installation and packaging as normal user. Root
                   1782:       privileges are only needed to add packages.</p></li>
                   1783: </ul></div>
1.4       rillig   1784: <p>With basic DESTDIR support, <strong class="userinput"><code>make
                   1785:     clean</code></strong> needs to be run as root.</p>
1.17      imil     1786: <p>Considering the <code class="filename">foo/bar</code> package,
                   1787:     DESTDIR full support can be tested using the following commands
                   1788: 
                   1789: </p>
                   1790: <pre class="programlisting">
                   1791: <code class="prompt">$</code> id
                   1792: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
                   1793: <code class="prompt">$</code> mkdir $HOME/packages
                   1794: <code class="prompt">$</code> cd $PKGSRCDIR/foo/bar
                   1795: </pre>
                   1796: <p>
                   1797: 
                   1798:     Verify <code class="varname">DESTDIR</code> full support, no root privileges
                   1799:     should be needed
                   1800: 
                   1801: </p>
                   1802: <pre class="programlisting">
1.66      asau     1803: <code class="prompt">$</code> make stage-install
1.17      imil     1804: </pre>
                   1805: <p>
                   1806: 
                   1807:     Create a package without root privileges
                   1808: 
                   1809: </p>
                   1810: <pre class="programlisting">
1.66      asau     1811: <code class="prompt">$</code> make PACKAGES=$HOME/packages package
1.17      imil     1812: </pre>
                   1813: <p>
                   1814: 
                   1815:     For the following command, you must be able to gain root
1.174     leot     1816:     privileges using <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a>
1.17      imil     1817: 
                   1818: </p>
                   1819: <pre class="programlisting">
1.66      asau     1820: <code class="prompt">$</code> make PACKAGES=$HOME/packages install
1.17      imil     1821: </pre>
                   1822: <p>
                   1823: 
                   1824:     Then, as a simple user
                   1825: 
                   1826: </p>
                   1827: <pre class="programlisting">
                   1828: <code class="prompt">$</code> make clean
                   1829: </pre>
                   1830: <p>
                   1831: 
                   1832:     </p>
1.4       rillig   1833: </div>
1.41      asau     1834: <div class="sect1">
1.4       rillig   1835: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1836: <a name="conf.compiler"></a>6.4. Selecting and configuring the compiler</h2></div></div></div>
1.41      asau     1837: <div class="sect2">
1.1       dsieger  1838: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1839: <a name="selecting-the-compiler"></a>6.4.1. Selecting the compiler</h3></div></div></div>
1.1       dsieger  1840: <p>By default, pkgsrc will use GCC to build packages.  This may be
                   1841:     overridden by setting the following variables in /etc/mk.conf:</p>
1.41      asau     1842: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  1843: <dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt>
                   1844: <dd>
                   1845: <p>This is a list of values specifying the chain of
                   1846:          compilers to invoke when building packages.  Valid values
                   1847:          are:</p>
1.41      asau     1848: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.66      asau     1849: <li class="listitem"><p><code class="varname">ccc</code>:
                   1850:            Compaq C Compilers (Tru64)</p></li>
                   1851: <li class="listitem"><p><code class="varname">ccache</code>:
                   1852:            compiler cache (chainable)</p></li>
                   1853: <li class="listitem"><p><code class="varname">clang</code>:
                   1854:            Clang C and Objective-C compiler</p></li>
1.23      wiz      1855: <li class="listitem"><p><code class="varname">distcc</code>:
1.1       dsieger  1856:            distributed C/C++ (chainable)</p></li>
1.66      asau     1857: <li class="listitem"><p><code class="varname">f2c</code>:
                   1858:            Fortran 77 to C compiler (chainable)</p></li>
                   1859: <li class="listitem"><p><code class="varname">icc</code>:
                   1860:            Intel C++ Compiler (Linux)</p></li>
                   1861: <li class="listitem"><p><code class="varname">ido</code>:
                   1862:            SGI IRIS Development Option cc (IRIX 5)</p></li>
1.23      wiz      1863: <li class="listitem"><p><code class="varname">gcc</code>:
1.1       dsieger  1864:            GNU C/C++ Compiler</p></li>
1.66      asau     1865: <li class="listitem"><p><code class="varname">hp</code>:
                   1866:            HP-UX C/aC++ compilers</p></li>
1.23      wiz      1867: <li class="listitem"><p><code class="varname">mipspro</code>:
1.1       dsieger  1868:            Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li>
1.66      asau     1869: <li class="listitem"><p><code class="varname">mipspro-ucode</code>:
1.1       dsieger  1870:            Silicon Graphics, Inc. MIPSpro (o32)</p></li>
1.23      wiz      1871: <li class="listitem"><p><code class="varname">sunpro</code>:
1.1       dsieger  1872:            Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li>
1.66      asau     1873: <li class="listitem"><p><code class="varname">xlc</code>:
1.118     sevan    1874:            IBM's XL C/C++ compiler suite</p></li>
1.1       dsieger  1875: </ul></div>
                   1876: <p>The default is
1.23      wiz      1877:          <span class="quote">&#8220;<span class="quote"><code class="varname">gcc</code></span>&#8221;</span>.  You can use
1.1       dsieger  1878:          <code class="varname">ccache</code> and/or
                   1879:          <code class="varname">distcc</code> with an appropriate
                   1880:          <code class="varname">PKGSRC_COMPILER</code> setting,
1.23      wiz      1881:          e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">ccache gcc</code></span>&#8221;</span>.  This
1.1       dsieger  1882:          variable should always be terminated with a value for
                   1883:          a real compiler.  Note that only one real compiler
1.23      wiz      1884:          should be listed (e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">sunpro gcc</code></span>&#8221;</span>
1.1       dsieger  1885:          is not allowed).</p>
                   1886: </dd>
                   1887: <dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt>
                   1888: <dd><p>This specifies the minimum version of GCC to use
                   1889:          when building packages.  If the system GCC doesn't
                   1890:          satisfy this requirement, then pkgsrc will build and
                   1891:          install one of the GCC packages to use instead.</p></dd>
1.153     leot     1892: <dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt>
1.114     maya     1893: <dd><p>Specifies which version of python to use when several
                   1894:          options are available.</p></dd>
                   1895: <dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt>
1.176     gutterid 1896: <dd><p>Specifies the Fortran compiler to use.
                   1897:          The default is <code class="varname">gfortran</code>.</p></dd>
1.114     maya     1898: <dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt>
                   1899: <dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code>
                   1900:          <code class="varname">gfortran</code> is used, this option specifies which
                   1901:          version to use.</p></dd>
1.1       dsieger  1902: </dl></div>
                   1903: </div>
1.41      asau     1904: <div class="sect2">
1.1       dsieger  1905: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1906: <a name="conf.cflags"></a>6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div>
1.1       dsieger  1907: <p>If you wish to set the <code class="varname">CFLAGS</code> variable,
                   1908:        please make sure to use the <code class="literal">+=</code> operator
                   1909:        instead of the <code class="literal">=</code> operator:</p>
                   1910: <pre class="programlisting">
                   1911: CFLAGS+=        -your -flags
                   1912: </pre>
                   1913: <p>Using <code class="varname">CFLAGS=</code> (i.e. without the
1.23      wiz      1914:        <span class="quote">&#8220;<span class="quote">+</span>&#8221;</span>) may lead to problems with packages that
1.16      jnemeth  1915:        need to add their own flags.  You may want to take a look
1.137     leot     1916:        at the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/README.html" target="_top"><code class="filename">devel/cpuflags</code></a>
1.23      wiz      1917:        package if you're interested in optimization specifically
                   1918:        for the current CPU. </p>
1.1       dsieger  1919: </div>
1.41      asau     1920: <div class="sect2">
1.1       dsieger  1921: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   1922: <a name="conf.ldflags"></a>6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div>
1.1       dsieger  1923: <p>If you want to pass flags to the linker, both in the configure
                   1924: step and the build step, you can do this in two ways.  Either set
                   1925: <code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>.  The difference
                   1926: between the two is that <code class="varname">LIBS</code> will be appended to
                   1927: the command line, while <code class="varname">LDFLAGS</code> come earlier.
                   1928: <code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF
                   1929: machines depending on the setting of <code class="varname">USE_IMAKE</code> or
                   1930: the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>.  As with
                   1931: <code class="varname">CFLAGS</code>, if you do not wish to override these
                   1932: settings, use the <code class="literal">+=</code> operator:</p>
                   1933: <pre class="programlisting">
                   1934: LDFLAGS+=        -your -linkerflags
                   1935: </pre>
                   1936: </div>
                   1937: </div>
1.41      asau     1938: <div class="sect1">
1.1       dsieger  1939: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1940: <a name="developer-advanced-settings"></a>6.5. Developer/advanced settings</h2></div></div></div>
1.84      wiz      1941: <p>
1.1       dsieger  1942:       </p>
1.41      asau     1943: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      1944: <li class="listitem">
1.1       dsieger  1945: <p><code class="varname">PKG_DEVELOPER</code>:
                   1946:            Run some sanity checks that package developers want:
                   1947:            </p>
1.41      asau     1948: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
1.23      wiz      1949: <li class="listitem"><p>make sure patches apply with zero
1.1       dsieger  1950:              fuzz</p></li>
1.23      wiz      1951: <li class="listitem"><p>run check-shlibs to see that all
1.1       dsieger  1952:              binaries will find their shared libs.</p></li>
                   1953: </ul></div>
                   1954: <p>
                   1955:        </p>
                   1956: </li>
1.23      wiz      1957: <li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level
1.1       dsieger  1958:        of debugging output which is displayed whilst making and
                   1959:        installing the package.  The default value for this is 0,
                   1960:        which will not display the commands as they are executed
                   1961:        (normal, default, quiet operation); the value 1 will display
                   1962:        all shell commands before their invocation, and the value 2
                   1963:        will display both the shell commands before their invocation,
1.112     rillig   1964:        as well as their actual execution progress with <span class="command"><strong>set
                   1965:        -x</strong></span>.</p></li>
1.1       dsieger  1966: </ul></div>
                   1967: <p>
                   1968:     </p>
                   1969: </div>
1.41      asau     1970: <div class="sect1">
1.1       dsieger  1971: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   1972: <a name="selecting-build-options"></a>6.6. Selecting Build Options</h2></div></div></div>
1.1       dsieger  1973: <p>Some packages have build time options, usually to select
                   1974:     between different dependencies, enable optional support for big
                   1975:     dependencies or enable experimental features.</p>
                   1976: <p>To see which options, if any, a package supports, and which
1.10      hubertf  1977:     options are mutually exclusive, run <span class="command"><strong>make
1.1       dsieger  1978:     show-options</strong></span>, for example:</p>
                   1979: <pre class="programlisting">
                   1980:     The following options are supported by this package:
                   1981:         ssl      Enable SSL support.
                   1982:     Exactly one of the following gecko options is required:
                   1983:         firefox  Use firefox as gecko rendering engine.
                   1984:         mozilla  Use mozilla as gecko rendering engine.
                   1985:     At most one of the following database options may be selected:
                   1986:         mysql    Enable support for MySQL database.
                   1987:         pgsql    Enable support for PostgreSQL database.
                   1988: 
                   1989:     These options are enabled by default: firefox
                   1990:     These options are currently enabled: mozilla ssl
                   1991: </pre>
                   1992: <p>The following variables can be defined in
1.10      hubertf  1993:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to select which options to
1.1       dsieger  1994:     enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>,
                   1995:     which can be used to select or disable options for all packages
                   1996:     that support them, and
                   1997:     <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>,
                   1998:     which can be used to select or disable options specifically for
                   1999:     package <em class="replaceable"><code>pkgbase</code></em>.  Options listed in
1.23      wiz      2000:     these variables are selected, options preceded by <span class="quote">&#8220;<span class="quote">-</span>&#8221;</span>
1.1       dsieger  2001:     are disabled. A few examples:</p>
                   2002: <pre class="screen">
1.10      hubertf  2003: <code class="prompt">$</code> <span class="command"><strong>grep "PKG.*OPTION" <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a></strong></span>
1.1       dsieger  2004: PKG_DEFAULT_OPTIONS=    -arts -dvdread -esound
                   2005: PKG_OPTIONS.kdebase=    debug -sasl
                   2006: PKG_OPTIONS.apache=     suexec </pre>
1.11      rillig   2007: <p>It is important to note that options that were specifically
1.18      snj      2008:     suggested by the package maintainer must be explicitly removed if
1.11      rillig   2009:     you do not wish to include the option.  If you are unsure you can view
                   2010:     the current state with <span class="command"><strong>make show-options</strong></span>.</p>
1.1       dsieger  2011: <p>The following settings are consulted in the order given, and
                   2012:     the last setting that selects or disables an option is
                   2013:     used:</p>
1.23      wiz      2014: <div class="orderedlist"><ol class="orderedlist" type="1">
                   2015: <li class="listitem"><p>the default options as suggested by the package
1.1       dsieger  2016:       maintainer</p></li>
1.23      wiz      2017: <li class="listitem"><p>the options implied by the settings of legacy
1.1       dsieger  2018:       variables (see below)</p></li>
1.23      wiz      2019: <li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li>
                   2020: <li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li>
1.1       dsieger  2021: </ol></div>
                   2022: <p>For groups of mutually exclusive options, the last option
                   2023:     selected is used, all others are automatically disabled.  If an
                   2024:     option of the group is explicitly disabled, the previously
                   2025:     selected option, if any, is used.  It is an error if no option
                   2026:     from a required group of options is selected, and building the
                   2027:     package will fail.</p>
                   2028: <p>Before the options framework was introduced, build options
                   2029:     were selected by setting a variable (often named
                   2030:     <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in
1.10      hubertf  2031:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> for each option.  To ease
1.1       dsieger  2032:     transition to the options framework for the user, these legacy
                   2033:     variables are converted to the appropriate options setting
                   2034:     (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>)
                   2035:     automatically.  A warning is issued to prompt the user to update
1.10      hubertf  2036:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework
1.1       dsieger  2037:     directly.  Support for the legacy variables will be removed
                   2038:     eventually.</p>
                   2039: </div>
                   2040: </div>
1.41      asau     2041: <div class="chapter">
1.1       dsieger  2042: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   2043: <a name="binary"></a>Chapter 7. Creating binary packages</h2></div></div></div>
1.1       dsieger  2044: <div class="toc">
                   2045: <p><b>Table of Contents</b></p>
1.100     leot     2046: <dl class="toc">
1.154     rillig   2047: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
                   2048: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.1       dsieger  2049: </dl>
                   2050: </div>
1.41      asau     2051: <div class="sect1">
1.1       dsieger  2052: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2053: <a name="building-a-single-binary-package"></a>7.1. Building a single binary package</h2></div></div></div>
1.1       dsieger  2054: <p>Once you have built and installed a package, you can create
                   2055:     a <span class="emphasis"><em>binary package</em></span> which can be installed on
1.174     leot     2056:     another system with <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. This saves having to build
1.1       dsieger  2057:     the same package on a group of hosts and wasting CPU time. It also
                   2058:     provides a simple means for others to install your package, should
                   2059:     you distribute it.</p>
                   2060: <p>To create a binary package, change into the appropriate
1.10      hubertf  2061:     directory in pkgsrc, and run <span class="command"><strong>make
1.1       dsieger  2062:     package</strong></span>:</p>
                   2063: <pre class="screen">
1.112     rillig   2064: <code class="prompt">$</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
                   2065: <code class="prompt">$</code> <strong class="userinput"><code>make package</code></strong>
                   2066: </pre>
1.1       dsieger  2067: <p>This will build and install your package (if not already done),
                   2068:     and then build a binary package from what was installed. You can
1.10      hubertf  2069:     then use the <span class="command"><strong>pkg_*</strong></span> tools to manipulate
1.1       dsieger  2070:     it. Binary packages are created by default in
                   2071:     <code class="filename">/usr/pkgsrc/packages</code>, in the form of a
1.10      hubertf  2072:     gzipped tar file. See <a class="xref" href="#logs.package" title="B.2. Packaging figlet">Section B.2, &#8220;Packaging figlet&#8221;</a> for a
1.137     leot     2073:     continuation of the above <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/misc/figlet/README.html" target="_top"><code class="filename">misc/figlet</code></a> example.</p>
1.154     rillig   2074: <p>See <a class="xref" href="#submit" title="Chapter 23. Submitting and Committing">Chapter 23, <i>Submitting and Committing</i></a> for information on how to submit
1.1       dsieger  2075:     such a binary package.</p>
                   2076: </div>
1.41      asau     2077: <div class="sect1">
1.1       dsieger  2078: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2079: <a name="settings-for-creationg-of-binary-packages"></a>7.2. Settings for creation of binary packages</h2></div></div></div>
                   2080: <p>See <a class="xref" href="#build.helpful-targets" title="19.17. Other helpful targets">Section 19.17, &#8220;Other helpful targets&#8221;</a>.</p>
1.6       rillig   2081: </div>
                   2082: </div>
1.41      asau     2083: <div class="chapter">
1.6       rillig   2084: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   2085: <a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk
1.6       rillig   2086: builds)</h2></div></div></div>
                   2087: <div class="toc">
                   2088: <p><b>Table of Contents</b></p>
1.100     leot     2089: <dl class="toc">
1.154     rillig   2090: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.180     rillig   2091: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.154     rillig   2092: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
                   2093: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.178     rillig   2094: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
                   2095: <dd><dl>
1.179     rillig   2096: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
                   2097: <dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
1.181   ! rillig   2098: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
        !          2099: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
        !          2100: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
        !          2101: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
        !          2102: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
        !          2103: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
        !          2104: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
        !          2105: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.178     rillig   2106: </dl></dd>
                   2107: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
                   2108: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.6       rillig   2109: </dl>
                   2110: </div>
1.175     gutterid 2111: <p>For a number of reasons, you may want to build binary packages
                   2112: for a large selected set of packages in pkgsrc, or even for all pkgsrc packages.
1.71      wiz      2113: For instance, when you have multiple machines that should run the same software,
                   2114: it is wasted time if they all build their packages themselves from source.
                   2115: Or you may want to build a list of packages you want and check them before
1.175     gutterid 2116: deploying onto production systems.
1.71      wiz      2117: There is a way of getting a set of binary packages:
1.175     gutterid 2118: the bulk build system, or pbulk ("p" stands for "parallel").
1.112     rillig   2119: This chapter describes how to set it up.</p>
1.41      asau     2120: <div class="sect1">
1.6       rillig   2121: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2122: <a name="bulk.pre"></a>8.1. Preparations</h2></div></div></div>
1.71      wiz      2123: <p>First of all, you have to decide whether you build all packages
                   2124: or a limited set of them. Full bulk builds usually consume a lot more resources,
                   2125: both space and time, than builds for some practical sets of packages.
1.175     gutterid 2126: A number of particularly heavy packages exist that are not actually
                   2127: interesting to a wide audience. (The approximate resource consumption for a
                   2128: full bulk build is given in section <a class="xref" href="#bulk.req" title="8.3. Requirements of a full bulk build">Section 8.3, &#8220;Requirements of a full bulk build&#8221;</a>.)
                   2129: For limited bulk builds you need to make a list of packages you want to build.
1.112     rillig   2130: Note that all their dependencies will be built, so you don't need to track them manually.
1.71      wiz      2131: </p>
                   2132: <p>During bulk builds various packages are installed and deinstalled
                   2133: in <code class="filename">/usr/pkg</code> (or whatever <code class="filename">LOCALBASE</code> is),
                   2134: so make sure that you don't need any package during the builds.
1.112     rillig   2135: Essentially, you should provide a fresh system, either a chroot environment
1.71      wiz      2136: or something even more restrictive, depending on what the operating system provides,
                   2137: or dedicate the whole physical machine.
                   2138: As a useful side effect this makes sure that bulk builds cannot
                   2139: break anything in your system. There have been numerous cases where
1.6       rillig   2140: certain packages tried to install files outside the
                   2141: <code class="filename">LOCALBASE</code> or wanted to edit some files in
1.71      wiz      2142: <code class="filename">/etc</code>.
                   2143: </p>
1.6       rillig   2144: </div>
1.41      asau     2145: <div class="sect1">
1.6       rillig   2146: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.180     rillig   2147: <a name="bulk.pbulk"></a>8.2. Running a bulk build</h2></div></div></div>
                   2148: <p>Running a bulk build works roughly as follows:</p>
1.41      asau     2149: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      2150: <li class="listitem"><p>First, build the pbulk infrastructure in a fresh pkgsrc location.</p></li>
                   2151: <li class="listitem"><p>Then, build each of the packages from a clean installation directory using the infrastructure.</p></li>
1.15      rillig   2152: </ul></div>
1.41      asau     2153: <div class="sect2">
1.15      rillig   2154: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   2155: <a name="bulk.pbulk.conf"></a>8.2.1. Configuration</h3></div></div></div>
1.112     rillig   2156: <p>To simplify configuration, we provide the helper script <code class="filename">mk/pbulk/pbulk.sh</code>.</p>
1.68      asau     2157: <p>In order to use it, prepare a clear system (real one, chroot environment, jail, zone, virtual machine).
                   2158: Configure network access to fetch distribution files.
1.112     rillig   2159: Create a user with name "pbulk".</p>
1.68      asau     2160: <p>Fetch and extract pkgsrc. Use a command like one of these:</p>
                   2161: <pre class="screen">
1.151     sevan    2162: <code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong>
                   2163: <code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong>
1.72      wiz      2164: <code class="prompt">#</code> <strong class="userinput"><code>(cd /usr &amp;&amp; cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)</code></strong>
1.68      asau     2165: </pre>
                   2166: <p>Or any other way that fits (e.g., curl, wget).</p>
                   2167: <p>Deploy and configure pbulk tools, e.g.:</p>
                   2168: <pre class="screen">
1.118     sevan    2169: <code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -n # use native make, no bootstrap kit needed (for use on NetBSD)</code></strong>
1.68      asau     2170: <code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -n -c mk.conf.frag # native, apply settings from given mk.conf fragment</code></strong>
                   2171: <code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build</code></strong>
                   2172: </pre>
                   2173: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   2174: <h3 class="title">Note</h3>
                   2175: <p><code class="filename">mk.conf.frag</code> is a fragment of
                   2176: <code class="filename">mk.conf</code> that contains settings you want to
                   2177: apply to packages you build. For instance,</p>
                   2178: <pre class="programlisting">
1.112     rillig   2179: PKG_DEVELOPER=          yes     # perform more checks
                   2180: X11_TYPE=               modular # use pkgsrc X11
                   2181: SKIP_LICENSE_CHECK=     yes     # accept all licences (useful
                   2182:                                 # when building all packages)
1.68      asau     2183: </pre>
                   2184: </div>
                   2185: <p>If configured for limited list, replace the list in <code class="filename">/usr/pbulk/etc/pbulk.list</code>
1.112     rillig   2186: with your list of packages, one per line without empty lines or comments. E.g.:</p>
1.68      asau     2187: <pre class="programlisting">
                   2188: www/firefox
                   2189: mail/thunderbird
                   2190: misc/libreoffice4
                   2191: </pre>
1.69      asau     2192: <p>At this point you can also review configuration in <code class="filename">/usr/pbulk/etc</code>
                   2193: and make final amendments, if wanted.</p>
1.68      asau     2194: <p>Start it:</p>
                   2195: <pre class="screen">
                   2196: <code class="prompt">#</code> <strong class="userinput"><code>/usr/pbulk/bin/bulkbuild</code></strong>
                   2197: </pre>
                   2198: <p>After it finishes, you'll have <code class="filename">/mnt</code> filled with distribution files, binary packages, and reports,
                   2199: plain text summary in <code class="filename">/mnt/bulklog/meta/report.txt</code>
                   2200: </p>
                   2201: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   2202: <h3 class="title">Note</h3>
                   2203: <p>The <code class="filename">pbulk.sh</code> script does not cover all possible use cases.
                   2204: While being ready to run, it serves as a good starting point to understand and build more complex setups.
                   2205: The script is kept small enough for better understanding.</p>
                   2206: </div>
                   2207: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   2208: <h3 class="title">Note</h3>
                   2209: <p>The <code class="filename">pbulk.sh</code> script supports running
                   2210: unprivileged bulk build and helps configuring distributed bulk builds.</p>
                   2211: </div>
1.6       rillig   2212: </div>
                   2213: </div>
1.41      asau     2214: <div class="sect1">
1.6       rillig   2215: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2216: <a name="bulk.req"></a>8.3. Requirements of a full bulk build</h2></div></div></div>
1.71      wiz      2217: <p>A complete bulk build requires lots of disk space. Some of the
                   2218: disk space can be read-only, some other must be writable. Some can be on
                   2219: remote filesystems (such as NFS) and some should be local. Some can be
                   2220: temporary filesystems, others must survive a sudden reboot.</p>
                   2221: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   2222: <li class="listitem"><p>40 GB for the distfiles (read-write, remote, temporary)</p></li>
                   2223: <li class="listitem"><p>30 GB for the binary packages (read-write, remote, permanent)</p></li>
                   2224: <li class="listitem"><p>1 GB for the pkgsrc tree (read-only, remote, permanent)</p></li>
                   2225: <li class="listitem"><p>5 GB for <code class="filename">LOCALBASE</code> (read-write, local, temporary)</p></li>
                   2226: <li class="listitem"><p>10 GB for the log files (read-write, remote, permanent)</p></li>
                   2227: <li class="listitem"><p>5 GB for temporary files (read-write, local, temporary)</p></li>
                   2228: </ul></div>
                   2229: </div>
                   2230: <div class="sect1">
                   2231: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.178     rillig   2232: <a name="bulk.var"></a>8.4. Bulk build variants</h2></div></div></div>
                   2233: <p>To ensure that pkgsrc packages work in different configurations, it
                   2234: makes sense to run non-default bulk builds from time to time. This
                   2235: section lists some ideas for bulk builds that intentionally let packages
                   2236: fail if they don't follow the pkgsrc style.</p>
                   2237: <div class="sect2">
                   2238: <div class="titlepage"><div><div><h3 class="title">
1.179     rillig   2239: <a name="bulk.var.confopt"></a>8.4.1. Detect unknown configure options</h3></div></div></div>
1.178     rillig   2240: <p>Add the following line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2241: <pre class="programlisting">
                   2242: GNU_CONFIGURE_STRICT=   yes
                   2243: </pre>
                   2244: <p>When a package fails this additional check, the most common cause
                   2245: is that the configure option was valid for an older version of the
                   2246: package but does not apply anymore. In that case, just remove it.</p>
                   2247: </div>
                   2248: <div class="sect2">
                   2249: <div class="titlepage"><div><div><h3 class="title">
1.179     rillig   2250: <a name="bulk.var.comperr"></a>8.4.2. Detect classes of bugs by forcing compiler warnings</h3></div></div></div>
1.178     rillig   2251: <p>The job of a compiler is not restricted to producing executable
1.179     rillig   2252: code, most compilers also detect typical programming mistakes. The pkgsrc
                   2253: compiler wrappers make it easy to force compiler options when the package
                   2254: is built. This can be used to find typical bugs across all packages that
                   2255: are in pkgsrc. By reporting these bugs upstream, the packages will be
                   2256: more reliable with the next updates.</p>
                   2257: <p>Add some of the following lines to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
1.178     rillig   2258: <pre class="programlisting">
                   2259: CFLAGS+=        -Werror=char-subscripts
1.179     rillig   2260: CFLAGS+=        -Werror=implicit-function-declaration
1.178     rillig   2261: </pre>
1.179     rillig   2262: <p>When a package fails to build using these stricter compiler
                   2263: options, document the circumstances in which the compiler produced the
                   2264: error message. This includes:</p>
1.178     rillig   2265: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   2266: <li class="listitem"><p>The platform
                   2267: (<code class="varname">MACHINE_PLATFORM</code>)</p></li>
                   2268: <li class="listitem"><p>The source file</p></li>
                   2269: <li class="listitem"><p>An excerpt of the code. GCC and Clang already do this as
                   2270: part of the diagnostic.</p></li>
1.179     rillig   2271: <li class="listitem"><p>The exact error message from the compiler.</p></li>
1.178     rillig   2272: </ul></div>
                   2273: <p>If a package produces these error messages, but the package is
1.179     rillig   2274: fine, record this in your local <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, like this, to skip this check
                   2275: in the next builds:</p>
1.178     rillig   2276: <pre class="programlisting">
1.179     rillig   2277: .if ${PKGPATH} == category/package
1.178     rillig   2278: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
                   2279: # error message
                   2280: # code
1.179     rillig   2281: # Reason why the code does not need to be fixed.
1.178     rillig   2282: BUILDLINK_TRANSFORM+=   rm:-Werror=char-subscripts
1.179     rillig   2283: .endif
1.178     rillig   2284: </pre>
                   2285: <p>If the error messages from the compiler are valid and the code
1.179     rillig   2286: needs to be fixed, prepare a local patch (see
                   2287: <code class="varname">LOCALPATCHES</code>) and report the bug to the upstream
                   2288: authors of the package, providing them with the information you collected
                   2289: above.</p>
                   2290: <p>Patches that are not essential for the package to work should only
                   2291: be reported upstream but not committed to pkgsrc, to make future updates
                   2292: easier.</p>
1.178     rillig   2293: </div>
                   2294: <div class="sect2">
                   2295: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2296: <a name="bulk.var.builderr"></a>8.4.3. Force compiler options only in the build phase</h3></div></div></div>
        !          2297: <p>When adding custom compiler flags via <code class="varname">CFLAGS</code>,
        !          2298: these apply to all phases of the package build process. Especially in the
        !          2299: configure phase, adding <code class="literal">-Werror</code> leads to wrong
        !          2300: decisions. The GNU configure scripts feed many small test programs to the
        !          2301: C compiler to see whether certain headers are available, functions are
        !          2302: defined in a library and programs can be run. In many cases these
        !          2303: programs would not survive a strict compiler run with <code class="literal">-Wall
        !          2304: -Wextra -Werror</code>.</p>
        !          2305: <p>The pkgsrc infrastructure is flexible enough to support compiler
        !          2306: options being added between the <code class="literal">configure</code> and
        !          2307: <code class="literal">build</code> phases. It's a little more complicated than the
        !          2308: other examples in this section but still easy enough.</p>
        !          2309: <p>The basic idea is to use the pkgsrc compiler wrapper to inject the
        !          2310: desired compiler options. The compiler wrapper's original task is to hide
        !          2311: unwanted directories of include files and to normalize compiler options.
        !          2312: It does this by wrapping the compiler command and rewriting the command
        !          2313: line. To see this in action, run <span class="command"><strong>bmake patch</strong></span> in a
        !          2314: package directory and examine the
        !          2315: <code class="filename">work/.cwrappers/config</code> directory. It contains
        !          2316: individual configurations for the C compiler and the related tools. The
        !          2317: plan is to find a hook between the configure and build phases, and to
        !          2318: modify these configuration files at that point.</p>
        !          2319: <p>To find this hook, have a look at
        !          2320: <code class="filename">mk/build/build.mk</code>, which contains among others the
        !          2321: <code class="literal">pre-build-checks-hook</code>. The word
        !          2322: <code class="literal">checks</code> doesn't quite fit, but the
        !          2323: <code class="literal">pre-build-hook</code> sounds good enough.</p>
        !          2324: <p>The code to be included in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> is:</p>
        !          2325: <pre class="programlisting">
        !          2326: # Just a few example options.
        !          2327: BUILD_ONLY_CFLAGS=      -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
        !          2328: 
        !          2329: .if ${BUILD_ONLY_CFLAGS:U:M*}
        !          2330: pre-build-checks-hook: add-build-only-cflags
        !          2331: 
        !          2332: add-build-only-cflags: .PHONY
        !          2333:         ${RUN} cd ${CWRAPPERS_CONFIG_DIR};      \
        !          2334:         ${TEST} ! -f ${.TARGET} || exit 0;      \
        !          2335:         for flag in ${BUILD_ONLY_CFLAGS}; do    \
        !          2336:                 ${ECHO} "append=$$flag" &gt;&gt; cc;  \
        !          2337:         done;                                   \
        !          2338:         &gt; ${.TARGET}
        !          2339: .endif
        !          2340: </pre>
        !          2341: <p>(When editing the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, make sure that the commands of the
        !          2342: <code class="literal">add-build-only-cflags</code> target are indented with a tab,
        !          2343: not with spaces.)</p>
        !          2344: <p>The condition in the <code class="literal">.if</code> statement contains the
        !          2345: <code class="literal">:U</code> modifier to prevent parse errors if the variable
        !          2346: should be undefined, possibly because it is only defined for a subset of
        !          2347: the packages. The <code class="literal">:M*</code> modifier ensures that there is
        !          2348: at least one compiler option, to prevent a syntax error in the shell
        !          2349: parser.</p>
        !          2350: <p>The code around the <code class="literal">${.TARGET}</code> variable ensures
        !          2351: that the additional compiler options are only appended once, even if
        !          2352: <span class="command"><strong>bmake build</strong></span> is run multiple times. To do this, it
        !          2353: creates a marker file.</p>
        !          2354: <p>To verify that this setup works, run <span class="command"><strong>bmake
        !          2355: configure</strong></span> in a package directory. Up to now, everything works
        !          2356: as usual. Examine the directory
        !          2357: <code class="filename">work/.cwrappers/config</code> to see that the compiler
        !          2358: options from <code class="varname">BUILD_ONLY_CFLAGS</code> are not yet added to
        !          2359: the file <code class="filename">cc</code>. Examine the tail of the
        !          2360: <code class="filename">work/.work.log</code> file to see that the normal compiler
        !          2361: options are used.</p>
        !          2362: <p>Now run <span class="command"><strong>bmake build</strong></span>. This will append the
        !          2363: options to the file <code class="filename">cc</code> and will create the marker
        !          2364: file in the same directory. After that, the build starts as usual, but
        !          2365: with the added compiler options. Examine the tail of the file
        !          2366: <code class="filename">work/.work.log</code> to see that the lines starting with
        !          2367: <code class="literal">[*]</code> don't contain the compiler options, but the
        !          2368: corresponding lines starting with <code class="literal">&lt;.&gt;</code> do end
        !          2369: with these options.</p>
        !          2370: <p>Building packages using this setup variant and fixing the resulting
        !          2371: bugs is the same as in <a class="xref" href="#bulk.var.comperr" title="8.4.2. Detect classes of bugs by forcing compiler warnings">Section 8.4.2, &#8220;Detect classes of bugs by forcing compiler warnings&#8221;</a>.</p>
        !          2372: </div>
        !          2373: <div class="sect2">
        !          2374: <div class="titlepage"><div><div><h3 class="title">
        !          2375: <a name="bulk.var.dirs"></a>8.4.4. Use custom directories</h3></div></div></div>
1.178     rillig   2376: <p>Some directories like <code class="varname">PREFIX</code>,
                   2377: <code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>,
                   2378: <code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be
                   2379: configured in pkgsrc. Set these to arbitrary paths during bootstrap or
                   2380: afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2381: <pre class="programlisting">
                   2382: PREFIX=         /a-random-uuid
                   2383: PKG_SYSCONFDIR= /a-random-uuid
                   2384: VARBASE=        /a-random-uuid
                   2385: PKGMANDIR=     a-random-uuid
                   2386: PKG_INFODIR=   a-random-uuid
                   2387: </pre>
                   2388: </div>
                   2389: <div class="sect2">
                   2390: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2391: <a name="bulk.var.warn"></a>8.4.5. Turn warnings into errors</h3></div></div></div>
1.178     rillig   2392: <p>When building a package, warnings are typically ignored since they
                   2393: just flow by and do not cause the build to fail immediately. To find
                   2394: these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2395: <pre class="programlisting">
                   2396: DELAYED_WARNING_MSG=    ${DELAYED_ERROR_MSG} "(was warning)"
                   2397: WARNING_MSG=            ${FAIL_MSG} "(was warning)"
                   2398: </pre>
                   2399: <p>(There are many more classes of warnings in pkgsrc, and most of
                   2400: them can be redefined with a simple definition like above.</p>
1.179     rillig   2401: <p>If a package suggests to add <code class="varname">USE_TOOLS+=perl</code> to
1.178     rillig   2402: the package Makefile, research whether the package actually needs Perl.
                   2403: If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package
                   2404: Makefile, and if it doesn't, add
                   2405: <code class="varname">TOOLS_BROKEN+=perl</code>.</p>
                   2406: </div>
                   2407: <div class="sect2">
                   2408: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2409: <a name="bulk.var.pkglint"></a>8.4.6. Reject packages for which pkglint reports errors</h3></div></div></div>
1.178     rillig   2410: <p>Using pkglint as part of the regular build process is mostly a
                   2411: waste of time. If you want to fix some of the warnings, just run pkglint
                   2412: recursively on the whole pkgsrc tree. This will take a few minutes (up to
                   2413: 10), which is much faster than a complete bulk build.</p>
                   2414: </div>
                   2415: <div class="sect2">
                   2416: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2417: <a name="bulk.var.strings"></a>8.4.7. Reject packages that contain forbidden strings</h3></div></div></div>
1.178     rillig   2418: <p>To ensure that the binary packages don't contain references to the
                   2419: build directory, there is already <code class="varname">CHECK_WRKREF</code>. If
                   2420: that variable includes the item <code class="literal">extra</code>, it is
                   2421: possible to define additional patterns that must not appear in any
                   2422: installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2423: <pre class="programlisting">
                   2424: CHECK_WRKREF=                   extra
                   2425: CHECK_WRKREF_EXTRA_DIRS+=       /usr/local
                   2426: CHECK_WRKREF_EXTRA_DIRS+=       /usr/pkg
                   2427: CHECK_WRKREF_EXTRA_DIRS+=      @[A-Z][A-Z]*@
                   2428: </pre>
                   2429: <p>The above patterns will probably generate many false positives,
                   2430: therefore the results need to be taken with a grain of salt.</p>
                   2431: </div>
                   2432: <div class="sect2">
                   2433: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2434: <a name="bulk.var.test"></a>8.4.8. Reject packages whose self-test fails</h3></div></div></div>
1.178     rillig   2435: <p>To run the test suites that come with each package, add this line
                   2436: to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2437: <pre class="programlisting">
                   2438: PKGSRC_RUN_TEST=        yes
                   2439: </pre>
                   2440: <p>Be prepared that even the most basic packages fail this test. When
                   2441: doing a bulk build with this, it will often abort in the early phase
                   2442: where the packages are scanned for their dependencies since there are
                   2443: cyclic dependencies. There is still a lot to do in this area.</p>
                   2444: </div>
                   2445: <div class="sect2">
                   2446: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2447: <a name="bulk.var.shvar"></a>8.4.9. Reject packages that use undefined shell variables</h3></div></div></div>
1.178     rillig   2448: <p>To catch typos in the shell snippets from the Makefile fragments,
                   2449: add the <code class="literal">-u</code> flag to most of the commands by adding this
                   2450: line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2451: <pre class="programlisting">
                   2452: RUN=    @set -eu;
                   2453: </pre>
1.181   ! rillig   2454: <p>After that, ensure that none of the bulk build log files (even
        !          2455: those for successfully built packages) contains the string
        !          2456: <code class="literal">parameter not set</code> or whatever error message the
        !          2457: command <span class="command"><strong>sh -ceu '$undefined'</strong></span> outputs.</p>
1.178     rillig   2458: <p>See <code class="filename">mk/misc/common.mk</code> for the existing
                   2459: definition.</p>
                   2460: </div>
                   2461: <div class="sect2">
                   2462: <div class="titlepage"><div><div><h3 class="title">
1.181   ! rillig   2463: <a name="bulk.var.quiet"></a>8.4.10. Turn off verbose logging</h3></div></div></div>
1.178     rillig   2464: <p>The build logs of a package are often quite long. This allows error
                   2465: messages or other interesting details to hide between the noise. To make
                   2466: the actual error message stand out more, add these lines to
                   2467: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2468: <pre class="programlisting">
                   2469: GNU_CONFIGURE_QUIET=    yes
                   2470: MAKE_FLAGS+=            -s
                   2471: </pre>
                   2472: <p>The <code class="literal">-s</code> option works for both GNU Make and BSD
                   2473: Make. On exotic platforms with their own make, it may be a little
                   2474: different.</p>
                   2475: </div>
                   2476: </div>
                   2477: <div class="sect1">
                   2478: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   2479: <a name="creating-cdroms"></a>8.5. Creating a multiple CD-ROM packages collection</h2></div></div></div>
1.1       dsieger  2480: <p>After your pkgsrc bulk-build has completed, you may wish to
                   2481:     create a CD-ROM set of the resulting binary packages to assist
                   2482:     in installing packages on other machines.  The
1.137     leot     2483:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/cdpack/README.html" target="_top"><code class="filename">pkgtools/cdpack</code></a> package provides
1.1       dsieger  2484:     a simple tool for creating the ISO 9660 images.
1.10      hubertf  2485:     <span class="command"><strong>cdpack</strong></span> arranges the packages on the CD-ROMs in a
1.1       dsieger  2486:     way that keeps all the dependencies for a given package on the same
                   2487:     CD as that package.</p>
1.41      asau     2488: <div class="sect2">
1.1       dsieger  2489: <div class="titlepage"><div><div><h3 class="title">
1.178     rillig   2490: <a name="cdpack-example"></a>8.5.1. Example of cdpack</h3></div></div></div>
1.1       dsieger  2491: <p>Complete documentation for cdpack is found in the cdpack(1)
                   2492:       man page. The following short example assumes that the binary
                   2493:       packages are left in
                   2494:       <code class="filename">/usr/pkgsrc/packages/All</code> and that
                   2495:       sufficient disk space exists in <code class="filename">/u2</code> to
                   2496:       hold the ISO 9660 images.</p>
                   2497: <pre class="screen">
                   2498: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /u2/images</code></strong>
                   2499: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   2500: <code class="prompt">#</code> <strong class="userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
                   2501:       </pre>
                   2502: <p>If you wish to include a common set of files
                   2503:       (<code class="filename">COPYRIGHT</code>, <code class="filename">README</code>,
                   2504:       etc.) on each CD in the collection, then you need to create a
1.175     gutterid 2505:       directory which contains these files, e.g.:</p>
1.1       dsieger  2506: <pre class="screen">
                   2507: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common</code></strong>
                   2508: <code class="prompt">#</code> <strong class="userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   2509: <code class="prompt">#</code> <strong class="userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   2510: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common/bin</code></strong>
                   2511: <code class="prompt">#</code> <strong class="userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   2512: <code class="prompt">#</code> <strong class="userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   2513: <code class="prompt">#</code> <strong class="userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
                   2514:       </pre>
                   2515: <p>Now create the images:</p>
                   2516: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong></pre>
                   2517: <p>Each image will contain <code class="filename">README</code>,
                   2518:       <code class="filename">COPYING</code>, and <code class="filename">bin/myscript</code>
                   2519:       in their root directories.</p>
                   2520: </div>
                   2521: </div>
                   2522: </div>
1.41      asau     2523: <div class="chapter">
1.1       dsieger  2524: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   2525: <a name="files"></a>Chapter 9. Directory layout of the installed files</h2></div></div></div>
1.1       dsieger  2526: <div class="toc">
                   2527: <p><b>Table of Contents</b></p>
1.100     leot     2528: <dl class="toc">
1.154     rillig   2529: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
                   2530: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
1.1       dsieger  2531: </dl>
                   2532: </div>
                   2533: <p>The files that are installed by pkgsrc are organized in a way that
                   2534: is similar to what you find in the <code class="filename">/usr</code> directory
                   2535: of the base system. But some details are different. This is because
                   2536: pkgsrc initially came from FreeBSD and had adopted its file system
                   2537: hierarchy. Later it was largely influenced by NetBSD. But no matter
                   2538: which operating system you are using pkgsrc with, you can expect the
                   2539: same layout for pkgsrc.</p>
                   2540: <p>There are mainly four root directories for pkgsrc, which are all
                   2541: configurable in the <code class="filename">bootstrap/bootstrap</code> script.
                   2542: When pkgsrc has been installed as root, the default locations
                   2543: are:</p>
                   2544: <pre class="programlisting">
                   2545: LOCALBASE=              /usr/pkg
                   2546: PKG_SYSCONFBASE=        /usr/pkg/etc
                   2547: VARBASE=                /var
1.119     sevan    2548: PKG_DBDIR=              /usr/pkg/pkgdb
1.1       dsieger  2549: </pre>
                   2550: <p>In unprivileged mode (when pkgsrc has been installed as any other
                   2551: user), the default locations are:</p>
                   2552: <pre class="programlisting">
                   2553: LOCALBASE=              ${HOME}/pkg
                   2554: PKG_SYSCONFBASE=        ${HOME}/pkg/etc
                   2555: VARBASE=                ${HOME}/pkg/var
1.119     sevan    2556: PKG_DBDIR=              ${HOME}/pkg/pkgdb
1.1       dsieger  2557: </pre>
                   2558: <p>What these four directories are for, and what they look like is
                   2559: explained below.</p>
1.41      asau     2560: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      2561: <li class="listitem"><p><code class="varname">LOCALBASE</code> corresponds to the
1.1       dsieger  2562: <code class="filename">/usr</code> directory in the base system. It is the
1.23      wiz      2563: <span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> directory where the files are installed and contains
1.1       dsieger  2564: the well-known subdirectories like <code class="filename">bin</code>,
                   2565: <code class="filename">include</code>, <code class="filename">lib</code>,
                   2566: <code class="filename">share</code> and
                   2567: <code class="filename">sbin</code>.</p></li>
1.23      wiz      2568: <li class="listitem"><p><code class="varname">VARBASE</code> corresponds to
1.1       dsieger  2569: <code class="filename">/var</code> in the base system. Some programs (especially
                   2570: games, network daemons) need write access to it during normal
                   2571: operation.</p></li>
1.23      wiz      2572: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR</code> corresponds to
1.1       dsieger  2573: <code class="filename">/etc</code> in the base system. It contains configuration
1.10      hubertf  2574: files of the packages, as well as pkgsrc's <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
1.1       dsieger  2575: itself.</p></li>
                   2576: </ul></div>
1.41      asau     2577: <div class="sect1">
1.1       dsieger  2578: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2579: <a name="files.localbase"></a>9.1. File system layout in <code class="literal">${LOCALBASE}</code>
1.1       dsieger  2580: </h2></div></div></div>
                   2581: <p>The following directories exist in a typical pkgsrc installation
                   2582: in <code class="filename">${LOCALBASE}</code>.</p>
1.41      asau     2583: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  2584: <dt><span class="term"><code class="filename">bin</code></span></dt>
                   2585: <dd><p>Contains executable programs that are intended to be
                   2586: directly used by the end user.</p></dd>
                   2587: <dt><span class="term"><code class="filename">emul</code></span></dt>
                   2588: <dd><p>Contains files for the emulation layers of various other
                   2589: operating systems, especially for
                   2590: NetBSD.</p></dd>
                   2591: <dt><span class="term"><code class="filename">etc</code> (the usual location of
                   2592: <code class="filename">${PKG_SYSCONFDIR}</code>)</span></dt>
                   2593: <dd><p>Contains
                   2594: the configuration files.</p></dd>
                   2595: <dt><span class="term"><code class="filename">include</code></span></dt>
                   2596: <dd><p>Contains headers for the C and C++ programming
                   2597: languages.</p></dd>
                   2598: <dt><span class="term"><code class="filename">info</code></span></dt>
                   2599: <dd><p>Contains GNU info files of various
                   2600: packages.</p></dd>
                   2601: <dt><span class="term"><code class="filename">lib</code></span></dt>
                   2602: <dd><p>Contains shared and static
                   2603: libraries.</p></dd>
                   2604: <dt><span class="term"><code class="filename">libdata</code></span></dt>
                   2605: <dd><p>Contains data files that don't change after
                   2606: installation. Other data files belong into
                   2607: <code class="filename">${VARBASE}</code>.</p></dd>
                   2608: <dt><span class="term"><code class="filename">libexec</code></span></dt>
                   2609: <dd><p>Contains programs that are not intended to be used by
                   2610: end users, such as helper programs or network
                   2611: daemons.</p></dd>
                   2612: <dt><span class="term"><code class="filename">libexec/cgi-bin</code></span></dt>
                   2613: <dd><p>Contains programs that are intended to be executed as
                   2614: CGI scripts by a web server.</p></dd>
                   2615: <dt><span class="term"><code class="filename">man</code> (the usual value of
                   2616: <code class="filename">${PKGMANDIR}</code>)</span></dt>
                   2617: <dd><p>Contains brief
                   2618: documentation in form of manual pages.</p></dd>
                   2619: <dt><span class="term"><code class="filename">sbin</code></span></dt>
                   2620: <dd><p>Contains programs that are intended to be used only by
                   2621: the super-user.</p></dd>
                   2622: <dt><span class="term"><code class="filename">share</code></span></dt>
                   2623: <dd><p>Contains platform-independent data files that don't
                   2624: change after installation.</p></dd>
                   2625: <dt><span class="term"><code class="filename">share/doc</code></span></dt>
                   2626: <dd><p>Contains documentation files provided by the
                   2627: packages.</p></dd>
                   2628: <dt><span class="term"><code class="filename">share/examples</code></span></dt>
                   2629: <dd><p>Contains example files provided by the packages. Among
                   2630: others, the original configuration files are saved here and copied to
                   2631: <code class="filename">${PKG_SYSCONFDIR}</code> during
                   2632: installation.</p></dd>
                   2633: <dt><span class="term"><code class="filename">share/examples/rc.d</code></span></dt>
                   2634: <dd><p>Contains the original files for rc.d
                   2635: scripts.</p></dd>
                   2636: <dt><span class="term"><code class="filename">var</code> (the usual location of
                   2637: <code class="filename">${VARBASE}</code>)</span></dt>
                   2638: <dd><p>Contains files
                   2639: that may be modified after
                   2640: installation.</p></dd>
                   2641: </dl></div>
                   2642: </div>
1.41      asau     2643: <div class="sect1">
1.1       dsieger  2644: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2645: <a name="files.varbase"></a>9.2. File system layout in <code class="literal">${VARBASE}</code>
1.1       dsieger  2646: </h2></div></div></div>
1.41      asau     2647: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  2648: <dt><span class="term"><code class="filename">db/pkg</code> (the usual location of
                   2649: <code class="filename">${PKG_DBDIR}</code>)</span></dt>
                   2650: <dd><p>Contains
                   2651: information about the currently installed
                   2652: packages.</p></dd>
                   2653: <dt><span class="term"><code class="filename">games</code></span></dt>
                   2654: <dd><p>Contains highscore
                   2655: files.</p></dd>
                   2656: <dt><span class="term"><code class="filename">log</code></span></dt>
                   2657: <dd><p>Contains log files.</p></dd>
                   2658: <dt><span class="term"><code class="filename">run</code></span></dt>
                   2659: <dd><p>Contains informational files about daemons that are
                   2660: currently running.</p></dd>
                   2661: </dl></div>
                   2662: </div>
                   2663: </div>
1.41      asau     2664: <div class="chapter">
1.1       dsieger  2665: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   2666: <a name="faq"></a>Chapter 10. Frequently Asked Questions</h2></div></div></div>
1.1       dsieger  2667: <div class="toc">
                   2668: <p><b>Table of Contents</b></p>
1.100     leot     2669: <dl class="toc">
1.154     rillig   2670: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
                   2671: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
                   2672: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
                   2673: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
                   2674: <dt><span class="sect1"><a href="#x.org-from-pkgsrc">10.5. How can I install/use modular X.org from pkgsrc?</a></span></dt>
                   2675: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
                   2676: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
                   2677: <dt><span class="sect1"><a href="#passive-ftp">10.8. How do I tell <span class="command"><strong>make fetch</strong></span> to do passive FTP?</a></span></dt>
                   2678: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
                   2679: <dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
1.23      wiz      2680: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
1.154     rillig   2681: <dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</a></span></dt>
                   2682: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' with pkgsrc</a></span></dt>
                   2683: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
                   2684: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
                   2685: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
                   2686: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build.  What shall I do?</a></span></dt>
                   2687: <dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</a></span></dt>
1.1       dsieger  2688: </dl>
                   2689: </div>
                   2690: <p>This section contains hints, tips &amp; tricks on special things in
                   2691: pkgsrc that we didn't find a better place for in the previous chapters, and
                   2692: it contains items for both pkgsrc users and developers.</p>
1.41      asau     2693: <div class="sect1">
1.1       dsieger  2694: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2695: <a name="mailing-list-pointers"></a>10.1. Are there any mailing lists for pkg-related discussion?</h2></div></div></div>
1.1       dsieger  2696: <p>The following mailing lists may be of interest to pkgsrc users:</p>
1.41      asau     2697: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      2698: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-users" target="_top">pkgsrc-users</a>:
1.1       dsieger  2699:          This is a general purpose list for most issues regarding
                   2700:          pkgsrc, regardless of platform, e.g. soliciting user help
                   2701:          for pkgsrc configuration, unexpected build failures, using
                   2702:          particular packages, upgrading pkgsrc installations,
                   2703:          questions regarding the pkgsrc release branches, etc.  General announcements or
                   2704:          proposals for changes that impact the pkgsrc user community,
                   2705:          e.g. major infrastructure changes, new features, package
                   2706:          removals, etc., may also be posted.</p></li>
1.174     leot     2707: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-bulk" target="_top">pkgsrc-bulk</a>:
1.1       dsieger  2708:          A list where the results of pkgsrc bulk builds are sent and
                   2709:          discussed.</p></li>
1.174     leot     2710: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-changes" target="_top">pkgsrc-changes</a>:
1.1       dsieger  2711:          This list is for those who are interested in getting a
                   2712:          commit message for every change committed to pkgsrc. It is
                   2713:          also available in digest form, meaning one daily message
                   2714:          containing all commit messages for changes to the package
                   2715:          source tree in that 24 hour period.</p></li>
                   2716: </ul></div>
                   2717: <p>To subscribe, do:</p>
                   2718: <pre class="programlisting">
                   2719: <code class="prompt">%</code> echo subscribe <em class="replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
                   2720: </pre>
                   2721: <p>Archives for all these mailing lists are available from
1.174     leot     2722: <a class="ulink" href="https://mail-index.NetBSD.org/" target="_top">https://mail-index.NetBSD.org/</a>.</p>
1.1       dsieger  2723: </div>
1.41      asau     2724: <div class="sect1">
1.1       dsieger  2725: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2726: <a name="faq-pkgtools"></a>10.2. Utilities for package management (pkgtools)</h2></div></div></div>
1.1       dsieger  2727: <p>The directory <code class="filename">pkgsrc/pkgtools</code> contains
                   2728: a number of useful utilities for both users and developers of pkgsrc.  This
1.121     sevan    2729: section attempts only to make the reader aware of some of the utilities and when
1.1       dsieger  2730: they might be useful, and not to duplicate the documentation that comes
                   2731: with each package.</p>
                   2732: <p>Utilities used by pkgsrc (automatically installed when needed):</p>
1.137     leot     2733: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/x11-links/README.html" target="_top"><code class="filename">pkgtools/x11-links</code></a>:
1.1       dsieger  2734:       Symlinks for use by buildlink.</p></li></ul></div>
                   2735: <p>OS tool augmentation (automatically installed when needed):</p>
1.41      asau     2736: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot     2737: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/digest/README.html" target="_top"><code class="filename">pkgtools/digest</code></a>:
1.121     sevan    2738:       Calculates various kinds of checksums (including SHA3).</p></li>
1.137     leot     2739: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libnbcompat/README.html" target="_top"><code class="filename">pkgtools/libnbcompat</code></a>:
1.1       dsieger  2740:       Compatibility library for pkgsrc tools.</p></li>
1.137     leot     2741: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/mtree/README.html" target="_top"><code class="filename">pkgtools/mtree</code></a>: Installed on
1.1       dsieger  2742:       non-BSD systems due to lack of native mtree.</p></li>
1.137     leot     2743: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a>:
1.1       dsieger  2744:       Up-to-date replacement for
                   2745:       <code class="filename">/usr/sbin/pkg_install</code>, or for use on operating
                   2746:       systems where pkg_install is not present.</p></li>
                   2747: </ul></div>
                   2748: <p>Utilities used by pkgsrc (not automatically installed):</p>
1.41      asau     2749: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot     2750: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/README.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a>:
1.1       dsieger  2751:       Create a binary package from an
1.10      hubertf  2752:       already-installed package.  Used by <span class="command"><strong>make replace</strong></span> to
1.1       dsieger  2753:       save the old package.</p></li>
1.137     leot     2754: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/dfdisk/README.html" target="_top"><code class="filename">pkgtools/dfdisk</code></a>:
1.1       dsieger  2755:       Adds extra functionality to pkgsrc, allowing it to fetch distfiles
                   2756:       from multiple locations. It currently supports the following
                   2757:       methods: multiple CD-ROMs and network FTP/HTTP connections.</p></li>
1.137     leot     2758: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/README.html" target="_top"><code class="filename">devel/cpuflags</code></a>: Determine
1.16      jnemeth  2759:       the best compiler flags to optimise code for your current
1.23      wiz      2760:       CPU and compiler. </p></li>
1.1       dsieger  2761: </ul></div>
                   2762: <p>Utilities for keeping track of installed packages, being up to date,
                   2763: etc:</p>
1.41      asau     2764: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot     2765: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgin/README.html" target="_top"><code class="filename">pkgtools/pkgin</code></a>: A package
1.65      wiz      2766:     update tool similar to apt(1). Download, install, and upgrade
                   2767:     binary packages easily.</p></li>
1.137     leot     2768: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/README.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a>: Reports on
1.1       dsieger  2769:       packages whose installed versions do not match the latest pkgsrc
                   2770:       entries.</p></li>
1.137     leot     2771: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdep/README.html" target="_top"><code class="filename">pkgtools/pkgdep</code></a>: Makes
1.1       dsieger  2772:       dependency graphs of packages, to aid in choosing a strategy for
                   2773:       updating.</p></li>
1.137     leot     2774: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdepgraph/README.html" target="_top"><code class="filename">pkgtools/pkgdepgraph</code></a>: Makes
                   2775:       graphs from the output of <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdep/README.html" target="_top"><code class="filename">pkgtools/pkgdep</code></a> (uses graphviz).</p></li>
                   2776: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>: The
1.12      weinem   2777:       pkglint(1) program checks a pkgsrc entry for errors.</p></li>
1.137     leot     2778: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/README.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a>: The lintpkgsrc(1) program
1.1       dsieger  2779:       does various checks on the complete pkgsrc system.</p></li>
1.137     leot     2780: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgsurvey/README.html" target="_top"><code class="filename">pkgtools/pkgsurvey</code></a>: Report what
1.1       dsieger  2781:       packages you have installed.</p></li>
                   2782: </ul></div>
                   2783: <p>Utilities for people maintaining or creating individual packages:</p>
1.41      asau     2784: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot     2785: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a>: Automate
1.1       dsieger  2786:       making and maintaining patches for a package (includes pkgdiff,
                   2787:       pkgvi, mkpatches, etc.).</p></li>
1.137     leot     2788: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>: Aids in
1.1       dsieger  2789:       converting to pkgsrc.</p></li>
                   2790: </ul></div>
                   2791: <p>Utilities for people maintaining pkgsrc (or: more obscure pkg
                   2792: utilities)</p>
1.41      asau     2793: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot     2794: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_comp/README.html" target="_top"><code class="filename">pkgtools/pkg_comp</code></a>: Build
1.1       dsieger  2795:       packages in a chrooted area.</p></li>
1.137     leot     2796: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libkver/README.html" target="_top"><code class="filename">pkgtools/libkver</code></a>: Spoof
1.1       dsieger  2797:       kernel version for chrooted cross builds.</p></li>
                   2798: </ul></div>
                   2799: </div>
1.41      asau     2800: <div class="sect1">
1.1       dsieger  2801: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2802: <a name="non-root-pkgsrc"></a>10.3. How to use pkgsrc as non-root</h2></div></div></div>
1.108     rillig   2803: <p>To install packages from source as a non-root user, download
1.154     rillig   2804: pkgsrc as described in <a class="xref" href="#getting" title="Chapter 3. Where to get pkgsrc and how to keep it up-to-date">Chapter 3, <i>Where to get pkgsrc and how to keep it up-to-date</i></a>, cd into that
1.108     rillig   2805: directory and run the command <span class="command"><strong>./bootstrap/bootstrap
                   2806: --unprivileged</strong></span>.</p>
                   2807: <p>This will install the binary part of pkgsrc to
                   2808: <code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
                   2809: into <code class="filename">~/pkg/etc</code>.</p>
                   2810: <p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p>
1.1       dsieger  2811: </div>
1.41      asau     2812: <div class="sect1">
1.1       dsieger  2813: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2814: <a name="resume-transfers"></a>10.4. How to resume transfers when fetching distfiles?</h2></div></div></div>
1.1       dsieger  2815: <p>By default, resuming transfers in pkgsrc is disabled, but you can
                   2816: enable this feature by adding the option
                   2817: <code class="varname">PKG_RESUME_TRANSFERS=YES</code> into
1.10      hubertf  2818: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.  If, during a fetch step, an incomplete
1.1       dsieger  2819: distfile is found, pkgsrc will try to resume it.</p>
                   2820: <p>You can also
1.61      wiz      2821: use a different program than the platform default program by changing the
1.16      jnemeth  2822: <code class="varname">FETCH_USING</code> variable.  You can specify the program by
                   2823: using of ftp, fetch, wget or curl.  Alternatively, fetching can be disabled
                   2824: by using the value manual.  A value of custom disables the system defaults
                   2825: and dependency tracking for the fetch program.  In that case you have to
                   2826: provide <code class="varname">FETCH_CMD</code>, <code class="varname">FETCH_BEFORE_ARGS</code>,
                   2827: <code class="varname">FETCH_RESUME_ARGS</code>, <code class="varname">FETCH_OUTPUT_ARGS</code>,
                   2828: <code class="varname">FETCH_AFTER_ARGS</code>.</p>
1.1       dsieger  2829: <p>For example, if you want to use
1.16      jnemeth  2830: <code class="filename">wget</code> to download, you'll have to use something
1.1       dsieger  2831: like:</p>
                   2832: <pre class="programlisting">
1.112     rillig   2833: FETCH_USING=    wget
1.1       dsieger  2834: </pre>
                   2835: </div>
1.41      asau     2836: <div class="sect1">
1.1       dsieger  2837: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2838: <a name="x.org-from-pkgsrc"></a>10.5. How can I install/use modular X.org from pkgsrc?</h2></div></div></div>
1.4       rillig   2839: <p>If you want to use modular X.org from pkgsrc instead of your system's own X11
1.1       dsieger  2840: (<code class="filename">/usr/X11R6</code>, <code class="filename">/usr/openwin</code>, ...)
                   2841: you will have to add the following line into
1.10      hubertf  2842: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
1.1       dsieger  2843: <pre class="programlisting">
1.4       rillig   2844: X11_TYPE=modular
1.1       dsieger  2845: </pre>
                   2846: </div>
1.41      asau     2847: <div class="sect1">
1.1       dsieger  2848: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2849: <a name="fetch-behind-firewall"></a>10.6. How to fetch files from behind a firewall</h2></div></div></div>
1.1       dsieger  2850: <p>If you are sitting behind a firewall which does not allow direct
                   2851: connections to Internet hosts (i.e. non-NAT), you may specify the
                   2852: relevant proxy hosts.  This is done using an environment variable in the
                   2853: form of a URL, e.g. in Amdahl, the machine
1.23      wiz      2854: <span class="quote">&#8220;<span class="quote">orpheus.amdahl.com</span>&#8221;</span> is one of the firewalls, and it uses
1.1       dsieger  2855: port 80 as the proxy port number.  So the proxy environment variables
                   2856: are:</p>
                   2857: <pre class="programlisting">
                   2858: ftp_proxy=ftp://orpheus.amdahl.com:80/
                   2859: http_proxy=http://orpheus.amdahl.com:80/
                   2860: </pre>
                   2861: </div>
1.41      asau     2862: <div class="sect1">
1.1       dsieger  2863: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2864: <a name="fetch-https"></a>10.7. How to fetch files from HTTPS sites</h2></div></div></div>
1.65      wiz      2865: <p>Some fetch tools are not prepared to support HTTPS by default
                   2866: (for example, the one in NetBSD 6.0), or the one installed by the
                   2867: pkgsrc bootstrap (to avoid an openssl dependency that low in the
                   2868: dependency graph).</p>
                   2869: <p>Usually you won't notice, because distribution files are
                   2870: mirrored weekly to <span class="quote">&#8220;<span class="quote">ftp.NetBSD.org</span>&#8221;</span>, but that might not
                   2871: be often enough if you are following pkgsrc-current. In that case, set
                   2872: <code class="varname">FETCH_USING</code> in your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file to
                   2873: <span class="quote">&#8220;<span class="quote">curl</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">wget</span>&#8221;</span>, which are both compiled
                   2874: with HTTPS support by default. Of course, these tools need to be
                   2875: installed before you can use them this way.</p>
                   2876: </div>
                   2877: <div class="sect1">
                   2878: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2879: <a name="passive-ftp"></a>10.8. How do I tell <span class="command"><strong>make fetch</strong></span> to do passive FTP?</h2></div></div></div>
1.1       dsieger  2880: <p>This depends on which utility is used to retrieve distfiles.  From
                   2881: <code class="filename">bsd.pkg.mk</code>, <code class="varname">FETCH_CMD</code> is assigned
                   2882: the first available command from the following list:</p>
1.41      asau     2883: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      2884: <li class="listitem"><p><code class="filename">${LOCALBASE}/bin/ftp</code></p></li>
                   2885: <li class="listitem"><p><code class="filename">/usr/bin/ftp</code></p></li>
1.1       dsieger  2886: </ul></div>
                   2887: <p>On a default NetBSD installation, this will be
                   2888: <code class="filename">/usr/bin/ftp</code>, which automatically tries passive
                   2889: connections first, and falls back to active connections if the server
                   2890: refuses to do passive.  For the other tools, add the following to your
1.10      hubertf  2891: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file:
1.1       dsieger  2892: <code class="varname">PASSIVE_FETCH=1</code>.</p>
                   2893: <p>Having that option present will prevent
                   2894: <code class="filename">/usr/bin/ftp</code> from falling back to active
                   2895: transfers.</p>
                   2896: </div>
1.41      asau     2897: <div class="sect1">
1.1       dsieger  2898: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2899: <a name="fetching-all-distfiles"></a>10.9. How to fetch all distfiles at once</h2></div></div></div>
1.1       dsieger  2900: <p>You would like to download all the distfiles in a single batch
1.10      hubertf  2901: from work or university, where you can't run a <span class="command"><strong>make
1.25      spz      2902: fetch</strong></span>.  There is an archive of distfiles on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/" target="_top">ftp.NetBSD.org</a>,
1.1       dsieger  2903: but downloading the entire directory may not be appropriate.</p>
1.10      hubertf  2904: <p>The answer here is to do a <span class="command"><strong>make fetch-list</strong></span> in
1.1       dsieger  2905: <code class="filename">/usr/pkgsrc</code> or one of its subdirectories, carry the
                   2906: resulting list to your machine at work/school and use it there.  If you
1.174     leot     2907: don't have a NetBSD-compatible <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?ftp+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">ftp</span>(1)</span></a> (like tnftp) at work, don't
1.1       dsieger  2908: forget to set <code class="varname">FETCH_CMD</code> to something that fetches a
                   2909: URL:</p>
                   2910: <p>At home:</p>
                   2911: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
                   2912: <code class="prompt">%</code> <strong class="userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   2913: <code class="prompt">%</code> <strong class="userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong></pre>
                   2914: <p>At work:</p>
                   2915: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>sh /tmp/fetch.sh</code></strong></pre>
                   2916: <p>then tar up <code class="filename">/tmp/distfiles</code> and take it
                   2917: home.</p>
                   2918: <p>If you have a machine running NetBSD, and you want to get
                   2919: <span class="emphasis"><em>all</em></span> distfiles (even ones that aren't for your
                   2920: machine architecture), you can do so by using the above-mentioned
1.10      hubertf  2921: <span class="command"><strong>make fetch-list</strong></span> approach, or fetch the distfiles
1.1       dsieger  2922: directly by running:</p>
                   2923: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make mirror-distfiles</code></strong></pre>
                   2924: <p>If you even decide to ignore
                   2925: <code class="varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you can get everything
                   2926: by running:</p>
                   2927: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch NO_SKIP=yes</code></strong></pre>
                   2928: </div>
1.41      asau     2929: <div class="sect1">
1.1       dsieger  2930: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2931: <a name="tmac.andoc-missing"></a>10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
1.23      wiz      2932: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</h2></div></div></div>
1.137     leot     2933: <p>When compiling the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a>
1.1       dsieger  2934: package, you get the error from make that it doesn't know how to make
                   2935: <code class="filename">/usr/share/tmac/tmac.andoc</code>? This indicates that
1.23      wiz      2936: you don't have installed the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> set (nroff, ...) from
1.1       dsieger  2937: the NetBSD base distribution on your machine.  It is recommended to do
                   2938: that to format man pages.</p>
1.137     leot     2939: <p>In the case of the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a> package, you
1.1       dsieger  2940: can get away with setting <code class="varname">NOMAN=YES</code> either in the
1.10      hubertf  2941: environment or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.1       dsieger  2942: </div>
1.41      asau     2943: <div class="sect1">
1.1       dsieger  2944: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2945: <a name="bsd.own.mk-missing"></a>10.11. What does <span class="quote">&#8220;<span class="quote">Could not find bsd.own.mk</span>&#8221;</span> mean?</h2></div></div></div>
1.1       dsieger  2946: <p>You didn't install the compiler set, <code class="filename">comp.tgz</code>,
                   2947: when you installed your NetBSD machine.  Please get and install it, by
                   2948: extracting it in <code class="filename">/</code>:</p>
                   2949: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /</code></strong>
                   2950: <code class="prompt">#</code> <strong class="userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong></pre>
                   2951: <p><code class="filename">comp.tgz</code> is part of every NetBSD release.  Get
1.10      hubertf  2952: the one that corresponds to your release (determine via <span class="command"><strong>uname
1.1       dsieger  2953: -r</strong></span>).</p>
                   2954: </div>
1.41      asau     2955: <div class="sect1">
1.1       dsieger  2956: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2957: <a name="using-sudo-with-pkgsrc"></a>10.12. Using 'sudo' with pkgsrc</h2></div></div></div>
1.1       dsieger  2958: <p>When installing packages as non-root user and using the just-in-time
1.174     leot     2959: <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?su+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a> feature of pkgsrc, it can become annoying to type in the root
1.1       dsieger  2960: password for each required package installed.  To avoid this, the sudo
                   2961: package can be used, which does password caching over a limited time.  To
                   2962: use it, install sudo (either as binary package or from
1.137     leot     2963: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/sudo/README.html" target="_top"><code class="filename">security/sudo</code></a>) and then put the
1.10      hubertf  2964: following into your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, somewhere
1.1       dsieger  2965: <span class="emphasis"><em>after</em></span> the definition of the
                   2966: <code class="varname">LOCALBASE</code> variable:</p>
                   2967: <pre class="programlisting">
                   2968: .if exists(${LOCALBASE}/bin/sudo)
                   2969: SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   2970: .endif
                   2971: </pre>
                   2972: </div>
1.41      asau     2973: <div class="sect1">
1.1       dsieger  2974: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2975: <a name="faq.conf"></a>10.13. How do I change the location of configuration files?</h2></div></div></div>
1.1       dsieger  2976: <p>As the system administrator, you can choose where configuration files
                   2977: are installed.  The default settings make all these files go into
                   2978: <code class="filename">${PREFIX}/etc</code> or some of its subdirectories; this may
                   2979: be suboptimal depending on your expectations (e.g., a read-only,
                   2980: NFS-exported <code class="varname">PREFIX</code> with a need of per-machine
                   2981: configuration of the provided packages).</p>
                   2982: <p>In order to change the defaults, you can modify the
                   2983: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.10      hubertf  2984: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>) to point to your preferred configuration
1.1       dsieger  2985: directory; some common examples include <code class="filename">/etc</code> or
                   2986: <code class="filename">/etc/pkg</code>.</p>
                   2987: <p>Furthermore, you can change this value on a per-package basis by
                   2988: setting the <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> variable.
                   2989: <code class="varname">PKG_SYSCONFVAR</code>'s value usually matches the name of the
                   2990: package you would like to modify, that is, the contents of
                   2991: <code class="varname">PKGBASE</code>.</p>
                   2992: <p>Note that after changing these settings, you must rebuild and
                   2993: reinstall any affected packages.</p>
                   2994: </div>
1.41      asau     2995: <div class="sect1">
1.1       dsieger  2996: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   2997: <a name="audit-packages"></a>10.14. Automated security checks</h2></div></div></div>
1.1       dsieger  2998: <p>Please be aware that there can often be bugs in third-party software,
                   2999: and some of these bugs can leave a machine vulnerable to exploitation by
                   3000: attackers.  In an effort to lessen the exposure, the NetBSD packages team
                   3001: maintains a database of known-exploits to packages which have at one time
                   3002: been included in pkgsrc.  The database can be downloaded automatically, and
                   3003: a security audit of all packages installed on a system can take place.  To
1.14      jmcneill 3004: do this, refer to the following two tools (installed as part of the
1.137     leot     3005: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/README.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a> package):</p>
1.23      wiz      3006: <div class="orderedlist"><ol class="orderedlist" type="1">
                   3007: <li class="listitem">
1.20      snj      3008: <p><span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, an easy way to
1.1       dsieger  3009:     download a list of the security vulnerabilities information.  This list
1.25      spz      3010:     is kept up to date by the pkgsrc security team, and is distributed
                   3011:     from the NetBSD ftp server:</p>
1.177     leot     3012: <p><a class="ulink" href="https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">https://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a></p>
1.1       dsieger  3013: </li>
1.23      wiz      3014: <li class="listitem"><p><span class="command"><strong>pkg_admin audit</strong></span>, an easy way to audit the
                   3015:     current machine, checking each known vulnerability.  If a
1.1       dsieger  3016:     vulnerable package is installed, it will be shown by output to stdout,
                   3017:     including a description of the type of vulnerability, and a URL
                   3018:     containing more information.</p></li>
                   3019: </ol></div>
1.121     sevan    3020: <p>Use of these tools is strongly recommended!
1.154     rillig   3021: See <a class="xref" href="#vulnerabilities" title="5.1.5. Checking for security vulnerabilities in installed packages">Section 5.1.5, &#8220;Checking for security vulnerabilities in installed packages&#8221;</a> for instructions on how to automate checking and
1.121     sevan    3022: reporting.</p>
                   3023: <p>If this database is installed, pkgsrc builds will use it to
                   3024: perform a security check before building any package.</p>
1.1       dsieger  3025: </div>
1.41      asau     3026: <div class="sect1">
1.1       dsieger  3027: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   3028: <a name="ufaq-cflags"></a>10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</h2></div></div></div>
1.1       dsieger  3029: <p>When you add your own preferences to the
                   3030:        <code class="varname">CFLAGS</code> variable in your
1.10      hubertf  3031:        <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, these flags are passed in
1.1       dsieger  3032:        environment variables to the <code class="filename">./configure</code>
1.174     leot     3033:        scripts and to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>. Some package authors ignore the
1.1       dsieger  3034:        <code class="varname">CFLAGS</code> from the environment variable by
                   3035:        overriding them in the <code class="filename">Makefile</code>s of their
                   3036:        package.</p>
                   3037: <p>Currently there is no solution to this problem. If you
                   3038:        really need the package to use your <code class="varname">CFLAGS</code>
1.10      hubertf  3039:        you should run <span class="command"><strong>make patch</strong></span> in the package
1.1       dsieger  3040:        directory and then inspect any <code class="filename">Makefile</code> and
                   3041:        <code class="filename">Makefile.in</code> for whether they define
                   3042:        <code class="varname">CFLAGS</code> explicitly. Usually you can remove
1.23      wiz      3043:        these lines. But be aware that some <span class="quote">&#8220;<span class="quote">smart</span>&#8221;</span>
1.1       dsieger  3044:        programmers write so bad code that it only works for the
                   3045:        specific combination of <code class="varname">CFLAGS</code> they have
                   3046:        chosen.</p>
1.172     rillig   3047: <p>To find out where the CFLAGS are ignored, add the following lines to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
                   3048: <pre class="programlisting">
                   3049: CPPFLAGS+=              -Dpkgsrc___CPPFLAGS
                   3050: CFLAGS+=                -Dpkgsrc___CFLAGS
                   3051: CXXFLAGS+=              -Dpkgsrc___CXXFLAGS
                   3052: </pre>
                   3053: <p>Then run <span class="command"><strong>bmake show-all-configure show-all-build</strong></span>
                   3054: to see whether the above flags are passed to the actual build
                   3055: commands in general.</p>
                   3056: <p>To find out whether the flags are passed to individual compiler
                   3057: commands, have a look at the file <code class="filename">work/.work.log</code>. In
                   3058: most cases, the flags from the original command lines (the lines starting
                   3059: with <code class="literal">[*]</code>) are passed unmodified to the actual compiler
                   3060: (the lines starting with <code class="literal">&lt;.&gt;</code>). If the flag is
                   3061: missing from the actual compiler command, it must have been removed by
                   3062: the <a class="link" href="#build.wrapper" title="19.10. The wrapper phase">pkgsrc compiler wrappers</a>.</p>
1.1       dsieger  3063: </div>
1.41      asau     3064: <div class="sect1">
1.1       dsieger  3065: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   3066: <a name="ufaq-fail"></a>10.16. A package does not build.  What shall I do?</h2></div></div></div>
1.23      wiz      3067: <div class="procedure"><ol class="procedure" type="1">
1.41      asau     3068: <li class="step"><p>Make sure that your copy of pkgsrc is consistent. A
1.1       dsieger  3069:        case that occurs often is that people only update pkgsrc in
                   3070:        parts, because of performance reasons. Since pkgsrc is one large
                   3071:        system, not a collection of many small systems, there are
                   3072:        sometimes changes that only work when the whole pkgsrc tree is
                   3073:        updated.</p></li>
1.41      asau     3074: <li class="step"><p>Make sure that you don't have any CVS conflicts.
1.23      wiz      3075:        Search for <span class="quote">&#8220;<span class="quote">&lt;&lt;&lt;&lt;&lt;&lt;</span>&#8221;</span> or
                   3076:        <span class="quote">&#8220;<span class="quote">&gt;&gt;&gt;&gt;&gt;&gt;</span>&#8221;</span> in all your pkgsrc
1.1       dsieger  3077:        files.</p></li>
1.41      asau     3078: <li class="step"><p>Make sure that you don't have old copies of the packages
1.10      hubertf  3079:        extracted. Run <span class="command"><strong>make clean clean-depends</strong></span> to
1.1       dsieger  3080:        verify this.</p></li>
1.108     rillig   3081: <li class="step"><p>If you are a package developer who wants to invest
1.154     rillig   3082:        some work, have a look at <a class="xref" href="#fixes" title="Chapter 21. Making your package work">Chapter 21, <i>Making your package work</i></a>.</p></li>
1.41      asau     3083: <li class="step"><p>If the problem still exists, write a mail to the
1.1       dsieger  3084:        <code class="literal">pkgsrc-users</code> mailing list.</p></li>
                   3085: </ol></div>
                   3086: </div>
1.41      asau     3087: <div class="sect1">
1.1       dsieger  3088: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   3089: <a name="faq.rcs-conflicts"></a>10.17. What does <span class="quote">&#8220;<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>&#8221;</span> mean?</h2></div></div></div>
1.1       dsieger  3090: <p>You have modified a file from pkgsrc, and someone else has
                   3091: modified that same file afterwards in the CVS repository. Both changes
                   3092: are in the same region of the file, so when you updated pkgsrc, the
                   3093: <code class="literal">cvs</code> command marked the conflicting changes in the
                   3094: file. Because of these markers, the file is no longer a valid
                   3095: <code class="filename">Makefile</code>.</p>
                   3096: <p>Have a look at that file, and if you don't need your local changes
1.10      hubertf  3097: anymore, you can remove that file and run <span class="command"><strong>cvs -q update
1.1       dsieger  3098: -dP</strong></span> in that directory to download the current version.</p>
                   3099: </div>
                   3100: </div>
                   3101: </div>
1.41      asau     3102: <div class="part">
1.1       dsieger  3103: <div class="titlepage"><div><div><h1 class="title">
                   3104: <a name="developers-guide"></a>Part II. The pkgsrc developer's guide</h1></div></div></div>
1.41      asau     3105: <div class="partintro">
1.1       dsieger  3106: <div></div>
                   3107: <p>This part of the book deals with creating and
1.23      wiz      3108:        modifying packages. It starts with a <span class="quote">&#8220;<span class="quote">HOWTO</span>&#8221;</span>-like
1.1       dsieger  3109:        guide on creating a new package. The remaining chapters are more
                   3110:        like a reference manual for pkgsrc.</p>
                   3111: <div class="toc">
                   3112: <p><b>Table of Contents</b></p>
1.100     leot     3113: <dl class="toc">
1.154     rillig   3114: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
                   3115: <dt><span class="chapter"><a href="#creating">12. Creating a new pkgsrc package from scratch</a></span></dt>
1.1       dsieger  3116: <dd><dl>
1.154     rillig   3117: <dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
1.1       dsieger  3118: <dd><dl>
1.154     rillig   3119: <dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
                   3120: <dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.160     brook    3121: <dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt>
                   3122: <dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
1.1       dsieger  3123: </dl></dd>
1.154     rillig   3124: <dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
                   3125: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.6       rillig   3126: </dl></dd>
1.154     rillig   3127: <dt><span class="chapter"><a href="#components">13. Package components - files, directories and contents</a></span></dt>
1.6       rillig   3128: <dd><dl>
1.154     rillig   3129: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
                   3130: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
                   3131: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
1.6       rillig   3132: <dd><dl>
1.154     rillig   3133: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
                   3134: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
                   3135: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
                   3136: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
                   3137: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
1.6       rillig   3138: </dl></dd>
1.154     rillig   3139: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
                   3140: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
1.6       rillig   3141: <dd><dl>
1.154     rillig   3142: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
                   3143: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
                   3144: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.6       rillig   3145: </dl></dd>
1.154     rillig   3146: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
                   3147: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.6       rillig   3148: </dl></dd>
1.154     rillig   3149: <dt><span class="chapter"><a href="#makefile">14. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.6       rillig   3150: <dd><dl>
1.154     rillig   3151: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
                   3152: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
                   3153: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
                   3154: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
1.6       rillig   3155: <dd><dl>
1.154     rillig   3156: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
                   3157: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
                   3158: <dt><span class="sect2"><a href="#cflags-gnu-configure">14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
                   3159: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.6       rillig   3160: </dl></dd>
                   3161: </dl></dd>
1.154     rillig   3162: <dt><span class="chapter"><a href="#plist">15. PLIST issues</a></span></dt>
1.6       rillig   3163: <dd><dl>
1.154     rillig   3164: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
                   3165: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
                   3166: <dt><span class="sect1"><a href="#print-PLIST">15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
                   3167: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
                   3168: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
                   3169: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
                   3170: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
                   3171: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
                   3172: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.6       rillig   3173: </dl></dd>
1.154     rillig   3174: <dt><span class="chapter"><a href="#buildlink">16. Buildlink methodology</a></span></dt>
1.6       rillig   3175: <dd><dl>
1.154     rillig   3176: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
                   3177: <dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.6       rillig   3178: <dd><dl>
1.154     rillig   3179: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
                   3180: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.26      wiz      3181:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   3182:       and
                   3183:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   3184:       in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.6       rillig   3185: </dl></dd>
1.154     rillig   3186: <dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.6       rillig   3187: <dd><dl>
1.154     rillig   3188: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
                   3189: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
1.6       rillig   3190: </dl></dd>
                   3191: </dl></dd>
1.154     rillig   3192: <dt><span class="chapter"><a href="#pkginstall">17. The pkginstall framework</a></span></dt>
1.6       rillig   3193: <dd><dl>
1.154     rillig   3194: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
                   3195: <dd><dl>
                   3196: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
                   3197: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
                   3198: </dl></dd>
                   3199: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
                   3200: <dd><dl>
                   3201: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
                   3202: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
                   3203: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
                   3204: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
                   3205: </dl></dd>
                   3206: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
                   3207: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">17.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
                   3208: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
                   3209: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
                   3210: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
                   3211: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
                   3212: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">17.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
                   3213: </dl></dd>
                   3214: <dt><span class="chapter"><a href="#options">18. Options handling</a></span></dt>
                   3215: <dd><dl>
                   3216: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
                   3217: <dt><span class="sect1"><a href="#converting-to-options">18.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
                   3218: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
                   3219: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
                   3220: </dl></dd>
                   3221: <dt><span class="chapter"><a href="#build">19. The build process</a></span></dt>
                   3222: <dd><dl>
                   3223: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
                   3224: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
                   3225: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
                   3226: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
                   3227: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   3228: <dd><dl>
                   3229: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
                   3230: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
                   3231: </dl></dd>
                   3232: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
                   3233: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
                   3234: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
                   3235: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
                   3236: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
                   3237: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   3238: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   3239: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
                   3240: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   3241: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
                   3242: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
                   3243: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
                   3244: </dl></dd>
                   3245: <dt><span class="chapter"><a href="#tools">20. Tools needed for building or running</a></span></dt>
                   3246: <dd><dl>
                   3247: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
                   3248: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
                   3249: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
                   3250: </dl></dd>
                   3251: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
                   3252: <dd><dl>
                   3253: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
                   3254: <dd><dl>
                   3255: <dt><span class="sect2"><a href="#pulling-vars-from-etc-mk.conf">21.1.1. How to pull in user-settable variables from <code class="filename">mk.conf</code></a></span></dt>
                   3256: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
                   3257: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
                   3258: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
                   3259: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
                   3260: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
                   3261: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
                   3262: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
                   3263: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
                   3264: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
                   3265: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
                   3266: </dl></dd>
                   3267: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   3268: <dd><dl>
                   3269: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
                   3270: <dt><span class="sect2"><a href="#modified-distfiles-same-name">21.2.2. How to handle modified distfiles with the 'old' name</a></span></dt>
                   3271: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
                   3272: </dl></dd>
                   3273: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   3274: <dd><dl>
                   3275: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
                   3276: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
                   3277: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
                   3278: </dl></dd>
                   3279: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
                   3280: <dd><dl>
                   3281: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
                   3282: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
                   3283: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
                   3284: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
                   3285: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
                   3286: </dl></dd>
                   3287: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   3288: <dd><dl>
                   3289: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
                   3290: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.172     rillig   3291: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
                   3292: <dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt>
                   3293: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.154     rillig   3294: </dl></dd>
                   3295: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   3296: <dd><dl>
                   3297: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
                   3298: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
                   3299: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
                   3300: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
                   3301: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
                   3302: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
                   3303: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
                   3304: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
                   3305: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
                   3306: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
                   3307: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
                   3308: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
                   3309: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
                   3310: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
                   3311: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
                   3312: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
                   3313: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
                   3314: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.1       dsieger  3315:     emulation</a></span></dt>
1.154     rillig   3316: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
                   3317: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.1       dsieger  3318: </dl></dd>
1.154     rillig   3319: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.1       dsieger  3320: </dl></dd>
1.154     rillig   3321: <dt><span class="chapter"><a href="#debug">22. Debugging</a></span></dt>
                   3322: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.1       dsieger  3323: <dd><dl>
1.154     rillig   3324: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
                   3325: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
                   3326: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
                   3327: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
                   3328: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
                   3329: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
                   3330: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
                   3331: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
                   3332: </dl></dd>
                   3333: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
                   3334: <dt><span class="chapter"><a href="#gnome">25. GNOME packaging and porting</a></span></dt>
                   3335: <dd><dl>
                   3336: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
                   3337: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
                   3338: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
                   3339: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.1       dsieger  3340: </dl></dd>
                   3341: </dl>
                   3342: </div>
                   3343: </div>
1.41      asau     3344: <div class="chapter">
1.1       dsieger  3345: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   3346: <a name="help-devel"></a>Chapter 11. Getting help</h2></div></div></div>
                   3347: <p>
                   3348:        To get help when developing pkgsrc, the definitive source is this
                   3349:        document, the pkgsrc guide. If you don't find anything here,
                   3350:        there are alternatives:
                   3351: </p>
                   3352: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3353: <li class="listitem">
                   3354: <p>
                   3355:        The built-in pkgsrc help, which is available after bootstrapping
                   3356:        pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get
                   3357:        help for any topic, such as a variable name like
                   3358:        <code class="varname">BUILD_DEFS</code>, a make target like
                   3359:        <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
                   3360:        <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
                   3361: <p>The available help topics are listed in <a class="xref" href="#help-topics" title="Appendix D. Help topics">Appendix D, <i>Help topics</i></a>.</p>
                   3362: </li>
                   3363: <li class="listitem"><p>
1.163     rillig   3364:        To see the value of a single variable, run <span class="command"><strong>bmake
                   3365:        show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
                   3366: </p></li>
                   3367: <li class="listitem"><p>
                   3368:        To see the values of the most common variables, run
                   3369:        <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
                   3370:        topic. To see the variables for a single topic, run
                   3371:        <span class="command"><strong>bmake
                   3372:        show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
                   3373:        <span class="command"><strong>bmake show-all-fetch</strong></span>.
                   3374: </p></li>
                   3375: <li class="listitem"><p>
1.154     rillig   3376:        The tech-pkg mailing list, to which
                   3377:        <a class="ulink" href="https://www.NetBSD.org/mailinglists/#tech-pkg" target="_top">you
                   3378:        can subscribe</a> and then <a class="ulink" href="mailto:tech-pkg@NetBSD.org" target="_top">ask your
                   3379:        questions</a>.</p></li>
                   3380: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
                   3381:        <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
                   3382:        or by using a specialized chat program such as
                   3383:        <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
                   3384:        Pick any user name and join the channel #pkgsrc.</p></li>
                   3385: </ul></div>
                   3386: </div>
                   3387: <div class="chapter">
                   3388: <div class="titlepage"><div><div><h2 class="title">
                   3389: <a name="creating"></a>Chapter 12. Creating a new pkgsrc package from scratch</h2></div></div></div>
1.1       dsieger  3390: <div class="toc">
                   3391: <p><b>Table of Contents</b></p>
1.100     leot     3392: <dl class="toc">
1.154     rillig   3393: <dt><span class="sect1"><a href="#creating.common">12.1. Common types of packages</a></span></dt>
1.1       dsieger  3394: <dd><dl>
1.154     rillig   3395: <dt><span class="sect2"><a href="#creating.perl-module">12.1.1. Perl modules</a></span></dt>
                   3396: <dt><span class="sect2"><a href="#creating.python-module">12.1.2. Python modules and programs</a></span></dt>
1.160     brook    3397: <dt><span class="sect2"><a href="#creating.R-package">12.1.3. R packages</a></span></dt>
                   3398: <dt><span class="sect2"><a href="#creating.TeX-package">12.1.4. TeXlive packages</a></span></dt>
1.1       dsieger  3399: </dl></dd>
1.154     rillig   3400: <dt><span class="sect1"><a href="#creating.examples">12.2. Examples</a></span></dt>
                   3401: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">12.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.1       dsieger  3402: </dl>
                   3403: </div>
                   3404: <p>When you find a package that is not yet in pkgsrc, you
                   3405: most likely have a URL from where you can download the source
                   3406: code. Starting with this URL, creating a package involves only a
                   3407: few steps.</p>
1.23      wiz      3408: <div class="procedure"><ol class="procedure" type="1">
1.137     leot     3409: <li class="step"><p>First, install the packages <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a> and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>.</p></li>
1.41      asau     3410: <li class="step"><p>Then, choose one of the top-level directories as the
1.1       dsieger  3411: category in which you want to place your package. You can also create a
                   3412: directory of your own (maybe called <code class="filename">local</code>). In that
                   3413: category directory, create another directory for your package and change
                   3414: into it.</p></li>
1.41      asau     3415: <li class="step"><p>Run the program <span class="command"><strong>url2pkg</strong></span>, which will ask
1.1       dsieger  3416: you for a URL. Enter the URL of the distribution file (in most cases a
                   3417: <code class="filename">.tar.gz</code> file) and watch how the basic ingredients
                   3418: of your package are created automatically. The distribution file is
                   3419: extracted automatically to fill in some details in the
                   3420: <code class="filename">Makefile</code> that would otherwise have to be done
                   3421: manually.</p></li>
1.41      asau     3422: <li class="step">
1.1       dsieger  3423: <p>Examine the extracted files to determine the dependencies of
                   3424: your package. Ideally, this is mentioned in some
                   3425: <code class="filename">README</code> file, but things may differ. For each of
                   3426: these dependencies, look where it exists in pkgsrc, and if there is a
                   3427: file called <code class="filename">buildlink3.mk</code> in that directory, add a
                   3428: line to your package <code class="filename">Makefile</code> which includes that
                   3429: file just before the last line. If the
1.25      spz      3430: <code class="filename">buildlink3.mk</code> file does not exist, it must be
1.161     leot     3431: created first. The <code class="filename">buildlink3.mk</code> file makes sure
                   3432: that the package's include files and libraries are provided.</p>
1.25      spz      3433: <p>If you just need binaries from a package, add a
1.1       dsieger  3434: <code class="varname">DEPENDS</code> line to the Makefile, which specifies the
                   3435: version of the dependency and where it can be found in pkgsrc. This line
                   3436: should be placed in the third paragraph. If the dependency is only
                   3437: needed for building the package, but not when using it, use
1.156     leot     3438: <code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code>
                   3439: instead of <code class="varname">DEPENDS</code>.
                   3440: The difference between <code class="varname">TOOL_DEPENDS</code> and
                   3441: <code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling:
                   3442: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
                   3443: packages, i.e. packages for the architecture where the package
                   3444: is built;
                   3445: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
                   3446: packages, i.e. packages for the architecture for which the package
1.175     gutterid 3447: is built. There is also <code class="varname">TEST_DEPENDS</code>, which is used
                   3448: to specify a dependency used only for testing the resulting package
                   3449: built, using the upstream project's included test suite.
1.1       dsieger  3450: Your package may then look like this:</p>
                   3451: <pre class="programlisting">
                   3452: [...]
                   3453: 
1.156     leot     3454: TOOL_DEPENDS+=  libxslt-[0-9]*:../../textproc/libxslt
1.1       dsieger  3455: DEPENDS+=       screen-[0-9]*:../../misc/screen
                   3456: DEPENDS+=       screen&gt;=4.0:../../misc/screen
                   3457: 
                   3458: [...]
                   3459: 
                   3460: .include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
                   3461: .include "../../devel/glib2/buildlink3.mk"
                   3462: .include "../../mk/bsd.pkg.mk"
                   3463: </pre>
                   3464: </li>
1.41      asau     3465: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
1.23      wiz      3466: to be done to make your package a <span class="quote">&#8220;<span class="quote">good</span>&#8221;</span> one. If you don't
1.10      hubertf  3467: know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
                   3468: --explain</strong></span> or <span class="command"><strong>pkglint
1.1       dsieger  3469: -e</strong></span>, which outputs additional
                   3470: explanations.</p></li>
1.41      asau     3471: <li class="step"><p>In many cases the package is not yet ready to build. You can
1.154     rillig   3472: find instructions for the most common cases in the next section, <a class="xref" href="#creating.common" title="12.1. Common types of packages">Section 12.1, &#8220;Common types of packages&#8221;</a>. After you have followed the instructions
1.1       dsieger  3473: over there, you can hopefully continue here.</p></li>
1.41      asau     3474: <li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working
1.1       dsieger  3475: directory from the extracted files. Besides these files, a lot of cache
                   3476: files and other system information has been saved in the working
                   3477: directory, which may become wrong after you edited the
                   3478: <code class="filename">Makefile</code>.</p></li>
1.41      asau     3479: <li class="step"><p>Now, run <span class="command"><strong>bmake</strong></span> to build the package. For
1.154     rillig   3480: the various things that can go wrong in this phase, consult <a class="xref" href="#fixes" title="Chapter 21. Making your package work">Chapter 21, <i>Making your package work</i></a>.</p></li>
1.41      asau     3481: <li class="step"><p>When the package builds fine, the next step is to install
1.10      hubertf  3482: the package. Run <span class="command"><strong>bmake install</strong></span> and hope that
1.1       dsieger  3483: everything works.</p></li>
1.41      asau     3484: <li class="step"><p>Up to now, the file <code class="filename">PLIST</code>, which
1.1       dsieger  3485: contains a list of the files that are installed by the package, is
1.10      hubertf  3486: nearly empty. Run <span class="command"><strong>bmake print-PLIST
1.1       dsieger  3487: &gt;PLIST</strong></span> to generate a probably correct list. Check
                   3488: the file using your preferred text editor to see if the list of
                   3489: files looks plausible.</p></li>
1.41      asau     3490: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> again to see if the generated
1.1       dsieger  3491: <code class="filename">PLIST</code> contains garbage or not.</p></li>
1.41      asau     3492: <li class="step"><p>When you ran <span class="command"><strong>bmake install</strong></span>, the package
1.1       dsieger  3493: has been registered in the database of installed files, but with an
1.10      hubertf  3494: empty list of files. To fix this, run <span class="command"><strong>bmake deinstall</strong></span>
                   3495: and <span class="command"><strong>bmake install</strong></span> again. Now the package is
1.1       dsieger  3496: registered with the list of files from
                   3497: <code class="filename">PLIST</code>.</p></li>
1.41      asau     3498: <li class="step"><p>Run <span class="command"><strong>bmake package</strong></span> to create a binary
1.1       dsieger  3499: package from the set of installed files.</p></li>
                   3500: </ol></div>
1.41      asau     3501: <div class="sect1">
1.1       dsieger  3502: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   3503: <a name="creating.common"></a>12.1. Common types of packages</h2></div></div></div>
1.41      asau     3504: <div class="sect2">
1.1       dsieger  3505: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   3506: <a name="creating.perl-module"></a>12.1.1. Perl modules</h3></div></div></div>
1.1       dsieger  3507: <p>Simple Perl modules are handled automatically by
1.10      hubertf  3508: <span class="command"><strong>url2pkg</strong></span>, including dependencies.</p>
1.1       dsieger  3509: </div>
1.41      asau     3510: <div class="sect2">
1.1       dsieger  3511: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   3512: <a name="creating.python-module"></a>12.1.2. Python modules and programs</h3></div></div></div>
1.17      imil     3513: <p>Python modules and programs packages are easily created using a
                   3514: set of predefined variables.</p>
                   3515: <p>
1.63      wiz      3516: If some Python versions are not supported by the software, set the
                   3517: <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions
                   3518: that are not supported, e.g.
1.17      imil     3519: </p>
                   3520: <pre class="programlisting">
1.93      sevan    3521: PYTHON_VERSIONS_INCOMPATIBLE=       27
1.17      imil     3522: </pre>
                   3523: <p>
1.103     wiz      3524: If the packaged software is a Python module, include one of
                   3525: <code class="filename">../../lang/python/egg.mk</code>,
                   3526: <code class="filename">../../lang/python/distutils.mk</code>, or
                   3527: <code class="filename">../../lang/python/extension.mk</code>.</p>
                   3528: <p>Most Python packages use either <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span> or
                   3529: easy-setup/setuptools (<span class="quote">&#8220;<span class="quote">eggs</span>&#8221;</span>).
1.175     gutterid 3530: If the packaged software is using setuptools, you only need
1.103     wiz      3531: to include <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/egg.mk</code></span>&#8221;</span>.
                   3532: Otherwise, if the software uses <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span>, include 
1.175     gutterid 3533: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/distutils.mk</code></span>&#8221;</span>,
1.103     wiz      3534: so pkgsrc will use this framework.
1.175     gutterid 3535: <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span> uses a script called <code class="filename">setup.py</code>;
1.103     wiz      3536: if the <span class="quote">&#8220;<span class="quote">distutils</span>&#8221;</span> driver is not called
                   3537: <code class="filename">setup.py</code>, set the <code class="varname">PYSETUP</code> variable
                   3538: to the name of the script.</p>
                   3539: <p>Either way, the package directory should be called
1.23      wiz      3540: <span class="quote">&#8220;<span class="quote">py-software</span>&#8221;</span> and <code class="varname">PKGNAME</code> should be set to
                   3541: <span class="quote">&#8220;<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>&#8221;</span>, e.g.
1.17      imil     3542: </p>
                   3543: <pre class="programlisting">
                   3544: DISTNAME=   foopymodule-1.2.10
                   3545: PKGNAME=    ${PYPKGPREFIX}-${DISTNAME}
                   3546: </pre>
1.63      wiz      3547: <p>If it is an application, include
                   3548: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>&#8221;</span>.
                   3549: In order to correctly set the path to the Python interpreter, use the
1.17      imil     3550: <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files
1.35      wiz      3551: (paths relative to <code class="varname">WRKSRC</code>) that must be corrected.
1.63      wiz      3552: For example:
1.17      imil     3553: </p>
                   3554: <pre class="programlisting">
1.35      wiz      3555: REPLACE_PYTHON=   *.py
1.17      imil     3556: </pre>
1.63      wiz      3557: <p>Some Python modules have separate distributions for Python-2.x
                   3558: and Python-3.x support. In pkgsrc this is handled by the
                   3559: <code class="filename">versioned_dependencies.mk</code> file. Set
                   3560: <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of
                   3561: packages that should be depended upon and include
                   3562: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>&#8221;</span>,
                   3563: then the pkgsrc infrastructure will depend on the appropriate package
                   3564: version. For example:
                   3565: </p>
                   3566: <pre class="programlisting">
1.135     wiz      3567: PYTHON_VERSIONED_DEPENDENCIES=dialog
1.63      wiz      3568: </pre>
                   3569: <p>
                   3570: Look inside <code class="filename">versioned_dependencies.mk</code> for a list
                   3571: of supported packages.</p>
1.17      imil     3572: </div>
1.160     brook    3573: <div class="sect2">
                   3574: <div class="titlepage"><div><div><h3 class="title">
                   3575: <a name="creating.R-package"></a>12.1.3. R packages</h3></div></div></div>
                   3576: <p>Simple R packages from <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>
                   3577: are handled automatically by <span class="command"><strong>R2pkg</strong></span>, which is
                   3578: available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/R2pkg/README.html" target="_top"><code class="filename">pkgtools/R2pkg</code></a>.
                   3579: Individual packages (and optionally their dependencies) may be created
                   3580: and updated.  R packages generally follow the same form, and most of
                   3581: the relevant information needed is contained in a
                   3582: <code class="filename">DESCRIPTION</code> file as part of each R package on
                   3583: <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>.
                   3584: Consequently, <span class="command"><strong>R2pkg</strong></span> downloads that information and
                   3585: creates or updates a package in the canonical form.  The resulting
                   3586: package should be reviewed for correctness.</p>
                   3587: </div>
                   3588: <div class="sect2">
                   3589: <div class="titlepage"><div><div><h3 class="title">
                   3590: <a name="creating.TeX-package"></a>12.1.4. TeXlive packages</h3></div></div></div>
                   3591: <p>TeXlive packages from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> are handled automatically by
                   3592: <span class="command"><strong>texlive2pkg</strong></span>, which is available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/texlive2pkg/README.html" target="_top"><code class="filename">pkgtools/texlive2pkg</code></a>.</p>
                   3593: <p>If the TeXlive package name is not known, it may be useful to
                   3594: search <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>.  A
                   3595: <span class="quote">&#8220;<span class="quote">Contained in</span>&#8221;</span> field on the package page typically
                   3596: identifies the basename of the package file in the <a class="ulink" href="https://www.ctan.org/tex-archive/systems/texlive/tlnet/archive" target="_top">TeXlive
                   3597: archive</a>.</p>
                   3598: <p>If the TeXlive package name is known, download the files from
                   3599: the <a class="ulink" href="https://www.ctan.org/tex-archive/systems/texlive/tlnet/archive" target="_top">TeXlive
                   3600: archive</a>.  For package <code class="filename">foo</code>, you will need
                   3601: to download <code class="filename">foo.tar.xz</code>.  Most TeXlive packages
                   3602: also have associated documentation packages, so download
                   3603: <code class="filename">foo.doc.tar.xz</code> at the same time.  These files
                   3604: should be placed in the appropriate category directory, which is often
                   3605: but not always <code class="filename">print</code>.  Then run the following
                   3606: command in the category directory.</p>
                   3607: <pre class="programlisting">
                   3608: texlive2pkg foo.tar.xz foo.doc.tar.xz
                   3609: </pre>
                   3610: <p>This will create two packages, <code class="filename">tex-foo</code> and
                   3611: <code class="filename">tex-foo-doc</code>.  Be sure to check that both packages
                   3612: are correct.</p>
                   3613: <p>Finally, <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>
                   3614: currently does not include version information in package filenames
                   3615: and changes their contents periodically when updates occur.
                   3616: Consequently, pkgsrc avoids downloading distfiles directly from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> and instead relies on the
                   3617: pkgsrc archives.  For each new or updated TeXlive package, e.g., the
                   3618: main one and the corresponding documentation, upload the distfiles
                   3619: with the following command in each package directory.</p>
                   3620: <pre class="programlisting">
                   3621: make upload-distfiles
                   3622: </pre>
                   3623: </div>
1.1       dsieger  3624: </div>
1.41      asau     3625: <div class="sect1">
1.1       dsieger  3626: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   3627: <a name="creating.examples"></a>12.2. Examples</h2></div></div></div>
1.41      asau     3628: <div class="sect2">
1.1       dsieger  3629: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   3630: <a name="creating.nvu"></a>12.2.1. How the www/nvu package came into pkgsrc</h3></div></div></div>
1.41      asau     3631: <div class="sect3">
1.1       dsieger  3632: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   3633: <a name="creating.nvu.init"></a>12.2.1.1. The initial package</h4></div></div></div>
1.1       dsieger  3634: <p>Looking at the file <code class="filename">pkgsrc/doc/TODO</code>, I saw
1.23      wiz      3635: that the <span class="quote">&#8220;<span class="quote">nvu</span>&#8221;</span> package has not yet been imported into
1.1       dsieger  3636: pkgsrc. As the description says it has to do with the web, the obvious
1.23      wiz      3637: choice for the category is <span class="quote">&#8220;<span class="quote">www</span>&#8221;</span>.</p>
1.1       dsieger  3638: <pre class="programlisting">
                   3639: <code class="prompt">$</code> mkdir www/nvu
                   3640: <code class="prompt">$</code> cd www/nvu
                   3641: </pre>
                   3642: <p>The web site says that the sources are available as a tar file, so
1.10      hubertf  3643: I fed that URL to the <span class="command"><strong>url2pkg</strong></span> program:</p>
1.1       dsieger  3644: <pre class="programlisting">
                   3645: <code class="prompt">$</code> url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
                   3646: </pre>
                   3647: <p>My editor popped up, and I added a <code class="varname">PKGNAME</code> line
                   3648: below the <code class="varname">DISTNAME</code> line, as the package name should
1.23      wiz      3649: not have the word <span class="quote">&#8220;<span class="quote">sources</span>&#8221;</span> in it. I also filled in the
1.1       dsieger  3650: <code class="varname">MAINTAINER</code>, <code class="varname">HOMEPAGE</code> and
                   3651: <code class="varname">COMMENT</code> fields. Then the package
                   3652: <code class="filename">Makefile</code> looked like that:</p>
                   3653: <pre class="programlisting">
1.121     sevan    3654: # $NetBSD $
1.1       dsieger  3655: #
                   3656: 
                   3657: DISTNAME=       nvu-1.0-sources
                   3658: PKGNAME=        nvu-1.0
                   3659: CATEGORIES=     www
                   3660: MASTER_SITES=   http://cvs.nvu.com/download/
                   3661: EXTRACT_SUFX=   .tar.bz2
                   3662: 
                   3663: MAINTAINER=     rillig@NetBSD.org
                   3664: HOMEPAGE=       http://cvs.nvu.com/
                   3665: COMMENT=        Web Authoring System
                   3666: 
                   3667: # url2pkg-marker (please do not remove this line.)
                   3668: .include "../../mk/bsd.pkg.mk"
                   3669: </pre>
1.124     wiz      3670: <p>On the first line of output above, an artificial space has been added between NetBSD and $,
1.121     sevan    3671: this is a workaround to prevent CVS expanding to the filename of the
                   3672: guide.</p>
1.1       dsieger  3673: <p>Then, I quit the editor and watched pkgsrc downloading a large
                   3674: source archive:</p>
                   3675: <pre class="programlisting">
                   3676: url2pkg&gt; Running "make makesum" ...
                   3677: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                   3678: =&gt; Fetching nvu-1.0-sources.tar.bz2
                   3679: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
                   3680: 100% |*************************************| 28992 KB  150.77 KB/s00:00 ETA
                   3681: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
                   3682: url2pkg&gt; Running "make extract" ...
                   3683: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                   3684: =&gt; Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
                   3685: =&gt; Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
                   3686: work.bacc -&gt; /tmp/roland/pkgsrc/www/nvu/work.bacc
                   3687: ===&gt; Installing dependencies for nvu-1.0
                   3688: ===&gt; Overriding tools for nvu-1.0
                   3689: ===&gt; Extracting for nvu-1.0
                   3690: url2pkg&gt; Adjusting the Makefile.
                   3691: 
                   3692: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
                   3693: 
                   3694: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
                   3695: </pre>
                   3696: </div>
1.41      asau     3697: <div class="sect3">
1.1       dsieger  3698: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   3699: <a name="creating.nvu.problems"></a>12.2.1.2. Fixing all kinds of problems to make the package work</h4></div></div></div>
1.1       dsieger  3700: <p>Now that the package has been extracted, let's see what's inside
                   3701: it. The package has a <code class="filename">README.txt</code>, but that only
                   3702: says something about mozilla, so it's probably useless for seeing what
                   3703: dependencies this package has. But since there is a GNU configure script
                   3704: in the package, let's hope that it will complain about everything it
                   3705: needs.</p>
                   3706: <pre class="programlisting">
                   3707: <code class="prompt">$</code> bmake
                   3708: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                   3709: =&gt; Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
                   3710: =&gt; Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
                   3711: ===&gt; Patching for nvu-1.0
                   3712: ===&gt; Creating toolchain wrappers for nvu-1.0
                   3713: ===&gt; Configuring for nvu-1.0
                   3714: [...]
                   3715: configure: error: Perl 5.004 or higher is required.
                   3716: [...]
                   3717: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
                   3718: [...]
                   3719: </pre>
                   3720: <p>That worked quite well. So I opened the package Makefile in my
                   3721: editor, and since it already has a <code class="varname">USE_TOOLS</code> line, I
1.23      wiz      3722: just appended <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to it. Since the dependencies of the
1.1       dsieger  3723: package have changed now, and since a perl wrapper is automatically
1.23      wiz      3724: installed in the <span class="quote">&#8220;<span class="quote">tools</span>&#8221;</span> phase, I need to build the package
1.1       dsieger  3725: from scratch.</p>
                   3726: <pre class="programlisting">
                   3727: <code class="prompt">$</code> bmake clean
                   3728: ===&gt; Cleaning for nvu-1.0
                   3729: <code class="prompt">$</code> bmake
                   3730: [...]
                   3731: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
                   3732: GNU Make.  You will not be able to build Mozilla without GNU Make.
                   3733: [...]
                   3734: </pre>
1.23      wiz      3735: <p>So I added <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> to the
1.1       dsieger  3736: <code class="varname">USE_TOOLS</code> line and tried again (from scratch).</p>
                   3737: <pre class="programlisting">
                   3738: [...]
                   3739: checking for GTK - version &gt;= 1.2.0... no
                   3740: *** Could not run GTK test program, checking why...
                   3741: [...]
                   3742: </pre>
                   3743: <p>Now to the other dependencies. The first question is: Where is the
                   3744: GTK package hidden in pkgsrc?</p>
                   3745: <pre class="programlisting">
                   3746: <code class="prompt">$</code> echo ../../*/gtk*
                   3747: [many packages ...]
                   3748: <code class="prompt">$</code> echo ../../*/gtk
                   3749: ../../x11/gtk
                   3750: <code class="prompt">$</code> echo ../../*/gtk2
                   3751: ../../x11/gtk2
                   3752: <code class="prompt">$</code> echo ../../*/gtk2/bui*
                   3753: ../../x11/gtk2/buildlink3.mk
                   3754: </pre>
                   3755: <p>The first try was definitely too broad. The second one had exactly
                   3756: one result, which is very good. But there is one pitfall with GNOME
                   3757: packages. Before GNOME 2 had been released, there were already many
                   3758: GNOME 1 packages in pkgsrc. To be able to continue to use these
                   3759: packages, the GNOME 2 packages were imported as separate packages, and
1.23      wiz      3760: their names usually have a <span class="quote">&#8220;<span class="quote">2</span>&#8221;</span> appended. So I checked
1.1       dsieger  3761: whether this was the case here, and indeed it was.</p>
                   3762: <p>Since the GTK2 package has a <code class="filename">buildlink3.mk</code>
                   3763: file, adding the dependency is very easy. I just inserted an
                   3764: <code class="literal">.include</code> line before the last line of the package
                   3765: <code class="filename">Makefile</code>, so that it now looks like this:</p>
                   3766: <pre class="programlisting">
                   3767: [...]
                   3768: .include "../../x11/gtk2/buildlink3.mk"
                   3769: .include "../../mk/bsd.pkg.mk
                   3770: </pre>
1.10      hubertf  3771: <p>After another <span class="command"><strong>bmake clean &amp;&amp; bmake</strong></span>, the answer
1.1       dsieger  3772: was:</p>
                   3773: <pre class="programlisting">
                   3774: [...]
                   3775: checking for gtk-config... /home/roland/pkg/bin/gtk-config
                   3776: checking for GTK - version &gt;= 1.2.0... no
                   3777: *** Could not run GTK test program, checking why...
                   3778: *** The test program failed to compile or link. See the file config.log for the
                   3779: *** exact error that occured. This usually means GTK was incorrectly installed
                   3780: *** or that you have moved GTK since it was installed. In the latter case, you
                   3781: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
                   3782: configure: error: Test for GTK failed.
                   3783: [...]
                   3784: </pre>
1.23      wiz      3785: <p>In this particular case, the assumption that <span class="quote">&#8220;<span class="quote">every package
                   3786: prefers GNOME 2</span>&#8221;</span> had been wrong. The first of the lines above
1.1       dsieger  3787: told me that this package really wanted to have the GNOME 1 version of
                   3788: GTK. If the package had looked for GTK2, it would have looked for
1.10      hubertf  3789: <span class="command"><strong>pkg-config</strong></span> instead of <span class="command"><strong>gtk-config</strong></span>.
1.1       dsieger  3790: So I changed the <code class="literal">x11/gtk2</code> to
                   3791: <code class="literal">x11/gtk</code> in the package <code class="filename">Makefile</code>,
                   3792: and tried again.</p>
                   3793: <pre class="programlisting">
                   3794: [...]
1.59      jnemeth  3795: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\"  [...]
1.1       dsieger  3796: In file included from xpidl.c:42:
                   3797: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
                   3798: In file included from xpidl.c:42:
                   3799: xpidl.h:132: error: parse error before "IDL_ns"
                   3800: [...]
                   3801: </pre>
                   3802: <p>The package still does not find all of its dependencies. Now the
                   3803: question is: Which package provides the
                   3804: <code class="filename">libIDL/IDL.h</code> header file?</p>
                   3805: <pre class="programlisting">
                   3806: <code class="prompt">$</code> echo ../../*/*idl*
                   3807: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
                   3808: <code class="prompt">$</code> echo ../../*/*IDL*
                   3809: ../../net/libIDL
                   3810: </pre>
                   3811: <p>Let's take the one from the second try. So I included the
                   3812: <code class="filename">../../net/libIDL/buildlink3.mk</code> file and tried
                   3813: again. But the error didn't change. After digging through some of the
                   3814: code, I concluded that the build process of the package was broken and
                   3815: couldn't have ever worked, but since the Mozilla source tree is quite
                   3816: large, I didn't want to fix it. So I added the following to the package
                   3817: <code class="filename">Makefile</code> and tried again:</p>
                   3818: <pre class="programlisting">
                   3819: CPPFLAGS+=              -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
1.139     leot     3820: BUILDLINK_TRANSFORM+=   l:IDL:IDL-2
1.1       dsieger  3821: </pre>
                   3822: <p>The latter line is needed because the package expects the library
                   3823: <code class="filename">libIDL.so</code>, but only
                   3824: <code class="filename">libIDL-2.so</code> is available. So I told the compiler
                   3825: wrapper to rewrite that on the fly.</p>
                   3826: <p>The next problem was related to a recent change of the FreeType
1.137     leot     3827: interface. I looked up in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/seamonkey/README.html" target="_top"><code class="filename">www/seamonkey</code></a>
1.1       dsieger  3828: which patch files were relevant for this issue and copied them to the
                   3829: <code class="filename">patches</code> directory. Then I retried, fixed the
                   3830: patches so that they applied cleanly and retried again. This time,
                   3831: everything worked.</p>
                   3832: </div>
1.41      asau     3833: <div class="sect3">
1.1       dsieger  3834: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   3835: <a name="creating.nvu.inst"></a>12.2.1.3. Installing the package</h4></div></div></div>
1.1       dsieger  3836: <pre class="programlisting">
                   3837: <code class="prompt">$</code> bmake CHECK_FILES=no install
                   3838: [...]
                   3839: <code class="prompt">$</code> bmake print-PLIST &gt;PLIST
                   3840: <code class="prompt">$</code> bmake deinstall
                   3841: <code class="prompt">$</code> bmake install
                   3842: </pre>
                   3843: </div>
                   3844: </div>
                   3845: </div>
                   3846: </div>
1.41      asau     3847: <div class="chapter">
1.1       dsieger  3848: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   3849: <a name="components"></a>Chapter 13. Package components - files, directories and contents</h2></div></div></div>
1.1       dsieger  3850: <div class="toc">
                   3851: <p><b>Table of Contents</b></p>
1.100     leot     3852: <dl class="toc">
1.154     rillig   3853: <dt><span class="sect1"><a href="#components.Makefile">13.1. <code class="filename">Makefile</code></a></span></dt>
                   3854: <dt><span class="sect1"><a href="#components.distinfo">13.2. <code class="filename">distinfo</code></a></span></dt>
                   3855: <dt><span class="sect1"><a href="#components.patches">13.3. <code class="filename">patches/*</code></a></span></dt>
                   3856: <dd><dl>
                   3857: <dt><span class="sect2"><a href="#components.patch.structure">13.3.1. Structure of a single patch file</a></span></dt>
                   3858: <dt><span class="sect2"><a href="#components.patches.caveats">13.3.2. Creating patch files</a></span></dt>
                   3859: <dt><span class="sect2"><a href="#components.patches.sources">13.3.3. Sources where the patch files come from</a></span></dt>
                   3860: <dt><span class="sect2"><a href="#components.patches.guidelines">13.3.4. Patching guidelines</a></span></dt>
                   3861: <dt><span class="sect2"><a href="#components.patches.feedback">13.3.5. Feedback to the author</a></span></dt>
                   3862: </dl></dd>
                   3863: <dt><span class="sect1"><a href="#other-mandatory-files">13.4. Other mandatory files</a></span></dt>
                   3864: <dt><span class="sect1"><a href="#components.optional">13.5. Optional files</a></span></dt>
                   3865: <dd><dl>
                   3866: <dt><span class="sect2"><a href="#components.optional.bin">13.5.1. Files affecting the binary package</a></span></dt>
                   3867: <dt><span class="sect2"><a href="#components.optional.build">13.5.2. Files affecting the build process</a></span></dt>
                   3868: <dt><span class="sect2"><a href="#components.optional.none">13.5.3. Files affecting nothing at all</a></span></dt>
1.1       dsieger  3869: </dl></dd>
1.154     rillig   3870: <dt><span class="sect1"><a href="#work-dir">13.6. <code class="filename">work*</code></a></span></dt>
                   3871: <dt><span class="sect1"><a href="#files-dir">13.7. <code class="filename">files/*</code></a></span></dt>
1.1       dsieger  3872: </dl>
                   3873: </div>
                   3874: <p>Whenever you're preparing a package, there are a number of
                   3875: files involved which are described in the following
                   3876: sections.</p>
1.41      asau     3877: <div class="sect1">
1.1       dsieger  3878: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   3879: <a name="components.Makefile"></a>13.1. <code class="filename">Makefile</code>
1.1       dsieger  3880: </h2></div></div></div>
                   3881: <p>Building, installation and creation of a binary package are all
                   3882:   controlled by the package's <code class="filename">Makefile</code>.
                   3883:   The <code class="filename">Makefile</code> describes various things about
                   3884:   a package, for example from where to get it, how to configure,
                   3885:   build, and install it.</p>
                   3886: <p>A package <code class="filename">Makefile</code> contains several
                   3887:   sections that describe the package.</p>
                   3888: <p>In the first section there are the following variables, which
                   3889:   should appear exactly in the order given here.  The order and
                   3890:   grouping of the variables is mostly historical and has no further
                   3891:   meaning.</p>
1.41      asau     3892: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      3893: <li class="listitem"><p><code class="varname">DISTNAME</code> is the basename of the
1.1       dsieger  3894:     distribution file to be downloaded from the package's
                   3895:     website.</p></li>
1.23      wiz      3896: <li class="listitem"><p><code class="varname">PKGNAME</code> is the name of the
1.66      asau     3897:     package, as used by pkgsrc. You need to provide it if
1.1       dsieger  3898:     <code class="varname">DISTNAME</code> (which is the default) is not a good
1.66      asau     3899:     name for the package in pkgsrc or <code class="varname">DISTNAME</code> is not
                   3900:     provided (no distribution file is required).  Usually it is the pkgsrc
1.1       dsieger  3901:     directory name together with the version number. It must match the
                   3902:     regular expression
                   3903:     <code class="varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>, that is, it
                   3904:     starts with a letter or digit, and contains only letters, digits,
                   3905:     dashes, underscores, dots and plus signs.</p></li>
1.23      wiz      3906: <li class="listitem">
1.1       dsieger  3907: <p><code class="varname">CATEGORIES</code> is a list of categories
                   3908:     which the package fits in. You can choose any of the top-level
                   3909:     directories of pkgsrc for it.</p>
                   3910: <p>Currently the following values are available for
                   3911:     <code class="varname">CATEGORIES</code>. If more than
                   3912:     one is used, they need to be separated by spaces:</p>
                   3913: <pre class="programlisting">
                   3914: archivers     cross         geography     meta-pkgs     security
                   3915: audio         databases     graphics      misc          shells
                   3916: benchmarks    devel         ham           multimedia    sysutils
                   3917: biology       editors       inputmethod   net           textproc
                   3918: cad           emulators     lang          news          time
                   3919: chat          finance       mail          parallel      wm
                   3920: comms         fonts         math          pkgtools      www
                   3921: converters    games         mbone         print         x11
                   3922: </pre>
                   3923: </li>
1.23      wiz      3924: <li class="listitem"><p><code class="varname">MASTER_SITES</code>,
1.1       dsieger  3925:     <code class="varname">DYNAMIC_MASTER_SITES</code>,
                   3926:     <code class="varname">DIST_SUBDIR</code>, <code class="varname">EXTRACT_SUFX</code>
                   3927:     and <code class="varname">DISTFILES</code> are discussed in detail in
1.154     rillig   3928:     <a class="xref" href="#build.fetch" title="19.5. The fetch phase">Section 19.5, &#8220;The <span class="emphasis"><em>fetch</em></span> phase&#8221;</a>.</p></li>
1.1       dsieger  3929: </ul></div>
                   3930: <p>The second section contains information about separately
                   3931:   downloaded patches, if any.
                   3932:   </p>
1.41      asau     3933: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.80      wiz      3934: <li class="listitem"><p><code class="varname">PATCHFILES</code>:
1.1       dsieger  3935:     Name(s) of additional files that contain distribution patches.
                   3936:     There is no default. pkgsrc will look for them at
                   3937:     <code class="varname">PATCH_SITES</code>.
                   3938:     They will automatically be uncompressed before patching if
                   3939:     the names end with <code class="filename">.gz</code> or
                   3940:     <code class="filename">.Z</code>.</p></li>
1.23      wiz      3941: <li class="listitem"><p><code class="varname">PATCH_SITES</code>:
1.1       dsieger  3942:     Primary location(s) for distribution patch files (see
1.80      wiz      3943:     <code class="varname">PATCHFILES</code> above) if not found locally.</p></li>
                   3944: <li class="listitem"><p><code class="varname">PATCH_DIST_STRIP</code>:
1.174     leot     3945:     an argument to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> that sets the pathname strip count to
1.80      wiz      3946:     help find the correct files to patch. It defaults to
                   3947:     <span class="command"><strong>-p0</strong></span>.</p></li>
1.1       dsieger  3948: </ul></div>
                   3949: <p>The third section contains the following variables.
                   3950:   </p>
1.41      asau     3951: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      3952: <li class="listitem"><p><code class="varname">MAINTAINER</code> is the email
1.14      jmcneill 3953:     address of the person who feels responsible for this package,
                   3954:     and who is most likely to look at problems or questions regarding
1.174     leot     3955:     this package which have been reported with <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a>.
1.14      jmcneill 3956:     Other developers may contact the <code class="varname">MAINTAINER</code>
                   3957:     before making changes to the package, but are not required to
                   3958:     do so. When packaging a new program, set <code class="varname">MAINTAINER</code>
                   3959:     to yourself. If you really can't maintain the package for future
                   3960:     updates, set it to
1.10      hubertf  3961:     <code class="email">&lt;<a class="email" href="mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>&gt;</code>.</p></li>
1.23      wiz      3962: <li class="listitem"><p><code class="varname">OWNER</code> should be used instead
1.14      jmcneill 3963:     of <code class="varname">MAINTAINER</code> when you do not want other
                   3964:     developers to update or change the package without contacting
                   3965:     you first. A package Makefile should contain one of
                   3966:     <code class="varname">MAINTAINER</code> or <code class="varname">OWNER</code>, but
                   3967:     not both.  </p></li>
1.23      wiz      3968: <li class="listitem"><p><code class="varname">HOMEPAGE</code> is a URL where users can
1.1       dsieger  3969:     find more information about the package.</p></li>
1.23      wiz      3970: <li class="listitem"><p><code class="varname">COMMENT</code> is a one-line
1.1       dsieger  3971:     description of the package (should not include the package
                   3972:     name).</p></li>
1.122     leot     3973: <li class="listitem"><p><code class="varname">LICENSE</code> indicates the license(s)
1.154     rillig   3974:     applicable for the package. See <a class="xref" href="#handling-licenses" title="21.1.3. Handling licenses">Section 21.1.3, &#8220;Handling licenses&#8221;</a> for further details.</p></li>
1.1       dsieger  3975: </ul></div>
                   3976: <p>Other variables that affect the build:
                   3977:   </p>
1.41      asau     3978: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1.1       dsieger  3979: <p><code class="varname">WRKSRC</code>: The directory where the
                   3980:       interesting distribution files of the package are found. The
                   3981:       default is <code class="filename">${WRKDIR}/${DISTNAME}</code>, which
                   3982:       works for most packages.</p>
                   3983: <p>If a package doesn't create a subdirectory for itself
                   3984:       (most GNU software does, for instance), but extracts itself in
                   3985:       the current directory, you should set
                   3986:       <code class="varname">WRKSRC=${WRKDIR}</code>.</p>
                   3987: <p>If a package doesn't create a subdirectory with the
                   3988:       name of <code class="varname">DISTNAME</code> but some different name,
                   3989:       set <code class="varname">WRKSRC</code> to point to the proper name in
                   3990:       <code class="filename">${WRKDIR}</code>, for example
                   3991:       <code class="varname">WRKSRC=${WRKDIR}/${DISTNAME}/unix</code>. See
1.137     leot     3992:       <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/tcl/README.html" target="_top"><code class="filename">lang/tcl</code></a> and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/tk/README.html" target="_top"><code class="filename">x11/tk</code></a> for other examples.</p>
1.1       dsieger  3993: <p>The name of the working directory created by pkgsrc is
                   3994:       taken from the <code class="varname">WRKDIR_BASENAME</code>
                   3995:       variable. By default, its value is
                   3996:       <code class="filename">work</code>. If you want to use the same
                   3997:       pkgsrc tree for building different kinds of binary packages,
                   3998:       you can change the variable according to your needs. Two
                   3999:       other variables handle common cases of setting
                   4000:       <code class="varname">WRKDIR_BASENAME</code> individually. If
                   4001:       <code class="varname">OBJHOSTNAME</code> is defined in
1.10      hubertf  4002:       <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the first component of
1.1       dsieger  4003:       the host's name is attached to the directory name. If
                   4004:       <code class="varname">OBJMACHINE</code> is defined, the platform name
                   4005:       is attached, which might look like
                   4006:       <code class="filename">work.i386</code> or
                   4007:       <code class="filename">work.sparc</code>.</p>
                   4008: </li></ul></div>
                   4009: <p>Please pay attention to the following gotchas:</p>
1.41      asau     4010: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      4011: <li class="listitem"><p>Add <code class="varname">MANCOMPRESSED</code> if man pages are
1.1       dsieger  4012:       installed in compressed form by the package.  For packages using
                   4013:       BSD-style makefiles which honor MANZ, there is
                   4014:       <code class="varname">MANCOMPRESSED_IF_MANZ</code>.</p></li>
1.23      wiz      4015: <li class="listitem"><p>Replace <code class="filename">/usr/local</code> with
                   4016:       <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span> in all files (see patches,
1.1       dsieger  4017:       below).</p></li>
1.154     rillig   4018: <li class="listitem"><p>If the package installs any info files, see <a class="xref" href="#faq.info-files" title="21.6.7. Packages installing info files">Section 21.6.7, &#8220;Packages installing info files&#8221;</a>.</p></li>
1.1       dsieger  4019: </ul></div>
                   4020: </div>
1.41      asau     4021: <div class="sect1">
1.1       dsieger  4022: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4023: <a name="components.distinfo"></a>13.2. <code class="filename">distinfo</code>
1.1       dsieger  4024: </h2></div></div></div>
                   4025: <p>The <code class="filename">distinfo</code> file contains the message
                   4026:   digest, or checksum, of each distfile needed for the package. This
                   4027:   ensures that the distfiles retrieved from the Internet have not been
                   4028:   corrupted during transfer or altered by a malign force to introduce
1.108     rillig   4029:   a security hole. To provide maximum security, all distfiles are
                   4030:   protected using three different message digest algorithms (SHA1,
                   4031:   RMD160, SHA512), as well as the file size.</p>
1.1       dsieger  4032: <p>The <code class="filename">distinfo</code> file also contains the
                   4033:   checksums for all the patches found in the
1.154     rillig   4034:   <code class="filename">patches</code> directory (see <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, &#8220;<code class="filename">patches/*</code>&#8221;</a>). These checksums ensure that patches
1.145     leot     4035:   are only applied intentionally and that they don't accidentally change,
                   4036:   e.g. when merging different changes together. They also make sure that
                   4037:   new patches are actually added to CVS and old ones are removed.
                   4038:   Too see whether the patches and the <code class="filename">distinfo</code> file
                   4039:   match, run <span class="command"><strong>pkglint</strong></span> after changing the patches.</p>
1.1       dsieger  4040: <p>To regenerate the <code class="filename">distinfo</code> file, use the
1.108     rillig   4041:   <span class="command"><strong>make distinfo</strong></span> command.</p>
1.1       dsieger  4042: <p>Some packages have different sets of distfiles depending on
1.178     rillig   4043:   the platform, for example <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/openjdk8/README.html" target="_top"><code class="filename">lang/openjdk8</code></a>. These are kept in the same
1.1       dsieger  4044:   <code class="filename">distinfo</code> file and care should be taken when
                   4045:   upgrading such a package to ensure distfile information is not
                   4046:   lost.</p>
                   4047: </div>
1.41      asau     4048: <div class="sect1">
1.1       dsieger  4049: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4050: <a name="components.patches"></a>13.3. <code class="filename">patches/*</code>
1.108     rillig   4051: </h2></div></div></div>
                   4052: <p>Some packages don't work out-of-the box on the various
                   4053:   platforms that are supported by pkgsrc. These packages need
                   4054:   to be patched to make them work. The patch files can be
1.1       dsieger  4055:   found in the <code class="filename">patches/</code> directory.</p>
                   4056: <p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are
                   4057:   applied to the files in <code class="varname">WRKSRC</code> directory after
1.108     rillig   4058:   extracting them, in alphabetic order.</p>
1.41      asau     4059: <div class="sect2">
1.1       dsieger  4060: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4061: <a name="components.patch.structure"></a>13.3.1. Structure of a single patch file</h3></div></div></div>
1.1       dsieger  4062: <p>The <code class="filename">patch-*</code> files should be in
1.10      hubertf  4063:   <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid
1.1       dsieger  4064:   problems. (To force patches to apply with fuzz you can set
                   4065:   <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch
                   4066:   should contain only changes for a single file, and no file should be
                   4067:   patched by more than one patch file. This helps to keep future
                   4068:   modifications simple.</p>
                   4069: <p>Each patch file is structured as follows: In the first line,
                   4070:   there is the RCS Id of the patch itself. The second line should be
                   4071:   empty for aesthetic reasons. After that, there should be a comment for
                   4072:   each change that the patch does. There are a number of standard
                   4073:   cases:</p>
1.41      asau     4074: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      4075: <li class="listitem"><p>Patches for commonly known vulnerabilities should
1.1       dsieger  4076:   mention the vulnerability ID (CAN, CVE).</p></li>
1.23      wiz      4077: <li class="listitem"><p>Patches that change source code should mention the
1.1       dsieger  4078:   platform and other environment (for example, the compiler) that the
                   4079:   patch is needed for.</p></li>
                   4080: </ul></div>
1.108     rillig   4081: <p>The patch should be commented so that any
1.1       dsieger  4082:   developer who knows the code of the application can make some use of
                   4083:   the patch. Special care should be taken for the upstream developers,
                   4084:   since we generally want that they accept our patches, so we have less
                   4085:   work in the future.</p>
                   4086: </div>
1.41      asau     4087: <div class="sect2">
1.1       dsieger  4088: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4089: <a name="components.patches.caveats"></a>13.3.2. Creating patch files</h3></div></div></div>
1.1       dsieger  4090: <p>One important thing to mention is to pay attention that no RCS
                   4091:   IDs get stored in the patch files, as these will cause problems when
                   4092:   later checked into the NetBSD CVS tree. Use the
1.137     leot     4093:   <span class="command"><strong>pkgdiff</strong></span> command from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package to avoid these
1.1       dsieger  4094:   problems.</p>
                   4095: <p>For even more automation, we recommend using
1.10      hubertf  4096:   <span class="command"><strong>mkpatches</strong></span> from the same package to make a
1.1       dsieger  4097:   whole set of patches. You just have to backup files before you
                   4098:   edit them to <code class="filename">filename.orig</code>, e.g. with
1.10      hubertf  4099:   <span class="command"><strong>cp -p filename filename.orig</strong></span> or, easier, by
                   4100:   using <span class="command"><strong>pkgvi</strong></span> again from the same package. If
1.1       dsieger  4101:   you upgrade a package this way, you can easily compare the new
                   4102:   set of patches with the previously existing one with
1.24      wiz      4103:   <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code>
                   4104:   are replaced by new files, so carefully check if you want to take all
                   4105:   the changes.</p>
1.1       dsieger  4106: <p>When you have finished a package, remember to generate
1.10      hubertf  4107:   the checksums for the patch files by using the <span class="command"><strong>make
1.154     rillig   4108:   makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="13.2. distinfo">Section 13.2, &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       dsieger  4109: <p>When adding a patch that corrects a problem in the
                   4110:   distfile (rather than e.g. enforcing pkgsrc's view of where
                   4111:   man pages should go), send the patch as a bug report to the
                   4112:   maintainer.  This benefits non-pkgsrc users of the package,
                   4113:   and usually makes it possible to remove the patch in future
                   4114:   version.</p>
1.2       rillig   4115: <p>The file names of the patch files are usually of the form
1.24      wiz      4116:   <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>.
                   4117:   Many packages still use the previous convention
                   4118:   <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>,
                   4119:   but new patches should be of the form containing the filename.
1.137     leot     4120:   <span class="command"><strong>mkpatches</strong></span> included in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> takes care of the name
1.24      wiz      4121:   automatically.</p>
1.1       dsieger  4122: </div>
1.41      asau     4123: <div class="sect2">
1.1       dsieger  4124: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4125: <a name="components.patches.sources"></a>13.3.3. Sources where the patch files come from</h3></div></div></div>
1.1       dsieger  4126: <p>If you want to share patches between multiple packages
                   4127:   in pkgsrc, e.g. because they use the same distfiles, set
                   4128:   <code class="varname">PATCHDIR</code> to the path where the patch files
                   4129:   can be found, e.g.:</p>
                   4130: <pre class="programlisting">
1.159     rillig   4131: PATCHDIR=       ../../editors/xemacs/patches
1.1       dsieger  4132: </pre>
                   4133: <p>Patch files that are distributed by the author or other
                   4134:     maintainers can be listed in
                   4135:     <code class="varname">PATCHFILES</code>.</p>
                   4136: <p>If it is desired to store any patches that should not be
                   4137:     committed into pkgsrc, they can be kept outside the pkgsrc
                   4138:     tree in the <code class="filename">$LOCALPATCHES</code> directory. The
                   4139:     directory tree there is expected to have the same
1.23      wiz      4140:     <span class="quote">&#8220;<span class="quote">category/package</span>&#8221;</span> structure as pkgsrc, and
1.1       dsieger  4141:     patches are expected to be stored inside these dirs (also
                   4142:     known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For
                   4143:     example, if you want to keep a private patch for
                   4144:     <code class="filename">pkgsrc/graphics/png</code>, keep it in
                   4145:     <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   4146:     files in the named directory are expected to be patch files,
                   4147:     and <span class="emphasis"><em>they are applied after pkgsrc patches are
                   4148:     applied</em></span>.</p>
                   4149: </div>
1.41      asau     4150: <div class="sect2">
1.1       dsieger  4151: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4152: <a name="components.patches.guidelines"></a>13.3.4. Patching guidelines</h3></div></div></div>
1.1       dsieger  4153: <p>When fixing a portability issue in the code do not use
                   4154:       preprocessor magic to check for the current operating system nor
                   4155:       platform.  Doing so hurts portability to other platforms because
                   4156:       the OS-specific details are not abstracted appropriately.</p>
                   4157: <p>The general rule to follow is: instead of checking for the
                   4158:       operating system the application is being built on, check for the
                   4159:       specific <span class="emphasis"><em>features</em></span> you need.  For example,
                   4160:       instead of assuming that kqueue is available under NetBSD and
                   4161:       using the <code class="varname">__NetBSD__</code> macro to conditionalize
1.14      jmcneill 4162:       kqueue support, add a check that detects kqueue itself &mdash;
1.1       dsieger  4163:       yes, this generally involves patching the
1.10      hubertf  4164:       <span class="command"><strong>configure</strong></span> script.  There is absolutely nothing
1.1       dsieger  4165:       that prevents some OSes from adopting interfaces from other OSes
                   4166:       (e.g. Linux implementing kqueue), something that the above checks
                   4167:       cannot take into account.</p>
                   4168: <p>Of course, checking for features generally involves more
                   4169:       work on the developer's side, but the resulting changes are
                   4170:       cleaner and there are chances they will work on many other
                   4171:       platforms.  Not to mention that there are higher chances of being
                   4172:       later integrated into the mainstream sources.  Remember:
                   4173:       <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p>
                   4174: <p>Some typical examples:</p>
                   4175: <div class="table">
1.154     rillig   4176: <a name="patch-examples"></a><p class="title"><b>Table 13.1. Patching examples</b></p>
1.106     tnn      4177: <div class="table-contents"><table class="table" summary="Patching examples" border="1">
1.1       dsieger  4178: <colgroup>
                   4179: <col>
                   4180: <col>
                   4181: <col>
                   4182: </colgroup>
                   4183: <thead><tr>
                   4184: <th>Where</th>
                   4185: <th>Incorrect</th>
                   4186: <th>Correct</th>
                   4187: </tr></thead>
                   4188: <tbody>
                   4189: <tr>
                   4190: <td>configure script</td>
                   4191: <td>
                   4192: <pre class="programlisting">
                   4193: case ${target_os} in
                   4194: netbsd*) have_kvm=yes ;;
                   4195: *)       have_kvm=no  ;;
                   4196: esac
                   4197: </pre>
                   4198:              </td>
                   4199: <td>
                   4200: <pre class="programlisting">
                   4201: AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)
                   4202: </pre>
                   4203:              </td>
                   4204: </tr>
                   4205: <tr>
                   4206: <td>C source file</td>
                   4207: <td>
                   4208: <pre class="programlisting">
                   4209: #if defined(__NetBSD__)
                   4210: #  include &lt;sys/event.h&gt;
                   4211: #endif
                   4212: </pre>
                   4213:              </td>
                   4214: <td>
                   4215: <pre class="programlisting">
                   4216: #if defined(HAVE_SYS_EVENT_H)
                   4217: #  include &lt;sys/event.h&gt;
                   4218: #endif
                   4219: </pre>
                   4220:              </td>
                   4221: </tr>
                   4222: <tr>
                   4223: <td>C source file</td>
                   4224: <td>
                   4225: <pre class="programlisting">
                   4226: int
                   4227: monitor_file(...)
                   4228: {
                   4229: #if defined(__NetBSD__)
                   4230:         int fd = kqueue();
                   4231:         ...
                   4232: #else
                   4233:         ...
                   4234: #endif
                   4235: }
                   4236: </pre>
                   4237:              </td>
                   4238: <td>
                   4239: <pre class="programlisting">
                   4240: int
                   4241: monitor_file(...)
                   4242: {
                   4243: #if defined(HAVE_KQUEUE)
                   4244:         int fd = kqueue();
                   4245:         ...
                   4246: #else
1.112     rillig   4247:         ...
1.1       dsieger  4248: #endif
                   4249: }
                   4250: </pre>
                   4251:              </td>
                   4252: </tr>
                   4253: </tbody>
                   4254: </table></div>
                   4255: </div>
1.141     maya     4256: <br class="table-break">
1.1       dsieger  4257: </div>
1.41      asau     4258: <div class="sect2">
1.1       dsieger  4259: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4260: <a name="components.patches.feedback"></a>13.3.5. Feedback to the author</h3></div></div></div>
1.1       dsieger  4261: <p>Always, always, <span class="strong"><strong>always</strong></span>
                   4262:       feed back any <span class="emphasis"><em>portability fixes</em></span> or
                   4263:       improvements you do to a package to the mainstream developers.
                   4264:       This is the only way to get their attention on portability issues
                   4265:       and to ensure that future versions can be built out-of-the box on
                   4266:       NetBSD.  Furthermore, any user that gets newer distfiles will get
                   4267:       the fixes straight from the packaged code.</p>
                   4268: <p>This generally involves cleaning up the patches
                   4269:       (because sometimes the patches that are
1.40      wiz      4270:       added to pkgsrc are quick hacks), filing bug reports in the
1.1       dsieger  4271:       appropriate trackers for the projects and working with the
                   4272:       mainstream authors to accept your changes.  It is
                   4273:       <span class="emphasis"><em>extremely important</em></span> that you do it so that
                   4274:       the packages in pkgsrc are kept simple and thus further changes
                   4275:       can be done without much hassle.</p>
1.24      wiz      4276: <p>When you have done this, please add a URL to the upstream
                   4277:       bug report to the patch comment.</p>
1.1       dsieger  4278: <p>Support the idea of free software!</p>
                   4279: </div>
                   4280: </div>
1.41      asau     4281: <div class="sect1">
1.1       dsieger  4282: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4283: <a name="other-mandatory-files"></a>13.4. Other mandatory files</h2></div></div></div>
1.41      asau     4284: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  4285: <dt><span class="term"><code class="filename">DESCR</code></span></dt>
                   4286: <dd><p>A multi-line description of the piece of software.  This should include
                   4287:          any credits where they are due.  Please bear in mind that others do not
                   4288:          share your sense of humour (or spelling idiosyncrasies), and that others
                   4289:          will read everything that you write here.</p></dd>
                   4290: <dt><span class="term"><code class="filename">PLIST</code></span></dt>
                   4291: <dd><p>This file governs the files that are installed on your
                   4292:          system: all the binaries, manual pages, etc. There are other
                   4293:          directives which may be entered in this file, to control the
                   4294:          creation and deletion of directories, and the location of
1.154     rillig   4295:          inserted files.  See <a class="xref" href="#plist" title="Chapter 15. PLIST issues">Chapter 15, <i>PLIST issues</i></a> for more
1.1       dsieger  4296:          information.</p></dd>
                   4297: </dl></div>
                   4298: </div>
1.41      asau     4299: <div class="sect1">
1.1       dsieger  4300: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4301: <a name="components.optional"></a>13.5. Optional files</h2></div></div></div>
1.41      asau     4302: <div class="sect2">
1.1       dsieger  4303: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4304: <a name="components.optional.bin"></a>13.5.1. Files affecting the binary package</h3></div></div></div>
1.41      asau     4305: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  4306: <dt><span class="term"><code class="filename">INSTALL</code></span></dt>
1.28      wiz      4307: <dd>
1.174     leot     4308: <p>This shell script is invoked twice by <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>.
1.1       dsieger  4309:            First time after package extraction and before files are
                   4310:            moved in place, the second time after the files to install
                   4311:            are moved in place. This can be used to do any custom
                   4312:            procedures not possible with @exec commands in
1.174     leot     4313:            <code class="filename">PLIST</code>. See <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> and
                   4314:            <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-9.0"><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="17.1. Files and directories outside the installation prefix">Section 17.1, &#8220;Files and directories outside the installation prefix&#8221;</a>.
1.28      wiz      4315:            Please note that you can modify variables in it easily by using
                   4316:            <code class="varname">FILES_SUBST</code> in the package's
                   4317:            <code class="filename">Makefile</code>:</p>
                   4318: <pre class="programlisting">
                   4319: FILES_SUBST+=  SOMEVAR="somevalue"
                   4320: </pre>
                   4321: <p>replaces "@SOMEVAR@" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in the
                   4322:            <code class="filename">INSTALL</code>.  By default, substitution is
                   4323:            performed for <code class="varname">PREFIX</code>,
                   4324:            <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
                   4325:            <code class="varname">VARBASE</code>, and a few others, type
                   4326:            <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a
                   4327:            complete list.</p>
                   4328: </dd>
1.1       dsieger  4329: <dt><span class="term"><code class="filename">DEINSTALL</code></span></dt>
                   4330: <dd><p>This script is executed before and after any files are removed.  It is
                   4331:            this script's responsibility to clean up any additional messy details
                   4332:            around the package's installation, since all pkg_delete knows is how to
                   4333:            delete the files created in the original distribution.
1.174     leot     4334:            See <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
                   4335:            and <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information.
1.28      wiz      4336:            The same methods to replace variables can be used as for
                   4337:            the <code class="filename">INSTALL</code> file.</p></dd>
1.1       dsieger  4338: <dt><span class="term"><code class="filename">MESSAGE</code></span></dt>
                   4339: <dd>
                   4340: <p>This file is displayed after installation of the package.
                   4341:            Useful for things like legal notices on almost-free
                   4342:            software and hints for updating config files after
                   4343:            installing modules for apache, PHP etc.
                   4344:            Please note that you can modify variables in it easily by using
                   4345:            <code class="varname">MESSAGE_SUBST</code> in the package's
                   4346:            <code class="filename">Makefile</code>:</p>
                   4347: <pre class="programlisting">
                   4348: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   4349: </pre>
1.23      wiz      4350: <p>replaces "${SOMEVAR}" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in
1.1       dsieger  4351:            <code class="filename">MESSAGE</code>.  By default, substitution is
                   4352:            performed for <code class="varname">PKGNAME</code>,
                   4353:            <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>,
1.99      sevan    4354:            <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
1.1       dsieger  4355:            <code class="varname">PKG_SYSCONFDIR</code>,
                   4356:            <code class="varname">ROOT_GROUP</code>, and
1.16      jnemeth  4357:            <code class="varname">ROOT_USER</code>.</p>
1.1       dsieger  4358: <p>You can display a different or additional files by
                   4359:            setting the <code class="varname">MESSAGE_SRC</code> variable.  Its
                   4360:            default is <code class="filename">MESSAGE</code>, if the file
                   4361:            exists.</p>
                   4362: </dd>
                   4363: <dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt>
1.66      asau     4364: <dd>
                   4365: <p>This file is used by the alternatives framework.
                   4366:            It creates, configures, and destroys generic wrappers used to
                   4367:            run programs with similar interfaces.
                   4368:            See pkg_alternatives(8) from pkgtools/pkg_alternatives
                   4369:             for more information.</p>
                   4370: <p>Each line of the file contains two filenames, first
                   4371:            the wrapper and then the alternative provided by the package.
                   4372:            Both paths are relative to <code class="varname">PREFIX</code>.</p>
                   4373: </dd>
1.1       dsieger  4374: </dl></div>
                   4375: </div>
1.41      asau     4376: <div class="sect2">
1.1       dsieger  4377: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4378: <a name="components.optional.build"></a>13.5.2. Files affecting the build process</h3></div></div></div>
1.41      asau     4379: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  4380: <dt><span class="term"><code class="filename">Makefile.common</code></span></dt>
                   4381: <dd><p>This file contains arbitrary things that could
                   4382:        also go into a <code class="filename">Makefile</code>, but its purpose is
                   4383:        to be used by more than one package. This file should only be
                   4384:        used when the packages that will use the file are known in
                   4385:        advance. For other purposes it is often better to write a
                   4386:        <code class="filename">*.mk</code> file and give it a good name that
                   4387:        describes what it does.</p></dd>
                   4388: <dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt>
                   4389: <dd><p>This file contains the dependency information
1.154     rillig   4390:        for the buildlink3 framework (see <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a>).</p></dd>
1.1       dsieger  4391: <dt><span class="term"><code class="filename">hacks.mk</code></span></dt>
                   4392: <dd><p>This file contains workarounds for compiler bugs
                   4393:        and similar things. It is included automatically by the pkgsrc
                   4394:        infrastructure, so you don't need an extra
                   4395:        <code class="literal">.include</code> line for
                   4396:        it.</p></dd>
                   4397: <dt><span class="term"><code class="filename">options.mk</code></span></dt>
                   4398: <dd><p>This file contains the code for the
1.154     rillig   4399:        package-specific options (see <a class="xref" href="#options" title="Chapter 18. Options handling">Chapter 18, <i>Options handling</i></a>) that can be
1.1       dsieger  4400:        selected by the user. If a package has only one or two options,
                   4401:        it is equally acceptable to put the code directly into the
                   4402:        <code class="filename">Makefile</code>.</p></dd>
                   4403: </dl></div>
                   4404: </div>
1.41      asau     4405: <div class="sect2">
1.1       dsieger  4406: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4407: <a name="components.optional.none"></a>13.5.3. Files affecting nothing at all</h3></div></div></div>
1.41      asau     4408: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  4409: <dt><span class="term"><code class="filename">README*</code></span></dt>
                   4410: <dd><p>These files do not take place in the creation of
                   4411:        a package and thus are purely informative to the package
                   4412:        developer.</p></dd>
                   4413: <dt><span class="term"><code class="filename">TODO</code></span></dt>
                   4414: <dd><p>This file contains things that need to be done
                   4415:        to make the package even
                   4416:        better.</p></dd>
                   4417: </dl></div>
                   4418: </div>
                   4419: </div>
1.41      asau     4420: <div class="sect1">
1.1       dsieger  4421: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4422: <a name="work-dir"></a>13.6. <code class="filename">work*</code>
1.1       dsieger  4423: </h2></div></div></div>
1.10      hubertf  4424: <p>When you type <span class="command"><strong>make</strong></span>, the distribution files are
1.1       dsieger  4425:     unpacked into the directory denoted by
                   4426:     <code class="varname">WRKDIR</code>. It can be removed by running
1.10      hubertf  4427:     <span class="command"><strong>make clean</strong></span>. Besides the sources, this
1.1       dsieger  4428:     directory is also used to keep various timestamp files.
                   4429:     The directory gets <span class="emphasis"><em>removed completely</em></span> on clean.
                   4430:     The default is <code class="filename">${.CURDIR}/work</code>
                   4431:     or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code>
                   4432:     if <code class="varname">OBJMACHINE</code> is set.</p>
                   4433: </div>
1.41      asau     4434: <div class="sect1">
1.1       dsieger  4435: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4436: <a name="files-dir"></a>13.7. <code class="filename">files/*</code>
1.1       dsieger  4437: </h2></div></div></div>
1.172     rillig   4438: <p>If you have any files that you wish to be placed in the package
                   4439:     prior to configuration or building, you can place these files here
                   4440:     and use a <span class="command"><strong>${CP}</strong></span> command in the
                   4441:     <span class="quote">&#8220;<span class="quote">post-extract</span>&#8221;</span> target to achieve this.</p>
1.1       dsieger  4442: <p>If you want to share files in this way with other
                   4443:     packages, set the <code class="varname">FILESDIR</code> variable to point
                   4444:     to the other package's <code class="filename">files</code> directory,
                   4445:     e.g.:</p>
                   4446: <pre class="programlisting">
1.159     rillig   4447: FILESDIR=       ../../editors/xemacs/files
1.1       dsieger  4448: </pre>
                   4449: </div>
                   4450: </div>
1.41      asau     4451: <div class="chapter">
1.1       dsieger  4452: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   4453: <a name="makefile"></a>Chapter 14. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
1.1       dsieger  4454: <div class="toc">
                   4455: <p><b>Table of Contents</b></p>
1.100     leot     4456: <dl class="toc">
1.154     rillig   4457: <dt><span class="sect1"><a href="#makefile.style">14.1. Caveats</a></span></dt>
                   4458: <dt><span class="sect1"><a href="#makefile.variables">14.2. <code class="filename">Makefile</code> variables</a></span></dt>
                   4459: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">14.2.1. Naming conventions</a></span></dt></dl></dd>
                   4460: <dt><span class="sect1"><a href="#makefile.code">14.3. Code snippets</a></span></dt>
                   4461: <dd><dl>
                   4462: <dt><span class="sect2"><a href="#adding-to-list">14.3.1. Adding things to a list</a></span></dt>
                   4463: <dt><span class="sect2"><a href="#echo-literal">14.3.2. Echoing a string exactly as-is</a></span></dt>
                   4464: <dt><span class="sect2"><a href="#cflags-gnu-configure">14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
                   4465: <dt><span class="sect2"><a href="#empty-variables">14.3.4. Handling possibly empty variables</a></span></dt>
1.1       dsieger  4466: </dl></dd>
                   4467: </dl>
                   4468: </div>
                   4469: <p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
                   4470:   each of which forms a well-defined part of the pkgsrc system. Using
1.174     leot     4471:   the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> system as a programming language for a big system
1.1       dsieger  4472:   like pkgsrc requires some discipline to keep the code correct and
                   4473:   understandable.</p>
                   4474: <p>The basic ingredients for <code class="filename">Makefile</code>
1.154     rillig   4475:   programming are variables and shell
1.1       dsieger  4476:   commands. Among these shell commands may even be more complex ones
1.174     leot     4477:   like <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?awk+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span></a> programs. To make sure that every shell command runs
1.1       dsieger  4478:   as intended it is necessary to quote all variables correctly when they
                   4479:   are used.</p>
1.154     rillig   4480: <p>This chapter describes some patterns that appear quite often in
1.1       dsieger  4481:   <code class="filename">Makefile</code>s, including the pitfalls that come along
                   4482:   with them.</p>
1.41      asau     4483: <div class="sect1">
1.1       dsieger  4484: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4485: <a name="makefile.style"></a>14.1. Caveats</h2></div></div></div>
1.41      asau     4486: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1.1       dsieger  4487: <p>When you are creating a file as a
                   4488:     target of a rule, always write the data to a temporary file first
                   4489:     and finally rename that file. Otherwise there might occur an error
                   4490:     in the middle of generating the file, and when the user runs
1.174     leot     4491:     <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> for the second time, the file exists and will not be
1.1       dsieger  4492:     regenerated properly. Example:</p>
                   4493: <pre class="programlisting">
                   4494: wrong:
                   4495:         @echo "line 1" &gt; ${.TARGET}
                   4496:         @echo "line 2" &gt;&gt; ${.TARGET}
                   4497:         @false
                   4498: 
                   4499: correct:
                   4500:         @echo "line 1" &gt; ${.TARGET}.tmp
                   4501:         @echo "line 2" &gt;&gt; ${.TARGET}.tmp
                   4502:         @false
                   4503:         @mv ${.TARGET}.tmp ${.TARGET}
                   4504: </pre>
1.10      hubertf  4505: <p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file
1.1       dsieger  4506:     <code class="filename">wrong</code> will exist, although there was an error
1.10      hubertf  4507:     message in the first run. On the other hand, running <span class="command"><strong>make
1.1       dsieger  4508:     correct</strong></span> gives an error message twice, as expected.</p>
1.174     leot     4509: <p>You might remember that <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> sometimes removes
1.1       dsieger  4510:     <code class="literal">${.TARGET}</code> in case of error, but this only
                   4511:     happens when it is interrupted, for example by pressing
1.154     rillig   4512:     <code class="literal">Ctrl+C</code>. This does <span class="emphasis"><em>not</em></span> happen
1.174     leot     4513:     when one of the commands fails (like <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?false+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">false</span>(1)</span></a> above).</p>
1.1       dsieger  4514: </li></ul></div>
                   4515: </div>
1.41      asau     4516: <div class="sect1">
1.1       dsieger  4517: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4518: <a name="makefile.variables"></a>14.2. <code class="filename">Makefile</code> variables</h2></div></div></div>
1.1       dsieger  4519: <p><code class="filename">Makefile</code> variables contain strings that
1.154     rillig   4520:     can be processed using the five operators <code class="code">=</code>,
                   4521:     <code class="code">+=</code>, <code class="code">?=</code>, <code class="code">:=</code> and
1.174     leot     4522:     <code class="code">!=</code>, which are described in the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man
1.1       dsieger  4523:     page.</p>
                   4524: <p>When a variable's value is parsed from a
1.154     rillig   4525:     <code class="filename">Makefile</code>, the hash character <code class="code">#</code> and
                   4526:     the backslash character <code class="code">\</code> are handled specially. If a
                   4527:     backslash is the last character in a line, that backslash is removed
                   4528:     from the line and the line continues with the next line of the file.</p>
                   4529: <p>The <code class="code">#</code> character starts a comment that reaches
                   4530:     until the end of the line. To get an actual <code class="code">#</code> character,
                   4531:     such as in a URL, write <code class="code">\#</code> instead.</p>
1.108     rillig   4532: <p>The evaluation of variables either happens immediately or lazy.
1.154     rillig   4533:     It happens immediately when the variable occurs on the right-hand
                   4534:     side of the <code class="code">:=</code> or the <code class="code">!=</code> operator, in a
1.108     rillig   4535:     <code class="varname">.if</code> condition or a <code class="varname">.for</code> loop.
                   4536:     In the other cases, it is evaluated lazily.</p>
1.1       dsieger  4537: <p>Some of the modifiers split the string into words and then
1.154     rillig   4538:     operate on the words, others operate on the string as a whole. When a
                   4539:     string is split into words, double quotes and single quotes are
1.174     leot     4540:     interpreted as delimiters, just like in <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?sh+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">sh</span>(1)</span></a>.</p>
1.41      asau     4541: <div class="sect2">
1.1       dsieger  4542: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4543: <a name="makefile.variables.names"></a>14.2.1. Naming conventions</h3></div></div></div>
1.41      asau     4544: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      4545: <li class="listitem"><p>All variable names starting with an underscore
1.1       dsieger  4546:        are reserved for use by the pkgsrc infrastructure. They shall
1.154     rillig   4547:        not be used by packages.</p></li>
1.23      wiz      4548: <li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use
1.1       dsieger  4549:        lowercase variable names for the iteration
                   4550:        variables.</p></li>
1.154     rillig   4551: <li class="listitem"><p>All list variables should have a plural name,
                   4552:        such as <code class="varname">PKG_OPTIONS</code> or
1.1       dsieger  4553:        <code class="varname">DISTFILES</code>.</p></li>
                   4554: </ul></div>
                   4555: </div>
                   4556: </div>
1.41      asau     4557: <div class="sect1">
1.1       dsieger  4558: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4559: <a name="makefile.code"></a>14.3. Code snippets</h2></div></div></div>
1.41      asau     4560: <div class="sect2">
1.1       dsieger  4561: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4562: <a name="adding-to-list"></a>14.3.1. Adding things to a list</h3></div></div></div>
1.108     rillig   4563: <p>When adding a string that possibly contains whitespace or quotes to
                   4564: a list (example 1), it must be quoted using the <code class="code">:Q</code>
                   4565: modifier.</p>
                   4566: <p>When adding another list to a list (example 2), it must not be
                   4567: quoted, since its elements are already quoted.</p>
1.1       dsieger  4568: <pre class="programlisting">
1.108     rillig   4569: STRING=         foo * bar `date`
                   4570: LIST=           # empty
                   4571: ANOTHER_LIST=   a=b c=d
                   4572: 
                   4573: LIST+=          ${STRING:Q}       # 1
                   4574: LIST+=          ${ANOTHER_LIST}   # 2
1.1       dsieger  4575: </pre>
                   4576: </div>
1.41      asau     4577: <div class="sect2">
1.1       dsieger  4578: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4579: <a name="echo-literal"></a>14.3.2. Echoing a string exactly as-is</h3></div></div></div>
1.108     rillig   4580: <p>Echoing a string containing special characters needs special
                   4581: work.</p>
1.1       dsieger  4582: <pre class="programlisting">
                   4583: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
1.108     rillig   4584: EXAMPLE_ENV=    string=${STRING:Q} x=multiple\ quoted\ words
1.1       dsieger  4585: 
                   4586: all:
                   4587:         echo ${STRING}                  # 1
1.108     rillig   4588:         echo ${STRING:Q}                # 2
                   4589:         printf '%s\n' ${STRING:Q}''     # 3
                   4590:         env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"'   # 4
                   4591: </pre>
                   4592: <p>Example 1 leads to a syntax error in the shell, as the characters
                   4593: are just copied.</p>
                   4594: <p>Example 2 quotes the string so that the shell interprets it
                   4595: correctly. But the echo command may additionally interpret strings with a
                   4596: leading dash or those containing backslashes.</p>
1.174     leot     4597: <p>Example 3 can handle arbitrary strings, since <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?printf+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> only
1.139     leot     4598: interprets the format string, but not the next argument. The trailing
                   4599: single quotes handle the case when the string is empty. In that case, the
                   4600: :Q modifier would result in an empty string too, which would then be
1.174     leot     4601: skipped by the shell. For <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?printf+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> this doesn't make a difference,
1.139     leot     4602: but other programs may care.</p>
1.108     rillig   4603: <p>In example 4, the <code class="varname">EXAMPLE_ENV</code> does not
                   4604: need to be quoted because the quoting has already been done
                   4605: when adding elements to the list.</p>
1.1       dsieger  4606: </div>
1.41      asau     4607: <div class="sect2">
1.1       dsieger  4608: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4609: <a name="cflags-gnu-configure"></a>14.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</h3></div></div></div>
1.108     rillig   4610: <p>When passing <code class="varname">CFLAGS</code> or similar variables to a
                   4611: GNU-style configure script (especially those that call other configure
                   4612: scripts), it must not have leading or trailing whitespace, since
                   4613: otherwise the configure script gets confused. To trim leading and
                   4614: trailing whitespace, use the <code class="code">:M</code> modifier, as in the
                   4615: following example:</p>
1.1       dsieger  4616: <pre class="programlisting">
                   4617: CPPFLAGS=               # empty
1.108     rillig   4618: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX}\"
1.1       dsieger  4619: CPPFLAGS+=              ${MY_CPPFLAGS}
                   4620: 
                   4621: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
                   4622: 
                   4623: all:
                   4624:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
1.108     rillig   4625:         echo x${CONFIGURE_ARGS:Q}x      # properly trimmed
1.1       dsieger  4626: </pre>
1.108     rillig   4627: <p>In this example, <code class="varname">CPPFLAGS</code> has both leading and
                   4628: trailing whitespace because the <code class="code">+=</code> operator always adds a
                   4629: space.</p>
                   4630: </div>
                   4631: <div class="sect2">
                   4632: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   4633: <a name="empty-variables"></a>14.3.4. Handling possibly empty variables</h3></div></div></div>
1.108     rillig   4634: <p>When a possibly empty variable is used in a shell program, it may
                   4635: lead to a syntax error.</p>
                   4636: <pre class="programlisting">
                   4637: EGFILES=        # empty
                   4638: 
                   4639: install-examples:   # produces a syntax error in the shell
                   4640:         for egfile in ${EGFILES}; do            \
                   4641:                 echo "Installing $$egfile";     \
                   4642:         done
                   4643: </pre>
                   4644: <p>The shell only sees the text <code class="code">for egfile in ; do</code>, since
1.174     leot     4645: <code class="code">${EGFILES}</code> is replaced with an empty string by <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>.
1.108     rillig   4646: To fix this syntax error, use one of the snippets below.</p>
                   4647: <pre class="programlisting">
                   4648: EMPTY=          # empty
                   4649: 
                   4650: install-examples:
                   4651:         for egfile in ${EGFILES} ""; do         \
                   4652:                 [ -n "$$egfile" ] || continue;  \
                   4653:                 echo "Installing $$egfile";     \
1.1       dsieger  4654:         done
1.108     rillig   4655: </pre>
                   4656: <p>In this case, an empty string is appended to the iteration list (to
                   4657: prevent the syntax error) and filtered out later.</p>
                   4658: <pre class="programlisting">
                   4659: EGFILES=        # empty
1.1       dsieger  4660: 
1.108     rillig   4661: install-examples:
                   4662: .for egfile in ${EGFILES}
                   4663:         echo "Installing ${egfile}"
1.1       dsieger  4664: .endfor
                   4665: </pre>
1.154     rillig   4666: <p>If one of the filenames contains special characters, it should be
                   4667: enclosed in single or double quotes.</p>
1.108     rillig   4668: <p>To have a shell command test whether a make variable is empty, use
                   4669: the following code: <code class="code">${TEST} -z ${POSSIBLY_EMPTY:Q}""</code>.</p>
1.1       dsieger  4670: </div>
                   4671: </div>
                   4672: </div>
1.41      asau     4673: <div class="chapter">
1.1       dsieger  4674: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   4675: <a name="plist"></a>Chapter 15. PLIST issues</h2></div></div></div>
1.1       dsieger  4676: <div class="toc">
                   4677: <p><b>Table of Contents</b></p>
1.100     leot     4678: <dl class="toc">
1.154     rillig   4679: <dt><span class="sect1"><a href="#rcs-id">15.1. RCS ID</a></span></dt>
                   4680: <dt><span class="sect1"><a href="#automatic-plist-generation">15.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
                   4681: <dt><span class="sect1"><a href="#print-PLIST">15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
                   4682: <dt><span class="sect1"><a href="#plist.misc">15.4. Variable substitution in PLIST</a></span></dt>
                   4683: <dt><span class="sect1"><a href="#manpage-compression">15.5. Man page compression</a></span></dt>
                   4684: <dt><span class="sect1"><a href="#using-PLIST_SRC">15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
                   4685: <dt><span class="sect1"><a href="#platform-specific-plist">15.7. Platform-specific and differing PLISTs</a></span></dt>
                   4686: <dt><span class="sect1"><a href="#build-plist">15.8. Build-specific PLISTs</a></span></dt>
                   4687: <dt><span class="sect1"><a href="#faq.common-dirs">15.9. Sharing directories between packages</a></span></dt>
1.1       dsieger  4688: </dl>
                   4689: </div>
                   4690: <p>The <code class="filename">PLIST</code> file contains a package's
1.23      wiz      4691:   <span class="quote">&#8220;<span class="quote">packing list</span>&#8221;</span>, i.e. a list of files that belong to
1.1       dsieger  4692:   the package (relative to the <code class="filename">${PREFIX}</code>
                   4693:   directory it's been installed in) plus some additional statements
1.174     leot     4694:   - see the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> man page for a full list.
1.1       dsieger  4695:   This chapter addresses some issues that need attention when
                   4696:   dealing with the <code class="filename">PLIST</code> file (or files, see
                   4697:   below!).</p>
1.41      asau     4698: <div class="sect1">
1.1       dsieger  4699: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4700: <a name="rcs-id"></a>15.1. RCS ID</h2></div></div></div>
1.1       dsieger  4701: <p>Be sure to add a RCS ID line as the first thing in any
                   4702:     <code class="filename">PLIST</code> file you write:</p>
                   4703: <pre class="programlisting">
1.121     sevan    4704: @comment $NetBSD $
1.111     sevan    4705: </pre>
1.123     wiz      4706: <p>An artificial space has been added between NetBSD and $, this is a
1.121     sevan    4707: workaround here to prevent CVS expanding to the filename of the guide. When
1.125     leot     4708: adding the RCS ID the space should be omitted.</p>
1.1       dsieger  4709: </div>
1.41      asau     4710: <div class="sect1">
1.1       dsieger  4711: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4712: <a name="automatic-plist-generation"></a>15.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div>
1.10      hubertf  4713: <p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command
1.1       dsieger  4714:     to output a PLIST that matches any new files since the package
1.154     rillig   4715:     was extracted.  See <a class="xref" href="#build.helpful-targets" title="19.17. Other helpful targets">Section 19.17, &#8220;Other helpful targets&#8221;</a> for
1.1       dsieger  4716:     more information on this target.</p>
                   4717: </div>
1.41      asau     4718: <div class="sect1">
1.1       dsieger  4719: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4720: <a name="print-PLIST"></a>15.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>
1.1       dsieger  4721: </h2></div></div></div>
                   4722: <p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set
                   4723:     of AWK patterns and actions that are used to filter the output of
                   4724:     print-PLIST.  You can <span class="emphasis"><em>append</em></span> any chunk of AWK
                   4725:     scripting you like to it, but be careful with quoting.</p>
                   4726: <p>For example, to get all files inside the
                   4727:     <code class="filename">libdata/foo</code> directory removed from the
                   4728:     resulting PLIST:</p>
                   4729: <pre class="programlisting">
                   4730: PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.111     sevan    4731: </pre>
1.1       dsieger  4732: </div>
1.41      asau     4733: <div class="sect1">
1.1       dsieger  4734: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4735: <a name="plist.misc"></a>15.4. Variable substitution in PLIST</h2></div></div></div>
1.1       dsieger  4736: <p>A number of variables are substituted automatically in
                   4737:     PLISTs when a package is installed on a system. This includes the
                   4738:     following variables:</p>
1.41      asau     4739: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  4740: <dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt>
                   4741: <dd>
                   4742: <p>Some packages like emacs and perl embed information
                   4743:          about which architecture they were built on into the
                   4744:          pathnames where they install their files. To handle this
                   4745:          case, PLIST will be preprocessed before actually used, and
                   4746:          the symbol
1.23      wiz      4747:          <span class="quote">&#8220;<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>&#8221;</span> will be
1.10      hubertf  4748:          replaced by what <span class="command"><strong>uname -p</strong></span> gives. The
1.1       dsieger  4749:          same is done if the string
                   4750:          <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   4751:          PLIST somewhere - use this on packages that have GNU
                   4752:          autoconf-created configure scripts.</p>
1.41      asau     4753: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  4754: <h3 class="title">Legacy note</h3>
                   4755: <p>There used to be a symbol
1.23      wiz      4756:            <span class="quote">&#8220;<span class="quote"><code class="varname">$ARCH</code></span>&#8221;</span> that
1.10      hubertf  4757:            was replaced by the output of <span class="command"><strong>uname
1.1       dsieger  4758:            -m</strong></span>, but that's no longer supported and has
                   4759:            been removed.</p>
                   4760: </div>
                   4761: </dd>
                   4762: <dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt>
                   4763: <dd>
                   4764: <p>Some packages want to embed the OS name and version
                   4765:          into some paths.  To do this, use these variables in the
                   4766:          <code class="filename">PLIST</code>:
                   4767:          </p>
1.41      asau     4768: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      4769: <li class="listitem"><p><code class="varname">${OPSYS}</code> - output of <span class="quote">&#8220;<span class="quote"><span class="command"><strong>uname -s</strong></span></span>&#8221;</span></p></li>
                   4770: <li class="listitem"><p><code class="varname">${LOWER_OPSYS}</code> - lowercase common name (eg. <span class="quote">&#8220;<span class="quote">solaris</span>&#8221;</span>)</p></li>
                   4771: <li class="listitem"><p><code class="varname">${OS_VERSION}</code> - <span class="quote">&#8220;<span class="quote"><span class="command"><strong>uname -r</strong></span></span>&#8221;</span></p></li>
1.1       dsieger  4772: </ul></div>
                   4773: </dd>
                   4774: </dl></div>
1.88      tnn      4775: <p>For a list of values which are replaced by
                   4776:     default, the output of <span class="command"><strong>make help topic=PLIST_SUBST</strong></span> as
                   4777: well as searching the <code class="filename">pkgsrc/mk</code> directory with <span class="command"><strong>grep</strong></span> for
                   4778: <code class="varname">PLIST_SUBST</code> should help.</p>
1.1       dsieger  4779: <p>If you want to change other variables not listed above, you
                   4780:     can add variables and their expansions to this variable in the
1.154     rillig   4781:     following way, similar to <code class="varname">MESSAGE_SUBST</code> (see <a class="xref" href="#components.optional" title="13.5. Optional files">Section 13.5, &#8220;Optional files&#8221;</a>):</p>
1.1       dsieger  4782: <pre class="programlisting">
                   4783: PLIST_SUBST+=   SOMEVAR="somevalue"
1.111     sevan    4784: </pre>
1.23      wiz      4785: <p>This replaces all occurrences of <span class="quote">&#8220;<span class="quote">${SOMEVAR}</span>&#8221;</span>
1.1       dsieger  4786:     in the <code class="filename">PLIST</code> with
1.23      wiz      4787:     <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span>.</p>
1.18      snj      4788: <p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify
                   4789:     the common case of conditionally including some
                   4790:     <code class="filename">PLIST</code> entries. It can be done by adding
                   4791:     <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and
                   4792:     setting the corresponding <code class="varname">PLIST.foo</code> variable
                   4793:     to <code class="literal">yes</code> if the entry should be included.
1.23      wiz      4794:     This will substitute <span class="quote">&#8220;<span class="quote"><code class="varname">${PLIST.foo}</code></span>&#8221;</span>
1.18      snj      4795:     in the <code class="filename">PLIST</code> with either
1.23      wiz      4796:     <span class="quote">&#8220;<span class="quote"><code class="literal">""</code></span>&#8221;</span> or
                   4797:     <span class="quote">&#8220;<span class="quote"><code class="literal">"@comment "</code></span>&#8221;</span>.
1.18      snj      4798:     For example, in <code class="filename">Makefile</code>:</p>
                   4799: <pre class="programlisting">
1.112     rillig   4800: PLIST_VARS+=    foo
1.18      snj      4801: .if <em class="replaceable"><code>condition</code></em>
1.112     rillig   4802: PLIST.foo=      yes
1.18      snj      4803: .else
1.111     sevan    4804: </pre>
1.18      snj      4805: <p>And then in <code class="filename">PLIST</code>:</p>
                   4806: <pre class="programlisting">
1.121     sevan    4807: @comment $NetBSD $
1.18      snj      4808: bin/bar
                   4809: man/man1/bar.1
                   4810: ${PLIST.foo}bin/foo
                   4811: ${PLIST.foo}man/man1/foo.1
                   4812: ${PLIST.foo}share/bar/foo.data
1.111     sevan    4813: </pre>
1.123     wiz      4814: <p>An artificial space has been added between NetBSD and $, this is a
1.121     sevan    4815: workaround here to prevent CVS expanding to the filename of the guide. When
                   4816: adding the RCS ID the space should be ommited.</p>
1.1       dsieger  4817: </div>
1.41      asau     4818: <div class="sect1">
1.1       dsieger  4819: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4820: <a name="manpage-compression"></a>15.5. Man page compression</h2></div></div></div>
1.1       dsieger  4821: <p>Man pages should be installed in compressed form if
                   4822:     <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>),
                   4823:     and uncompressed otherwise. To handle this in the
1.23      wiz      4824:     <code class="filename">PLIST</code> file, the suffix <span class="quote">&#8220;<span class="quote">.gz</span>&#8221;</span> is
1.1       dsieger  4825:     appended/removed automatically for man pages according to
                   4826:     <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set
                   4827:     or not, see above for details. This modification of the
                   4828:     <code class="filename">PLIST</code> file is done on a copy of it, not
                   4829:     <code class="filename">PLIST</code> itself.</p>
                   4830: </div>
1.41      asau     4831: <div class="sect1">
1.1       dsieger  4832: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4833: <a name="using-PLIST_SRC"></a>15.6. Changing PLIST source with <code class="varname">PLIST_SRC</code>
1.1       dsieger  4834: </h2></div></div></div>
                   4835: <p>To use one or more files as source for the <code class="filename">PLIST</code> used
                   4836:     in generating the binary package, set the variable
                   4837:     <code class="varname">PLIST_SRC</code> to the names of that file(s).
1.174     leot     4838:     The files are later concatenated using <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?cat+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span></a>, and the order of things is
1.1       dsieger  4839:     important. The default for <code class="varname">PLIST_SRC</code> is
                   4840:     <code class="filename">${PKGDIR}/PLIST</code>.</p>
                   4841: </div>
1.41      asau     4842: <div class="sect1">
1.1       dsieger  4843: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4844: <a name="platform-specific-plist"></a>15.7. Platform-specific and differing PLISTs</h2></div></div></div>
1.1       dsieger  4845: <p>Some packages decide to install a different set of files based on
                   4846:     the operating system being used. These differences can be
                   4847:     automatically handled by using the following files:</p>
1.41      asau     4848: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      4849: <li class="listitem"><p><code class="filename">PLIST.common</code></p></li>
                   4850: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li>
                   4851: <li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li>
                   4852: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li>
                   4853: <li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li>
1.1       dsieger  4854: </ul></div>
                   4855: </div>
1.41      asau     4856: <div class="sect1">
1.1       dsieger  4857: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4858: <a name="build-plist"></a>15.8. Build-specific PLISTs</h2></div></div></div>
1.86      wiz      4859: <p>Some packages decide to generate hard-to-guess file names
                   4860:     during installation that are hard to wire down.</p>
                   4861: <p>In such cases, you can set the
                   4862:     <code class="varname">GENERATE_PLIST</code> variable to shell code
                   4863:     terminated (with a semicolon) that will output PLIST entries which
                   4864:     will be appended to the PLIST</p>
                   4865: <p>You can find one example in editors/xemacs:</p>
                   4866: <pre class="programlisting">
1.111     sevan    4867: GENERATE_PLIST+=        ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
                   4868: </pre>
1.86      wiz      4869: <p>which will append something like
                   4870:     <code class="filename">bin/xemacs-21.4.23-54e8ea71.dmp</code> to the
                   4871:     <code class="filename">PLIST</code>.
                   4872:     </p>
                   4873: </div>
                   4874: <div class="sect1">
                   4875: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4876: <a name="faq.common-dirs"></a>15.9. Sharing directories between packages</h2></div></div></div>
1.23      wiz      4877: <p>A <span class="quote">&#8220;<span class="quote">shared directory</span>&#8221;</span> is a directory where
1.1       dsieger  4878:     multiple (and unrelated) packages install files.  These
1.22      jakllsch 4879:     directories were problematic because you had to add special
                   4880:     tricks in the PLIST to conditionally remove them, or have some
1.1       dsieger  4881:     centralized package handle them.</p>
1.22      jakllsch 4882: <p>In pkgsrc, it is now easy: Each package should create
                   4883:     directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span>
                   4884:     will remove any directories left empty after uninstalling a
                   4885:     package.</p>
                   4886: <p>If a package needs an empty directory to work, create
                   4887:     the directory during installation as usual, and also add an
                   4888:     entry to the PLIST:
1.111     sevan    4889: 
                   4890: </p>
1.1       dsieger  4891: <pre class="programlisting">
1.22      jakllsch 4892: @pkgdir path/to/empty/directory
1.111     sevan    4893: </pre>
1.22      jakllsch 4894: <p>
1.111     sevan    4895: 
1.86      wiz      4896:     or take a look at <code class="varname">MAKE_DIRS</code> and
                   4897:     <code class="varname">OWN_DIRS</code>.
1.22      jakllsch 4898:     </p>
1.1       dsieger  4899: </div>
                   4900: </div>
1.41      asau     4901: <div class="chapter">
1.1       dsieger  4902: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   4903: <a name="buildlink"></a>Chapter 16. Buildlink methodology</h2></div></div></div>
1.1       dsieger  4904: <div class="toc">
                   4905: <p><b>Table of Contents</b></p>
1.100     leot     4906: <dl class="toc">
1.154     rillig   4907: <dt><span class="sect1"><a href="#converting-to-buildlink3">16.1. Converting packages to use buildlink3</a></span></dt>
                   4908: <dt><span class="sect1"><a href="#creating-buildlink3.mk">16.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.1       dsieger  4909: <dd><dl>
1.154     rillig   4910: <dt><span class="sect2"><a href="#anatomy-of-bl3">16.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
                   4911: <dt><span class="sect2"><a href="#updating-buildlink-depends">16.2.2. Updating
1.26      wiz      4912:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   4913:       and
                   4914:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   4915:       in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.1       dsieger  4916: </dl></dd>
1.154     rillig   4917: <dt><span class="sect1"><a href="#writing-builtin.mk">16.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.1       dsieger  4918: <dd><dl>
1.154     rillig   4919: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
                   4920: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">16.3.2. Global preferences for native or pkgsrc software</a></span></dt>
1.1       dsieger  4921: </dl></dd>
                   4922: </dl>
                   4923: </div>
                   4924: <p>Buildlink is a framework in pkgsrc that controls what headers and libraries
                   4925:   are seen by a package's configure and build processes.  This is implemented
                   4926:   in a two step process:</p>
1.23      wiz      4927: <div class="orderedlist"><ol class="orderedlist" type="1">
                   4928: <li class="listitem"><p>Symlink headers and libraries for dependencies into
1.1       dsieger  4929:       <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory
                   4930:       of <code class="varname">WRKDIR</code>.</p></li>
1.23      wiz      4931: <li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler
1.1       dsieger  4932:       tools that translate <code class="option">-I${LOCALBASE}/include</code> and
                   4933:       <code class="option">-L${LOCALBASE}/lib</code> into references to
                   4934:       <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make
                   4935:       native compiler on some operating systems look like GCC, so that
                   4936:       packages that expect GCC won't require modifications to build with
                   4937:       those native compilers.</p></li>
                   4938: </ol></div>
                   4939: <p>This normalizes the environment in which a package is built so that the
                   4940:   package may be built consistently despite what other software may be
                   4941:   installed. Please note that the normal system header and library paths,
                   4942:   e.g. <code class="filename">/usr/include</code>,
                   4943:   <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is
                   4944:   designed to insulate the package build from non-system-supplied
                   4945:   software.</p>
1.41      asau     4946: <div class="sect1">
1.1       dsieger  4947: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   4948: <a name="converting-to-buildlink3"></a>16.1. Converting packages to use buildlink3</h2></div></div></div>
1.1       dsieger  4949: <p>The process of converting packages to use the buildlink3
1.23      wiz      4950:     framework (<span class="quote">&#8220;<span class="quote">bl3ifying</span>&#8221;</span>) is fairly straightforward.
1.1       dsieger  4951:     The things to keep in mind are:</p>
1.23      wiz      4952: <div class="orderedlist"><ol class="orderedlist" type="1">
                   4953: <li class="listitem"><p>Ensure that the build always calls the wrapper scripts
1.1       dsieger  4954:        instead of the actual toolchain.  Some packages are tricky,
                   4955:        and the only way to know for sure is the check
                   4956:        <code class="filename">${WRKDIR}/.work.log</code> to see if the
                   4957:        wrappers are being invoked.</p></li>
1.23      wiz      4958: <li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within
1.1       dsieger  4959:        the package Makefile, e.g. Java VMs, standalone shells,
                   4960:        etc., because the code to symlink files into
                   4961:        <code class="filename">${BUILDLINK_DIR}</code> looks for files
1.23      wiz      4962:        relative to <span class="quote">&#8220;<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>&#8221;</span>.
1.1       dsieger  4963:        </p></li>
1.23      wiz      4964: <li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the
1.1       dsieger  4965:        <code class="filename">buildlink3.mk</code> files that you list in a
                   4966:        package's Makefile are added as dependencies for that package.
                   4967:        </p></li>
                   4968: </ol></div>
                   4969: <p>If a dependency on a particular package is required for its libraries and
                   4970:     headers, then we replace:</p>
                   4971: <pre class="programlisting">
                   4972: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   4973: </pre>
                   4974: <p>with</p>
                   4975: <pre class="programlisting">
                   4976: .include "../../category/foo/buildlink3.mk"
                   4977: </pre>
                   4978: <p>The buildlink3.mk files usually define the required dependencies.
                   4979:     If you need a newer version of the dependency when using buildlink3.mk
                   4980:     files, then you can define it in your Makefile; for example:</p>
                   4981: <pre class="programlisting">
                   4982: BUILDLINK_API_DEPENDS.foo+=   foo&gt;=1.1.0
                   4983: .include "../../category/foo/buildlink3.mk"
                   4984: </pre>
                   4985: <p>There are several <code class="filename">buildlink3.mk</code>
                   4986:     files in <code class="filename">pkgsrc/mk</code>
                   4987:     that handle special package issues:</p>
1.41      asau     4988: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      4989: <li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either
1.1       dsieger  4990:        the native or a pkgsrc Berkeley DB implementation based on
                   4991:        the values of <code class="varname">BDB_ACCEPTED</code> and
                   4992:        <code class="varname">BDB_DEFAULT</code>.</p></li>
1.23      wiz      4993: <li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system
1.1       dsieger  4994:        comes with neither Curses nor NCurses, this will take care
1.137     leot     4995:        to install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/ncurses/README.html" target="_top"><code class="filename">devel/ncurses</code></a> package.</p></li>
1.23      wiz      4996: <li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value
1.1       dsieger  4997:        of <code class="varname">KRB5_ACCEPTED</code> to choose between
                   4998:        adding a dependency on Heimdal or MIT-krb5 for packages that
                   4999:        require a Kerberos 5 implementation.</p></li>
1.23      wiz      5000: <li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a
1.1       dsieger  5001:        system-provided Motif installation or adds a dependency on
1.137     leot     5002:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/lesstif/README.html" target="_top"><code class="filename">x11/lesstif</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/motif/README.html" target="_top"><code class="filename">x11/motif</code></a>. The user can set
1.23      wiz      5003:        <code class="varname">MOTIF_TYPE</code> to <span class="quote">&#8220;<span class="quote">dt</span>&#8221;</span>,
1.126     leot     5004:        <span class="quote">&#8220;<span class="quote">lesstif</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">motif</span>&#8221;</span>
                   5005:        to choose which Motif version will be used.</p></li>
1.55      ryoon    5006: <li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a
1.56      wiz      5007:        system-provided GNU readline or editline (libedit) installation,
1.137     leot     5008:        or adds a dependency on <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/readline/README.html" target="_top"><code class="filename">devel/readline</code></a>,
                   5009:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/editline/README.html" target="_top"><code class="filename">devel/editline</code></a>. The user can set
1.55      ryoon    5010:        <code class="varname">READLINE_DEFAULT</code> to choose readline implementation.
                   5011:        If your package really needs GNU readline library, its Makefile
                   5012:        should include <code class="filename">devel/readline/buildlink3.mk</code>
                   5013:        instead of <code class="filename">readline.buildlink3.mk</code>.</p></li>
1.23      wiz      5014: <li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several
1.1       dsieger  5015:        variables that may be used by packages that use the
                   5016:        Open Sound System (OSS) API.</p></li>
1.23      wiz      5017: <li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept
1.35      wiz      5018:        any of the Postgres versions in the variable
                   5019:        <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to
                   5020:        the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See
1.1       dsieger  5021:        the file for more information.</p></li>
1.23      wiz      5022: <li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of
1.1       dsieger  5023:        <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds
1.137     leot     5024:        a dependency on <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pth/README.html" target="_top"><code class="filename">devel/pth</code></a> as needed.</p></li>
1.23      wiz      5025: <li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of
1.1       dsieger  5026:        <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets
                   5027:        library.</p></li>
                   5028: </ul></div>
                   5029: <p>The comments in those <code class="filename">buildlink3.mk</code>
                   5030:     files provide a more complete
                   5031:     description of how to use them properly.</p>
                   5032: </div>
1.41      asau     5033: <div class="sect1">
1.1       dsieger  5034: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5035: <a name="creating-buildlink3.mk"></a>16.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div>
1.7       rillig   5036: <a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is
1.1       dsieger  5037:     included by Makefiles to indicate the need to compile and link
                   5038:     against header files and libraries provided by the package.  A
                   5039:     <code class="filename">buildlink3.mk</code> file should always provide
                   5040:     enough information to add the correct type of dependency
                   5041:     relationship and include any other
                   5042:     <code class="filename">buildlink3.mk</code> files that it needs to find
                   5043:     headers and libraries that it needs in turn.</p>
                   5044: <p>To generate an initial <code class="filename">buildlink3.mk</code>
1.137     leot     5045:     file for further editing, Rene Hexel's <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/createbuildlink/README.html" target="_top"><code class="filename">pkgtools/createbuildlink</code></a>
1.1       dsieger  5046:     package is highly recommended.  For most packages, the following
                   5047:     command will generate a good starting point for
                   5048:     <code class="filename">buildlink3.mk</code> files:</p>
                   5049: <pre class="screen">
                   5050: <code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em>
                   5051: <code class="prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
                   5052:     </pre>
1.41      asau     5053: <div class="sect2">
1.1       dsieger  5054: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5055: <a name="anatomy-of-bl3"></a>16.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div>
1.1       dsieger  5056: <p>The following real-life example
                   5057:       <code class="filename">buildlink3.mk</code> is taken
                   5058:       from <code class="filename">pkgsrc/graphics/tiff</code>:</p>
                   5059: <pre class="programlisting">
1.18      snj      5060: # $NetBSD: buildlink3.mk,v 1.16 2009/03/20 19:24:45 joerg Exp $
1.1       dsieger  5061: 
1.112     rillig   5062: BUILDLINK_TREE+=        tiff
1.1       dsieger  5063: 
1.18      snj      5064: .if !defined(TIFF_BUILDLINK3_MK)
                   5065: TIFF_BUILDLINK3_MK:=
1.1       dsieger  5066: 
1.112     rillig   5067: BUILDLINK_API_DEPENDS.tiff+=    tiff&gt;=3.6.1
                   5068: BUILDLINK_ABI_DEPENDS.tiff+=    tiff&gt;=3.7.2nb1
                   5069: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
1.1       dsieger  5070: 
                   5071: .include "../../devel/zlib/buildlink3.mk"
                   5072: .include "../../graphics/jpeg/buildlink3.mk"
1.18      snj      5073: .endif # TIFF_BUILDLINK3_MK
1.1       dsieger  5074: 
1.112     rillig   5075: BUILDLINK_TREE+=        -tiff
1.1       dsieger  5076: </pre>
                   5077: <p>The header and footer manipulate
1.18      snj      5078:       <code class="varname">BUILDLINK_TREE</code>, which is common across all
1.1       dsieger  5079:       <code class="filename">buildlink3.mk</code> files and is used to track
1.18      snj      5080:       the dependency tree.</p>
                   5081: <p>The main section is protected from multiple inclusion
1.1       dsieger  5082:       and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is
                   5083:       added.  Several important variables are set in the section:</p>
1.41      asau     5084: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      5085: <li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5086:          is the actual dependency recorded in the installed
                   5087:          package; this should always be set using
1.10      hubertf  5088:          <span class="command"><strong>+=</strong></span> to ensure that
1.1       dsieger  5089:          we're appending to any pre-existing list of values.  This
                   5090:          variable should be set to the first version of the
1.26      wiz      5091:          package that had an backwards-incompatible API change.
1.1       dsieger  5092:          </p></li>
1.23      wiz      5093: <li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5094:          is the location of the <em class="replaceable"><code>pkg</code></em>
                   5095:          pkgsrc directory.</p></li>
1.23      wiz      5096: <li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5097:          (not shown above) controls whether we use
                   5098:          <code class="varname">BUILD_DEPENDS</code> or
                   5099:          <code class="varname">DEPENDS</code> to add the dependency on
                   5100:          <em class="replaceable"><code>pkg</code></em>.  The build dependency is
                   5101:          selected by setting
                   5102:          <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.23      wiz      5103:          to <span class="quote">&#8220;<span class="quote">build</span>&#8221;</span>.  By default, the full dependency is
1.1       dsieger  5104:          used.</p></li>
1.23      wiz      5105: <li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5106:            and
                   5107:            <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
                   5108:            (not shown above) are lists of subdirectories of
                   5109:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
                   5110:            to add to the header and library search paths.  These
1.23      wiz      5111:            default to <span class="quote">&#8220;<span class="quote">include</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">lib</span>&#8221;</span>
1.1       dsieger  5112:          respectively.</p></li>
1.23      wiz      5113: <li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5114:            (not shown above) is the list of preprocessor flags to add
                   5115:            to <code class="varname">CPPFLAGS</code>, which are passed on to the
1.23      wiz      5116:            configure and build phases.  The <span class="quote">&#8220;<span class="quote">-I</span>&#8221;</span> option
1.1       dsieger  5117:            should be avoided and instead be handled using
                   5118:            <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as
                   5119:          above.</p></li>
                   5120: </ul></div>
                   5121: <p>The following variables are all optionally defined within
                   5122:       this second section (protected against multiple inclusion) and
                   5123:       control which package files are symlinked into
                   5124:       <code class="filename">${BUILDLINK_DIR}</code> and how their names are
                   5125:       transformed during the symlinking:</p>
1.41      asau     5126: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      5127: <li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5128:            (not shown above) is a shell glob pattern relative to
                   5129:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
                   5130:            to be symlinked into
                   5131:            <code class="filename">${BUILDLINK_DIR}</code>,
                   5132:          e.g. <code class="filename">include/*.h</code>.</p></li>
1.23      wiz      5133: <li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5134:            (not shown above) is a shell pipeline that
                   5135:            outputs to stdout a list of files relative to
                   5136:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>.
                   5137:            The resulting files are to be symlinked
                   5138:            into <code class="filename">${BUILDLINK_DIR}</code>.  By default,
                   5139:            this takes the <code class="filename">+CONTENTS</code> of a
                   5140:            <em class="replaceable"><code>pkg</code></em> and filters it through
                   5141:            <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li>
1.23      wiz      5142: <li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5143:            (not shown above) is a filter command that filters
                   5144:            <code class="filename">+CONTENTS</code> input into a list of files
                   5145:            relative to
                   5146:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
1.84      wiz      5147:            on stdout.  By default,
1.1       dsieger  5148:            <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
                   5149:            outputs the contents of the <code class="filename">include</code>
                   5150:            and <code class="filename">lib</code> directories in the package
1.84      wiz      5151:            <code class="filename">+CONTENTS</code>.</p></li>
1.23      wiz      5152: <li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code>
1.1       dsieger  5153:            (not shown above) is a list of sed arguments used to
                   5154:            transform the name of the source filename into a
1.10      hubertf  5155:            destination filename, e.g. <span class="command"><strong>-e
1.1       dsieger  5156:            "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li>
                   5157: </ul></div>
1.18      snj      5158: <p>This section can additionally include any
1.1       dsieger  5159:       <code class="filename">buildlink3.mk</code> needed for
                   5160:       <em class="replaceable"><code>pkg</code></em>'s library dependencies.
                   5161:       Including these <code class="filename">buildlink3.mk</code> files
                   5162:       means that the headers and libraries for these
                   5163:       dependencies are also symlinked into
                   5164:       <code class="filename">${BUILDLINK_DIR}</code>
                   5165:       whenever the <em class="replaceable"><code>pkg</code></em>
                   5166:       <code class="filename">buildlink3.mk</code>
1.18      snj      5167:       file is included. Dependencies are only added for directly
                   5168:       include <code class="filename">buildlink3.mk</code> files.</p>
1.47      wiz      5169: <p>When providing a <code class="filename">buildlink3.mk</code> and
                   5170:       including other <code class="filename">buildlink3.mk</code> files in it,
1.50      wiz      5171:       please only add necessary ones, i.e., those whose libraries or
1.47      wiz      5172:       header files are automatically exposed when the package is
                   5173:       use.</p>
                   5174: <p>In particular, if only an executable
                   5175:       (<code class="filename">bin/foo</code>) is linked against a library, that
                   5176:       library does not need to be propagated in the
                   5177:       <code class="filename">buildlink3.mk</code> file.</p>
                   5178: <p>The following steps should help you decide if a
                   5179:       <code class="filename">buildlink3.mk</code> file needs to be included:
                   5180:       </p>
                   5181: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   5182: <li class="listitem"><p>Look at the installed header files: What
                   5183:        headers do they include? The packages providing these files
                   5184:        must be buildlinked.</p></li>
1.49      wiz      5185: <li class="listitem"><p>Run <code class="filename">ldd</code> on all installed
                   5186:        libraries and look against what other libraries they link.
                   5187:        Some of the packages providing these probably need to be
                   5188:        buildlinked; however, it's not automatic, since e.g. GTK on
                   5189:        some systems pulls in the X libraries, so they will show up in
                   5190:        the <code class="filename">ldd</code> output, while on others (like OS
1.50      wiz      5191:        X) it won't. <code class="filename">ldd</code> output can thus only be
1.49      wiz      5192:        used as a hint.</p></li>
1.47      wiz      5193: </ul></div>
                   5194: <p>
                   5195:       </p>
1.1       dsieger  5196: </div>
1.41      asau     5197: <div class="sect2">
1.1       dsieger  5198: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5199: <a name="updating-buildlink-depends"></a>16.2.2. Updating
1.1       dsieger  5200:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.26      wiz      5201:       and
                   5202:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5203:       in <code class="filename">buildlink3.mk</code> files</h3></div></div></div>
                   5204: <p>These two variables differ in that one describes source
                   5205:       compatibility (API) and the other binary compatibility (ABI).
                   5206:       The difference is that a change in the API breaks compilation of
                   5207:       programs while changes in the ABI stop compiled programs from
                   5208:       running.</p>
                   5209: <p>Changes to the
1.27      wiz      5210:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.26      wiz      5211:       variable in a <code class="filename">buildlink3.mk</code> file happen
                   5212:       very rarely. One possible reason is that all packages depending
                   5213:       on this already need a newer version. In case it is bumped see
                   5214:       the description below.</p>
                   5215: <p>The most common example of an ABI change is that the major
                   5216:       version of a shared library is increased. In this case,
                   5217:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5218:       should be adjusted to require at least the new package version.
                   5219:       Then the packages that depend on this package need their
                   5220:       <code class="varname">PKGREVISION</code>s increased and, if they have
                   5221:       <code class="filename">buildlink3.mk</code> files, their
                   5222:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5223:       adjusted, too. This is needed so pkgsrc will require the correct
                   5224:       package dependency and not settle for an older one when building
                   5225:       the source.</p>
1.154     rillig   5226: <p>See <a class="xref" href="#dependencies" title="21.1.5. Handling dependencies">Section 21.1.5, &#8220;Handling dependencies&#8221;</a> for
1.26      wiz      5227:       more information about dependencies on other packages,
                   5228:       including the <code class="varname">BUILDLINK_ABI_DEPENDS</code> and
1.1       dsieger  5229:       <code class="varname">ABI_DEPENDS</code> definitions.</p>
                   5230: <p>Please take careful consideration before adjusting
                   5231:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5232:       or
                   5233:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5234:       as we don't want to cause unneeded package deletions and
                   5235:       rebuilds.  In many cases, new versions of packages work just
                   5236:       fine with older dependencies.</p>
                   5237: <p>Also it is not needed to set
1.26      wiz      5238:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   5239:       when it is identical to
1.1       dsieger  5240:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.        </p>
                   5241: </div>
                   5242: </div>
1.41      asau     5243: <div class="sect1">
1.1       dsieger  5244: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5245: <a name="writing-builtin.mk"></a>16.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div>
1.1       dsieger  5246: <p>Some packages in pkgsrc install headers and libraries that
                   5247:       coincide with headers and libraries present in the base system.
                   5248:       Aside from a <code class="filename">buildlink3.mk</code> file, these
                   5249:       packages should also include a <code class="filename">builtin.mk</code>
                   5250:       file that includes the necessary checks to decide whether using
                   5251:       the built-in software or the pkgsrc software is
                   5252:     appropriate.</p>
                   5253: <p>The only requirements of a builtin.mk file for
                   5254:     <em class="replaceable"><code>pkg</code></em> are:</p>
1.23      wiz      5255: <div class="orderedlist"><ol class="orderedlist" type="1">
                   5256: <li class="listitem"><p>It should set
1.1       dsieger  5257:        <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.23      wiz      5258:        to either <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>
1.1       dsieger  5259:        after it is included.</p></li>
1.23      wiz      5260: <li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any
1.1       dsieger  5261:        <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   5262:        which is already set before the
                   5263:        <code class="filename">builtin.mk</code> file is included.</p></li>
1.23      wiz      5264: <li class="listitem"><p>It should be written to allow multiple inclusion.  This
1.1       dsieger  5265:        is <span class="emphasis"><em>very</em></span> important and takes careful
                   5266:        attention to <code class="filename">Makefile</code> coding.</p></li>
                   5267: </ol></div>
1.41      asau     5268: <div class="sect2">
1.1       dsieger  5269: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5270: <a name="anatomy-of-builtin.mk"></a>16.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</h3></div></div></div>
1.1       dsieger  5271: <p>The following is the recommended template for builtin.mk
                   5272:       files:</p>
                   5273: <pre class="programlisting">
                   5274: .if !defined(IS_BUILTIN.foo)
                   5275: #
                   5276: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   5277: # genuinely exists in the system or not.
                   5278: #
                   5279: IS_BUILTIN.foo?=        no
                   5280: 
                   5281: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   5282: # version can be determined.
                   5283: #
                   5284: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   5285: BUILTIN_PKG.foo?=       foo-1.0
                   5286: .  endif
                   5287: .endif  # IS_BUILTIN.foo
                   5288: 
                   5289: .if !defined(USE_BUILTIN.foo)
                   5290: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   5291: .  if defined(BUILTIN_PKG.foo)
                   5292: .    for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
                   5293: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   5294: USE_BUILTIN.foo!=                                                       \
                   5295:         ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}            \
                   5296:         &amp;&amp; ${ECHO} "yes" || ${ECHO} "no"
                   5297: .      endif
                   5298: .    endfor
                   5299: .  endif
                   5300: .endif  # USE_BUILTIN.foo
                   5301: 
                   5302: CHECK_BUILTIN.foo?=     no
                   5303: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   5304: #
                   5305: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   5306: # "yes" or "no".
                   5307: #
                   5308: .endif  # CHECK_BUILTIN.foo
                   5309: </pre>
                   5310: <p>The first section sets
                   5311:       <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   5312:       depending on if <em class="replaceable"><code>pkg</code></em> really exists
                   5313:       in the base system.  This should not be a base system software
                   5314:       with similar functionality to <em class="replaceable"><code>pkg</code></em>;
1.23      wiz      5315:       it should only be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> if the actual package is
1.1       dsieger  5316:       included as part of the base system.  This variable is only
                   5317:       used internally within the <code class="filename">builtin.mk</code>
                   5318:       file.</p>
                   5319: <p>The second section sets
                   5320:       <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
                   5321:       to the version of <em class="replaceable"><code>pkg</code></em> in the base
                   5322:       system if it exists (if
                   5323:       <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.23      wiz      5324:       is <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>).  This variable is only used internally
1.1       dsieger  5325:       within the <code class="filename">builtin.mk</code> file.</p>
                   5326: <p>The third section sets
                   5327:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   5328:       and is <span class="emphasis"><em>required</em></span> in all
                   5329:       <code class="filename">builtin.mk</code> files.  The code in this
                   5330:       section must make the determination whether the built-in
                   5331:       software is adequate to satisfy the dependencies listed in
                   5332:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
                   5333:       This is typically done by comparing
                   5334:       <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
                   5335:       against each of the dependencies in
                   5336:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
                   5337:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   5338:       <span class="emphasis"><em>must</em></span> be set to the correct value by the
                   5339:       end of the <code class="filename">builtin.mk</code> file.  Note that
                   5340:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.23      wiz      5341:       may be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> even if
1.1       dsieger  5342:       <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
1.23      wiz      5343:       is <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span> because we may make the determination
1.1       dsieger  5344:       that the built-in version of the software is similar enough to
                   5345:       be used as a replacement.</p>
                   5346: <p>The last section is guarded by
                   5347:       <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>,
                   5348:       and includes code that uses the value of
                   5349:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   5350:       set in the previous section.  This typically includes, e.g.,
                   5351:       adding additional dependency restrictions and listing additional
                   5352:       files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via
                   5353:       <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p>
                   5354: </div>
1.41      asau     5355: <div class="sect2">
1.1       dsieger  5356: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5357: <a name="native-or-pkgsrc-preference"></a>16.3.2. Global preferences for native or pkgsrc software</h3></div></div></div>
1.1       dsieger  5358: <p>When building packages, it's possible to choose whether to set
                   5359:        a global preference for using either the built-in (native)
                   5360:        version or the pkgsrc version of software to satisfy a
                   5361:        dependency.  This is controlled by setting
                   5362:        <code class="varname">PREFER_PKGSRC</code> and
                   5363:        <code class="varname">PREFER_NATIVE</code>.  These variables take values
1.23      wiz      5364:        of either <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>, or a list of
1.1       dsieger  5365:        packages.  <code class="varname">PREFER_PKGSRC</code> tells pkgsrc to
                   5366:        use the pkgsrc versions of software, while
                   5367:        <code class="varname">PREFER_NATIVE</code> tells pkgsrc to use the
                   5368:        built-in versions.  Preferences are determined by the most
                   5369:        specific instance of the package in either
                   5370:        <code class="varname">PREFER_PKGSRC</code> or
                   5371:        <code class="varname">PREFER_NATIVE</code>.  If a package is specified
                   5372:        in neither or in both variables, then
                   5373:        <code class="varname">PREFER_PKGSRC</code> has precedence over
                   5374:        <code class="varname">PREFER_NATIVE</code>.  For example, to require
                   5375:        using pkgsrc versions of software for all but the most basic
                   5376:       bits on a NetBSD system, you can set:</p>
                   5377: <pre class="programlisting">
                   5378: PREFER_PKGSRC=  yes
                   5379: PREFER_NATIVE=  getopt skey tcp_wrappers
                   5380: </pre>
                   5381: <p>A package <span class="emphasis"><em>must</em></span> have a
                   5382:       <code class="filename">builtin.mk</code>
                   5383:       file to be listed in <code class="varname">PREFER_NATIVE</code>,
                   5384:       otherwise it is simply ignored in that list.</p>
1.117     sevan    5385: <p>Setting <code class="varname">PREFER_NATIVE</code> should be performed
                   5386:       straight after bootstrap and <code class="varname">PREFER_PKGSRC</code> during
                   5387:       bootstrap.
                   5388:       Switching between settings globally at a later date can introduce
                   5389:       complications with dependency resolution. This is caused by packages
                   5390:       built with the opposite preference being installed alongside each other.</p>
                   5391: <pre class="screen">
                   5392: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap --prefer-pkgsrc yes</code></strong>
                   5393: </pre>
1.1       dsieger  5394: </div>
                   5395: </div>
                   5396: </div>
1.41      asau     5397: <div class="chapter">
1.1       dsieger  5398: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   5399: <a name="pkginstall"></a>Chapter 17. The pkginstall framework</h2></div></div></div>
1.1       dsieger  5400: <div class="toc">
                   5401: <p><b>Table of Contents</b></p>
1.100     leot     5402: <dl class="toc">
1.154     rillig   5403: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">17.1. Files and directories outside the installation prefix</a></span></dt>
1.1       dsieger  5404: <dd><dl>
1.154     rillig   5405: <dt><span class="sect2"><a href="#dirs-outside-prefix">17.1.1. Directory manipulation</a></span></dt>
                   5406: <dt><span class="sect2"><a href="#files-outside-prefix">17.1.2. File manipulation</a></span></dt>
1.1       dsieger  5407: </dl></dd>
1.154     rillig   5408: <dt><span class="sect1"><a href="#conf-files">17.2. Configuration files</a></span></dt>
1.1       dsieger  5409: <dd><dl>
1.154     rillig   5410: <dt><span class="sect2"><a href="#conf-files-sysconfdir">17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
                   5411: <dt><span class="sect2"><a href="#conf-files-configure">17.2.2. Telling the software where configuration files are</a></span></dt>
                   5412: <dt><span class="sect2"><a href="#conf-files-patching">17.2.3. Patching installations</a></span></dt>
                   5413: <dt><span class="sect2"><a href="#conf-files-disable">17.2.4. Disabling handling of configuration files</a></span></dt>
                   5414: </dl></dd>
                   5415: <dt><span class="sect1"><a href="#rcd-scripts">17.3. System startup scripts</a></span></dt>
                   5416: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">17.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
                   5417: <dt><span class="sect1"><a href="#users-and-groups">17.4. System users and groups</a></span></dt>
                   5418: <dt><span class="sect1"><a href="#shells">17.5. System shells</a></span></dt>
                   5419: <dd><dl><dt><span class="sect2"><a href="#shells-disable">17.5.1. Disabling shell registration</a></span></dt></dl></dd>
                   5420: <dt><span class="sect1"><a href="#fonts">17.6. Fonts</a></span></dt>
                   5421: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">17.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
1.1       dsieger  5422: </dl>
                   5423: </div>
                   5424: <p>This chapter describes the framework known as
                   5425: <code class="literal">pkginstall</code>, whose key features are:</p>
1.41      asau     5426: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      5427: <li class="listitem"><p>Generic installation and manipulation of directories and files
1.1       dsieger  5428:     outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li>
1.23      wiz      5429: <li class="listitem"><p>Automatic handling of configuration files during installation,
1.1       dsieger  5430:     provided that packages are correctly designed.</p></li>
1.23      wiz      5431: <li class="listitem"><p>Generation and installation of system startup scripts.</p></li>
                   5432: <li class="listitem"><p>Registration of system users and groups.</p></li>
                   5433: <li class="listitem"><p>Registration of system shells.</p></li>
                   5434: <li class="listitem"><p>Automatic updating of fonts databases.</p></li>
1.1       dsieger  5435: </ul></div>
                   5436: <p>The following sections inspect each of the above points in detail.</p>
                   5437: <p>You may be thinking that many of the things described here could be
                   5438: easily done with simple code in the package's post-installation target
                   5439: (<code class="literal">post-install</code>).  <span class="emphasis"><em>This is incorrect</em></span>,
                   5440: as the code in them is only executed when building from source.  Machines
                   5441: using binary packages could not benefit from it at all (as the code itself
                   5442: could be unavailable).  Therefore, the only way to achieve any of the items
                   5443: described above is by means of the installation scripts, which are
                   5444: automatically generated by pkginstall.</p>
1.41      asau     5445: <div class="sect1">
1.1       dsieger  5446: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5447: <a name="files-and-dirs-outside-prefix"></a>17.1. Files and directories outside the installation prefix</h2></div></div></div>
1.1       dsieger  5448: <p>As you already know, the <code class="filename">PLIST</code> file holds a list
                   5449: of files and directories that belong to a package.  The names used in it
                   5450: are relative to the installation prefix (<code class="filename">${PREFIX}</code>),
                   5451: which means that it cannot register files outside this directory (absolute
                   5452: path names are not allowed).  Despite this restriction, some packages need
                   5453: to install files outside this location; e.g., under
                   5454: <code class="filename">${VARBASE}</code> or
                   5455: <code class="filename">${PKG_SYSCONFDIR}</code>.  The only way to achieve this
                   5456: is to create such files during installation time by using
                   5457: installation scripts.</p>
                   5458: <p>The generic installation scripts are shell scripts that can
                   5459: contain arbitrary code.  The list of scripts to execute is taken from
                   5460: the <code class="varname">INSTALL_FILE</code> variable, which defaults to
                   5461: <code class="filename">INSTALL</code>.  A similar variable exists for package
                   5462: removal (<code class="varname">DEINSTALL_FILE</code>, whose default is
                   5463: <code class="filename">DEINSTALL</code>).  These scripts can run arbitrary
                   5464: commands, so they have the potential to create and manage files
                   5465: anywhere in the file system.</p>
                   5466: <p>Using these general installation files is not recommended, but
                   5467: may be needed in some special cases.  One reason for avoiding them is
                   5468: that the user has to trust the packager that there is no unwanted or
                   5469: simply erroneous code included in the installation script. Also,
                   5470: previously there were many similar scripts for the same functionality,
                   5471: and fixing a common error involved finding and changing all of
                   5472: them.</p>
                   5473: <p>The pkginstall framework offers another, standardized way.  It
                   5474: provides generic scripts to abstract the manipulation of such files
                   5475: and directories based on variables set in the package's
                   5476: <code class="filename">Makefile</code>.  The rest of this section describes
                   5477: these variables.</p>
1.41      asau     5478: <div class="sect2">
1.1       dsieger  5479: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5480: <a name="dirs-outside-prefix"></a>17.1.1. Directory manipulation</h3></div></div></div>
1.1       dsieger  5481: <p>The following variables can be set to request the creation of
                   5482: directories anywhere in the file system:</p>
1.41      asau     5483: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.108     rillig   5484: <li class="listitem">
                   5485: <p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code>
1.1       dsieger  5486:     contain a list of directories that should be created and should attempt
                   5487:     to be destroyed by the installation scripts.  The difference between
                   5488:     the two is that the latter prompts the administrator to remove any
                   5489:     directories that may be left after deinstallation (because they were
1.108     rillig   5490:     not empty), while the former does not.  Example:</p>
                   5491: <pre class="programlisting">
                   5492: MAKE_DIRS+=             ${VARBASE}/foo/private
                   5493: </pre>
                   5494: </li>
1.23      wiz      5495: <li class="listitem">
1.1       dsieger  5496: <p><code class="varname">MAKE_DIRS_PERMS</code> and
                   5497:     <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing
                   5498:     which directories should be created and should attempt to be destroyed
                   5499:     by the installation scripts.  Each tuple holds the following values,
                   5500:     separated by spaces: the directory name, its owner, its group and its
                   5501:     numerical mode.  For example:</p>
                   5502: <pre class="programlisting">
1.108     rillig   5503: MAKE_DIRS_PERMS+=       ${VARBASE}/foo/private \
                   5504:                         ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1       dsieger  5505: </pre>
                   5506: <p>The difference between the two is exactly the same as their
                   5507:     non-<code class="varname">PERMS</code> counterparts.</p>
                   5508: </li>
                   5509: </ul></div>
                   5510: </div>
1.41      asau     5511: <div class="sect2">
1.1       dsieger  5512: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5513: <a name="files-outside-prefix"></a>17.1.2. File manipulation</h3></div></div></div>
1.1       dsieger  5514: <p>Creating non-empty files outside the installation prefix is tricky
                   5515: because the <code class="filename">PLIST</code> forces all files to be inside it.
                   5516: To overcome this problem, the only solution is to extract the file in the
                   5517: known place (i.e., inside the installation prefix) and copy it to the
                   5518: appropriate location during installation (done by the installation scripts
                   5519: generated by pkginstall).  We will call the former the <span class="emphasis"><em>master
                   5520: file</em></span> in the following paragraphs, which describe the variables
                   5521: that can be used to automatically and consistently handle files outside the
                   5522: installation prefix:</p>
1.41      asau     5523: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      5524: <li class="listitem">
1.1       dsieger  5525: <p><code class="varname">CONF_FILES</code> and
1.30      wiz      5526:     <code class="varname">REQD_FILES</code> are pairs of master and target files.
1.1       dsieger  5527:     During installation time, the master file is copied to the target one
                   5528:     if and only if the latter does not exist.  Upon deinstallation, the
                   5529:     target file is removed provided that it was not modified by the
                   5530:     installation.</p>
                   5531: <p>The difference between the two is that the latter prompts the
                   5532:     administrator to remove any files that may be left after
                   5533:     deinstallation (because they were not empty), while the former does
                   5534:     not.</p>
                   5535: </li>
1.23      wiz      5536: <li class="listitem">
1.1       dsieger  5537: <p><code class="varname">CONF_FILES_PERMS</code> and
1.30      wiz      5538:     <code class="varname">REQD_FILES_PERMS</code> contain tuples describing master
1.1       dsieger  5539:     files as well as their target locations.  For each of them, it also
                   5540:     specifies their owner, their group and their numeric permissions, in
                   5541:     this order.  For example:</p>
                   5542: <pre class="programlisting">
1.108     rillig   5543: REQD_FILES_PERMS+=      ${PREFIX}/share/somefile ${VARBASE}/somefile \
                   5544:                         ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.1       dsieger  5545: </pre>
                   5546: <p>The difference between the two is exactly the same as their
                   5547:     non-<code class="varname">PERMS</code> counterparts.</p>
                   5548: </li>
                   5549: </ul></div>
                   5550: </div>
                   5551: </div>
1.41      asau     5552: <div class="sect1">
1.1       dsieger  5553: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5554: <a name="conf-files"></a>17.2. Configuration files</h2></div></div></div>
1.1       dsieger  5555: <p>Configuration files are special in the sense that they are installed
                   5556: in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and
                   5557: need special treatment during installation (most of which is automated by
                   5558: pkginstall).  The main concept you must bear in mind is that files marked
                   5559: as configuration files are automatically copied to the right place (somewhere
                   5560: inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if
                   5561: and only if</em></span> they didn't exist before.  Similarly, they will not
                   5562: be removed if they have local modifications.  This ensures that
                   5563: administrators never lose any custom changes they may have made.</p>
1.41      asau     5564: <div class="sect2">
1.1       dsieger  5565: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5566: <a name="conf-files-sysconfdir"></a>17.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</h3></div></div></div>
1.1       dsieger  5567: <p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable
                   5568: specifies where configuration files shall be installed.  Its contents are
                   5569: set based upon the following variables:</p>
1.41      asau     5570: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      5571: <li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root
1.1       dsieger  5572:     directory.  Defaults to <code class="filename">${PREFIX}/etc</code> although it may
                   5573:     be overridden by the user to point to his preferred location (e.g.,
                   5574:     <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.).
                   5575:     Packages must not use it directly.</p></li>
1.23      wiz      5576: <li class="listitem">
1.1       dsieger  5577: <p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of
                   5578:     <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files
                   5579:     for the package being built shall be installed.  The definition of this
                   5580:     variable only makes sense in the package's
                   5581:     <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p>
                   5582: <p>As an example, consider the Apache package,
1.137     leot     5583:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/README.html" target="_top"><code class="filename">www/apache24</code></a>, which places its
1.1       dsieger  5584:     configuration files under the
                   5585:     <code class="filename">httpd/</code> subdirectory of
                   5586:     <code class="varname">PKG_SYSCONFBASE</code>.  This should be set in the package
                   5587:     Makefile.</p>
                   5588: </li>
1.23      wiz      5589: <li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the
1.1       dsieger  5590:     variable that holds this package's configuration directory (if
                   5591:     different from <code class="varname">PKG_SYSCONFBASE</code>).  It defaults to
                   5592:     <code class="varname">PKGBASE</code>'s value, and is always prefixed with
                   5593:     <code class="literal">PKG_SYSCONFDIR</code>.</p></li>
1.23      wiz      5594: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the
1.1       dsieger  5595:     directory where the configuration files for the package identified by
                   5596:     <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li>
                   5597: </ul></div>
                   5598: <p>Based on the above variables, pkginstall determines the value of
                   5599: <code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span>
                   5600: variable that can be used within a package to refer to its configuration
                   5601: directory.  The algorithm used to set its value is basically the
                   5602: following:</p>
1.23      wiz      5603: <div class="orderedlist"><ol class="orderedlist" type="1">
                   5604: <li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set,
1.1       dsieger  5605:     its value is used.</p></li>
1.23      wiz      5606: <li class="listitem"><p>If the previous variable is not defined but
1.1       dsieger  5607:     <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's
                   5608:     <code class="filename">Makefile</code>, the resulting value is
                   5609:     <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li>
1.23      wiz      5610: <li class="listitem"><p>Otherwise, it is set to
1.1       dsieger  5611:     <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li>
                   5612: </ol></div>
                   5613: <p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is
1.154     rillig   5614: automatically added to <code class="filename">OWN_DIRS</code>.  See <a class="xref" href="#dirs-outside-prefix" title="17.1.1. Directory manipulation">Section 17.1.1, &#8220;Directory manipulation&#8221;</a> what this means.  This does not apply to
1.16      jnemeth  5615: subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to
                   5616: be created with OWN_DIRS or MAKE_DIRS.</p>
1.1       dsieger  5617: </div>
1.41      asau     5618: <div class="sect2">
1.1       dsieger  5619: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5620: <a name="conf-files-configure"></a>17.2.2. Telling the software where configuration files are</h3></div></div></div>
1.1       dsieger  5621: <p>Given that pkgsrc (and users!) expect configuration files to be in a
                   5622: known place, you need to teach each package where it shall install its
                   5623: files.  In some cases you will have to patch the package Makefiles to
                   5624: achieve it.  If you are lucky, though, it may be as easy as passing an
                   5625: extra flag to the configuration script; this is the case of GNU Autoconf-
                   5626: generated files:</p>
                   5627: <pre class="programlisting">
                   5628: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
                   5629: </pre>
                   5630: <p>Note that this specifies where the package has to <span class="emphasis"><em>look
                   5631: for</em></span> its configuration files, not where they will be originally
                   5632: installed (although the difference is never explicit,
                   5633: unfortunately).</p>
                   5634: </div>
1.41      asau     5635: <div class="sect2">
1.1       dsieger  5636: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5637: <a name="conf-files-patching"></a>17.2.3. Patching installations</h3></div></div></div>
1.1       dsieger  5638: <p>As said before, pkginstall automatically handles configuration files.
                   5639: This means that <span class="strong"><strong>the packages themselves must not
                   5640: touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code>
                   5641: directly</strong></span>.  Bad news is that many software installation scripts
                   5642: will, out of the box, mess with the contents of that directory.  So what is
                   5643: the correct procedure to fix this issue?</p>
                   5644: <p>You must teach the package (usually by manually patching it) to
                   5645: install any configuration files under the examples hierarchy,
                   5646: <code class="filename">share/examples/${PKGBASE}/</code>.  This way, the
                   5647: <code class="filename">PLIST</code> registers them and the administrator always
                   5648: has the original copies available.</p>
                   5649: <p>Once the required configuration files are in place (i.e., under the
                   5650: examples hierarchy), the pkginstall framework can use them as master copies
                   5651: during the package installation to update what is in
                   5652: <code class="filename">${PKG_SYSCONFDIR}</code>.  To achieve this, the variables
                   5653: <code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are
1.154     rillig   5654: used.  Check out <a class="xref" href="#files-outside-prefix" title="17.1.2. File manipulation">Section 17.1.2, &#8220;File manipulation&#8221;</a> for information
1.1       dsieger  5655: about their syntax and their purpose.  Here is an example, taken from the
1.137     leot     5656: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/mail/mutt/README.html" target="_top"><code class="filename">mail/mutt</code></a> package:</p>
1.1       dsieger  5657: <pre class="programlisting">
                   5658: EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   5659: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   5660: </pre>
                   5661: <p>Note that the <code class="varname">EGDIR</code> variable is specific to that
                   5662: package and has no meaning outside it.</p>
                   5663: </div>
1.41      asau     5664: <div class="sect2">
1.1       dsieger  5665: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5666: <a name="conf-files-disable"></a>17.2.4. Disabling handling of configuration files</h3></div></div></div>
1.1       dsieger  5667: <p>The automatic copying of config files can be toggled by setting the
                   5668: environment variable <code class="varname">PKG_CONFIG</code> prior to package
                   5669: installation.</p>
                   5670: </div>
                   5671: </div>
1.41      asau     5672: <div class="sect1">
1.1       dsieger  5673: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5674: <a name="rcd-scripts"></a>17.3. System startup scripts</h2></div></div></div>
1.1       dsieger  5675: <p>System startup scripts are special files because they must be
                   5676: installed in a place known by the underlying OS, usually outside the
1.154     rillig   5677: installation prefix.  Therefore, the same rules described in <a class="xref" href="#files-and-dirs-outside-prefix" title="17.1. Files and directories outside the installation prefix">Section 17.1, &#8220;Files and directories outside the installation prefix&#8221;</a> apply, and the same solutions
1.1       dsieger  5678: can be used.  However, pkginstall provides a special mechanism to handle
                   5679: these files.</p>
                   5680: <p>In order to provide system startup scripts, the package has
                   5681: to:</p>
1.23      wiz      5682: <div class="orderedlist"><ol class="orderedlist" type="1">
                   5683: <li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with
1.1       dsieger  5684:     the <code class="literal">.sh</code> suffix appended.  Considering the
1.137     leot     5685:     <a href="https://cdn.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
1.1       dsieger  5686:     <code class="filename">cupsd.sh</code> in its files directory.</p></li>
1.23      wiz      5687: <li class="listitem">
1.1       dsieger  5688: <p>Tell pkginstall to handle it, appending the name of the script,
                   5689:     without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable.
                   5690:     Continuing the previous example:</p>
                   5691: <pre class="programlisting">
                   5692: RCD_SCRIPTS+=   cupsd
                   5693: </pre>
                   5694: </li>
                   5695: </ol></div>
                   5696: <p>Once this is done, pkginstall will do the following steps for each
                   5697: script in an automated fashion:</p>
1.23      wiz      5698: <div class="orderedlist"><ol class="orderedlist" type="1">
                   5699: <li class="listitem"><p>Process the file found in the files directory applying all the
1.1       dsieger  5700:     substitutions described in the <code class="filename">FILES_SUBST</code>
                   5701:     variable.</p></li>
1.23      wiz      5702: <li class="listitem"><p>Copy the script from the files directory to the examples
1.1       dsieger  5703:     hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>.  Note
                   5704:     that this master file must be explicitly registered in the
                   5705:     <code class="filename">PLIST</code>.</p></li>
1.23      wiz      5706: <li class="listitem"><p>Add code to the installation scripts to copy the startup script
1.1       dsieger  5707:     from the examples hierarchy into the system-wide startup scripts
                   5708:     directory.</p></li>
                   5709: </ol></div>
1.41      asau     5710: <div class="sect2">
1.1       dsieger  5711: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5712: <a name="rcd-scripts-disable"></a>17.3.1. Disabling handling of system startup scripts</h3></div></div></div>
1.1       dsieger  5713: <p>The automatic copying of config files can be toggled by setting the
                   5714: environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package
                   5715: installation.  Note that the scripts will be always copied inside the
                   5716: examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no
                   5717: matter what the value of this variable is.</p>
                   5718: </div>
                   5719: </div>
1.41      asau     5720: <div class="sect1">
1.1       dsieger  5721: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5722: <a name="users-and-groups"></a>17.4. System users and groups</h2></div></div></div>
1.1       dsieger  5723: <p>If a package needs to create special users and/or groups during
                   5724: installation, it can do so by using the pkginstall framework.</p>
                   5725: <p>Users can be created by adding entries to the
                   5726: <code class="varname">PKG_USERS</code> variable.  Each entry has the following
                   5727: syntax:</p>
                   5728: <pre class="programlisting">
                   5729: user:group
                   5730: </pre>
                   5731: <p>Further specification of user details may be done by setting
                   5732: per-user variables.
                   5733: <code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the
                   5734: numeric UID for the user.
                   5735: <code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the
                   5736: user's description or comment.
                   5737: <code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the
                   5738: user's home directory, and defaults to
                   5739: <code class="filename">/nonexistent</code> if not specified.
                   5740: <code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the
                   5741: user's shell, and defaults to <code class="filename">/sbin/nologin</code> if
                   5742: not specified.</p>
                   5743: <p>Similarly, groups can be created by adding entries to the
                   5744: <code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p>
                   5745: <pre class="programlisting">
                   5746: group
                   5747: </pre>
                   5748: <p>The numeric GID of the group may be set by defining
                   5749: <code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p>
                   5750: <p>If a package needs to create the users and groups at an earlier
1.116     wiz      5751: stage, then it can set <code class="varname">USERGROUP_PHASE</code> to either
                   5752: <code class="literal">configure</code>,<code class="literal">build</code>, or
                   5753: <code class="literal">pre-install</code> to indicate the phase before which the
                   5754: users and groups are created. In this case, the numeric UIDs and GIDs
                   5755: of the created users and groups are automatically hardcoded into the
                   5756: final installation scripts.</p>
1.1       dsieger  5757: </div>
1.41      asau     5758: <div class="sect1">
1.1       dsieger  5759: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5760: <a name="shells"></a>17.5. System shells</h2></div></div></div>
1.1       dsieger  5761: <p>Packages that install system shells should register them in the shell
                   5762: database, <code class="filename">/etc/shells</code>, to make things easier to the
                   5763: administrator.  This must be done from the installation scripts to keep
                   5764: binary packages working on any system.  pkginstall provides an easy way to
                   5765: accomplish this task.</p>
                   5766: <p>When a package provides a shell interpreter, it has to set the
                   5767: <code class="varname">PKG_SHELL</code> variable to its absolute file name.  This will
                   5768: add some hooks to the installation scripts to handle it.  Consider the
1.137     leot     5769: following example, taken from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/zsh/README.html" target="_top"><code class="filename">shells/zsh</code></a>:</p>
1.1       dsieger  5770: <pre class="programlisting">
                   5771: PKG_SHELL=      ${PREFIX}/bin/zsh
                   5772: </pre>
1.41      asau     5773: <div class="sect2">
1.1       dsieger  5774: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5775: <a name="shells-disable"></a>17.5.1. Disabling shell registration</h3></div></div></div>
1.1       dsieger  5776: <p>The automatic registration of shell interpreters can be disabled by
                   5777: the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code>
                   5778: environment variable to <code class="literal">NO</code>.</p>
                   5779: </div>
                   5780: </div>
1.41      asau     5781: <div class="sect1">
1.1       dsieger  5782: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5783: <a name="fonts"></a>17.6. Fonts</h2></div></div></div>
1.1       dsieger  5784: <p>Packages that install X11 fonts should update the database files
                   5785: that index the fonts within each fonts directory.  This can easily be
                   5786: accomplished within the pkginstall framework.</p>
                   5787: <p>When a package installs X11 fonts, it must list the directories in
                   5788: which fonts are installed in the
                   5789: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables,
1.23      wiz      5790: where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>,
                   5791: <span class="quote">&#8220;<span class="quote">type1</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">x11</span>&#8221;</span>.  This will add hooks to the
1.1       dsieger  5792: installation scripts to run the appropriate commands to update the fonts
                   5793: database files within each of those directories.  For convenience, if the
                   5794: directory path is relative, it is taken to be relative to the package's
1.137     leot     5795: installation prefix.  Consider the following example, taken from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/fonts/dbz-ttf/README.html" target="_top"><code class="filename">fonts/dbz-ttf</code></a>:</p>
1.1       dsieger  5796: <pre class="programlisting">
1.67      wiz      5797: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.1       dsieger  5798: </pre>
1.41      asau     5799: <div class="sect2">
1.1       dsieger  5800: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   5801: <a name="fonts-disable"></a>17.6.1. Disabling automatic update of the fonts databases</h3></div></div></div>
1.1       dsieger  5802: <p>The automatic update of fonts databases can be disabled by
                   5803: the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code>
                   5804: environment variable to <code class="literal">NO</code>.</p>
                   5805: </div>
                   5806: </div>
                   5807: </div>
1.41      asau     5808: <div class="chapter">
1.1       dsieger  5809: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   5810: <a name="options"></a>Chapter 18. Options handling</h2></div></div></div>
1.1       dsieger  5811: <div class="toc">
                   5812: <p><b>Table of Contents</b></p>
1.100     leot     5813: <dl class="toc">
1.154     rillig   5814: <dt><span class="sect1"><a href="#global-default-options">18.1. Global default options</a></span></dt>
                   5815: <dt><span class="sect1"><a href="#converting-to-options">18.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
                   5816: <dt><span class="sect1"><a href="#option-names">18.3. Option Names</a></span></dt>
                   5817: <dt><span class="sect1"><a href="#option-build">18.4. Determining the options of dependencies</a></span></dt>
1.1       dsieger  5818: </dl>
                   5819: </div>
                   5820: <p>Many packages have the ability to be built to support different
                   5821: sets of features.  <code class="filename">bsd.options.mk</code> is a framework
                   5822: in pkgsrc that provides generic handling of those options that
                   5823: determine different ways in which the packages can be built.  It's
                   5824: possible for the user to specify exactly which sets of options will be
                   5825: built into a package or to allow a set of global default options
                   5826: apply.</p>
1.7       rillig   5827: <p>There are two broad classes of behaviors that one might want to
                   5828: control via options.  One is whether some particular feature is
                   5829: enabled in a program that will be built anyway, often by including or
                   5830: not including a dependency on some other package.  The other is
                   5831: whether or not an additional program will be built as part of the
                   5832: package.  Generally, it is better to make a split package for such
                   5833: additional programs instead of using options, because it enables
                   5834: binary packages to be built which can then be added separately.  For
                   5835: example, the foo package might have minimal dependencies (those
                   5836: packages without which foo doesn't make sense), and then the foo-gfoo
                   5837: package might include the GTK frontend program gfoo.  This is better
                   5838: than including a gtk option to foo that adds gfoo, because either that
                   5839: option is default, in which case binary users can't get foo without
                   5840: gfoo, or not default, in which case they can't get gfoo.  With split
                   5841: packages, they can install foo without having GTK, and later decide to
                   5842: install gfoo (pulling in GTK at that time).  This is an advantage to
                   5843: source users too, avoiding the need for rebuilds.</p>
                   5844: <p>Plugins with widely varying dependencies should usually be split
                   5845: instead of options.</p>
                   5846: <p>It is often more work to maintain split packages, especially if
                   5847: the upstream package does not support this.  The decision of split
                   5848: vs. option should be made based on the likelihood that users will want
                   5849: or object to the various pieces, the size of the dependencies that are
                   5850: included, and the amount of work.</p>
                   5851: <p>A further consideration is licensing.  Non-free parts, or parts
                   5852: that depend on non-free dependencies (especially plugins) should
                   5853: almost always be split if feasible.</p>
1.41      asau     5854: <div class="sect1">
1.1       dsieger  5855: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5856: <a name="global-default-options"></a>18.1. Global default options</h2></div></div></div>
1.1       dsieger  5857: <p>Global default options are listed in
                   5858: <code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options
                   5859: that should be built into every package if that option is supported.
1.10      hubertf  5860: This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.1       dsieger  5861: </div>
1.41      asau     5862: <div class="sect1">
1.1       dsieger  5863: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   5864: <a name="converting-to-options"></a>18.2. Converting packages to use <code class="filename">bsd.options.mk</code>
1.1       dsieger  5865: </h2></div></div></div>
                   5866: <p>The following example shows how
                   5867: <code class="filename">bsd.options.mk</code> should be used
                   5868: by the hypothetical ``wibble'' package, either in the package
                   5869: <code class="filename">Makefile</code>, or in a file,
                   5870: e.g. <code class="filename">options.mk</code>, that is included by the
                   5871: main package <code class="filename">Makefile</code>.</p>
                   5872: <pre class="programlisting">
                   5873: PKG_OPTIONS_VAR=                PKG_OPTIONS.wibble
                   5874: PKG_SUPPORTED_OPTIONS=          wibble-foo ldap
                   5875: PKG_OPTIONS_OPTIONAL_GROUPS=    database
                   5876: PKG_OPTIONS_GROUP.database=     mysql pgsql
                   5877: PKG_SUGGESTED_OPTIONS=          wibble-foo
                   5878: PKG_OPTIONS_LEGACY_VARS+=       WIBBLE_USE_OPENLDAP:ldap
                   5879: PKG_OPTIONS_LEGACY_OPTS+=       foo:wibble-foo
                   5880: 
                   5881: .include "../../mk/bsd.prefs.mk"
                   5882: 
                   5883: # this package was previously named wibble2
                   5884: .if defined(PKG_OPTIONS.wibble2)
                   5885: PKG_LEGACY_OPTIONS+=            ${PKG_OPTIONS.wibble2}
                   5886: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   5887:         "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
                   5888: .endif
                   5889: 
                   5890: .include "../../mk/bsd.options.mk"
                   5891: 
                   5892: # Package-specific option-handling
                   5893: 
                   5894: ###
                   5895: ### FOO support
                   5896: ###
                   5897: .if !empty(PKG_OPTIONS:Mwibble-foo)
                   5898: CONFIGURE_ARGS+=    --enable-foo
                   5899: .endif
                   5900: 
                   5901: ###
                   5902: ### LDAP support
                   5903: ###
                   5904: .if !empty(PKG_OPTIONS:Mldap)
                   5905: .  include "../../databases/openldap-client/buildlink3.mk"
                   5906: CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
                   5907: .endif
                   5908: 
                   5909: ###
                   5910: ### database support
                   5911: ###
                   5912: .if !empty(PKG_OPTIONS:Mmysql)
                   5913: .  include "../../mk/mysql.buildlink3.mk"
                   5914: .endif
                   5915: .if !empty(PKG_OPTIONS:Mpgsql)
                   5916: .  include "../../mk/pgsql.buildlink3.mk"
                   5917: .endif
                   5918: </pre>
                   5919: <p>The first section contains the information about which build
                   5920: options are supported by the package, and any default options settings
                   5921: if needed.</p>
1.23      wiz      5922: <div class="orderedlist"><ol class="orderedlist" type="1">
                   5923: <li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the
1.174     leot     5924: <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> variable that the user can set to override the default
1.1       dsieger  5925: options.  It should be set to
                   5926: PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to
                   5927: PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined
                   5928: at the point where the options are processed.</p></li>
1.23      wiz      5929: <li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of
1.1       dsieger  5930: build options supported by the package.</p></li>
1.23      wiz      5931: <li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
1.1       dsieger  5932: list of names of groups of mutually exclusive options.  The options in
                   5933: each group are listed in
                   5934: <code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>.
                   5935: The most specific setting of any option from the group takes
                   5936: precedence over all other options in the group.  Options from the
                   5937: groups will be automatically added to
                   5938: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li>
1.23      wiz      5939: <li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like
1.1       dsieger  5940: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the
                   5941: packages will fail if no option from the group is
                   5942: selected.</p></li>
1.23      wiz      5943: <li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list
1.1       dsieger  5944: of names of sets of options.  At least one option from each set must
                   5945: be selected.  The options in each set are listed in
                   5946: <code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>.
                   5947: Options from the sets will be automatically added to
                   5948: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.  Building the package will
                   5949: fail if no option from the set is selected.</p></li>
1.23      wiz      5950: <li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of
1.1       dsieger  5951: build options which are enabled by default.</p></li>
1.23      wiz      5952: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
1.1       dsieger  5953: of
1.23      wiz      5954: <span class="quote">&#8220;<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>&#8221;</span>
1.10      hubertf  5955: pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to
1.1       dsieger  5956: their option counterparts.  Pairs should be added with
1.23      wiz      5957: <span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep the listing of global legacy variables.  A
1.1       dsieger  5958: warning will be issued if the user uses a legacy
                   5959: variable.</p></li>
1.23      wiz      5960: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
1.1       dsieger  5961: of
1.23      wiz      5962: <span class="quote">&#8220;<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>&#8221;</span>
1.1       dsieger  5963: pairs that map options that have been renamed to their new
1.23      wiz      5964: counterparts.  Pairs should be added with <span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep
1.1       dsieger  5965: the listing of global legacy options.  A warning will be issued if
                   5966: the user uses a legacy option.</p></li>
1.23      wiz      5967: <li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of
1.1       dsieger  5968: options implied by deprecated variables used.  This can be used for
                   5969: cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   5970: <code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when
                   5971: <code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li>
1.23      wiz      5972: <li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
1.1       dsieger  5973: a list of warnings about deprecated variables or options used, and
                   5974: what to use instead.</p></li>
                   5975: </ol></div>
                   5976: <p>A package should never modify
                   5977: <code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in
                   5978: <code class="varname">PKG_OPTIONS_VAR</code>.  These are strictly user-settable.
                   5979: To suggest a default set of options, use
                   5980: <code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   5981: <p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before
                   5982: including <code class="filename">bsd.options.mk</code>.  If none of
                   5983: <code class="varname">PKG_SUPPORTED_OPTIONS</code>,
                   5984: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   5985: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can
                   5986: happen with platform-specific options if none of them is supported on
                   5987: the current platform), <code class="varname">PKG_OPTIONS</code> is set to the
                   5988: empty list and the package is otherwise treated as not using the
                   5989: options framework.</p>
                   5990: <p>After the inclusion of <code class="filename">bsd.options.mk</code>, the
                   5991: variable <code class="varname">PKG_OPTIONS</code> contains the list of selected
                   5992: build options, properly filtered to remove unsupported and duplicate
                   5993: options.</p>
                   5994: <p>The remaining sections contain the logic that is specific to
                   5995: each option.  The correct way to check for an option is to check
                   5996: whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p>
                   5997: <pre class="programlisting">
                   5998: .if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>)
                   5999: </pre>
                   6000: </div>
1.41      asau     6001: <div class="sect1">
1.1       dsieger  6002: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6003: <a name="option-names"></a>18.3. Option Names</h2></div></div></div>
1.1       dsieger  6004: <p>Options that enable similar features in different packages (like
                   6005: optional support for a library) should use a common name in all
                   6006: packages that support it (like the name of the library).  If another
                   6007: package already has an option with the same meaning, use the same
                   6008: name.</p>
                   6009: <p>Options that enable features specific to one package, where it's
                   6010: unlikely that another (unrelated) package has the same (or a similar)
                   6011: optional feature, should use a name prefixed with
                   6012: <code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p>
                   6013: <p>If a group of related packages share an optional feature
                   6014: specific to that group, prefix it with the name of the
1.23      wiz      6015: <span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> package
1.1       dsieger  6016: (e. g. <code class="varname">djbware-errno-hack</code>).</p>
                   6017: <p>For new options, add a line to
                   6018: <code class="filename">mk/defaults/options.description</code>.  Lines have two
                   6019: fields, separated by tab.  The first field is the option name, the
                   6020: second its description.  The description should be a whole sentence
                   6021: (starting with an uppercase letter and ending with a period) that
1.23      wiz      6022: describes what enabling the option does.  E. g. <span class="quote">&#8220;<span class="quote">Enable ispell
                   6023: support.</span>&#8221;</span> The file is sorted by option names.</p>
1.1       dsieger  6024: </div>
1.41      asau     6025: <div class="sect1">
1.7       rillig   6026: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6027: <a name="option-build"></a>18.4. Determining the options of dependencies</h2></div></div></div>
1.10      hubertf  6028: <p>When writing <a class="link" href="#buildlink3.mk"><code class="filename">buildlink3.mk</code></a> files, it is often necessary to list
1.7       rillig   6029: different dependencies based on the options with which the package was
                   6030: built. For querying these options, the file
                   6031: <code class="filename">pkgsrc/mk/pkg-build-options.mk</code> should be used. A
                   6032: typical example looks like this:</p>
                   6033: <pre class="programlisting">
                   6034: pkgbase := libpurple
                   6035: .include "../../mk/pkg-build-options.mk"
                   6036: 
                   6037: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
                   6038: ...
                   6039: .endif
                   6040: </pre>
                   6041: <p>Including <code class="filename">pkg-build-options.mk</code> here will set
                   6042: the variable <code class="varname">PKG_BUILD_OPTIONS.libpurple</code> to the build
                   6043: options of the libpurple package, which can then be queried like
                   6044: <code class="varname">PKG_OPTIONS</code> in the <code class="filename">options.mk</code>
                   6045: file. See the file <code class="filename">pkg-build-options.mk</code> for more
                   6046: details.</p>
                   6047: </div>
1.1       dsieger  6048: </div>
1.41      asau     6049: <div class="chapter">
1.1       dsieger  6050: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   6051: <a name="build"></a>Chapter 19. The build process</h2></div></div></div>
1.1       dsieger  6052: <div class="toc">
                   6053: <p><b>Table of Contents</b></p>
1.100     leot     6054: <dl class="toc">
1.154     rillig   6055: <dt><span class="sect1"><a href="#build.intro">19.1. Introduction</a></span></dt>
                   6056: <dt><span class="sect1"><a href="#build.prefix">19.2. Program location</a></span></dt>
                   6057: <dt><span class="sect1"><a href="#build.builddirs">19.3. Directories used during the build process</a></span></dt>
                   6058: <dt><span class="sect1"><a href="#build.running">19.4. Running a phase</a></span></dt>
                   6059: <dt><span class="sect1"><a href="#build.fetch">19.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   6060: <dd><dl>
                   6061: <dt><span class="sect2"><a href="#build.fetch.what">19.5.1. What to fetch and where to get it from</a></span></dt>
                   6062: <dt><span class="sect2"><a href="#build.fetch.how">19.5.2. How are the files fetched?</a></span></dt>
                   6063: </dl></dd>
                   6064: <dt><span class="sect1"><a href="#build.checksum">19.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
                   6065: <dt><span class="sect1"><a href="#build.extract">19.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
                   6066: <dt><span class="sect1"><a href="#build.patch">19.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
                   6067: <dt><span class="sect1"><a href="#build.tools">19.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
                   6068: <dt><span class="sect1"><a href="#build.wrapper">19.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
                   6069: <dt><span class="sect1"><a href="#build.configure">19.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   6070: <dt><span class="sect1"><a href="#build.build">19.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   6071: <dt><span class="sect1"><a href="#build.test">19.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
                   6072: <dt><span class="sect1"><a href="#build.install">19.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   6073: <dt><span class="sect1"><a href="#build.package">19.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
                   6074: <dt><span class="sect1"><a href="#build.clean">19.16. Cleaning up</a></span></dt>
                   6075: <dt><span class="sect1"><a href="#build.helpful-targets">19.17. Other helpful targets</a></span></dt>
1.1       dsieger  6076: </dl>
                   6077: </div>
1.41      asau     6078: <div class="sect1">
1.1       dsieger  6079: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6080: <a name="build.intro"></a>19.1. Introduction</h2></div></div></div>
1.1       dsieger  6081: <p>This chapter gives a detailed description on how a package is
                   6082:     built. Building a package is separated into different
                   6083:     <span class="emphasis"><em>phases</em></span> (for example <code class="varname">fetch</code>,
                   6084:     <code class="varname">build</code>, <code class="varname">install</code>), all of which are
1.18      snj      6085:     described in the following sections. Each phase is split into
1.1       dsieger  6086:     so-called <span class="emphasis"><em>stages</em></span>, which take the name of the
                   6087:     containing phase, prefixed by one of <code class="varname">pre-</code>,
                   6088:     <code class="varname">do-</code> or <code class="varname">post-</code>. (Examples are
                   6089:     <code class="varname">pre-configure</code>, <code class="varname">post-build</code>.) Most
                   6090:     of the actual work is done in the <code class="varname">do-*</code> stages.</p>
                   6091: <p>Never override the regular targets (like
                   6092:     <code class="varname">fetch</code>), if you have to, override the
                   6093:     <code class="varname">do-*</code> ones instead.</p>
                   6094: <p>The basic steps for building a program are always the same.  First
                   6095:     the program's source (<span class="emphasis"><em>distfile</em></span>) must be brought to
                   6096:     the local system and then extracted. After any pkgsrc-specific patches
                   6097:     to compile properly are applied, the software can be configured, then
                   6098:     built (usually by compiling), and finally the generated binaries, etc.
                   6099:     can be put into place on the system.</p>
                   6100: <p>To get more details about what is happening at each step,
                   6101:     you can set the <code class="varname">PKG_VERBOSE</code> variable, or the
                   6102:     <code class="varname">PATCH_DEBUG</code> variable if you are just interested
                   6103:     in more details about the <span class="emphasis"><em>patch</em></span> step.</p>
                   6104: </div>
1.41      asau     6105: <div class="sect1">
1.1       dsieger  6106: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6107: <a name="build.prefix"></a>19.2. Program location</h2></div></div></div>
1.1       dsieger  6108: <p>Before outlining the process performed by the NetBSD package system in
                   6109:     the next section, here's a brief discussion on where programs are
                   6110:     installed, and which variables influence this.</p>
                   6111: <p>The automatic variable <code class="varname">PREFIX</code> indicates
                   6112:     where all files of the final program shall be installed. It is
                   6113:     usually set to <code class="varname">LOCALBASE</code>
                   6114:     (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code>
                   6115:     for pkgs in the <code class="filename">cross</code> category.  The value of
                   6116:     <code class="varname">PREFIX</code> needs to be put
                   6117:     into the various places in the program's source where paths to
1.154     rillig   6118:     these files are encoded.  See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> and <a class="xref" href="#fixes.libtool" title="21.3.1. Shared libraries - libtool">Section 21.3.1, &#8220;Shared libraries - libtool&#8221;</a> for more details.</p>
1.1       dsieger  6119: <p>When choosing which of these variables to use,
                   6120:     follow the following rules:</p>
1.41      asau     6121: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      6122: <li class="listitem"><p><code class="varname">PREFIX</code> always points to the location
1.1       dsieger  6123:        where the current pkg will be installed.  When referring to a
                   6124:        pkg's own installation path, use
1.23      wiz      6125:        <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span>.</p></li>
                   6126: <li class="listitem"><p><code class="varname">LOCALBASE</code> is where all non-X11 pkgs
1.1       dsieger  6127:        are installed.  If you need to construct a -I or -L argument
                   6128:        to the compiler to find includes and libraries installed by
1.23      wiz      6129:        another non-X11 pkg, use <span class="quote">&#8220;<span class="quote">${LOCALBASE}</span>&#8221;</span>. The name
1.1       dsieger  6130:        <code class="varname">LOCALBASE</code> stems from FreeBSD, which
                   6131:        installed all packages in <code class="filename">/usr/local</code>. As
                   6132:        pkgsrc leaves <code class="filename">/usr/local</code> for the system
                   6133:        administrator, this variable is a misnomer.</p></li>
1.23      wiz      6134: <li class="listitem"><p><code class="varname">X11BASE</code> is where the actual X11
1.1       dsieger  6135:        distribution (from xsrc, etc.) is installed. When looking for
                   6136:        <span class="emphasis"><em>standard</em></span> X11 includes (not those
1.23      wiz      6137:        installed by a package), use <span class="quote">&#8220;<span class="quote">${X11BASE}</span>&#8221;</span>.</p></li>
1.99      sevan    6138: <li class="listitem"><p>X11-based packages using imake must set
                   6139:        <code class="varname">USE_IMAKE</code> to be installed correctly under
                   6140:        <code class="varname">LOCALBASE</code>.</p></li>
1.23      wiz      6141: <li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should
1.174     leot     6142:        install files according to <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?hier+7.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span></a>, with the exception that
1.1       dsieger  6143:        manual pages go into <code class="filename">${PREFIX}/man</code>, not
                   6144:        <code class="filename">${PREFIX}/share/man</code>.</p></li>
                   6145: </ul></div>
                   6146: </div>
1.41      asau     6147: <div class="sect1">
1.1       dsieger  6148: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6149: <a name="build.builddirs"></a>19.3. Directories used during the build process</h2></div></div></div>
1.14      jmcneill 6150: <p>When building a package, various directories are used to store
1.1       dsieger  6151:     source files, temporary files, pkgsrc-internal files, and so on. These
                   6152:     directories are explained here.</p>
                   6153: <p>Some of the directory variables contain relative pathnames. There
                   6154:     are two common base directories for these relative directories:
                   6155:     <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are
                   6156:     pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories
                   6157:     inside the package itself.</p>
1.41      asau     6158: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6159: <dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt>
                   6160: <dd><p>This is an absolute pathname that points to the pkgsrc
                   6161:       root directory. Generally, you don't need
                   6162:       it.</p></dd>
                   6163: <dt><span class="term"><code class="varname">PKGDIR</code></span></dt>
                   6164: <dd><p>This is an absolute pathname that points to the
                   6165:       current package.</p></dd>
                   6166: <dt><span class="term"><code class="varname">PKGPATH</code></span></dt>
                   6167: <dd><p>This is a pathname relative to
                   6168:       <code class="varname">PKGSRCDIR</code> that points to the current
                   6169:       package.</p></dd>
                   6170: <dt><span class="term"><code class="varname">WRKDIR</code></span></dt>
                   6171: <dd><p>This is an absolute pathname pointing to the directory
                   6172:       where all work takes place. The distfiles are extracted to this
                   6173:       directory. It also contains temporary directories and log files used by
                   6174:       the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or
                   6175:       the <span class="emphasis"><em>wrappers</em></span>.</p></dd>
                   6176: <dt><span class="term"><code class="varname">WRKSRC</code></span></dt>
                   6177: <dd><p>This is an absolute pathname pointing to the directory
                   6178:       where the distfiles are extracted. It is usually a direct subdirectory
                   6179:       of <code class="varname">WRKDIR</code>, and often it's the only directory entry
                   6180:       that isn't hidden. This variable may be changed by a package
                   6181:       <code class="filename">Makefile</code>.</p></dd>
                   6182: </dl></div>
1.14      jmcneill 6183: <p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either
                   6184:     the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults
1.15      rillig   6185:     to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the
1.14      jmcneill 6186:     <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory.
                   6187:     If users would like to have their pkgsrc trees behave in a
                   6188:     read-only manner, then the value of
                   6189:     <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to
                   6190:     <span class="emphasis"><em>no</em></span>.</p>
1.1       dsieger  6191: </div>
1.41      asau     6192: <div class="sect1">
1.1       dsieger  6193: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6194: <a name="build.running"></a>19.4. Running a phase</h2></div></div></div>
1.10      hubertf  6195: <p>You can run a particular phase by typing <span class="command"><strong>make
1.1       dsieger  6196:     phase</strong></span>, where <span class="emphasis"><em>phase</em></span> is the name of the
                   6197:     phase. This will automatically run all phases that are required for this
                   6198:     phase. The default phase is <code class="varname">build</code>, that is, when you
1.10      hubertf  6199:     run <span class="command"><strong>make</strong></span> without parameters in a package directory,
1.1       dsieger  6200:     the package will be built, but not installed.</p>
                   6201: </div>
1.41      asau     6202: <div class="sect1">
1.1       dsieger  6203: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6204: <a name="build.fetch"></a>19.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.1       dsieger  6205: <p>The first step in building a package is to fetch the
                   6206:     distribution files (distfiles) from the sites that are providing
                   6207:     them. This is the task of the <span class="emphasis"><em>fetch</em></span>
                   6208:     phase.</p>
1.41      asau     6209: <div class="sect2">
1.1       dsieger  6210: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   6211: <a name="build.fetch.what"></a>19.5.1. What to fetch and where to get it from</h3></div></div></div>
1.1       dsieger  6212: <p>In simple cases, <code class="varname">MASTER_SITES</code>
                   6213:       defines all URLs from where the distfile, whose name is
                   6214:       derived from the <code class="varname">DISTNAME</code> variable, is
                   6215:       fetched. The more complicated cases are described
                   6216:       below.</p>
                   6217: <p>The variable <code class="varname">DISTFILES</code> specifies
                   6218:       the list of distfiles that have to be fetched. Its value
1.66      asau     6219:       defaults to <code class="literal">${DEFAULT_DISTFILES}</code> and
                   6220:       its value is <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>,
1.1       dsieger  6221:       so that most packages don't need to define it at all.
                   6222:       <code class="varname">EXTRACT_SUFX</code> is
                   6223:       <code class="literal">.tar.gz</code> by default, but can be changed
                   6224:       freely. Note that if your package requires additional
                   6225:       distfiles to the default one, you cannot just append the
                   6226:       additional filenames using the <code class="literal">+=</code>
                   6227:       operator, but you have write for example:</p>
                   6228: <pre class="programlisting">
1.66      asau     6229: DISTFILES=      ${DEFAULT_DISTFILES} additional-files.tar.gz
1.1       dsieger  6230: </pre>
                   6231: <p>Each distfile is fetched from a list of sites, usually
                   6232:       <code class="varname">MASTER_SITES</code>. If the package has multiple
                   6233:       <code class="varname">DISTFILES</code> or multiple
                   6234:       <code class="varname">PATCHFILES</code> from different sites, you can
                   6235:       set
                   6236:       <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code>
                   6237:       to the list of URLs where the file
                   6238:       <code class="filename"><em class="replaceable"><code>distfile</code></em></code>
                   6239:       (including the suffix) can be found.</p>
                   6240: <pre class="programlisting">
                   6241: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   6242: DISTFILES+=     foo-file.tar.gz
                   6243: SITES.foo-file.tar.gz= \
1.174     leot     6244: https://www.somewhere.com/somehow/ \
                   6245: https://www.somewhereelse.com/mirror/somehow/
1.1       dsieger  6246: </pre>
                   6247: <p>When actually fetching the distfiles, each item from
                   6248:       <code class="varname">MASTER_SITES</code> or
                   6249:       <code class="varname">SITES.*</code> gets the name of each distfile
                   6250:       appended to it, without an intermediate slash. Therefore,
                   6251:       all site values have to end with a slash or other separator
                   6252:       character. This allows for example to set
                   6253:       <code class="varname">MASTER_SITES</code> to a URL of a CGI script
                   6254:       that gets the name of the distfile as a parameter. In this
                   6255:       case, the definition would look like:</p>
                   6256: <pre class="programlisting">
1.174     leot     6257: MASTER_SITES=   https://www.example.com/download.cgi?file=
1.1       dsieger  6258: </pre>
1.22      jakllsch 6259: <p> The exception to this rule are URLs starting with a dash.
1.66      asau     6260:       In that case the URL is taken as is, fetched and the result
                   6261:       stored under the name of the distfile. You can use this style
                   6262:       for the case when the download URL style does not match the
                   6263:       above common case. For example, if permanent download URL is a
                   6264:       redirector to the real download URL, or the download file name
                   6265:       is offered by an HTTP Content-Disposition header. In the
                   6266:       following example, <code class="filename">foo-1.0.0.tar.gz</code> will be
                   6267:       created instead of the default
                   6268:       <code class="filename">v1.0.0.tar.gz</code>.</p>
                   6269: <pre class="programlisting">
                   6270: DISTNAME=       foo-1.0.0
1.174     leot     6271: MASTER_SITES=   -https://www.example.com/archive/v1.0.0.tar.gz
1.66      asau     6272: </pre>
1.1       dsieger  6273: <p>There are some predefined values for
                   6274:       <code class="varname">MASTER_SITES</code>, which can be used in
                   6275:       packages.  The names of the variables should speak for
                   6276:       themselves.</p>
1.156     leot     6277: <table border="0" summary="Simple list" class="simplelist">
                   6278: <tr>
                   6279: <td>MASTER_SITE_APACHE</td>
                   6280: <td>MASTER_SITE_BACKUP</td>
                   6281: </tr>
                   6282: <tr>
                   6283: <td>MASTER_SITE_CRATESIO</td>
                   6284: <td>MASTER_SITE_CYGWIN</td>
                   6285: </tr>
                   6286: <tr>
                   6287: <td>MASTER_SITE_DEBIAN</td>
                   6288: <td>MASTER_SITE_FREEBSD</td>
                   6289: </tr>
                   6290: <tr>
                   6291: <td>MASTER_SITE_FREEBSD_LOCAL</td>
                   6292: <td>MASTER_SITE_GENTOO</td>
                   6293: </tr>
                   6294: <tr>
                   6295: <td>MASTER_SITE_GITHUB</td>
                   6296: <td>MASTER_SITE_GNOME</td>
                   6297: </tr>
                   6298: <tr>
                   6299: <td>MASTER_SITE_GNU</td>
                   6300: <td>MASTER_SITE_GNUSTEP</td>
                   6301: </tr>
                   6302: <tr>
                   6303: <td>MASTER_SITE_HASKELL_HACKAGE</td>
                   6304: <td>MASTER_SITE_IFARCHIVE</td>
                   6305: </tr>
                   6306: <tr>
                   6307: <td>MASTER_SITE_KDE</td>
                   6308: <td>MASTER_SITE_MOZILLA</td>
                   6309: </tr>
                   6310: <tr>
                   6311: <td>MASTER_SITE_MOZILLA_ALL</td>
                   6312: <td>MASTER_SITE_MYSQL</td>
                   6313: </tr>
                   6314: <tr>
                   6315: <td>MASTER_SITE_NETLIB</td>
                   6316: <td>MASTER_SITE_OPENBSD</td>
                   6317: </tr>
                   6318: <tr>
                   6319: <td>MASTER_SITE_OPENOFFICE</td>
                   6320: <td>MASTER_SITE_OSDN</td>
                   6321: </tr>
                   6322: <tr>
                   6323: <td>MASTER_SITE_PERL_CPAN</td>
                   6324: <td>MASTER_SITE_PGSQL</td>
                   6325: </tr>
                   6326: <tr>
                   6327: <td>MASTER_SITE_PYPI</td>
                   6328: <td>MASTER_SITE_RUBYGEMS</td>
                   6329: </tr>
                   6330: <tr>
                   6331: <td>MASTER_SITE_R_CRAN</td>
                   6332: <td>MASTER_SITE_SOURCEFORGE</td>
                   6333: </tr>
                   6334: <tr>
                   6335: <td>MASTER_SITE_SUNSITE</td>
                   6336: <td>MASTER_SITE_SUSE</td>
                   6337: </tr>
                   6338: <tr>
                   6339: <td>MASTER_SITE_TEX_CTAN</td>
                   6340: <td>MASTER_SITE_XCONTRIB</td>
                   6341: </tr>
                   6342: <tr>
                   6343: <td>MASTER_SITE_XEMACS</td>
                   6344: <td>MASTER_SITE_XORG</td>
                   6345: </tr>
                   6346: </table>
1.1       dsieger  6347: <p>Some explanations for the less self-explaining ones:
                   6348:       <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites
1.26      wiz      6349:       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
1.25      spz      6350:       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>
1.1       dsieger  6351: <p>If you choose one of these predefined sites, you may
                   6352:       want to specify a subdirectory of that site. Since these
                   6353:       macros may expand to more than one actual site, you
                   6354:       <span class="emphasis"><em>must</em></span> use the following construct to
                   6355:       specify a subdirectory:</p>
                   6356: <pre class="programlisting">
                   6357: MASTER_SITES=   ${MASTER_SITE_GNU:=subdirectory/name/}
                   6358: MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE:=project_name/}
                   6359: </pre>
                   6360: <p>Note the trailing slash after the subdirectory
                   6361:       name.</p>
                   6362: </div>
1.41      asau     6363: <div class="sect2">
1.1       dsieger  6364: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   6365: <a name="build.fetch.how"></a>19.5.2. How are the files fetched?</h3></div></div></div>
1.1       dsieger  6366: <p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that
                   6367:       all the distfiles exist in a local directory
                   6368:       (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc
                   6369:       user). If the files do not exist, they are fetched using
                   6370:       commands of the form</p>
                   6371: <pre class="programlisting">
                   6372: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   6373: </pre>
                   6374: <p>where <code class="literal">${site}</code> varies through
                   6375:       several possibilities in turn: first,
                   6376:       <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   6377:       sites specified in either <code class="varname">SITES.file</code> if
                   6378:       defined, else <code class="varname">MASTER_SITES</code> or
                   6379:       <code class="varname">PATCH_SITES</code>, as applies, then finally the
                   6380:       value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of
                   6381:       all except the first and the last can be optionally sorted
                   6382:       by the user, via setting either
                   6383:       <code class="varname">MASTER_SORT_RANDOM</code>, and
                   6384:       <code class="varname">MASTER_SORT_AWK</code> or
                   6385:       <code class="varname">MASTER_SORT_REGEX</code>.</p>
1.16      jnemeth  6386: <p> The specific command and arguments used depend on the
                   6387:       <code class="varname">FETCH_USING</code> parameter. The example above is
                   6388:       for <code class="literal">FETCH_USING=custom</code>.</p>
1.1       dsieger  6389: <p>The distfiles mirror run by the NetBSD Foundation uses the
                   6390:       <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the
                   6391:       distfiles, if they are freely distributable.  Packages setting
                   6392:       <code class="varname">NO_SRC_ON_FTP</code> (usually to
1.23      wiz      6393:       <span class="quote">&#8220;<span class="quote">${RESTRICTED}</span>&#8221;</span>) will not have their distfiles
1.1       dsieger  6394:       mirrored.</p>
                   6395: </div>
                   6396: </div>
1.41      asau     6397: <div class="sect1">
1.1       dsieger  6398: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6399: <a name="build.checksum"></a>19.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div>
1.1       dsieger  6400: <p>After the distfile(s) are fetched, their checksum is
                   6401:     generated and compared with the checksums stored in the
                   6402:     distinfo file. If the checksums don't match, the build is
                   6403:     aborted. This is to ensure the same distfile is used for
                   6404:     building, and that the distfile wasn't changed, e.g. by some
                   6405:     malign force, deliberately changed distfiles on the master
                   6406:     distribution site or network lossage.</p>
                   6407: </div>
1.41      asau     6408: <div class="sect1">
1.1       dsieger  6409: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6410: <a name="build.extract"></a>19.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div>
1.1       dsieger  6411: <p>When the distfiles are present on the local system, they
                   6412:     need to be extracted, as they usually come in the form of some
                   6413:     compressed archive format.</p>
                   6414: <p>By default, all <code class="varname">DISTFILES</code> are
                   6415:     extracted. If you only need some of them, you can set the
                   6416:     <code class="varname">EXTRACT_ONLY</code> variable to the list of those
                   6417:     files.</p>
                   6418: <p>Extracting the files is usually done by a little
                   6419:     program, <code class="filename">mk/extract/extract</code>, which
                   6420:     already knows how to extract various archive formats, so most
                   6421:     likely you will not need to change anything here. But if you
                   6422:     need, the following variables may help you:</p>
1.41      asau     6423: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6424: <dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
                   6425: <dd><p>Use these variables to override the default
                   6426:       options for an extract command, which are defined in
                   6427:       <code class="filename">mk/extract/extract</code>.</p></dd>
                   6428: <dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt>
                   6429: <dd><p>This variable can be set to
1.14      jmcneill 6430:       <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code>
                   6431:       (which is the default value), <code class="literal">pax</code>, or an
1.1       dsieger  6432:       absolute pathname pointing to the command with which tar
1.14      jmcneill 6433:       archives should be extracted.  It is preferred to choose bsdtar over gtar
                   6434:       if NetBSD's pax-as-tar is not good enough.</p></dd>
1.1       dsieger  6435: </dl></div>
                   6436: <p>If the <code class="filename">extract</code> program doesn't
                   6437:     serve your needs, you can also override the
                   6438:     <code class="varname">EXTRACT_CMD</code> variable, which holds the
                   6439:     command used for extracting the files. This command is
                   6440:     executed in the <code class="filename">${WRKSRC}</code>
                   6441:     directory. During execution of this command, the shell
                   6442:     variable <code class="varname">extract_file</code> holds the absolute
                   6443:     pathname of the file that is going to be extracted.</p>
                   6444: <p>And if that still does not suffice, you can override the
                   6445:     <code class="varname">do-extract</code> target in the package
                   6446:     Makefile.</p>
                   6447: </div>
1.41      asau     6448: <div class="sect1">
1.1       dsieger  6449: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6450: <a name="build.patch"></a>19.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
1.1       dsieger  6451: <p>After extraction, all the patches named by the
                   6452:     <code class="varname">PATCHFILES</code>, those present in the patches
                   6453:     subdirectory of the package as well as in
                   6454:     $LOCALPATCHES/$PKGPATH (e.g.
                   6455:     <code class="filename">/usr/local/patches/graphics/png</code>) are
                   6456:     applied.  Patchfiles ending in <code class="filename">.Z</code> or
                   6457:     <code class="filename">.gz</code> are uncompressed before they are
                   6458:     applied, files ending in <code class="filename">.orig</code> or
                   6459:     <code class="filename">.rej</code> are ignored. Any special options to
1.174     leot     6460:     <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> can be handed in
1.154     rillig   6461:     <code class="varname">PATCH_DIST_ARGS</code>.  See <a class="xref" href="#components.patches" title="13.3. patches/*">Section 13.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more details.</p>
1.180     rillig   6462: <p>By default <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?patch+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> is given special arguments to make it
                   6463:     fail if the expected text from the patch context is not found in the
                   6464:     patched file. If that happens, fix the patch file by comparing it
                   6465:     with the actual text in the file to be patched.</p>
1.1       dsieger  6466: </div>
1.41      asau     6467: <div class="sect1">
1.1       dsieger  6468: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6469: <a name="build.tools"></a>19.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
                   6470: <p>This is covered in <a class="xref" href="#tools" title="Chapter 20. Tools needed for building or running">Chapter 20, <i>Tools needed for building or running</i></a>.
1.1       dsieger  6471:     </p>
                   6472: </div>
1.41      asau     6473: <div class="sect1">
1.1       dsieger  6474: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6475: <a name="build.wrapper"></a>19.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div>
1.1       dsieger  6476: <p>This phase creates wrapper programs for the compilers and
                   6477:     linkers. The following variables can be used to tweak the
                   6478:     wrappers.</p>
1.41      asau     6479: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6480: <dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt>
                   6481: <dd><p>The command used to print progress
                   6482:       messages. Does nothing by default. Set to
                   6483:       <code class="literal">${ECHO}</code> to see the progress
                   6484:       messages.</p></dd>
                   6485: <dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt>
                   6486: <dd><p>This variable can be set to
                   6487:       <code class="literal">yes</code> (default) or <code class="literal">no</code>,
                   6488:       depending on whether you want additional information in the
                   6489:       wrapper log file.</p></dd>
                   6490: <dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt>
                   6491: <dd><p>This variable can be set to
                   6492:       <code class="literal">yes</code> or <code class="literal">no</code>, depending
                   6493:       on whether the wrapper should use its cache, which will
                   6494:       improve the speed. The default value is
                   6495:       <code class="literal">yes</code>, but is forced to
                   6496:       <code class="literal">no</code> if the platform does not support
                   6497:       it.</p></dd>
                   6498: <dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt>
                   6499: <dd><p>A list of reordering commands. A reordering
                   6500:       command has the form
                   6501:       <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>.
                   6502:       It ensures that that
                   6503:       <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs
                   6504:       before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>.
                   6505:       </p></dd>
                   6506: </dl></div>
                   6507: </div>
1.41      asau     6508: <div class="sect1">
1.1       dsieger  6509: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6510: <a name="build.configure"></a>19.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.1       dsieger  6511: <p>Most pieces of software need information on the header
                   6512:     files, system calls, and library routines which are available
                   6513:     on the platform they run on. The process of determining this
                   6514:     information is known as configuration, and is usually
                   6515:     automated. In most cases, a script is supplied with the
                   6516:     distfiles, and its invocation results in generation of header
                   6517:     files, Makefiles, etc.</p>
                   6518: <p>If the package contains a configure script, this can be
                   6519:     invoked by setting <code class="varname">HAS_CONFIGURE</code> to
1.23      wiz      6520:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. If the configure script is a GNU autoconf
1.1       dsieger  6521:     script, you should set <code class="varname">GNU_CONFIGURE</code> to
1.23      wiz      6522:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> instead. What happens in the
1.1       dsieger  6523:     <span class="emphasis"><em>configure</em></span> phase is roughly:</p>
                   6524: <pre class="programlisting">
                   6525: .for d in ${CONFIGURE_DIRS}
                   6526:         cd ${WRKSRC} \
                   6527:         &amp;&amp; cd ${d} \
                   6528:         &amp;&amp; env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
                   6529: .endfor
                   6530: </pre>
                   6531: <p><code class="varname">CONFIGURE_DIRS</code> (default:
1.23      wiz      6532:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to
1.1       dsieger  6533:     <code class="varname">WRKSRC</code>. In each of these directories, the
                   6534:     configure script is run with the environment
                   6535:     <code class="varname">CONFIGURE_ENV</code> and arguments
                   6536:     <code class="varname">CONFIGURE_ARGS</code>. The variables
                   6537:     <code class="varname">CONFIGURE_ENV</code>,
                   6538:     <code class="varname">CONFIGURE_SCRIPT</code> (default:
1.23      wiz      6539:     <span class="quote">&#8220;<span class="quote">./configure</span>&#8221;</span>) and
1.1       dsieger  6540:     <code class="varname">CONFIGURE_ARGS</code> may all be changed by the
                   6541:     package.</p>
1.37      wiz      6542: <p>If the program uses the Perl way of configuration (mainly Perl
                   6543:     modules, but not only), i.e. a file called
                   6544:     <code class="filename">Makefile.PL</code>, it should include
                   6545:     <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for
                   6546:     <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code>
                   6547:     variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p>
1.1       dsieger  6548: <p>If the program uses an <code class="filename">Imakefile</code>
                   6549:     for configuration, the appropriate steps can be invoked by
                   6550:     setting <code class="varname">USE_IMAKE</code> to
1.99      sevan    6551:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.  If you only need xmkmf, add it to <code class="varname">USE_TOOLS</code>.
                   6552:     You can add variables to xmkmf's environment by adding them to the
1.1       dsieger  6553:     <code class="varname">SCRIPTS_ENV</code> variable.</p>
1.11      rillig   6554: <p>If the program uses <code class="filename">cmake</code>
                   6555:     for configuration, the appropriate steps can be invoked by
1.23      wiz      6556:     setting <code class="varname">USE_CMAKE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.
1.11      rillig   6557:     You can add variables to cmake's environment by adding them to the
                   6558:     <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake
                   6559:     by adding them to the <code class="varname">CMAKE_ARGS</code> variable.
                   6560:     The top directory argument is given by the
                   6561:     <code class="varname">CMAKE_ARG_PATH</code> variable, that defaults to
1.23      wiz      6562:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p>
1.1       dsieger  6563: <p>If there is no configure step at all, set
1.23      wiz      6564:     <code class="varname">NO_CONFIGURE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p>
1.1       dsieger  6565: </div>
1.41      asau     6566: <div class="sect1">
1.1       dsieger  6567: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6568: <a name="build.build"></a>19.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.1       dsieger  6569: <p>For building a package, a rough equivalent of the
                   6570:     following code is executed.</p>
                   6571: <pre class="programlisting">
                   6572: .for d in ${BUILD_DIRS}
                   6573:         cd ${WRKSRC} \
                   6574:         &amp;&amp; cd ${d} \
                   6575:         &amp;&amp; env ${MAKE_ENV} \
                   6576:             ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \
                   6577:                 -f ${MAKE_FILE} \
                   6578:                 ${BUILD_TARGET}
                   6579: .endfor
                   6580: </pre>
                   6581: <p><code class="varname">BUILD_DIRS</code> (default:
1.23      wiz      6582:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to
1.1       dsieger  6583:     <code class="varname">WRKSRC</code>. In each of these directories,
                   6584:     <code class="varname">MAKE_PROGRAM</code> is run with the environment
                   6585:     <code class="varname">MAKE_ENV</code> and arguments
                   6586:     <code class="varname">BUILD_MAKE_FLAGS</code>. The variables
                   6587:     <code class="varname">MAKE_ENV</code>,
                   6588:     <code class="varname">BUILD_MAKE_FLAGS</code>,
                   6589:     <code class="varname">MAKE_FILE</code> and
                   6590:     <code class="varname">BUILD_TARGET</code> may all be changed by the
                   6591:     package.</p>
                   6592: <p>The default value of <code class="varname">MAKE_PROGRAM</code> is
1.23      wiz      6593:     <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> if <code class="varname">USE_TOOLS</code> contains
                   6594:     <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> otherwise. The
1.1       dsieger  6595:     default value of <code class="varname">MAKE_FILE</code> is
1.23      wiz      6596:     <span class="quote">&#8220;<span class="quote">Makefile</span>&#8221;</span>, and <code class="varname">BUILD_TARGET</code>
                   6597:     defaults to <span class="quote">&#8220;<span class="quote">all</span>&#8221;</span>.</p>
1.1       dsieger  6598: <p>If there is no build step at all, set
1.23      wiz      6599:     <code class="varname">NO_BUILD</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p>
1.1       dsieger  6600: </div>
1.41      asau     6601: <div class="sect1">
1.1       dsieger  6602: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6603: <a name="build.test"></a>19.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div>
1.1       dsieger  6604: <p>[TODO]</p>
                   6605: </div>
1.41      asau     6606: <div class="sect1">
1.1       dsieger  6607: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6608: <a name="build.install"></a>19.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.1       dsieger  6609: <p>Once the build stage has completed, the final step is to
                   6610:     install the software in public directories, so users can
                   6611:     access the programs and files.</p>
                   6612: <p>In the <span class="emphasis"><em>install</em></span> phase, a rough
                   6613:     equivalent of the following code is executed. Additionally,
                   6614:     before and after this code, much magic is performed to do
                   6615:     consistency checks, registering the package, and so on.</p>
                   6616: <pre class="programlisting">
                   6617: .for d in ${INSTALL_DIRS}
                   6618:         cd ${WRKSRC} \
                   6619:         &amp;&amp; cd ${d} \
                   6620:         &amp;&amp; env ${MAKE_ENV} \
                   6621:             ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \
                   6622:                 -f ${MAKE_FILE} \
                   6623:                 ${INSTALL_TARGET}
                   6624: .endfor
                   6625: </pre>
                   6626: <p>The variable's meanings are analogous to the ones in the
                   6627:     <span class="emphasis"><em>build</em></span> phase.
                   6628:     <code class="varname">INSTALL_DIRS</code> defaults to
                   6629:     <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code>
1.23      wiz      6630:     is <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> by default, plus
                   6631:     <span class="quote">&#8220;<span class="quote">install.man</span>&#8221;</span> if <code class="varname">USE_IMAKE</code> is
1.1       dsieger  6632:     defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not
                   6633:     defined.</p>
                   6634: <p>In the <span class="emphasis"><em>install</em></span> phase, the following
                   6635:     variables are useful. They are all variations of the
1.174     leot     6636:     <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?install+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> command that have the owner, group and
1.1       dsieger  6637:     permissions preset. <code class="varname">INSTALL</code> is the plain
                   6638:     install command. The specialized variants, together with their
                   6639:     intended use, are:</p>
1.41      asau     6640: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6641: <dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt>
                   6642: <dd><p>directories that contain
                   6643:       binaries</p></dd>
                   6644: <dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt>
                   6645: <dd><p>directories that contain
                   6646:       scripts</p></dd>
                   6647: <dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt>
                   6648: <dd><p>directories that contain shared and static
                   6649:       libraries</p></dd>
                   6650: <dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt>
                   6651: <dd><p>directories that contain data
                   6652:       files</p></dd>
                   6653: <dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt>
                   6654: <dd><p>directories that contain man
                   6655:       pages</p></dd>
1.100     leot     6656: <dt><span class="term"><code class="varname">INSTALL_GAME_DIR</code></span></dt>
                   6657: <dd><p>directories that contain data files for games
                   6658:       </p></dd>
1.1       dsieger  6659: <dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt>
                   6660: <dd><p>binaries that can be stripped from debugging
                   6661:       symbols</p></dd>
                   6662: <dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt>
                   6663: <dd><p>binaries that cannot be
                   6664:       stripped</p></dd>
                   6665: <dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt>
                   6666: <dd><p>game
                   6667:       binaries</p></dd>
                   6668: <dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt>
                   6669: <dd><p>shared and static
                   6670:       libraries</p></dd>
                   6671: <dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt>
                   6672: <dd><p>data files</p></dd>
                   6673: <dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt>
                   6674: <dd><p>data files for
                   6675:       games</p></dd>
                   6676: <dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt>
                   6677: <dd><p>man pages</p></dd>
                   6678: </dl></div>
                   6679: <p>Some other variables are:</p>
1.41      asau     6680: <div class="variablelist"><dl class="variablelist">
1.106     tnn      6681: <dt><span class="term"><code class="varname">INSTALL_UNSTRIPPED</code></span></dt>
1.174     leot     6682: <dd><p>If set to <code class="literal">yes</code>, do not run <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?strip+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">strip</span>(1)</span></a>
1.106     tnn      6683:       when installing binaries. Any debugging sections and symbols present in
                   6684:       binaries will be preserved.
                   6685:       </p></dd>
1.1       dsieger  6686: <dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt>
                   6687: <dd><p>A list of directories relative to
                   6688:       <code class="varname">PREFIX</code> that are created by pkgsrc at the
                   6689:       beginning of the <span class="emphasis"><em>install</em></span> phase.
                   6690:       The package is supposed to create all needed directories itself
                   6691:       before installing files to it and list all other directories here.
                   6692:       </p></dd>
                   6693: </dl></div>
                   6694: <p>In the rare cases that a package shouldn't install anything,
1.23      wiz      6695:     set <code class="varname">NO_INSTALL</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. This is
1.1       dsieger  6696:     mostly relevant for packages in the <code class="filename">regress</code>
                   6697:     category.</p>
                   6698: </div>
1.41      asau     6699: <div class="sect1">
1.1       dsieger  6700: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6701: <a name="build.package"></a>19.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div>
1.1       dsieger  6702: <p>Once the install stage has completed, a binary package of
                   6703:     the installed files can be built.  These binary packages can be
                   6704:     used for quick installation without previous compilation, e.g. by
1.10      hubertf  6705:     the <span class="command"><strong>make bin-install</strong></span> or by using
                   6706:     <span class="command"><strong>pkg_add</strong></span>.</p>
1.1       dsieger  6707: <p>By default, the binary packages are created in
                   6708:     <code class="filename">${PACKAGES}/All</code> and symlinks are created in
                   6709:     <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>,
                   6710:     one for each category in the <code class="varname">CATEGORIES</code>
                   6711:     variable.  <code class="varname">PACKAGES</code> defaults to
                   6712:     <code class="filename">pkgsrc/packages</code>.</p>
                   6713: </div>
1.41      asau     6714: <div class="sect1">
1.1       dsieger  6715: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6716: <a name="build.clean"></a>19.16. Cleaning up</h2></div></div></div>
1.1       dsieger  6717: <p>Once you're finished with a package, you can clean the work
1.10      hubertf  6718:     directory by running <span class="command"><strong>make clean</strong></span>.  If you want
1.1       dsieger  6719:     to clean the work directories of all dependencies too, use
1.10      hubertf  6720:     <span class="command"><strong>make clean-depends</strong></span>.</p>
1.1       dsieger  6721: </div>
1.41      asau     6722: <div class="sect1">
1.1       dsieger  6723: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   6724: <a name="build.helpful-targets"></a>19.17. Other helpful targets</h2></div></div></div>
1.41      asau     6725: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6726: <dt><span class="term">pre/post-*</span></dt>
                   6727: <dd><p>For any of the main targets described in the
                   6728:          previous section, two auxiliary targets exist with
1.23      wiz      6729:          <span class="quote">&#8220;<span class="quote">pre-</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">post-</span>&#8221;</span> used as a
1.1       dsieger  6730:          prefix for the main target's name.  These targets are
                   6731:          invoked before and after the main target is called,
                   6732:          allowing extra configuration or installation steps be
                   6733:          performed from a package's Makefile, for example, which
                   6734:          a program's configure script or install target
                   6735:          omitted.</p></dd>
                   6736: <dt><span class="term">do-*</span></dt>
                   6737: <dd><p>Should one of the main targets do the wrong thing,
                   6738:          and should there be no variable to fix this, you can
                   6739:          redefine it with the do-* target.  (Note that redefining
                   6740:          the target itself instead of the do-* target is a bad
                   6741:          idea, as the pre-* and post-* targets won't be called
                   6742:          anymore, etc.) You will not usually need to do
                   6743:          this.</p></dd>
                   6744: <dt><span class="term">reinstall</span></dt>
                   6745: <dd>
1.10      hubertf  6746: <p>If you did a <span class="command"><strong>make install</strong></span> and
1.1       dsieger  6747:          you noticed some file was not installed properly, you
                   6748:          can repeat the installation with this target, which will
1.23      wiz      6749:          ignore the <span class="quote">&#8220;<span class="quote">already installed</span>&#8221;</span> flag.</p>
1.1       dsieger  6750: <p>This is the default value of
                   6751:          <code class="varname">DEPENDS_TARGET</code> except in the case of
1.10      hubertf  6752:          <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make
1.1       dsieger  6753:          package</strong></span>, where the defaults are
1.23      wiz      6754:          <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span>,
1.1       dsieger  6755:          respectively.</p>
                   6756: </dd>
                   6757: <dt><span class="term">deinstall</span></dt>
                   6758: <dd>
1.174     leot     6759: <p>This target does a <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> in the
1.1       dsieger  6760:          current directory, effectively de-installing the
                   6761:          package. The following variables can be used to tune the
                   6762:          behaviour:</p>
1.41      asau     6763: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6764: <dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt>
1.174     leot     6765: <dd><p>Add a "-v" to the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> command.</p></dd>
1.1       dsieger  6766: <dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt>
                   6767: <dd><p>Remove all packages that require (depend on)
                   6768:                the given package.  This can be used to remove any
                   6769:                packages that may have been pulled in by a given
1.10      hubertf  6770:                package, e.g. if <span class="command"><strong>make deinstall
1.1       dsieger  6771:                DEINSTALLDEPENDS=1</strong></span> is done in
                   6772:                <code class="filename">pkgsrc/x11/kde</code>, this is
                   6773:                likely to remove whole KDE. Works by adding
1.174     leot     6774:                <span class="quote">&#8220;<span class="quote">-R</span>&#8221;</span> to the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
1.1       dsieger  6775:                command line.</p></dd>
                   6776: </dl></div>
                   6777: </dd>
                   6778: <dt><span class="term">bin-install</span></dt>
                   6779: <dd><p>Install a binary package from local disk and via FTP
                   6780:          from a list of sites (see the
                   6781:          <code class="varname">BINPKG_SITES</code> variable), and do a
1.10      hubertf  6782:          <span class="command"><strong>make package</strong></span> if no binary package is
1.1       dsieger  6783:          available anywhere.  The arguments given to
1.10      hubertf  6784:          <span class="command"><strong>pkg_add</strong></span> can be set via
1.1       dsieger  6785:          <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose
                   6786:          operation, etc.</p></dd>
1.95      wiz      6787: <dt><span class="term">install-clean</span></dt>
                   6788: <dd><p>This target removes the state files for the "install" and later
                   6789:          phases so that the "install" target may be re-invoked. This can be
                   6790:          used after editing the PLIST to install the package without
                   6791:          rebuilding it.</p></dd>
                   6792: <dt><span class="term">build-clean</span></dt>
                   6793: <dd><p>This target removes the state files for the "build" and later
                   6794:          phases so that the "build" target may be re-invoked.</p></dd>
1.1       dsieger  6795: <dt><span class="term">update</span></dt>
                   6796: <dd>
                   6797: <p>This target causes the current package to be
                   6798:          updated to the latest version.  The package and all
                   6799:          depending packages first get de-installed, then current
                   6800:          versions of the corresponding packages get compiled and
                   6801:          installed.  This is similar to manually noting which
                   6802:          packages are currently installed, then performing a
1.10      hubertf  6803:          series of <span class="command"><strong>make deinstall</strong></span> and
                   6804:          <span class="command"><strong>make install</strong></span> (or whatever
1.1       dsieger  6805:          <code class="varname">UPDATE_TARGET</code> is set to) for these
                   6806:          packages.</p>
1.23      wiz      6807: <p>You can use the <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> target to
1.10      hubertf  6808:          resume package updating in case a previous <span class="command"><strong>make
1.1       dsieger  6809:          update</strong></span> was interrupted for some reason.
                   6810:          However, in this case, make sure you don't call
1.10      hubertf  6811:          <span class="command"><strong>make clean</strong></span> or otherwise remove the
1.1       dsieger  6812:          list of dependent packages in <code class="varname">WRKDIR</code>.
                   6813:          Otherwise, you lose the ability to automatically update
                   6814:          the current package along with the dependent packages
                   6815:          you have installed.</p>
1.10      hubertf  6816: <p>Resuming an interrupted <span class="command"><strong>make
1.1       dsieger  6817:          update</strong></span> will only work as long as the package
                   6818:          tree remains unchanged.  If the source code for one of
                   6819:          the packages to be updated has been changed, resuming
1.10      hubertf  6820:          <span class="command"><strong>make update</strong></span> will most certainly
1.1       dsieger  6821:          fail!</p>
                   6822: <p>The following variables can be used either on the
1.10      hubertf  6823:          command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
                   6824:          alter the behaviour of <span class="command"><strong>make
1.1       dsieger  6825:          update</strong></span>:</p>
1.41      asau     6826: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6827: <dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt>
                   6828: <dd><p>Install target to recursively use for the
                   6829:                updated package and the dependent packages.
                   6830:                Defaults to <code class="varname">DEPENDS_TARGET</code> if
1.23      wiz      6831:                set, <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> otherwise for
1.10      hubertf  6832:                <span class="command"><strong>make update</strong></span>.  Other good
1.23      wiz      6833:                targets are <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> or
                   6834:                <span class="quote">&#8220;<span class="quote">bin-install</span>&#8221;</span>.  Do not set this to
                   6835:                <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> or you will get stuck in an
1.1       dsieger  6836:                endless loop!</p></dd>
                   6837: <dt><span class="term"><code class="varname">NOCLEAN</code></span></dt>
                   6838: <dd><p>Don't clean up after updating.  Useful if
                   6839:                you want to leave the work sources of the updated
                   6840:                packages around for inspection or other purposes.
                   6841:                Be sure you eventually clean up the source tree
1.23      wiz      6842:                (see the <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target below)
1.1       dsieger  6843:                or you may run into troubles with old source code
                   6844:                still lying around on your next
1.10      hubertf  6845:                <span class="command"><strong>make</strong></span> or <span class="command"><strong>make
1.1       dsieger  6846:                update</strong></span>.</p></dd>
                   6847: <dt><span class="term"><code class="varname">REINSTALL</code></span></dt>
                   6848: <dd><p>Deinstall each package before installing
                   6849:                (making <code class="varname">DEPENDS_TARGET</code>). This
                   6850:                may be necessary if the
1.23      wiz      6851:                <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target (see below) was
1.10      hubertf  6852:                called after interrupting a running <span class="command"><strong>make
1.1       dsieger  6853:                update</strong></span>.</p></dd>
                   6854: <dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt>
                   6855: <dd><p>Allows you to disable recursion and hardcode
                   6856:                the target for packages.  The default is
1.23      wiz      6857:                <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for the update target,
1.1       dsieger  6858:                facilitating a recursive update of prerequisite
                   6859:                packages.  Only set
                   6860:                <code class="varname">DEPENDS_TARGET</code> if you want to
                   6861:                disable recursive updates. Use
                   6862:                <code class="varname">UPDATE_TARGET</code> instead to just
                   6863:                set a specific target for each package to be
1.10      hubertf  6864:                installed during <span class="command"><strong>make update</strong></span>
1.1       dsieger  6865:                (see above).</p></dd>
                   6866: </dl></div>
                   6867: </dd>
                   6868: <dt><span class="term">clean-update</span></dt>
                   6869: <dd>
                   6870: <p>Clean the source tree for all packages that would
1.10      hubertf  6871:          get updated if <span class="command"><strong>make update</strong></span> was called
1.1       dsieger  6872:          from the current directory.  This target should not be
                   6873:          used if the current package (or any of its depending
                   6874:          packages) have already been de-installed (e.g., after
1.10      hubertf  6875:          calling <span class="command"><strong>make update</strong></span>) or you may lose
1.1       dsieger  6876:          some packages you intended to update. As a rule of
                   6877:          thumb: only use this target <span class="emphasis"><em>before</em></span>
1.10      hubertf  6878:          the first time you run <span class="command"><strong>make update</strong></span>
1.1       dsieger  6879:          and only if you have a dirty package tree (e.g., if you
                   6880:          used <code class="varname">NOCLEAN</code>).</p>
                   6881: <p>If you are unsure about whether your tree is
1.10      hubertf  6882:          clean, you can either perform a <span class="command"><strong>make
1.1       dsieger  6883:          clean</strong></span> at the top of the tree, or use the
                   6884:          following sequence of commands from the directory of the
                   6885:          package you want to update (<span class="emphasis"><em>before</em></span>
1.10      hubertf  6886:          running <span class="command"><strong>make update</strong></span> for the first
1.1       dsieger  6887:          time, otherwise you lose all the packages you wanted to
                   6888:          update!):</p>
                   6889: <pre class="screen">
                   6890: <code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong>
                   6891: <code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   6892: <code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong>
                   6893:          </pre>
                   6894: <p>The following variables can be used either on the
1.10      hubertf  6895:          command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of
                   6896:          <span class="command"><strong>make clean-update</strong></span>:</p>
1.41      asau     6897: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  6898: <dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt>
1.10      hubertf  6899: <dd><p>After <span class="command"><strong>make clean</strong></span>, do not
1.1       dsieger  6900:                reconstruct the list of directories to update for
1.10      hubertf  6901:                this package.  Only use this if <span class="command"><strong>make
1.1       dsieger  6902:                update</strong></span> successfully installed all
                   6903:                packages you wanted to update.  Normally, this is
1.10      hubertf  6904:                done automatically on <span class="command"><strong>make
1.1       dsieger  6905:                update</strong></span>, but may have been suppressed by
                   6906:                the <code class="varname">NOCLEAN</code> variable (see
                   6907:                above).</p></dd>
                   6908: </dl></div>
                   6909: </dd>
                   6910: <dt><span class="term">replace</span></dt>
                   6911: <dd>
                   6912: <p>Update the installation of the current package.  This
                   6913:          differs from update in that it does not replace dependent
1.137     leot     6914:          packages.  You will need to install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/README.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a> for this
1.1       dsieger  6915:          target to work.</p>
                   6916: <p><span class="emphasis"><em>Be careful when using this
                   6917:          target!</em></span> There are no guarantees that dependent
                   6918:          packages will still work, in particular they will most
1.10      hubertf  6919:          certainly break if you <span class="command"><strong>make replace</strong></span> a
1.1       dsieger  6920:          library package whose shared library major version changed
                   6921:          between your installed version and the new one.  For this
                   6922:          reason, this target is not officially supported and only
                   6923:          recommended for advanced users.</p>
                   6924: </dd>
                   6925: <dt><span class="term">info</span></dt>
1.174     leot     6926: <dd><p>This target invokes <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a> for the current
1.1       dsieger  6927:          package. You can use this to check which version of a
                   6928:          package is installed.</p></dd>
                   6929: <dt><span class="term">index</span></dt>
                   6930: <dd>
                   6931: <p>This is a top-level command, i.e. it should be used in
                   6932:          the <code class="filename">pkgsrc</code> directory.  It creates a
                   6933:          database of all packages in the local pkgsrc tree, including
                   6934:          dependencies, comment, maintainer, and some other useful
                   6935:          information.  Individual entries are created by running
1.10      hubertf  6936:          <span class="command"><strong>make describe</strong></span> in the packages'
1.1       dsieger  6937:          directories.  This index file is saved as
                   6938:          <code class="filename">pkgsrc/INDEX</code>.  It can be displayed in
1.10      hubertf  6939:          verbose format by running <span class="command"><strong>make
1.1       dsieger  6940:          print-index</strong></span>.  You can search in it with
1.10      hubertf  6941:          <span class="command"><strong>make search
1.1       dsieger  6942:          key=<em class="replaceable"><code>something</code></em></strong></span>.  You can
                   6943:          extract a list of all packages that depend on a particular
1.10      hubertf  6944:          one by running <span class="command"><strong>make show-deps
1.1       dsieger  6945:          PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p>
                   6946: <p>Running this command takes a very long time, some
                   6947:          hours even on fast machines!</p>
                   6948: </dd>
                   6949: <dt><span class="term">readme</span></dt>
                   6950: <dd>
                   6951: <p>This target generates a
                   6952:          <code class="filename">README.html</code> file, which can be
1.137     leot     6953:          viewed using a browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/README.html" target="_top"><code class="filename">www/firefox</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/links/README.html" target="_top"><code class="filename">www/links</code></a>.  The generated files
1.1       dsieger  6954:          contain references to any packages which are in the
                   6955:          <code class="varname">PACKAGES</code> directory on the local
                   6956:          host. The generated files can be made to refer to URLs
                   6957:          based on <code class="varname">FTP_PKG_URL_HOST</code> and
                   6958:          <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I
                   6959:          wanted to generate <code class="filename">README.html</code>
                   6960:          files which pointed to binary packages on the local
                   6961:          machine, in the directory
                   6962:          <code class="filename">/usr/packages</code>, set
                   6963:          <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and
                   6964:          <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   6965:          <code class="varname">${PACKAGES}</code> directory and its
                   6966:          subdirectories will be searched for all the binary
                   6967:          packages.</p>
                   6968: <p>The target can be run at the toplevel or in category
                   6969:          directories, in which case it descends recursively.</p>
                   6970: </dd>
                   6971: <dt><span class="term">readme-all</span></dt>
                   6972: <dd><p>This is a top-level command, run it in
                   6973:          <code class="filename">pkgsrc</code>.  Use this target to create a
                   6974:          file <code class="filename">README-all.html</code> which contains a
                   6975:          list of all packages currently available in the NetBSD
                   6976:          Packages Collection, together with the category they belong
                   6977:          to and a short description. This file is compiled from the
                   6978:          <code class="filename">pkgsrc/*/README.html</code> files, so be sure
1.10      hubertf  6979:          to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make
1.1       dsieger  6980:          readme</strong></span>.</p></dd>
                   6981: <dt><span class="term">cdrom-readme</span></dt>
                   6982: <dd><p>This is very much the same as the
1.23      wiz      6983:          <span class="quote">&#8220;<span class="quote">readme</span>&#8221;</span> target (see above), but is to be
1.1       dsieger  6984:          used when generating a pkgsrc tree to be written to a
                   6985:          CD-ROM.  This target also produces
                   6986:          <code class="filename">README.html</code> files, and can be made
                   6987:          to refer to URLs based on
                   6988:          <code class="varname">CDROM_PKG_URL_HOST</code> and
                   6989:          <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd>
                   6990: <dt><span class="term">show-distfiles</span></dt>
                   6991: <dd><p>This target shows which distfiles and patchfiles
                   6992:          are needed to build the package
                   6993:          (<code class="varname">ALLFILES</code>, which contains all
                   6994:          <code class="varname">DISTFILES</code> and
                   6995:          <code class="varname">PATCHFILES</code>, but not
                   6996:          <code class="filename">patches/*</code>).</p></dd>
                   6997: <dt><span class="term">show-downlevel</span></dt>
                   6998: <dd><p>This target shows nothing if the package is not
                   6999:          installed. If a version of this package is installed,
                   7000:          but is not the version provided in this version of
                   7001:          pkgsrc, then a warning message is displayed. This target
                   7002:          can be used to show which of your installed packages are
                   7003:          downlevel, and so the old versions can be deleted, and
                   7004:          the current ones added.</p></dd>
                   7005: <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7006: <dd><p>This target shows the directory in the pkgsrc
                   7007:          hierarchy from which the package can be built and
                   7008:          installed. This may not be the same directory as the one
                   7009:          from which the package was installed. This target is
                   7010:          intended to be used by people who may wish to upgrade
                   7011:          many packages on a single host, and can be invoked from
                   7012:          the top-level pkgsrc Makefile by using the
1.23      wiz      7013:          <span class="quote">&#8220;<span class="quote">show-host-specific-pkgs</span>&#8221;</span> target.</p></dd>
1.1       dsieger  7014: <dt><span class="term">show-installed-depends</span></dt>
                   7015: <dd><p>This target shows which installed packages match
                   7016:          the current package's <code class="varname">DEPENDS</code>. Useful
                   7017:          if out of date dependencies are causing build
                   7018:          problems.</p></dd>
1.95      wiz      7019: <dt><span class="term">print-build-depends-list</span></dt>
                   7020: <dd><p>This target shows the list of packages that the current package
                   7021:            depends on for building.</p></dd>
                   7022: <dt><span class="term">print-run-depends-list</span></dt>
                   7023: <dd><p>This target shows the list of packages that the current package
                   7024:            depends on for running.</p></dd>
1.1       dsieger  7025: <dt><span class="term">check-shlibs</span></dt>
                   7026: <dd><p>After a package is installed, check all its
                   7027:          binaries and (on ELF platforms) shared libraries to see
                   7028:          if they find the shared libs they need.  Run by default
1.10      hubertf  7029:          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>
1.1       dsieger  7030: <dt><span class="term">print-PLIST</span></dt>
                   7031: <dd>
1.23      wiz      7032: <p>After a <span class="quote">&#8220;<span class="quote">make install</span>&#8221;</span> from a new or
1.1       dsieger  7033:          upgraded pkg, this prints out an attempt to generate a
1.10      hubertf  7034:          new <code class="filename">PLIST</code> from a <span class="command"><strong>find
1.1       dsieger  7035:          -newer work/.extract_done</strong></span>.  An attempt is made
                   7036:          to care for shared libs etc., but it is
                   7037:          <span class="emphasis"><em>strongly</em></span> recommended to review the
                   7038:          result before putting it into
                   7039:          <code class="filename">PLIST</code>. On upgrades, it's useful to
                   7040:          diff the output of this command against an already
                   7041:          existing <code class="filename">PLIST</code> file.</p>
1.174     leot     7042: <p>If the package installs files via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or
1.1       dsieger  7043:          other methods that don't update file access times, be
                   7044:          sure to add these files manually to your
1.23      wiz      7045:          <code class="filename">PLIST</code>, as the <span class="quote">&#8220;<span class="quote">find
                   7046:          -newer</span>&#8221;</span> command used by this target won't catch
1.1       dsieger  7047:          them!</p>
1.154     rillig   7048: <p>See <a class="xref" href="#print-PLIST" title="15.3. Tweaking output of make print-PLIST">Section 15.3, &#8220;Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>&#8221;</a> for more
1.1       dsieger  7049:          information on this target.</p>
                   7050: </dd>
                   7051: </dl></div>
                   7052: </div>
                   7053: </div>
1.41      asau     7054: <div class="chapter">
1.1       dsieger  7055: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   7056: <a name="tools"></a>Chapter 20. Tools needed for building or running</h2></div></div></div>
1.1       dsieger  7057: <div class="toc">
                   7058: <p><b>Table of Contents</b></p>
1.100     leot     7059: <dl class="toc">
1.154     rillig   7060: <dt><span class="sect1"><a href="#pkgsrc-tools">20.1. Tools for pkgsrc builds</a></span></dt>
                   7061: <dt><span class="sect1"><a href="#package-tools">20.2. Tools needed by packages</a></span></dt>
                   7062: <dt><span class="sect1"><a href="#platform-tools">20.3. Tools provided by platforms</a></span></dt>
1.1       dsieger  7063: </dl>
                   7064: </div>
                   7065: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
                   7066: by pkgsrc and also for individual packages to define what commands
1.156     leot     7067: are needed for building a package (like <code class="varname">TOOL_DEPENDS</code>)
1.1       dsieger  7068: or for later run-time of an installed packaged (such as
                   7069: <code class="varname">DEPENDS</code>).
                   7070: If the native system provides an adequate tool, then in many cases, a pkgsrc
                   7071: package will not be used.</p>
                   7072: <p>When building a package, the replacement tools are
                   7073: made available in a directory (as symlinks or wrapper scripts)
                   7074: that is early in the executable search path. Just like the buildlink
                   7075: system, this helps with consistent builds.</p>
                   7076: <p>A tool may be needed to help build a specific package. For example,
                   7077: perl, GNU make (gmake) or yacc may be needed.</p>
                   7078: <p>Also a tool may be needed, for example, because the native system's supplied
                   7079: tool may be inefficient for building a package with pkgsrc.
                   7080: For example, a package may need GNU awk, bison (instead of
                   7081: yacc) or a better sed.</p>
                   7082: <p>The tools used by a package can be listed by running
1.10      hubertf  7083: <span class="command"><strong>make show-tools</strong></span>.</p>
1.41      asau     7084: <div class="sect1">
1.1       dsieger  7085: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   7086: <a name="pkgsrc-tools"></a>20.1. Tools for pkgsrc builds</h2></div></div></div>
1.1       dsieger  7087: <p>The default set of tools used by pkgsrc is defined in
                   7088: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
1.10      hubertf  7089: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
                   7090: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
1.1       dsieger  7091: These can be seen by running:
1.10      hubertf  7092: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
1.1       dsieger  7093: <p>If a package needs a specific program to build
                   7094: then the <code class="varname">USE_TOOLS</code> variable can be used
                   7095: to define the tools needed.</p>
                   7096: </div>
1.41      asau     7097: <div class="sect1">
1.1       dsieger  7098: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   7099: <a name="package-tools"></a>20.2. Tools needed by packages</h2></div></div></div>
1.28      wiz      7100: <p>In the following examples, the :run means that it is needed at
                   7101: run-time (and becomes a DEPENDS).
1.1       dsieger  7102: The default is a build dependency which can be set with
                   7103: :build. (So in this example, it is the same as gmake:build
                   7104: and pkg-config:build.)</p>
                   7105: <pre class="programlisting">
                   7106: USE_TOOLS+=     gmake perl:run pkg-config
                   7107: </pre>
                   7108: <p>When using the tools framework, a
                   7109: <code class="varname">TOOLS_PATH.foo</code> variable is defined
                   7110: which contains the full path to the appropriate tool. For example,
1.23      wiz      7111: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">&#8220;<span class="quote">/bin/bash</span>&#8221;</span>
1.1       dsieger  7112: on Linux systems.</p>
                   7113: <p>If you always need a pkgsrc version of the
                   7114: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
                   7115: </p>
                   7116: </div>
1.41      asau     7117: <div class="sect1">
1.1       dsieger  7118: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   7119: <a name="platform-tools"></a>20.3. Tools provided by platforms</h2></div></div></div>
1.1       dsieger  7120: <p>When improving or porting pkgsrc to a new platform, have a look
                   7121: at (or create) the corresponding platform specific make file fragment under
                   7122: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
                   7123: the name of the common tools. For example:</p>
                   7124: <pre class="programlisting">
                   7125: .if exists(/usr/bin/bzcat)
                   7126: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzcat
                   7127: .elif exists(/usr/bin/bzip2)
                   7128: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzip2 -cd
                   7129: .endif
                   7130: 
                   7131: TOOLS_PLATFORM.true?=           true                    # shell builtin
                   7132: </pre>
                   7133: </div>
                   7134: </div>
1.41      asau     7135: <div class="chapter">
1.1       dsieger  7136: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   7137: <a name="fixes"></a>Chapter 21. Making your package work</h2></div></div></div>
1.1       dsieger  7138: <div class="toc">
                   7139: <p><b>Table of Contents</b></p>
1.100     leot     7140: <dl class="toc">
1.154     rillig   7141: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
1.1       dsieger  7142: <dd><dl>
1.154     rillig   7143: <dt><span class="sect2"><a href="#pulling-vars-from-etc-mk.conf">21.1.1. How to pull in user-settable variables from <code class="filename">mk.conf</code></a></span></dt>
                   7144: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
                   7145: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
                   7146: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
                   7147: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
                   7148: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
                   7149: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
                   7150: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
                   7151: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
                   7152: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
                   7153: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
                   7154: </dl></dd>
                   7155: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   7156: <dd><dl>
                   7157: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
                   7158: <dt><span class="sect2"><a href="#modified-distfiles-same-name">21.2.2. How to handle modified distfiles with the 'old' name</a></span></dt>
                   7159: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
                   7160: </dl></dd>
                   7161: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   7162: <dd><dl>
                   7163: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
                   7164: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
                   7165: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
                   7166: </dl></dd>
                   7167: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
                   7168: <dd><dl>
                   7169: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
                   7170: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
                   7171: <dt><span class="sect2"><a href="#perl-scripts">21.4.3. Packages containing perl scripts</a></span></dt>
                   7172: <dt><span class="sect2"><a href="#shell-scripts">21.4.4. Packages containing shell scripts</a></span></dt>
                   7173: <dt><span class="sect2"><a href="#other-programming-languages">21.4.5. Other programming languages</a></span></dt>
                   7174: </dl></dd>
                   7175: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   7176: <dd><dl>
                   7177: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
                   7178: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.172     rillig   7179: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
                   7180: <dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span></a></span></dt>
                   7181: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.154     rillig   7182: </dl></dd>
                   7183: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   7184: <dd><dl>
                   7185: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
                   7186: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
                   7187: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
                   7188: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
                   7189: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
                   7190: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing perl modules</a></span></dt>
                   7191: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
                   7192: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
                   7193: <dt><span class="sect2"><a href="#gconf-data-files">21.6.9. Packages installing GConf data files</a></span></dt>
                   7194: <dt><span class="sect2"><a href="#scrollkeeper-data-files">21.6.10. Packages installing scrollkeeper/rarian data files</a></span></dt>
                   7195: <dt><span class="sect2"><a href="#x11-fonts">21.6.11. Packages installing X11 fonts</a></span></dt>
                   7196: <dt><span class="sect2"><a href="#gtk2-modules">21.6.12. Packages installing GTK2 modules</a></span></dt>
                   7197: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.13. Packages installing SGML or XML data</a></span></dt>
                   7198: <dt><span class="sect2"><a href="#mime-database">21.6.14. Packages installing extensions to the MIME database</a></span></dt>
                   7199: <dt><span class="sect2"><a href="#intltool">21.6.15. Packages using intltool</a></span></dt>
                   7200: <dt><span class="sect2"><a href="#startup-scripts">21.6.16. Packages installing startup scripts</a></span></dt>
                   7201: <dt><span class="sect2"><a href="#tex-packages">21.6.17. Packages installing TeX modules</a></span></dt>
                   7202: <dt><span class="sect2"><a href="#emulation-packages">21.6.18. Packages supporting running binaries in
1.1       dsieger  7203:     emulation</a></span></dt>
1.154     rillig   7204: <dt><span class="sect2"><a href="#hicolor-theme">21.6.19. Packages installing hicolor theme icons</a></span></dt>
                   7205: <dt><span class="sect2"><a href="#desktop-files">21.6.20. Packages installing desktop files</a></span></dt>
1.1       dsieger  7206: </dl></dd>
1.154     rillig   7207: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.1       dsieger  7208: </dl>
                   7209: </div>
1.41      asau     7210: <div class="sect1">
1.1       dsieger  7211: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   7212: <a name="general-operation"></a>21.1. General operation</h2></div></div></div>
1.1       dsieger  7213: <p>One appealing feature of pkgsrc is that it runs on many
1.108     rillig   7214:   different platforms. As a result, it is important to ensure,
                   7215:   where possible, that packages in pkgsrc are portable. This
                   7216:   chapter mentions some particular details you should pay
                   7217:   attention to while working on pkgsrc.</p>
1.41      asau     7218: <div class="sect2">
1.1       dsieger  7219: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7220: <a name="pulling-vars-from-etc-mk.conf"></a>21.1.1. How to pull in user-settable variables from <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
1.1       dsieger  7221: </h3></div></div></div>
                   7222: <p>The pkgsrc user can configure pkgsrc by overriding several
                   7223:     variables in the file pointed to by <code class="varname">MAKECONF</code>,
1.10      hubertf  7224:     which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
1.1       dsieger  7225:     want to use those variables in the preprocessor directives of
1.174     leot     7226:     <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> (for example <code class="literal">.if</code> or
1.1       dsieger  7227:     <code class="literal">.for</code>), you need to include the file
                   7228:     <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
                   7229:     loads the user preferences.</p>
                   7230: <p>But note that some variables may not be completely defined
                   7231:     after <code class="filename">../../mk/bsd.prefs.mk</code> has been
                   7232:     included, as they may contain references to variables that are
1.108     rillig   7233:     not yet defined. In shell commands (the lines in
                   7234:     <code class="filename">Makefile</code> that are indented with a tab) this
                   7235:     is no problem, since variables are only expanded when they are
                   7236:     used. But in the preprocessor directives mentioned above and in
                   7237:     dependency lines (of the form <code class="literal">target:
1.1       dsieger  7238:     dependencies</code>) the variables are expanded at load
                   7239:     time.</p>
1.41      asau     7240: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  7241: <h3 class="title">Note</h3>
1.108     rillig   7242: <p>To check whether a variable can be used at load time,
                   7243:     run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p>
1.1       dsieger  7244: </div>
                   7245: </div>
1.41      asau     7246: <div class="sect2">
1.1       dsieger  7247: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7248: <a name="user-interaction"></a>21.1.2. User interaction</h3></div></div></div>
1.1       dsieger  7249: <p>Occasionally, packages require interaction from the user,
                   7250:     and this can be in a number of ways:</p>
1.41      asau     7251: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      7252: <li class="listitem"><p>When fetching the distfiles, some packages require user
1.1       dsieger  7253:        interaction such as entering username/password or accepting a
                   7254:        license on a web page.</p></li>
1.23      wiz      7255: <li class="listitem"><p>When extracting the distfiles, some packages may ask for
1.1       dsieger  7256:        passwords.</p></li>
1.23      wiz      7257: <li class="listitem"><p>help to configure the package before it is built</p></li>
                   7258: <li class="listitem"><p>help during the build process</p></li>
                   7259: <li class="listitem"><p>help during the installation of a package</p></li>
1.1       dsieger  7260: </ul></div>
1.108     rillig   7261: <p>A package can set the <code class="varname">INTERACTIVE_STAGE</code>
                   7262:     variable to define which stages need interaction. This should be
                   7263:     done in the package's <code class="filename">Makefile</code>, e.g.:</p>
1.1       dsieger  7264: <pre class="programlisting">
                   7265: INTERACTIVE_STAGE=      configure install
1.111     sevan    7266: </pre>
1.1       dsieger  7267: <p>The user can then decide to skip this package by setting the
1.108     rillig   7268:     <code class="varname">BATCH</code> variable. Packages that require interaction
                   7269:     are also excluded from bulk builds.</p>
1.1       dsieger  7270: </div>
1.41      asau     7271: <div class="sect2">
1.1       dsieger  7272: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7273: <a name="handling-licenses"></a>21.1.3. Handling licenses</h3></div></div></div>
1.111     sevan    7274: <p>Authors of software can choose the licence under which software
                   7275:     can be copied.  The Free Software Foundation has declared some
                   7276:     licenses "Free", and the Open Source Initiative has a definition of
                   7277:     "Open Source".</p>
                   7278: <p>By default, pkgsrc allows packages with Free or Open Source
                   7279:     licenses to be built.  To allow packages with other licenses to be
                   7280:     built as well, the pkgsrc user needs to add these licenses to the
                   7281:     <code class="varname">ACCEPTABLE_LICENSES</code> variable in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.  Note
                   7282:     that this variable only affects which packages may be
                   7283:     <span class="emphasis"><em>built</em></span>, while the license terms often also
                   7284:     restrict the actual use of the package and its redistribution.</p>
1.1       dsieger  7285: <p>One might want to only install packages with a BSD license,
1.108     rillig   7286:     or the GPL, and not the other.  The free licenses are added to the
1.111     sevan    7287:     default <code class="varname">ACCEPTABLE_LICENSES</code> variable.  The pkgsrc
1.19      jnemeth  7288:     user can override the default by setting the
                   7289:     <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead
1.111     sevan    7290:     of "+=".  The licenses accepted by default are defined in the
                   7291:     <code class="varname">DEFAULT_ACCEPTABLE_LICENSES</code> variable in the file
                   7292:     <code class="filename">pkgsrc/mk/license.mk</code>.</p>
1.1       dsieger  7293: <p>The license tag mechanism is intended to address
                   7294:     copyright-related issues surrounding building, installing and
                   7295:     using a package, and not to address redistribution issues (see
                   7296:     <code class="varname">RESTRICTED</code> and
1.111     sevan    7297:     <code class="varname">NO_SRC_ON_FTP</code>, etc.).
1.19      jnemeth  7298:     Packages with redistribution restrictions should set these
                   7299:     tags.</p>
1.1       dsieger  7300: <p>Denoting that a package may be copied according to a
                   7301:     particular license is done by placing the license in
                   7302:     <code class="filename">pkgsrc/licenses</code> and setting the
                   7303:     <code class="varname">LICENSE</code> variable to a string identifying the
1.137     leot     7304:     license, e.g. in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/xv/README.html" target="_top"><code class="filename">graphics/xv</code></a>:</p>
1.1       dsieger  7305: <pre class="programlisting">
                   7306: LICENSE=        xv-license
1.111     sevan    7307: </pre>
1.1       dsieger  7308: <p>When trying to build, the user will get a notice that the
                   7309:     package is covered by a license which has not been placed in the
                   7310:     <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p>
                   7311: <pre class="programlisting">
                   7312: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
                   7313: ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   7314: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   7315: ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   7316: ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   7317: *** Error code 1
1.111     sevan    7318: </pre>
1.10      hubertf  7319: <p>The license can be viewed with <span class="command"><strong>make
1.1       dsieger  7320:     show-license</strong></span>, and if the user so chooses, the line
1.10      hubertf  7321:     printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.1       dsieger  7322:     convey to pkgsrc that it should not in the future fail because of
                   7323:     that license:</p>
                   7324: <pre class="programlisting">
                   7325: ACCEPTABLE_LICENSES+=xv-license
1.111     sevan    7326: </pre>
                   7327: <p>The use of <code class="varname">LICENSE=shareware</code>,
                   7328:     <code class="varname">LICENSE=no-commercial-use</code>, and similar language
                   7329:     is deprecated because it does not crisply refer to a particular
                   7330:     license text.  Another problem with such usage is that it does not
                   7331:     enable a user to tell pkgsrc to proceed for a single package
                   7332:     without also telling pkgsrc to proceed for all packages with that
                   7333:     tag.</p>
                   7334: <div class="sect3">
                   7335: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   7336: <a name="new-license"></a>21.1.3.1. Adding a package with a new license</h4></div></div></div>
1.48      rodent   7337: <p>When adding a package with a new license, the following steps
                   7338:     are required:</p>
                   7339: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7340: <li class="listitem">
1.169     rillig   7341: <p>Check whether the license qualifies as Free or Open Source by
                   7342:     referencing <a class="ulink" href="https://www.gnu.org/licenses/license-list.en.html" target="_top">Various
                   7343:     Licenses and Comments about Them</a> and <a class="ulink" href="https://opensource.org/licenses/alphabetical" target="_top">Licenses by Name |
1.111     sevan    7344:     Open Source Initiative</a>.  If this is the case, the filename in
                   7345:     <code class="filename">pkgsrc/licenses/</code> does not need the
                   7346:     <code class="filename">-license</code> suffix, and the license name should be
                   7347:     added to:</p>
1.48      rodent   7348: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.169     rillig   7349: <li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in
                   7350:     <code class="filename">pkgsrc/mk/license.mk</code></p></li>
                   7351: <li class="listitem"><p>default_acceptable_licenses in
                   7352:     <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li>
1.48      rodent   7353: </ul></div>
                   7354: </li>
1.169     rillig   7355: <li class="listitem"><p>The license text should be added to
                   7356:     <code class="filename">pkgsrc/licenses</code> for displaying.  A list of known
                   7357:     licenses can be seen in this directory.</p></li>
1.48      rodent   7358: </ol></div>
1.111     sevan    7359: </div>
                   7360: <div class="sect3">
                   7361: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   7362: <a name="change-license"></a>21.1.3.2. Change to the license</h4></div></div></div>
1.1       dsieger  7363: <p>When the license changes (in a way other than formatting),
1.111     sevan    7364:     make sure that the new license has a different name (e.g.,
1.1       dsieger  7365:     append the version number if it exists, or the date).  Just
                   7366:     because a user told pkgsrc to build programs under a previous
                   7367:     version of a license does not mean that pkgsrc should build
                   7368:     programs under the new licenses.  The higher-level point is that
                   7369:     pkgsrc does not evaluate licenses for reasonableness; the only
                   7370:     test is a mechanistic test of whether a particular text has been
1.111     sevan    7371:     approved by either of two bodies (FSF or OSI).</p>
                   7372: </div>
1.1       dsieger  7373: </div>
1.41      asau     7374: <div class="sect2">
1.1       dsieger  7375: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7376: <a name="restricted-packages"></a>21.1.4. Restricted packages</h3></div></div></div>
1.1       dsieger  7377: <p>Some licenses restrict how software may be re-distributed.
1.111     sevan    7378:     By declaring the restrictions, package tools can
1.1       dsieger  7379:     automatically refrain from e.g. placing binary packages on FTP
                   7380:     sites.</p>
1.111     sevan    7381: <p>There are four possible restrictions, which are
1.1       dsieger  7382:     the cross product of sources (distfiles) and binaries not being
                   7383:     placed on FTP sites and CD-ROMs.  Because this is rarely the exact
                   7384:     language in any license, and because non-Free licenses tend to be
                   7385:     different from each other, pkgsrc adopts a definition of FTP and
1.111     sevan    7386:     CD-ROM.
                   7387: 
                   7388:     "FTP" means making the source or binary file available over the
                   7389:     Internet at no charge.
                   7390: 
                   7391:     "CD-ROM" means making the source or binary available on some kind of
                   7392:     media, together with other source and binary packages, which is sold
                   7393:     for a distribution charge.
1.1       dsieger  7394:     </p>
                   7395: <p>In order to encode these restrictions, the package system
                   7396:     defines five make variables that can be set to note these
                   7397:     restrictions:</p>
1.41      asau     7398: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      7399: <li class="listitem">
1.1       dsieger  7400: <p><code class="varname">RESTRICTED</code></p>
                   7401: <p>This variable should be set whenever a restriction
                   7402:        exists (regardless of its kind).  Set this variable to a
                   7403:        string containing the reason for the restriction.  It should
                   7404:        be understood that those wanting to understand the restriction
                   7405:        will have to read the license, and perhaps seek advice of
                   7406:        counsel.</p>
                   7407: </li>
1.23      wiz      7408: <li class="listitem">
1.1       dsieger  7409: <p><code class="varname">NO_BIN_ON_CDROM</code></p>
                   7410: <p>Binaries may not be placed on CD-ROM containing other
                   7411:        binary packages, for which a distribution charge may be made.
                   7412:        In this case, set this variable to
                   7413:        <code class="varname">${RESTRICTED}</code>.</p>
                   7414: </li>
1.23      wiz      7415: <li class="listitem">
1.1       dsieger  7416: <p><code class="varname">NO_BIN_ON_FTP</code></p>
                   7417: <p>Binaries may not made available on the Internet without
                   7418:        charge.  In this case, set this variable to
                   7419:        <code class="varname">${RESTRICTED}</code>.  If this variable is set,
                   7420:        binary packages will not be included on ftp.NetBSD.org.</p>
                   7421: </li>
1.23      wiz      7422: <li class="listitem">
1.1       dsieger  7423: <p><code class="varname">NO_SRC_ON_CDROM</code></p>
                   7424: <p>Distfiles may not be placed on CD-ROM, together with
                   7425:        other distfiles, for which a fee may be charged.  In this
                   7426:        case, set this variable to <code class="varname">${RESTRICTED}</code>.
                   7427:        </p>
                   7428: </li>
1.23      wiz      7429: <li class="listitem">
1.1       dsieger  7430: <p><code class="varname">NO_SRC_ON_FTP</code></p>
                   7431: <p>Distfiles may not made available via FTP at no charge.
                   7432:        In this case, set this variable to
                   7433:        <code class="varname">${RESTRICTED}</code>.  If this variable is set,
                   7434:        the distfile(s) will not be mirrored on ftp.NetBSD.org.</p>
                   7435: </li>
                   7436: </ul></div>
1.111     sevan    7437: <p>Please note that packages will be removed from pkgsrc when the
                   7438:     distfiles are not distributable and cannot be obtained for a period
                   7439:     of one full quarter branch. Packages with manual/interactive fetch
                   7440:     must have a maintainer and it is his/her responsibility to ensure
                   7441:     this.</p>
1.1       dsieger  7442: </div>
1.41      asau     7443: <div class="sect2">
1.1       dsieger  7444: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7445: <a name="dependencies"></a>21.1.5. Handling dependencies</h3></div></div></div>
1.175     gutterid 7446: <p>Your package may depend on some other package being present,
                   7447:     and there are various ways of expressing this dependency.
                   7448:     pkgsrc supports the <code class="varname">DEPENDS</code>,
                   7449:     <code class="varname">BUILD_DEPENDS</code>,
                   7450:     <code class="varname">TOOL_DEPENDS</code>, and
                   7451:     <code class="varname">TEST_DEPENDS</code> definitions, the
1.1       dsieger  7452:     <code class="varname">USE_TOOLS</code> definition, as well as dependencies
                   7453:     via <code class="filename">buildlink3.mk</code>, which is the preferred way
                   7454:     to handle dependencies, and which uses the variables named above.
1.154     rillig   7455:     See <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a> for more information.</p>
1.175     gutterid 7456: <p>The basic difference is that the <code class="varname">DEPENDS</code>
                   7457:     definition registers that pre-requisite in the binary package so it
                   7458:     will be pulled in when the binary package is later installed, whilst
                   7459:     the <code class="varname">BUILD_DEPENDS</code>, <code class="varname">TOOL_DEPENDS</code>,
                   7460:     and <code class="varname">TEST_DEPENDS</code> definitions do not, marking a
                   7461:     dependency that is only needed for building or testing the resulting
                   7462:     package. See also <a class="xref" href="#creating" title="Chapter 12. Creating a new pkgsrc package from scratch">Chapter 12, <i>Creating a new pkgsrc package from scratch</i></a> for more information.</p>
1.1       dsieger  7463: <p>This means that if you only need a package present whilst
1.175     gutterid 7464:     you are building or testing, it should be noted as a
                   7465:     <code class="varname">TOOL_DEPENDS</code>,
                   7466:     <code class="varname">BUILD_DEPENDS</code>, or
                   7467:     <code class="varname">TEST_DEPENDS</code>.  When cross-compiling,
1.156     leot     7468:     <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
                   7469:     packages, i.e. packages for the architecture where the package
                   7470:     is built;
                   7471:     <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
1.175     gutterid 7472:     packages, i.e., packages for the architecture for which the package
1.156     leot     7473:     is built.</p>
1.175     gutterid 7474: <p>The format for a <code class="varname">DEPENDS</code>,
                   7475:     <code class="varname">BUILD_DEPENDS</code>, <code class="varname">TOOL_DEPENDS</code>,
                   7476:     and <code class="varname">TEST_DEPENDS</code> definition is:</p>
1.1       dsieger  7477: <pre class="programlisting">
                   7478: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.111     sevan    7479: </pre>
1.23      wiz      7480: <p>Please note that the <span class="quote">&#8220;<span class="quote">pre-req-package-name</span>&#8221;</span>
1.1       dsieger  7481:     may include any of the wildcard version numbers recognized by
1.174     leot     7482:     <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a>.</p>
1.23      wiz      7483: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7484: <li class="listitem">
1.1       dsieger  7485: <p>If your package needs another package's binaries or
1.54      wiz      7486:        libraries to build and run, and if that package has a
1.1       dsieger  7487:        <code class="filename">buildlink3.mk</code> file available, use it:</p>
                   7488: <pre class="programlisting">
                   7489: .include "../../graphics/jpeg/buildlink3.mk"
1.111     sevan    7490: </pre>
1.1       dsieger  7491: </li>
1.23      wiz      7492: <li class="listitem">
1.54      wiz      7493: <p>If your package needs another package's binaries or
                   7494:        libraries only for building, and if that package has a
                   7495:        <code class="filename">buildlink3.mk</code> file available, use it:</p>
                   7496: <pre class="programlisting">
                   7497: .include "../../graphics/jpeg/buildlink3.mk"
1.111     sevan    7498: </pre>
1.54      wiz      7499: <p>but set
                   7500:        <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code>
                   7501:        to make it a build dependency only. This case is rather
                   7502:        rare.</p>
                   7503: </li>
                   7504: <li class="listitem">
1.25      spz      7505: <p>If your package needs binaries from another package to build,
1.156     leot     7506:        use the <code class="varname">TOOL_DEPENDS</code> definition:</p>
1.1       dsieger  7507: <pre class="programlisting">
1.156     leot     7508: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.111     sevan    7509: </pre>
1.1       dsieger  7510: </li>
1.156     leot     7511: <li class="listitem"><p>If your package needs static libraries to link against, header
                   7512:        files to include, etc. from another package to build,
                   7513:        use the <code class="varname">BUILD_DEPENDS</code> definition.</p></li>
1.25      spz      7514: <li class="listitem"><p>If your package needs a library with which to link and
                   7515:        there is no <code class="filename">buildlink3.mk</code> file
                   7516:        available, create one. Using
                   7517:        <code class="varname">DEPENDS</code> won't be sufficient because the
                   7518:        include files and libraries will be hidden from the compiler.</p></li>
1.23      wiz      7519: <li class="listitem">
1.25      spz      7520: <p>If your package needs some executable to be able to run
                   7521:        correctly and if there's no
                   7522:        <code class="filename">buildlink3.mk</code> file, this is specified
                   7523:        using the <code class="varname">DEPENDS</code> variable. The
1.137     leot     7524:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/lyx/README.html" target="_top"><code class="filename">print/lyx</code></a> package needs to
1.129     wiz      7525:        be able to execute the latex binary from the tex-latex-bin package
1.25      spz      7526:        when it runs, and that is specified:</p>
1.1       dsieger  7527: <pre class="programlisting">
1.129     wiz      7528: DEPENDS+=        tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.111     sevan    7529: </pre>
1.25      spz      7530: </li>
1.175     gutterid 7531: <li class="listitem"><p>If your package includes a test suite that has extra
                   7532:         dependencies only required for this purpose (frequently this
                   7533:         can be run as a <span class="quote">&#8220;<span class="quote">make test</span>&#8221;</span> target), use the
                   7534:         <code class="varname">TEST_DEPENDS</code> variable.</p></li>
1.25      spz      7535: <li class="listitem">
                   7536: <p>You can use wildcards in package dependencies. Note that
                   7537:        such wildcard dependencies are retained when creating binary
                   7538:        packages. The dependency is checked when installing the binary
                   7539:        package and any package which matches the pattern will be
                   7540:        used. Wildcard dependencies should be used with care.</p>
1.23      wiz      7541: <p>The <span class="quote">&#8220;<span class="quote">-[0-9]*</span>&#8221;</span> should be used instead of
                   7542:        <span class="quote">&#8220;<span class="quote">-*</span>&#8221;</span> to avoid potentially ambiguous matches
                   7543:        such as <span class="quote">&#8220;<span class="quote">tk-postgresql</span>&#8221;</span> matching a
                   7544:        <span class="quote">&#8220;<span class="quote">tk-*</span>&#8221;</span> <code class="varname">DEPENDS</code>.</p>
1.1       dsieger  7545: <p>Wildcards can also be used to specify that a package
                   7546:        will only build against a certain minimum version of a
                   7547:        pre-requisite:</p>
                   7548: <pre class="programlisting">
1.25      spz      7549: DEPENDS+=       ImageMagick&gt;=6.0:../../graphics/ImageMagick
1.111     sevan    7550: </pre>
1.25      spz      7551: <p>This means that the package will build using version 6.0
                   7552:        of ImageMagick or newer. Such a dependency may be warranted
                   7553:        if, for example, the command line options of an executable
                   7554:        have changed.</p>
                   7555: <p>If you need to depend on minimum versions of libraries,
                   7556:        see the buildlink section of the pkgsrc guide.</p>
1.1       dsieger  7557: <p>For security fixes, please update the package
1.154     rillig   7558:        vulnerabilities file. See <a class="xref" href="#security-handling" title="21.1.9. Handling packages with security problems">Section 21.1.9, &#8220;Handling packages with security problems&#8221;</a> for more
1.1       dsieger  7559:        information.</p>
                   7560: </li>
                   7561: </ol></div>
                   7562: <p>If your package needs files from another package to build,
                   7563:     add the relevant distribution files to
                   7564:     <code class="varname">DISTFILES</code>, so they will be extracted
1.137     leot     7565:     automatically. See the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/ghostscript/README.html" target="_top"><code class="filename">print/ghostscript</code></a> package for an example.
1.1       dsieger  7566:     (It relies on the jpeg sources being present in source form
                   7567:     during the build.)</p>
                   7568: </div>
1.41      asau     7569: <div class="sect2">
1.1       dsieger  7570: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7571: <a name="conflicts"></a>21.1.6. Handling conflicts with other packages</h3></div></div></div>
1.1       dsieger  7572: <p>Your package may conflict with other packages a user might
                   7573:     already have installed on his system, e.g. if your package
                   7574:     installs the same set of files as another package in the pkgsrc
1.80      wiz      7575:     tree or has the same <code class="varname">PKGNAME</code>.</p>
1.142     leot     7576: <p>For example, <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/libXaw3d/README.html" target="_top"><code class="filename">x11/libXaw3d</code></a>
                   7577:     and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw-Xpm/README.html" target="_top"><code class="filename">x11/Xaw-Xpm</code></a>
                   7578:     install the same shared library, thus you set in
                   7579:     <code class="filename">pkgsrc/x11/libXaw3d/Makefile</code>:</p>
                   7580: <pre class="programlisting">
                   7581: CONFLICTS=      Xaw-Xpm-[0-9]*
                   7582:     </pre>
                   7583: <p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
                   7584: <pre class="programlisting">
                   7585: CONFLICTS=      libXaw3d-[0-9]*
                   7586:     </pre>
1.174     leot     7587: <p><a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> is able to detect attempts to install packages
1.142     leot     7588:     that conflict with existing packages and abort. However, in many
                   7589:     situations this is too late in the process. Binary package managers
                   7590:     will not know about the conflict until they attempt to install the
                   7591:     package after already downloading it and all its dependencies.
                   7592:     Users may also waste time building a package and its dependencies
                   7593:     only to find out at the end that it conflicts with another package
                   7594:     they have installed.</p>
                   7595: <p>To avoid these issues <code class="varname">CONFLICTS</code> entries
                   7596:     should be added in all cases where it is known that packages conflict
                   7597:     with each other.  These <code class="varname">CONFLICTS</code> entries are
1.174     leot     7598:     exported in <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> files and consumed by binary package
1.142     leot     7599:     managers to inform users that packages cannot be installed onto
                   7600:     the target system.</p>
1.1       dsieger  7601: </div>
1.41      asau     7602: <div class="sect2">
1.1       dsieger  7603: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7604: <a name="not-building-packages"></a>21.1.7. Packages that cannot or should not be built</h3></div></div></div>
1.1       dsieger  7605: <p>There are several reasons why a package might be
                   7606:     instructed to not build under certain circumstances.  If the
                   7607:     package builds and runs on most platforms, the exceptions
1.83      dholland 7608:     should be noted with <code class="varname">BROKEN_ON_PLATFORM</code>.  If
                   7609:     the package builds and runs on a small handful of platforms,
                   7610:     set <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> instead.
                   7611:     Both <code class="varname">BROKEN_ON_PLATFORM</code> and
                   7612:     <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> are OS triples
                   7613:     (OS-version-platform) that can use glob-style
                   7614:     wildcards.</p>
                   7615: <p>If a package is not appropriate for some platforms (as
1.114     maya     7616:     opposed to merely broken), a different set of variables should be
1.83      dholland 7617:     used as this affects failure reporting and statistics.
                   7618:     If the package is appropriate for most platforms, the exceptions
1.1       dsieger  7619:     should be noted with <code class="varname">NOT_FOR_PLATFORM</code>.  If
1.83      dholland 7620:     the package is appropriate for only a small handful of platforms
                   7621:     (often exactly one), set <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.1       dsieger  7622:     Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   7623:     <code class="varname">NOT_FOR_PLATFORM</code> are OS triples
                   7624:     (OS-version-platform) that can use glob-style
                   7625:     wildcards.</p>
                   7626: <p>Some packages are tightly bound to a specific version of an
1.137     leot     7627:     operating system, e.g. LKMs or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/lsof/README.html" target="_top"><code class="filename">sysutils/lsof</code></a>.  Such binary packages are not
1.1       dsieger  7628:     backwards compatible with other versions of the OS, and should be
                   7629:     uploaded to a version specific directory on the FTP server.  Mark
                   7630:     these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to
1.23      wiz      7631:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.  This variable is not currently used by any of
1.1       dsieger  7632:     the package system internals, but may be used in the
                   7633:     future.</p>
                   7634: <p>If the package should be skipped (for example, because it
                   7635:     provides functionality already provided by the system), set
                   7636:     <code class="varname">PKG_SKIP_REASON</code> to a descriptive message.  If
                   7637:     the package should fail because some preconditions are not met,
                   7638:     set <code class="varname">PKG_FAIL_REASON</code> to a descriptive
                   7639:     message.</p>
                   7640: </div>
1.41      asau     7641: <div class="sect2">
1.1       dsieger  7642: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7643: <a name="undeletable-packages"></a>21.1.8. Packages which should not be deleted, once installed</h3></div></div></div>
1.1       dsieger  7644: <p>To ensure that a package may not be deleted, once it has been
                   7645:     installed, the <code class="varname">PKG_PRESERVE</code> definition should
                   7646:     be set in the package Makefile. This will be carried into any
                   7647:     binary package that is made from this pkgsrc entry. A
1.23      wiz      7648:     <span class="quote">&#8220;<span class="quote">preserved</span>&#8221;</span> package will
1.174     leot     7649:     not be deleted using <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> unless the
1.23      wiz      7650:     <span class="quote">&#8220;<span class="quote">-f</span>&#8221;</span> option is used.</p>
1.1       dsieger  7651: </div>
1.41      asau     7652: <div class="sect2">
1.1       dsieger  7653: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7654: <a name="security-handling"></a>21.1.9. Handling packages with security problems</h3></div></div></div>
1.1       dsieger  7655: <p>When a vulnerability is found, this should be noted in
                   7656:     <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.31      wiz      7657:     and after committing that file, ask pkgsrc-security@NetBSD.org to
                   7658:     update the file on ftp.NetBSD.org.</p>
1.1       dsieger  7659: <p>After fixing the vulnerability by a patch, its
1.31      wiz      7660:     <code class="varname">PKGREVISION</code> should be increased (this is of
                   7661:     course not necessary if the problem is fixed by using a newer
                   7662:     release of the software), and the pattern in the
                   7663:     pkg-vulnerabilities file must be updated.</p>
1.1       dsieger  7664: <p>Also, if the fix should be applied to the stable pkgsrc
                   7665:     branch, be sure to submit a pullup request!</p>
                   7666: <p>Binary packages already on ftp.NetBSD.org will be handled
                   7667:     semi-automatically by a weekly cron job.</p>
                   7668: </div>
1.41      asau     7669: <div class="sect2">
1.1       dsieger  7670: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7671: <a name="bumping-pkgrevision"></a>21.1.10. How to handle incrementing versions when fixing an existing package</h3></div></div></div>
1.1       dsieger  7672: <p>When making fixes to an existing package it can be useful
                   7673:     to change the version number in <code class="varname">PKGNAME</code>. To
                   7674:     avoid conflicting with future versions by the original author, a
1.23      wiz      7675:     <span class="quote">&#8220;<span class="quote">nb1</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">nb2</span>&#8221;</span>, ... suffix can be used
1.1       dsieger  7676:     on package versions by setting <code class="varname">PKGREVISION=1</code>
1.23      wiz      7677:     (2, ...). The <span class="quote">&#8220;<span class="quote">nb</span>&#8221;</span> is treated like a
                   7678:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> by the package tools. e.g.</p>
1.1       dsieger  7679: <pre class="programlisting">
                   7680: DISTNAME=       foo-17.42
                   7681: PKGREVISION=    9
1.111     sevan    7682: </pre>
1.1       dsieger  7683: <p>will result in a <code class="varname">PKGNAME</code> of
1.23      wiz      7684:     <span class="quote">&#8220;<span class="quote">foo-17.42nb9</span>&#8221;</span>. If you want to use the original
                   7685:     value of <code class="varname">PKGNAME</code> without the <span class="quote">&#8220;<span class="quote">nbX</span>&#8221;</span>
1.1       dsieger  7686:     suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use
                   7687:     <code class="varname">PKGNAME_NOREV</code>.</p>
                   7688: <p>When a new release of the package is released, the
                   7689:     <code class="varname">PKGREVISION</code> should be removed, e.g. on a new
                   7690:     minor release of the above package, things should be like:</p>
                   7691: <pre class="programlisting">
                   7692: DISTNAME=       foo-17.43
1.111     sevan    7693: </pre>
1.1       dsieger  7694: <p><code class="varname">PKGREVISION</code> should be incremented for any
                   7695:     non-trivial change in the resulting binary package.  Without a
                   7696:     <code class="varname">PKGREVISION</code> bump, someone with the previous
                   7697:     version installed has no way of knowing that their package is out
                   7698:     of date.  Thus, changes without increasing
                   7699:     <code class="varname">PKGREVISION</code> are essentially labeled "this is so
                   7700:     trivial that no reasonable person would want to upgrade", and this
                   7701:     is the rough test for when increasing
                   7702:     <code class="varname">PKGREVISION</code> is appropriate.  Examples of
                   7703:     changes that do not merit increasing
                   7704:     <code class="varname">PKGREVISION</code> are:</p>
1.41      asau     7705: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      7706: <li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>,
1.169     rillig   7707:       <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>, or
                   7708:       comments in Makefile.</p></li>
                   7709: <li class="listitem"><p>Changing build variables if the resulting binary
                   7710:       package is the same.</p></li>
                   7711: <li class="listitem"><p>Changing
                   7712:       <code class="filename">DESCR</code>.</p></li>
                   7713: <li class="listitem"><p>Adding <code class="varname">PKG_OPTIONS</code> if the
                   7714:       default options don't change.</p></li>
1.1       dsieger  7715: </ul></div>
                   7716: <p>Examples of changes that do merit an increase to
                   7717:     <code class="varname">PKGREVISION</code> include:</p>
1.41      asau     7718: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.169     rillig   7719: <li class="listitem"><p>Security fixes</p></li>
                   7720: <li class="listitem"><p>Changes or additions to a patch
                   7721:       file</p></li>
                   7722: <li class="listitem"><p>Changes to the
                   7723:       <code class="filename">PLIST</code></p></li>
                   7724: <li class="listitem"><p>A dependency is changed or
                   7725:       renamed.</p></li>
1.1       dsieger  7726: </ul></div>
                   7727: <p>PKGREVISION must also be incremented when dependencies have ABI
                   7728:     changes.</p>
                   7729: </div>
1.41      asau     7730: <div class="sect2">
1.1       dsieger  7731: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7732: <a name="fixes.subst"></a>21.1.11. Substituting variable text in the package files (the SUBST framework)</h3></div></div></div>
1.180     rillig   7733: <p>When you want to replace the same text in multiple files, or
                   7734: multiple times in the same file, it is cumbersome to maintain a patch
                   7735: file for this. This is where the SUBST framework steps in. It provides an
                   7736: easy-to-use interface for replacing text in files. It just needs the
                   7737: following information:</p>
                   7738: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   7739: <li class="listitem"><p>In which phase of the package build cycle should the
                   7740: replacement happen?</p></li>
                   7741: <li class="listitem"><p>In which files should the replacement
1.172     rillig   7742: happen?</p></li>
1.180     rillig   7743: <li class="listitem"><p>Which text should be replaced with
                   7744: what?</p></li>
1.172     rillig   7745: </ul></div>
                   7746: <p>This information is encoded in a block of <code class="varname">SUBST</code>
1.180     rillig   7747: variables. A minimal example is:</p>
                   7748: <pre class="programlisting">
                   7749: SUBST_CLASSES+=         paths
                   7750: SUBST_STAGE.paths=      pre-configure
                   7751: SUBST_FILES.paths=      src/*.c
                   7752: SUBST_SED.paths=        -e 's,/usr/local,${PREFIX},g'
                   7753: </pre>
                   7754: <p>Translated into English, it means: In the pre-configure stage (that
                   7755: is, after applying the patches from the patches/ directory and before
                   7756: running the configure script and the portability check), replace the text
                   7757: <code class="literal">/usr/local</code> with the content of the variable
                   7758: <code class="varname">PREFIX</code>.</p>
                   7759: <p>Each SUBST block starts by appending an identifier to
                   7760: <code class="varname">SUBST_CLASSES</code> (note the <code class="literal">+=</code>). This
                   7761: identifier can be chosen freely by the package. If there should ever be
                   7762: duplicate identifiers, the pkgsrc infrastructure will catch this and fail
                   7763: early, so don't worry about name collisions.</p>
                   7764: <p>Except for <code class="varname">SUBST_CLASSES</code>, all variables in a
                   7765: SUBST block are parameterized using this identifier. In the remainder of
                   7766: this section, these parameterized variables are written as
                   7767: <code class="varname">SUBST_STAGE.*</code>.</p>
                   7768: <pre class="programlisting">
                   7769: SUBST_CLASSES+=         paths
                   7770: SUBST_STAGE.paths=      pre-configure
                   7771: SUBST_MESSAGE.paths=    Fixing absolute paths.
                   7772: SUBST_FILES.paths=      src/*.c
                   7773: SUBST_FILES.paths+=     scripts/*.sh
                   7774: SUBST_SED.paths=        -e 's,"/usr/local,"${PREFIX},g'
                   7775: SUBST_SED.paths+=       -e 's,"/var/log,"${VARBASE}/log,g'
                   7776: SUBST_VARS.paths=       LOCALBASE PREFIX PKGVERSION
                   7777: </pre>
                   7778: <p>To get a complete picture about the SUBST substitutions, run
                   7779: <span class="command"><strong>bmake show-all-subst</strong></span>. If something doesn't work as
                   7780: expected, run pkglint on the package, which detects several typical
                   7781: mistakes surrounding the SUBST blocks. For any questions that might
                   7782: remain after this, have a look at
                   7783: <code class="filename">mk/subst.mk</code>.</p>
                   7784: <div class="sect3">
                   7785: <div class="titlepage"><div><div><h4 class="title">
                   7786: <a name="fixes.subst.when"></a>21.1.11.1. Choosing the time where the substitutions happen</h4></div></div></div>
                   7787: <p>The <code class="varname">SUBST_STAGE.*</code> is one of
                   7788: {pre,do,post}-{extract,patch,configure,build,test,install}. Of these,
                   7789: <code class="literal">pre-configure</code> is used most often, by far. The most
                   7790: popular stages are, in chronological order:</p>
                   7791: <div class="variablelist"><dl class="variablelist">
                   7792: <dt><span class="term"><code class="literal">post-extract</code></span></dt>
                   7793: <dd>
                   7794: <p>The substitutions are applied immediately after the
                   7795: distfiles are extracted. Running <span class="command"><strong>bmake extract</strong></span> on the
                   7796: package will leave no traces of the original files.</p>
                   7797: <p>When the substitution applies to files for which there is also a
                   7798: patch in the <code class="filename">patches/</code> directory, this means that the
                   7799: patches will be computed based on the result of the substitution. When
                   7800: these patches are sent to the upstream maintainer later, to be fixed in
                   7801: the upstream package, these patches may no longer match what the upstream
                   7802: author is used to. Because of this, <code class="literal">pre-configure</code> is
                   7803: often a better choice.</p>
                   7804: </dd>
                   7805: <dt><span class="term"><code class="literal">pre-configure</code></span></dt>
                   7806: <dd>
                   7807: <p>The substitutions are applied after the patches from the
                   7808: <code class="filename">patches/</code> directory. This makes it possible to run
                   7809: <span class="command"><strong>bmake patch</strong></span> on the package, after which the patches
                   7810: can be edited using the tools pkgvi and mkpatches from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package.</p>
                   7811: <p>When updating the patches, it is helpful to explicitly separate the
                   7812: <span class="command"><strong>bmake patch</strong></span> from the <span class="command"><strong>bmake
                   7813: configure</strong></span>, and to only edit the patches between these commands.
                   7814: Otherwise the substitutions from the SUBST block will end up in the patch
                   7815: file. When this happens in really obvious ways, pkglint will complain
                   7816: about patches that contain a hard-coded <code class="literal">/usr/pkg</code>
                   7817: instead of the correct and intended <code class="literal">@PREFIX@</code>, but it
                   7818: can only detect these really obvious
                   7819: cases.</p>
                   7820: </dd>
                   7821: <dt><span class="term"><code class="literal">do-configure</code></span></dt>
                   7822: <dd><p>This stage should only be used if the package defines a
                   7823: <code class="literal">pre-configure</code> action itself, and the substitution must
                   7824: happen after that. Typical examples are packages that use the
                   7825: <code class="literal">pre-configure</code> stage to regenerate the GNU configure
                   7826: script from
                   7827: <code class="filename">configure.ac</code>.</p></dd>
                   7828: <dt><span class="term"><code class="literal">post-configure</code></span></dt>
                   7829: <dd><p>This stage is used to fix up any mistakes by the
                   7830: configure stage.</p></dd>
                   7831: <dt><span class="term"><code class="literal">pre-build</code></span></dt>
                   7832: <dd><p>This stage should only be used for substitutions that are
                   7833: clearly related to building the package, not for fixing the
                   7834: configuration. Substitutions for pathnames (such as replacing
                   7835: <code class="filename">/usr/local</code> with <code class="literal">${PREFIX}</code>) or
                   7836: user names (such as replacing <code class="literal">@MY_USER@</code> with the
                   7837: actual username) belong in pre-configure or post-configure
                   7838: instead.</p></dd>
                   7839: <dt><span class="term"><code class="literal">post-build</code></span></dt>
                   7840: <dd>
                   7841: <p>Just as with pre-build, this stage should only be used
                   7842: for substitutions that are clearly related to building the package, not
                   7843: for fixing the configuration. Substitutions for pathnames (such as
                   7844: replacing <code class="filename">/usr/local</code> with
                   7845: <code class="literal">${PREFIX}</code>) or user names (such as replacing
                   7846: <code class="literal">@MY_USER@</code> with the actual username) belong in
                   7847: pre-configure or post-configure instead.</p>
                   7848: <p>A typical use is to update pkg-config files to include the rpath
                   7849: compiler options.</p>
                   7850: </dd>
                   7851: <dt><span class="term"><code class="literal">pre-install</code></span></dt>
                   7852: <dd><p>In general, the install phase should be as simple as
                   7853: possible. As with the pre-build and post-build stages, it should not be
                   7854: used to fix pathnames or user names, these belong in pre-configure
                   7855: instead. There are only few legitimate use cases for applying
                   7856: substitutions in this stage.</p></dd>
                   7857: </dl></div>
                   7858: </div>
                   7859: <div class="sect3">
                   7860: <div class="titlepage"><div><div><h4 class="title">
1.181   ! rillig   7861: <a name="fixes.subst.where"></a>21.1.11.2. Choosing the files where the substitutions happen</h4></div></div></div>
1.180     rillig   7862: <p>The <code class="varname">SUBST_FILES.*</code> variable contains a list of
                   7863: filename patterns. These patterns are relative to
                   7864: <code class="varname">WRKSRC</code> since that is where most substitutions happen.
                   7865: A typical example is:</p>
                   7866: <pre class="programlisting">
                   7867: SUBST_FILES.path=       Makefile */Makefile */*/Makefile *.[ch]
                   7868: </pre>
                   7869: <p>The above patterns, especially the last, are quite broad. The SUBST
                   7870: implementation checks that each filename pattern that is mentioned here
                   7871: has an effect. For example, if none of the
                   7872: <code class="filename">*/*/Makefile</code> files contains the patterns to be found
                   7873: and substituted, that filename pattern is redundant and should be left
1.181   ! rillig   7874: out. By default, the SUBST framework will complain with an error message.
        !          7875: If the text to be substituted occurs in some of the files from a single
        !          7876: pattern, but not in all of them, that is totally ok, and the SUBST
1.180     rillig   7877: framework will only print an INFO message for those files.</p>
                   7878: <p>If there is a good reason for having redundant filename patterns,
1.181   ! rillig   7879: set <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
1.180     rillig   7880: <p>Another popular way of choosing the files for the substitutions is
                   7881: via a shell command, like this:</p>
                   7882: <pre class="programlisting">
1.181   ! rillig   7883: C_FILES_CMD=            cd ${WRKSRC} &amp;&amp; ${FIND} . -name '*.c'
1.180     rillig   7884: SUBST_FILES.path=       ${C_FILES_CMD:sh}
                   7885: </pre>
                   7886: <p>The variable name <code class="varname">C_FILES_CMD</code> in this example is
                   7887: freely chosen and independent of the SUBST framework.</p>
                   7888: <p>In this variant, the <code class="varname">SUBST_FILES.*</code> variable
                   7889: lists each file individually. Thereby chances are higher that there are
                   7890: filename patterns in which no substitution happens. Since the SUBST
                   7891: framework cannot know whether the filename patterns in
                   7892: <code class="varname">SUBST_FILES.*</code> have been explicitly listed in the
                   7893: Makefile (where any redundant filename pattern would be suspicious) or
                   7894: been generated by a shell command (in which redundant filename patterns
                   7895: are more likely and to be expected), it will complain about these
                   7896: redundant filename patterns. Therefore, SUBST blocks that use a shell
                   7897: command to generate the list of filename patterns often need to set
                   7898: <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
                   7899: </div>
                   7900: <div class="sect3">
                   7901: <div class="titlepage"><div><div><h4 class="title">
                   7902: <a name="fixes.subst.what"></a>21.1.11.3. Choosing what to substitute</h4></div></div></div>
                   7903: <p>In most cases, the substitutions are given using one or more
                   7904: <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?sed+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> commands, like this:</p>
                   7905: <pre class="programlisting">
                   7906: SUBST_SED.path=         -e 's|/usr/local|${PREFIX}|g'
                   7907: </pre>
                   7908: <p>Each of the sed commands needs to be preceded by the
                   7909: <code class="literal">-e</code> option and should be specified on a line of its
                   7910: own, to avoid hiding short sed commands at the end of a line.</p>
                   7911: <p>Since the sed commands often contain shell metacharacters as the
                   7912: separator (the <code class="literal">|</code> in the above example), it is common
                   7913: to enclose them in single quotes.</p>
                   7914: <p>A common substitution is to replace placeholders of the form
                   7915: <code class="literal">@VARNAME@</code> with their pkgsrc counterpart variable
                   7916: <code class="literal">${VARNAME}</code>. A typical example is:</p>
                   7917: <pre class="programlisting">
                   7918: SUBST_VARS.path=        PREFIX
                   7919: </pre>
                   7920: <p>This type of substitutions is typically done by the GNU configure
1.181   ! rillig   7921: scripts during the do-configure stage, but in some cases these need to be
        !          7922: overridden. The same pattern is also used when a package defines patches
        !          7923: that replace previously hard-coded paths like
        !          7924: <code class="literal">/usr/local</code> with a <code class="literal">@PREFIX@</code>
        !          7925: placeholder first, which then gets substituted by the actual
        !          7926: <code class="literal">${PREFIX}</code> in the pre-configure stage. In many of these
        !          7927: cases, it works equally well to just use the SUBST framework to directly
        !          7928: replace <code class="literal">/usr/local</code> with <code class="literal">${PREFIX}</code>,
        !          7929: thereby omitting the intermediate patch file.</p>
1.180     rillig   7930: <p>If the above is not flexible enough, it is possible to not use sed
                   7931: at all for the substitution but to specify an entirely different command,
                   7932: like this:</p>
1.1       dsieger  7933: <pre class="programlisting">
1.180     rillig   7934: SUBST_FILTER_CMD.path=  LC_ALL=C ${TR} -d '\r'
                   7935: </pre>
                   7936: <p>This is used for the few remaining packages in which the
                   7937: distributed files use Windows-style line endings that need to be
                   7938: converted to UNIX-style line endings.</p>
                   7939: </div>
                   7940: <div class="sect3">
                   7941: <div class="titlepage"><div><div><h4 class="title">
                   7942: <a name="fixes.subst.other"></a>21.1.11.4. Other SUBST variables</h4></div></div></div>
                   7943: <p>When a SUBST block is applied during a package build, a message is
                   7944: logged. The default message is fine for most purposes but can be
                   7945: overridden by setting <code class="literal">SUBST_MESSAGE.*</code> to an individual
                   7946: message.</p>
                   7947: </div>
1.1       dsieger  7948: </div>
                   7949: </div>
1.41      asau     7950: <div class="sect1">
1.1       dsieger  7951: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   7952: <a name="fixes.fetch"></a>21.2. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.41      asau     7953: <div class="sect2">
1.1       dsieger  7954: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7955: <a name="no-plain-download"></a>21.2.1. Packages whose distfiles aren't available for plain downloading</h3></div></div></div>
1.1       dsieger  7956: <p>If you need to download from a dynamic URL you can set
1.10      hubertf  7957:     <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make
1.1       dsieger  7958:     fetch</strong></span> will call <code class="filename">files/getsite.sh</code>
                   7959:     with the name of each file to download as an argument, expecting
                   7960:     it to output the URL of the directory from which to download
1.137     leot     7961:     it. <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/ns-cult3d/README.html" target="_top"><code class="filename">graphics/ns-cult3d</code></a> is an
1.1       dsieger  7962:     example of this usage.</p>
                   7963: <p>If the download can't be automated, because the user must
                   7964:     submit personal information to apply for a password, or must pay
                   7965:     for the source, or whatever, you can set
                   7966:     <code class="varname">FETCH_MESSAGE</code> to a list of lines that are
                   7967:     displayed to the user before aborting the build. Example:</p>
                   7968: <pre class="programlisting">
                   7969: FETCH_MESSAGE=  "Please download the files"
                   7970: FETCH_MESSAGE+= "    "${DISTFILES:Q}
                   7971: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
1.111     sevan    7972: </pre>
1.1       dsieger  7973: </div>
1.41      asau     7974: <div class="sect2">
1.1       dsieger  7975: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   7976: <a name="modified-distfiles-same-name"></a>21.2.2. How to handle modified distfiles with the 'old' name</h3></div></div></div>
1.1       dsieger  7977: <p>Sometimes authors of a software package make some
                   7978:     modifications after the software was released, and they put up a
                   7979:     new distfile without changing the package's version number. If a
                   7980:     package is already in pkgsrc at that time, the checksum will
                   7981:     no longer match. The contents of the new distfile should be
                   7982:     compared against the old one before changing anything, to make
                   7983:     sure the distfile was really updated on purpose, and that
                   7984:     no trojan horse or so crept in.
                   7985:     Please mention that the distfiles were compared and what was found
1.53      rodent   7986:     in your commit message.</p>
1.109     wiz      7987: <p>Then, the correct way to work around this is to set
                   7988:     <code class="varname">DIST_SUBDIR</code> to a unique directory name, usually
                   7989:     based on <code class="varname">PKGNAME_NOREV</code> (but take care with
                   7990:     python or ruby packages, where <code class="varname">PKGNAME</code> includes
                   7991:     a variable prefix). All <code class="varname">DISTFILES</code> and
1.1       dsieger  7992:     <code class="varname">PATCHFILES</code> for this package will be put in that
1.154     rillig   7993:     subdirectory of the local distfiles directory. (See <a class="xref" href="#bumping-pkgrevision" title="21.1.10. How to handle incrementing versions when fixing an existing package">Section 21.1.10, &#8220;How to handle incrementing versions when fixing an existing package&#8221;</a> for more details.) In case this
1.1       dsieger  7994:     happens more often, <code class="varname">PKGNAME</code> can be used (thus
1.109     wiz      7995:     including the <code class="filename">nbX</code> suffix) or a date stamp can
                   7996:     be appended, like
                   7997:     <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p>
1.169     rillig   7998: <p><code class="varname">DIST_SUBDIR</code> is also used when a distfile's
                   7999:     name does not contain a version and the distfile is apt to change. In
                   8000:     cases where the likelihood of this is very small,
                   8001:     <code class="varname">DIST_SUBDIR</code> might not be required. Additionally,
                   8002:     <code class="varname">DIST_SUBDIR</code> must not be removed unless the
                   8003:     distfile name changes, even if a package is being moved or
                   8004:     renamed.</p>
1.53      rodent   8005: <p>Do not forget regenerating the <code class="filename">distinfo</code> file
1.1       dsieger  8006:     after that, since it contains the <code class="varname">DIST_SUBDIR</code>
                   8007:     path in the filenames.
1.53      rodent   8008:     Also, increase the PKGREVISION if the installed package is different.
1.1       dsieger  8009:     Furthermore, a mail to the package's authors seems appropriate
                   8010:     telling them that changing distfiles after releases without
                   8011:     changing the file names is not good practice.</p>
                   8012: </div>
1.88      tnn      8013: <div class="sect2">
                   8014: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8015: <a name="build.fetch.github"></a>21.2.3. Packages hosted on github.com</h3></div></div></div>
1.169     rillig   8016: <p>Helper methods exist for packages hosted on github.com which
                   8017:     will often have distfile names that clash with other packages, for
                   8018:     example <code class="filename">1.0.tar.gz</code>. Use one of the three recipes
                   8019:     from below:</p>
1.88      tnn      8020: <div class="sect3">
                   8021: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   8022: <a name="build.fetch.github.tag"></a>21.2.3.1. Fetch based on a tagged release</h4></div></div></div>
1.169     rillig   8023: <p>If your distfile URL looks similar to
1.174     leot     8024:       <code class="literal">https://github.com/username/exampleproject/archive/v1.0.zip</code>,
1.169     rillig   8025:       then you are packaging a tagged release.</p>
1.88      tnn      8026: <pre class="programlisting">
                   8027: DISTNAME=       exampleproject-1.0
1.90      tnn      8028: MASTER_SITES=   ${MASTER_SITE_GITHUB:=username/}
                   8029: #GITHUB_PROJECT=        # can be omitted if same as DISTNAME
                   8030: GITHUB_TAG=     v${PKGVERSION_NOREV}
1.88      tnn      8031: EXTRACT_SUFX=   .zip
                   8032: </pre>
                   8033: </div>
                   8034: <div class="sect3">
                   8035: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   8036: <a name="build.fetch.github.commit"></a>21.2.3.2. Fetch based on a specific commit</h4></div></div></div>
1.169     rillig   8037: <p>If your distfile URL looks similar to
1.174     leot     8038:       <code class="literal">https://github.com&#8203;/example&#8203;/example&#8203;/archive&#8203;/988881adc9fc3655077dc2d4d757d480b5ea0e11.tar.gz</code>,
1.169     rillig   8039:       then you are packaging a specific commit not tied to a
                   8040:       release.</p>
1.88      tnn      8041: <pre class="programlisting">
                   8042: DISTNAME=       example-1.0
1.107     jnemeth  8043: MASTER_SITES=   ${MASTER_SITE_GITHUB:=example/}
1.90      tnn      8044: #GITHUB_PROJECT=        # can be omitted if same as DISTNAME
                   8045: GITHUB_TAG=     988881adc9fc3655077dc2d4d757d480b5ea0e11
1.111     sevan    8046: </pre>
1.88      tnn      8047: </div>
                   8048: <div class="sect3">
                   8049: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   8050: <a name="build.fetch.github.release"></a>21.2.3.3. Fetch based on release</h4></div></div></div>
1.169     rillig   8051: <p>If your distfile URL looks similar to
1.174     leot     8052:       <code class="literal">https://github.com&#8203;/username/exampleproject&#8203;/releases&#8203;/download&#8203;/rel-1.6&#8203;/offensive-1.6.zip</code>,
1.169     rillig   8053:       then you are packaging a release.</p>
1.88      tnn      8054: <pre class="programlisting">
                   8055: DISTNAME=       offensive-1.6
1.90      tnn      8056: PKGNAME=        ${DISTNAME:S/offensive/proper/}
                   8057: MASTER_SITES=   ${MASTER_SITE_GITHUB:=username/}
                   8058: GITHUB_PROJECT= exampleproject
                   8059: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
                   8060: EXTRACT_SUFX=   .zip
1.111     sevan    8061: </pre>
1.88      tnn      8062: </div>
                   8063: </div>
1.1       dsieger  8064: </div>
1.41      asau     8065: <div class="sect1">
1.1       dsieger  8066: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   8067: <a name="fixes.configure"></a>21.3. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.41      asau     8068: <div class="sect2">
1.1       dsieger  8069: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8070: <a name="fixes.libtool"></a>21.3.1. Shared libraries - libtool</h3></div></div></div>
1.1       dsieger  8071: <p>pkgsrc supports many different machines, with different
                   8072:     object formats like a.out and ELF, and varying abilities to do
                   8073:     shared library and dynamic loading at all. To accompany this,
                   8074:     varying commands and options have to be passed to the
                   8075:     compiler, linker, etc. to get the Right Thing, which can be
                   8076:     pretty annoying especially if you don't have all the machines
                   8077:     at your hand to test things.  The
1.137     leot     8078:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/libtool/README.html" target="_top"><code class="filename">devel/libtool</code></a> pkg
1.23      wiz      8079:     can help here, as it just <span class="quote">&#8220;<span class="quote">knows</span>&#8221;</span> how to build
1.1       dsieger  8080:     both static and dynamic libraries from a set of source files,
                   8081:     thus being platform-independent.</p>
                   8082: <p>Here's how to use libtool in a package in seven simple
                   8083:     steps:</p>
1.23      wiz      8084: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8085: <li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package
1.1       dsieger  8086:        Makefile.</p></li>
1.23      wiz      8087: <li class="listitem"><p>For library objects, use <span class="quote">&#8220;<span class="quote">${LIBTOOL} --mode=compile
                   8088:        ${CC}</span>&#8221;</span> in place of <span class="quote">&#8220;<span class="quote">${CC}</span>&#8221;</span>. You could even
1.1       dsieger  8089:        add it to the definition of <code class="varname">CC</code>, if only
                   8090:        libraries are being built in a given Makefile. This one command
                   8091:        will build both PIC and non-PIC library objects, so you need not
                   8092:        have separate shared and non-shared library rules.</p></li>
1.23      wiz      8093: <li class="listitem">
1.1       dsieger  8094: <p>For the linking of the library, remove any
1.23      wiz      8095:        <span class="quote">&#8220;<span class="quote">ar</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">ranlib</span>&#8221;</span>, and <span class="quote">&#8220;<span class="quote">ld
                   8096:        -Bshareable</span>&#8221;</span> commands, and instead use:</p>
1.1       dsieger  8097: <pre class="programlisting">
                   8098: ${LIBTOOL} --mode=link \
                   8099:     ${CC} -o ${.TARGET:.a=.la} \
                   8100:         ${OBJS:.o=.lo} \
                   8101:         -rpath ${PREFIX}/lib \
                   8102:         -version-info major:minor
1.111     sevan    8103: </pre>
1.1       dsieger  8104: <p>Note that the library is changed to have a
                   8105:        <code class="filename">.la</code> extension, and the objects are
                   8106:        changed to have a <code class="filename">.lo</code>
                   8107:        extension. Change <code class="varname">OBJS</code> as
                   8108:        necessary. This automatically creates all of the
                   8109:        <code class="filename">.a</code>,
                   8110:        <code class="filename">.so.major.minor</code>, and ELF symlinks (if
                   8111:        necessary) in the build directory. Be sure to include
1.23      wiz      8112:        <span class="quote">&#8220;<span class="quote">-version-info</span>&#8221;</span>, especially when major and
1.1       dsieger  8113:        minor are zero, as libtool will otherwise strip off the
                   8114:        shared library version.</p>
                   8115: <p>From the libtool manual:</p>
                   8116: <pre class="programlisting">
                   8117: So, libtool library versions are described by three integers:
                   8118: 
                   8119: CURRENT
                   8120: The most recent interface number that this library implements.
                   8121: 
                   8122: REVISION
                   8123: The implementation number of the CURRENT interface.
                   8124: 
                   8125: AGE
                   8126: The difference between the newest and oldest interfaces that
                   8127: this library implements.  In other words, the library implements
                   8128: all the interface numbers in the range from number `CURRENT -
                   8129: AGE' to `CURRENT'.
                   8130: 
                   8131: If two libraries have identical CURRENT and AGE numbers, then the
                   8132: dynamic linker chooses the library with the greater REVISION number.
1.111     sevan    8133: </pre>
1.23      wiz      8134: <p>The <span class="quote">&#8220;<span class="quote">-release</span>&#8221;</span> option will produce
1.1       dsieger  8135:        different results for a.out and ELF (excluding symlinks)
                   8136:        in only one case. An ELF library of the form
1.23      wiz      8137:        <span class="quote">&#8220;<span class="quote">libfoo-release.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>&#8221;</span>
1.1       dsieger  8138:        will have a symlink of
1.23      wiz      8139:        <span class="quote">&#8220;<span class="quote">libfoo.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>&#8221;</span>
1.1       dsieger  8140:        on an a.out platform. This is handled
                   8141:        automatically.</p>
1.23      wiz      8142: <p>The <span class="quote">&#8220;<span class="quote">-rpath argument</span>&#8221;</span> is the install
1.1       dsieger  8143:        directory of the library being built.</p>
                   8144: <p>In the <code class="filename">PLIST</code>, include only the
                   8145:        <code class="filename">.la</code> file, the other files will be
                   8146:        added automatically.</p>
                   8147: </li>
1.23      wiz      8148: <li class="listitem">
1.1       dsieger  8149: <p>When linking shared object (<code class="filename">.so</code>)
1.174     leot     8150:        files, i.e. files that are loaded via <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">dlopen</span>(3)</span></a>, NOT
1.23      wiz      8151:        shared libraries, use <span class="quote">&#8220;<span class="quote">-module
                   8152:        -avoid-version</span>&#8221;</span> to prevent them getting version
1.1       dsieger  8153:        tacked on.</p>
                   8154: <p>The <code class="filename">PLIST</code> file gets the
                   8155:        <code class="filename">foo.so</code> entry.</p>
                   8156: </li>
1.23      wiz      8157: <li class="listitem">
1.1       dsieger  8158: <p>When linking programs that depend on these libraries
                   8159:        <span class="emphasis"><em>before</em></span> they are installed, preface
1.174     leot     8160:        the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?cc+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">cc</span>(1)</span></a> or <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?ld+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">ld</span>(1)</span></a> line with <span class="quote">&#8220;<span class="quote">${LIBTOOL}
1.23      wiz      8161:        --mode=link</span>&#8221;</span>, and it will find the correct
1.1       dsieger  8162:        libraries (static or shared), but please be aware that
                   8163:        libtool will not allow you to specify a relative path in
1.23      wiz      8164:        -L (such as <span class="quote">&#8220;<span class="quote">-L../somelib</span>&#8221;</span>), because it
1.1       dsieger  8165:        expects you to change that argument to be the
                   8166:        <code class="filename">.la</code> file. e.g.</p>
                   8167: <pre class="programlisting">
                   8168: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.111     sevan    8169: </pre>
1.1       dsieger  8170: <p>should be changed to:</p>
                   8171: <pre class="programlisting">
                   8172: ${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em>
1.111     sevan    8173: </pre>
1.1       dsieger  8174: <p>and it will do the right thing with the libraries.</p>
                   8175: </li>
1.23      wiz      8176: <li class="listitem">
1.174     leot     8177: <p>When installing libraries, preface the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?install+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a>
                   8178:        or <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?cp+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span></a> command with <span class="quote">&#8220;<span class="quote">${LIBTOOL}
1.23      wiz      8179:        --mode=install</span>&#8221;</span>, and change the library name to
1.1       dsieger  8180:        <code class="filename">.la</code>. e.g.</p>
                   8181: <pre class="programlisting">
1.22      jakllsch 8182: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.111     sevan    8183: </pre>
1.1       dsieger  8184: <p>This will install the static <code class="filename">.a</code>,
                   8185:        shared library, any needed symlinks, and run
1.174     leot     8186:        <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">ldconfig</span>(8)</span></a>.</p>
1.1       dsieger  8187: </li>
1.23      wiz      8188: <li class="listitem"><p>In your <code class="filename">PLIST</code>, include only
1.1       dsieger  8189:        the <code class="filename">.la</code>
                   8190:        file (this is a change from previous behaviour).</p></li>
                   8191: </ol></div>
                   8192: </div>
1.41      asau     8193: <div class="sect2">
1.1       dsieger  8194: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8195: <a name="using-libtool"></a>21.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div>
1.1       dsieger  8196: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to the
                   8197:     package Makefile. This will override the package's own libtool
                   8198:     in most cases.  For older libtool using packages,  libtool is
                   8199:     made by ltconfig script during the do-configure step; you can
1.10      hubertf  8200:     check the libtool script location by doing <span class="command"><strong>make
1.1       dsieger  8201:     configure; find work*/ -name libtool</strong></span>.</p>
                   8202: <p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool
                   8203:     scripts, relative to <code class="varname">WRKSRC</code>, to override.  By
1.23      wiz      8204:     default, it is set to <span class="quote">&#8220;<span class="quote">libtool */libtool
                   8205:     */*/libtool</span>&#8221;</span>.  If this does not match the location of the
1.1       dsieger  8206:     package's libtool script(s), set it as appropriate.</p>
                   8207: <p>If you do not need <code class="filename">*.a</code> static
                   8208:     libraries built and installed, then use
                   8209:     <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
                   8210: <p>If your package makes use of the platform-independent library
                   8211:     for loading dynamic shared objects, that comes with libtool
                   8212:     (libltdl), you should include devel/libltdl/buildlink3.mk.</p>
                   8213: <p>Some packages use libtool incorrectly so that the package
                   8214:     may not work or build in some circumstances. Some of the more
                   8215:     common errors are:</p>
1.41      asau     8216: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      8217: <li class="listitem">
1.1       dsieger  8218: <p>The inclusion of a shared object (-module) as a dependent library in an
                   8219:        executable or library. This in itself isn't a problem if one of two things
                   8220:        has been done:</p>
1.23      wiz      8221: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8222: <li class="listitem"><p>The shared object is named correctly, i.e.
1.1       dsieger  8223:            <code class="filename">libfoo.la</code>, not
                   8224:            <code class="filename">foo.la</code></p></li>
1.23      wiz      8225: <li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li>
1.1       dsieger  8226: </ol></div>
                   8227: </li>
1.23      wiz      8228: <li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines.
1.1       dsieger  8229:        The function lt_dlinit() should be called and the macro
                   8230:        <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in
                   8231:        executables.</p></li>
                   8232: </ul></div>
                   8233: </div>
1.41      asau     8234: <div class="sect2">
1.1       dsieger  8235: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8236: <a name="autoconf-automake"></a>21.3.3. GNU Autoconf/Automake</h3></div></div></div>
1.1       dsieger  8237: <p>If a package needs GNU autoconf or automake to be executed
                   8238:     to regenerate the configure script and Makefile.in makefile
                   8239:     templates, then they should be executed in a pre-configure
                   8240:     target.</p>
                   8241: <p>For packages that need only autoconf:</p>
                   8242: <pre class="programlisting">
                   8243: AUTOCONF_REQD=  2.50            # if default version is not good enough
                   8244: USE_TOOLS+=     autoconf        # use "autoconf213" for autoconf-2.13
                   8245: ...
                   8246: 
                   8247: pre-configure:
                   8248:         cd ${WRKSRC} &amp;&amp; autoconf
                   8249: 
                   8250: ...
1.111     sevan    8251: </pre>
1.1       dsieger  8252: <p>and for packages that need automake and autoconf:</p>
                   8253: <pre class="programlisting">
                   8254: AUTOMAKE_REQD=  1.7.1           # if default version is not good enough
                   8255: USE_TOOLS+=     automake        # use "automake14" for automake-1.4
                   8256: ...
                   8257: 
                   8258: pre-configure:
                   8259:         set -e; cd ${WRKSRC}; \
                   8260:         aclocal; autoheader; automake -a --foreign -i; autoconf
                   8261: 
                   8262: ...
1.111     sevan    8263: </pre>
1.1       dsieger  8264: <p>Packages which use GNU Automake will almost certainly
                   8265:     require GNU Make.</p>
                   8266: <p>There are times when the configure process makes
                   8267:     additional changes to the generated files, which then causes
                   8268:     the build process to try to re-execute the automake sequence.
                   8269:     This is prevented by touching various files in the configure
                   8270:     stage. If this causes problems with your package you can set
                   8271:     <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package
                   8272:     Makefile.</p>
                   8273: </div>
                   8274: </div>
1.41      asau     8275: <div class="sect1">
1.1       dsieger  8276: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   8277: <a name="programming-languages"></a>21.4. Programming languages</h2></div></div></div>
1.41      asau     8278: <div class="sect2">
1.1       dsieger  8279: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8280: <a name="basic-programming-languages"></a>21.4.1. C, C++, and Fortran</h3></div></div></div>
1.1       dsieger  8281: <p>Compilers for the C, C++, and Fortran languages comes with
                   8282:     the NetBSD base system.  By default, pkgsrc assumes that a package
                   8283:     is written in C and will hide all other compilers (via the wrapper
1.154     rillig   8284:     framework, see <a class="xref" href="#buildlink" title="Chapter 16. Buildlink methodology">Chapter 16, <i>Buildlink methodology</i></a>).</p>
1.1       dsieger  8285: <p>To declare which language's compiler a package needs, set
                   8286:     the <code class="varname">USE_LANGUAGES</code> variable. Allowed values
1.23      wiz      8287:     currently are <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">c++</span>&#8221;</span>, and
                   8288:     <span class="quote">&#8220;<span class="quote">fortran</span>&#8221;</span> (and any combination).  The default is
                   8289:     <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>.  Packages using GNU configure scripts, even if
1.1       dsieger  8290:     written in C++, usually need a C compiler for the configure
                   8291:     phase.</p>
                   8292: </div>
1.41      asau     8293: <div class="sect2">
1.1       dsieger  8294: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8295: <a name="java-programming-language"></a>21.4.2. Java</h3></div></div></div>
1.1       dsieger  8296: <p>If a program is written in Java, use the Java framework in
                   8297:     pkgsrc.  The package must include
                   8298:     <code class="filename">../../mk/java-vm.mk</code>.  This Makefile fragment
                   8299:     provides the following variables:</p>
1.41      asau     8300: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      8301: <li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build
1.1       dsieger  8302:       dependency on the JDK is added.  If
1.23      wiz      8303:       <code class="varname">USE_JAVA</code> is set to <span class="quote">&#8220;<span class="quote">run</span>&#8221;</span>, then
1.1       dsieger  8304:       there is only a runtime dependency on the JDK.  The default is
1.23      wiz      8305:       <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, which also adds a build dependency on the
1.1       dsieger  8306:       JDK.</p></li>
1.23      wiz      8307: <li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that
1.1       dsieger  8308:       a package needs a Java2 implementation.  The supported values
1.23      wiz      8309:       are <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span>, and
                   8310:       <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span>.  <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> accepts any Java2
                   8311:       implementation, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span> insists on versions 1.4 or
                   8312:       above, and <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span> only accepts versions 1.5 or
1.1       dsieger  8313:       above. This variable is not set by default.</p></li>
1.24      wiz      8314: <li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is
                   8315:       automatically set to the runtime location of the used Java
                   8316:       implementation dependency. It may be used to set
                   8317:       <code class="varname">JAVA_HOME</code> to a good value if the program
                   8318:       needs this variable to be defined.
                   8319:       </p></li>
1.1       dsieger  8320: </ul></div>
                   8321: </div>
1.41      asau     8322: <div class="sect2">
1.1       dsieger  8323: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8324: <a name="perl-scripts"></a>21.4.3. Packages containing perl scripts</h3></div></div></div>
1.1       dsieger  8325: <p>If your package contains interpreted perl scripts, add
1.23      wiz      8326:     <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to the <code class="varname">USE_TOOLS</code> variable
1.1       dsieger  8327:     and set <code class="varname">REPLACE_PERL</code> to ensure that the proper
                   8328:     interpreter path is set. <code class="varname">REPLACE_PERL</code> should
                   8329:     contain a list of scripts, relative to <code class="varname">WRKSRC</code>,
1.74      wiz      8330:     that you want adjusted. Every occurrence of
                   8331:     <code class="filename">*/bin/perl</code> in a she-bang line will be
                   8332:     replaced with the full path to the perl executable.</p>
1.1       dsieger  8333: <p>If a particular version of perl is needed, set the
                   8334:     <code class="varname">PERL5_REQD</code> variable to the version number.  The
1.23      wiz      8335:     default is <span class="quote">&#8220;<span class="quote">5.0</span>&#8221;</span>.</p>
1.154     rillig   8336: <p>See <a class="xref" href="#perl-modules" title="21.6.6. Packages installing perl modules">Section 21.6.6, &#8220;Packages installing perl modules&#8221;</a> for information
1.1       dsieger  8337:     about handling perl modules.</p>
                   8338: </div>
1.41      asau     8339: <div class="sect2">
1.1       dsieger  8340: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8341: <a name="shell-scripts"></a>21.4.4. Packages containing shell scripts</h3></div></div></div>
1.40      wiz      8342: <p><code class="varname">REPLACE_SH</code>,
                   8343:     <code class="varname">REPLACE_BASH</code>, <code class="varname">REPLACE_CSH</code>,
                   8344:     and <code class="varname">REPLACE_KSH</code> can be used to replace shell
                   8345:     hash bangs in files. Please use the appropriate one, prefering
                   8346:     <code class="varname">REPLACE_SH</code> in case this shell is sufficient.
1.74      wiz      8347:     Each should contain a list of scripts, relative to
                   8348:     <code class="varname">WRKSRC</code>, that you want adjusted. Every
                   8349:     occurrence of the matching shell in a she-bang line will be
                   8350:     replaced with the full path to the shell executable.
1.40      wiz      8351:     When using <code class="varname">REPLACE_BASH</code>, don't forget to add
                   8352:     <code class="filename">bash</code> to <code class="varname">USE_TOOLS</code>.</p>
                   8353: </div>
1.41      asau     8354: <div class="sect2">
1.40      wiz      8355: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8356: <a name="other-programming-languages"></a>21.4.5. Other programming languages</h3></div></div></div>
1.1       dsieger  8357: <p>Currently, there is no special handling for other languages
                   8358:     in pkgsrc.  If a compiler package provides a
                   8359:     <code class="filename">buildlink3.mk</code> file, include that, otherwise
                   8360:     just add a (build) dependency on the appropriate compiler
                   8361:     package.</p>
                   8362: </div>
                   8363: </div>
1.41      asau     8364: <div class="sect1">
1.1       dsieger  8365: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   8366: <a name="fixes.build"></a>21.5. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.1       dsieger  8367: <p>The most common failures when building a package are that
                   8368:        some platforms do not provide certain header files, functions or
                   8369:        libraries, or they provide the functions in a library that the
                   8370:        original package author didn't know. To work around this, you
                   8371:        can rewrite the source code in most cases so that it does not
                   8372:        use the missing functions or provides a replacement function.</p>
1.41      asau     8373: <div class="sect2">
1.1       dsieger  8374: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8375: <a name="fixes.build.cpp"></a>21.5.1. Compiling C and C++ code conditionally</h3></div></div></div>
1.1       dsieger  8376: <p>If a package already comes with a GNU configure script, the
                   8377:        preferred way to fix the build failure is to change the
                   8378:        configure script, not the code. In the other cases, you can
                   8379:        utilize the C preprocessor, which defines certain macros
                   8380:        depending on the operating system and hardware architecture it
                   8381:        compiles for. These macros can be queried using for example
                   8382:        <code class="varname">#if defined(__i386)</code>. Almost every operating
                   8383:        system, hardware architecture and compiler has its own macro.
                   8384:        For example, if the macros <code class="varname">__GNUC__</code>,
                   8385:        <code class="varname">__i386__</code> and <code class="varname">__NetBSD__</code>
                   8386:        are all defined, you know that you are using NetBSD on an i386
                   8387:        compatible CPU, and your compiler is GCC.</p>
                   8388: <p>The list of the following macros for hardware and
                   8389:        operating system depends on the compiler that is used. For
                   8390:        example, if you want to conditionally compile code on Solaris,
                   8391:        don't use <code class="varname">__sun__</code>, as the SunPro compiler
                   8392:        does not define it. Use <code class="varname">__sun</code> instead.</p>
1.41      asau     8393: <div class="sect3">
1.1       dsieger  8394: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   8395: <a name="fixes.build.cpp.os"></a>21.5.1.1. C preprocessor macros to identify the operating system</h4></div></div></div>
1.1       dsieger  8396: <p>To distinguish between 4.4 BSD-derived systems and the
                   8397:         rest of the world, you should use the following code.</p>
                   8398: <pre class="programlisting">
                   8399: #include &lt;sys/param.h&gt;
                   8400: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   8401: /* BSD-specific code goes here */
                   8402: #else
                   8403: /* non-BSD-specific code goes here */
                   8404: #endif
                   8405: </pre>
                   8406: <p>If this distinction is not fine enough, you can also test
                   8407:        for the following macros.</p>
                   8408: <pre class="programlisting">
1.45      obache   8409: Cygwin      __CYGWIN__
                   8410: DragonFly   __DragonFly__
1.1       dsieger  8411: FreeBSD     __FreeBSD__
1.45      obache   8412: Haiku       __HAIKU__
1.1       dsieger  8413: Interix     __INTERIX
                   8414: IRIX        __sgi (TODO: get a definite source for this)
                   8415: Linux       linux, __linux, __linux__
1.83      dholland 8416: Mac OS X    __APPLE__
1.45      obache   8417: MirBSD      __MirBSD__ (__OpenBSD__ is also defined)
                   8418: Minix3      __minix
1.1       dsieger  8419: NetBSD      __NetBSD__
                   8420: OpenBSD     __OpenBSD__
                   8421: Solaris     sun, __sun
                   8422: </pre>
                   8423: </div>
1.41      asau     8424: <div class="sect3">
1.1       dsieger  8425: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   8426: <a name="fixes.build.cpp.arch"></a>21.5.1.2. C preprocessor macros to identify the hardware architecture</h4></div></div></div>
1.1       dsieger  8427: <pre class="programlisting">
                   8428: i386        i386, __i386, __i386__
                   8429: MIPS        __mips
                   8430: SPARC       sparc, __sparc
                   8431: </pre>
                   8432: </div>
1.41      asau     8433: <div class="sect3">
1.1       dsieger  8434: <div class="titlepage"><div><div><h4 class="title">
1.154     rillig   8435: <a name="fixes.build.cpp.compiler"></a>21.5.1.3. C preprocessor macros to identify the compiler</h4></div></div></div>
1.1       dsieger  8436: <pre class="programlisting">
                   8437: GCC         __GNUC__ (major version), __GNUC_MINOR__
                   8438: MIPSpro     _COMPILER_VERSION (0x741 for MIPSpro 7.41)
                   8439: SunPro      __SUNPRO_C (0x570 for Sun C 5.7)
                   8440: SunPro C++  __SUNPRO_CC (0x580 for Sun C++ 5.8)
                   8441: </pre>
                   8442: </div>
                   8443: </div>
1.41      asau     8444: <div class="sect2">
1.1       dsieger  8445: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8446: <a name="compiler-bugs"></a>21.5.2. How to handle compiler bugs</h3></div></div></div>
1.1       dsieger  8447: <p>Some source files trigger bugs in the compiler, based on
                   8448:         combinations of compiler version and architecture and almost
                   8449:         always relation to optimisation being enabled.  Common symptoms
                   8450:         are gcc internal errors or never finishing compiling a
                   8451:        file.</p>
                   8452: <p>Typically, a workaround involves testing the
                   8453:         <code class="varname">MACHINE_ARCH</code> and compiler version, disabling
                   8454:         optimisation for that combination of file,
1.87      tnn      8455:        <code class="varname">MACHINE_ARCH</code> and compiler.</p>
                   8456: <p>This used to be a big problem in the past, but is rarely
                   8457:        needed now as compiler technology has matured. If you still need
                   8458:        to add a compiler specific workaround, please do so in the file
                   8459:        <code class="filename">hacks.mk</code> and describe the symptom and
                   8460:        compiler version as detailed as possible.</p>
1.1       dsieger  8461: </div>
1.41      asau     8462: <div class="sect2">
1.1       dsieger  8463: <div class="titlepage"><div><div><h3 class="title">
1.172     rillig   8464: <a name="fixes.build.header"></a>21.5.3. No such file or directory</h3></div></div></div>
                   8465: <p>Compilation sometimes fails with an error message like this:</p>
                   8466: <pre class="programlisting">
                   8467: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
                   8468:     fatal error: pango/pango.h: No such file or directory
                   8469: </pre>
                   8470: <p>The proper way to fix this problem depends on the type of the
                   8471: header, which is described in the following sections.</p>
                   8472: <div class="sect3">
                   8473: <div class="titlepage"><div><div><h4 class="title">
                   8474: <a name="fixes.build.header.bl3"></a>21.5.3.1. Headers from other packages</h4></div></div></div>
                   8475: <p>If the header name looks like it comes from a different package,
                   8476: that other package should be included via the buildlink3
                   8477: framework.</p>
                   8478: <p>First, look whether the header is somewhere in the buildlink3
                   8479: directory below <code class="varname">WRKDIR</code>. In the above case of
                   8480: the missing Pango header:</p>
                   8481: <pre class="programlisting">
                   8482: <code class="prompt">$</code> find work/.buildlink/ -print | grep -F pango/pango.h
                   8483: </pre>
                   8484: <p>In the case of Pango, the output is:</p>
                   8485: <pre class="programlisting">
                   8486: work/.buildlink/include/pango-1.0/pango/pango.h
                   8487: </pre>
                   8488: <p>If the <code class="filename">pango/pango.h</code> file were placed directly
                   8489: in the <code class="filename">.buildlink</code> directory, it would have been
                   8490: found automatically. There is an extra <code class="filename">pango-1.0</code>
                   8491: path component though, which means that the compiler command line must
                   8492: contain an option of the form
                   8493: <code class="literal">-I${BUILDLINK3_PREFIX.pango}/include/pango-1.0</code>. In
                   8494: most cases this option is generated by the configure script, which can be examined using:</p>
                   8495: <pre class="programlisting">
                   8496: <code class="prompt">$</code> $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
                   8497: -I/usr/pkg/include/pango-1.0
                   8498: -I/usr/pkg/include/pango-1.0
                   8499: -I/usr/pkg/include/pango-1.0
                   8500: -I/usr/pkg/include/pango-1.0
                   8501: -I/usr/pkg/include/pango-1.0
                   8502: </pre>
                   8503: <p>This looks good. These options are transformed by the buildlink
                   8504: wrapper to refer to the correct path inside
                   8505: <code class="filename">work/.buildlink</code>.</p>
                   8506: <p>Since the compilation fails though, examine the compiler command
                   8507: lines in <code class="filename">work/.work.log</code> to see whether the
                   8508: <code class="literal">-I</code> option is included in the particular command
                   8509: line.</p>
                   8510: <p>To further analyze the situation, run <span class="command"><strong>bmake
                   8511: build-env</strong></span>, which sets up an interactive, realistic environment
                   8512: including all the pkgsrc wrapper commands and environment variables. From
                   8513: there, try to compile some simple example programs that use the
                   8514: header.</p>
                   8515: </div>
                   8516: <div class="sect3">
                   8517: <div class="titlepage"><div><div><h4 class="title">
                   8518: <a name="fixes.build.header.gen"></a>21.5.3.2. Headers generated during the build</h4></div></div></div>
                   8519: <p>If the name of the header seems to come from the package itself,
                   8520: and if the build is run with parallel jobs, the package may have some
                   8521: undeclared dependencies between the <code class="filename">.c</code> and the
                   8522: <code class="filename">.h</code> files, and a C file is compiled before its
                   8523: required header is generated.</p>
                   8524: <p>To see whether the build runs with parallel jobs, run
                   8525: <span class="command"><strong>bmake show-all-build | grep JOBS</strong></span>. Its output looks
                   8526: like this:</p>
                   8527: <pre class="programlisting">
                   8528:   usr   MAKE_JOBS=              7
                   8529:   pkg   MAKE_JOBS_SAFE          # undefined
                   8530:   def   _MAKE_JOBS_N=           7
                   8531: </pre>
                   8532: <p>In this case the pkgsrc user has asked pkgsrc to build packages
                   8533: with 7 jobs in parallel (<code class="varname">MAKE_JOBS</code>). The
                   8534: package could have disabled parallel builds by setting
                   8535: <code class="varname">MAKE_JOBS_SAFE</code> to <code class="literal">no</code>, but
                   8536: in this case it hasn't.</p>
                   8537: <p>To see whether the build failure is caused by parallel builds,
                   8538: first save the exact error message and a bit of context, maybe you need
                   8539: it later for reporting a bug. Next, run:</p>
                   8540: <pre class="programlisting">
                   8541: MAKE_JOBS_SAFE=no bmake clean build
                   8542: </pre>
                   8543: <p>If that succeeds, <a class="ulink" href="https://www.NetBSD.org/cgi-bin/sendpr.cgi?gndb=netbsd" target="_top">file a bug
                   8544: report</a> against the pkgsrc package, including the exact error
                   8545: message and the contents of your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file.</p>
                   8546: </div>
1.173     rillig   8547: <div class="sect3">
                   8548: <div class="titlepage"><div><div><h4 class="title">
                   8549: <a name="fixes.build.header.symlink"></a>21.5.3.3. Symlinks</h4></div></div></div>
                   8550: <p>Pkgsrc does not work reliably if any of
                   8551: <code class="varname">LOCALBASE</code>, <code class="varname">VARBASE</code> or
                   8552: <code class="varname">WRKDIR</code> contains a symlink. Since 2019Q2, the pkgsrc
                   8553: bootstrap program prevents installing pkgsrc in symlink-based
                   8554: directories. Existing pkgsrc installations are not checked for symlinks
                   8555: though.</p>
                   8556: <p>The "No such file or directory" error messages are a typical
                   8557: symptom of symlinks, and it's quite difficult to find out that this is
                   8558: the actual cause.</p>
                   8559: </div>
                   8560: <div class="sect3">
                   8561: <div class="titlepage"><div><div><h4 class="title">
                   8562: <a name="fixes.build.header.stale"></a>21.5.3.4. Stale working directories</h4></div></div></div>
                   8563: <p>When building a hierarchy of packages, it may happen that one
                   8564: package is built and then pkgsrc is updated. This situation can provoke
                   8565: various hard to diagnose build errors. To clean up the situation:</p>
                   8566: <pre class="programlisting">
                   8567: <code class="prompt">$</code> (cd ../../ &amp;&amp; test -f mk/bsd.pkg.mk &amp;&amp; rm -rf */*/work)
                   8568: </pre>
                   8569: <p>(The test for <code class="filename">bsd.pkg.mk</code> just prevents running
                   8570: this command in the wrong directory.)</p>
                   8571: <p>If you have set <code class="varname">WRKOBJDIR</code> in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, remove
                   8572: that directory as well.</p>
                   8573: </div>
                   8574: <div class="sect3">
                   8575: <div class="titlepage"><div><div><h4 class="title">
                   8576: <a name="fixes.build.header.misc"></a>21.5.3.5. Other possible reasons</h4></div></div></div>
                   8577: <p>On platforms other than BSD, third-party packages are installed in
                   8578: <code class="filename">/usr/include</code>, together with the base system. This
                   8579: means that pkgsrc cannot distinguish between headers provided by the base
                   8580: system (which it needs) and headers from third-party packages (which are
                   8581: often included in pkgsrc as well). This can lead to subtle version
                   8582: mismatches.</p>
                   8583: <p>In pkgsrc installations that have been active for several years, it
                   8584: may happen that some files are manually deleted. To exclude this unlikely
                   8585: reason, run <span class="command"><strong>pkg_admin check</strong></span>.</p>
                   8586: <p>It may help to run <span class="command"><strong>pkg_admin rebuild-tree</strong></span> to
                   8587: check/fix dependencies.</p>
                   8588: <p>If all of the above doesn't help, see <a class="xref" href="#help-user" title="Chapter 2. Getting help">Chapter 2, <i>Getting help</i></a>
                   8589: for contact information. Be prepared to describe what you have tried so
                   8590: far and what any error messages were.</p>
                   8591: </div>
1.172     rillig   8592: </div>
                   8593: <div class="sect2">
                   8594: <div class="titlepage"><div><div><h3 class="title">
                   8595: <a name="undefined-reference"></a>21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span>
1.23      wiz      8596: </h3></div></div></div>
1.1       dsieger  8597: <p>This error message often means that a package did not
                   8598:        link to a shared library it needs. The following functions are
                   8599:        known to cause this error message over and over.</p>
                   8600: <div class="informaltable">
1.106     tnn      8601: <a name="undefined-reference-functions"></a><table class="informaltable" border="1">
1.1       dsieger  8602: <colgroup>
                   8603: <col>
                   8604: <col>
                   8605: <col>
                   8606: </colgroup>
                   8607: <thead><tr>
                   8608: <th>Function</th>
                   8609: <th>Library</th>
                   8610: <th>Affected platforms</th>
                   8611: </tr></thead>
                   8612: <tbody>
                   8613: <tr>
                   8614: <td>accept, bind, connect</td>
                   8615: <td>-lsocket</td>
                   8616: <td>Solaris</td>
                   8617: </tr>
                   8618: <tr>
                   8619: <td>crypt</td>
                   8620: <td>-lcrypt</td>
                   8621: <td>DragonFly, NetBSD</td>
                   8622: </tr>
                   8623: <tr>
                   8624: <td>dlopen, dlsym</td>
                   8625: <td>-ldl</td>
                   8626: <td>Linux</td>
                   8627: </tr>
                   8628: <tr>
                   8629: <td>gethost*</td>
                   8630: <td>-lnsl</td>
                   8631: <td>Solaris</td>
                   8632: </tr>
                   8633: <tr>
                   8634: <td>inet_aton</td>
                   8635: <td>-lresolv</td>
                   8636: <td>Solaris</td>
                   8637: </tr>
                   8638: <tr>
                   8639: <td>nanosleep, sem_*, timer_*</td>
                   8640: <td>-lrt</td>
                   8641: <td>Solaris</td>
                   8642: </tr>
                   8643: <tr>
                   8644: <td>openpty</td>
                   8645: <td>-lutil</td>
                   8646: <td>Linux</td>
                   8647: </tr>
                   8648: </tbody>
                   8649: </table>
                   8650: </div>
                   8651: <p>To fix these linker errors, it is often sufficient to say
                   8652:     <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+=
                   8653:     -l<em class="replaceable"><code>foo</code></em></code> to the package
1.10      hubertf  8654:     <code class="filename">Makefile</code> and then say <span class="command"><strong>bmake clean;
1.1       dsieger  8655:     bmake</strong></span>.</p>
1.41      asau     8656: <div class="sect3">
1.1       dsieger  8657: <div class="titlepage"><div><div><h4 class="title">
1.172     rillig   8658: <a name="undefined-reference-sunpro"></a>21.5.4.1. Special issue: The SunPro compiler</h4></div></div></div>
1.1       dsieger  8659: <p>When you are using the SunPro compiler, there is another
                   8660: possibility. That compiler cannot handle the following code:</p>
                   8661: <pre class="programlisting">
                   8662: extern int extern_func(int);
                   8663: 
                   8664: static inline int
                   8665: inline_func(int x)
                   8666: {
                   8667:         return extern_func(x);
                   8668: }
                   8669: 
                   8670: int main(void)
                   8671: {
                   8672:         return 0;
                   8673: }
                   8674: </pre>
                   8675: <p>It generates the code for <code class="function">inline_func</code> even if
                   8676: that function is never used. This code then refers to
                   8677: <code class="function">extern_func</code>, which can usually not be resolved. To
                   8678: solve this problem you can try to tell the package to disable inlining
                   8679: of functions.</p>
                   8680: </div>
                   8681: </div>
1.41      asau     8682: <div class="sect2">
1.1       dsieger  8683: <div class="titlepage"><div><div><h3 class="title">
1.172     rillig   8684: <a name="out-of-memory"></a>21.5.5. Running out of memory</h3></div></div></div>
1.1       dsieger  8685: <p>Sometimes packages fail to build because the compiler runs
                   8686:     into an operating system specific soft limit.  With the
                   8687:     <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told
1.94      wiz      8688:     to unlimit the resources.  Currently, the allowed values are any combination of
                   8689:     <span class="quote">&#8220;<span class="quote">cputime</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">datasize</span>&#8221;</span>,
                   8690:     <span class="quote">&#8220;<span class="quote">memorysize</span>&#8221;</span>, and <span class="quote">&#8220;<span class="quote">stacksize</span>&#8221;</span>.
1.1       dsieger  8691:     Setting this variable is similar to running the shell builtin
1.10      hubertf  8692:     <span class="command"><strong>ulimit</strong></span> command to raise the maximum data
1.1       dsieger  8693:     segment size or maximum stack size of a process, respectively, to
                   8694:     their hard limits.</p>
                   8695: </div>
                   8696: </div>
1.41      asau     8697: <div class="sect1">
1.1       dsieger  8698: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   8699: <a name="fixes.install"></a>21.6. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.41      asau     8700: <div class="sect2">
1.1       dsieger  8701: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8702: <a name="install-scripts"></a>21.6.1. Creating needed directories</h3></div></div></div>
1.10      hubertf  8703: <p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied
1.1       dsieger  8704:     with some operating systems cannot create more than one
                   8705:     directory at a time. As such, you should call
                   8706:     <code class="literal">${INSTALL_*_DIR}</code> like this:</p>
                   8707: <pre class="programlisting">
                   8708: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8709: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.111     sevan    8710: </pre>
1.23      wiz      8711: <p>You can also just append <span class="quote">&#8220;<span class="quote"><code class="literal">dir1
                   8712:     dir2</code></span>&#8221;</span> to the
1.1       dsieger  8713:     <code class="varname">INSTALLATION_DIRS</code> variable, which will
                   8714:     automatically do the right thing.</p>
                   8715: </div>
1.41      asau     8716: <div class="sect2">
1.1       dsieger  8717: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8718: <a name="where-to-install-documentation"></a>21.6.2. Where to install documentation</h3></div></div></div>
1.1       dsieger  8719: <p>In general, documentation should be installed into
                   8720:     <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
                   8721:     <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code> (the latter
                   8722:     includes the version number of the package).</p>
                   8723: <p>Many modern packages using GNU autoconf allow to set the
                   8724:     directory where HTML documentation is installed with the
1.23      wiz      8725:     <span class="quote">&#8220;<span class="quote">--with-html-dir</span>&#8221;</span> option. Sometimes using this flag
1.1       dsieger  8726:     is needed because otherwise the documentation ends up in
                   8727:     <code class="filename">${PREFIX}/share/doc/html</code> or other
                   8728:     places.</p>
                   8729: <p>An exception to the above is that library API documentation
1.137     leot     8730:     generated with the <a href="https://cdn.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
1.1       dsieger  8731:     browsers (devhelp) should be left at their default location, which
                   8732:     is <code class="filename">${PREFIX}/share/gtk-doc</code>.  Such
                   8733:     documentation can be recognized from files ending in
                   8734:     <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>.
                   8735:     (It is also acceptable to install such files in
                   8736:     <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
                   8737:     <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the
                   8738:     <code class="filename">.devhelp*</code> file must be directly in that
                   8739:     directory then, no additional subdirectory level is allowed in
                   8740:     this case. This is usually achieved by using
1.23      wiz      8741:     <span class="quote">&#8220;<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>&#8221;</span>.
1.1       dsieger  8742:     <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred
                   8743:     though.)</p>
                   8744: </div>
1.41      asau     8745: <div class="sect2">
1.1       dsieger  8746: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8747: <a name="installing-score-files"></a>21.6.3. Installing highscore files</h3></div></div></div>
1.1       dsieger  8748: <p>Certain packages, most of them in the games category, install
                   8749:     a score file that allows all users on the system to record their
                   8750:     highscores.  In order for this to work, the binaries need to be
                   8751:     installed setgid and the score files owned by the appropriate
1.35      wiz      8752:     group and/or owner (traditionally the "games" user/group).  Set
                   8753:     <code class="varname">USE_GAMESGROUP</code> to yes to support this. The
1.1       dsieger  8754:     following variables, documented in more detail in
                   8755:     <code class="filename">mk/defaults/mk.conf</code>, control this
1.35      wiz      8756:     behaviour: <code class="varname">GAMEDATAMODE</code>,
                   8757:     <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>,
1.100     leot     8758:     <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.
                   8759:     Other useful variables are: <code class="varname">GAMEDIR_PERMS</code>,
                   8760:     <code class="varname">GAMEDATA_PERMS</code> and
                   8761:     <code class="varname">SETGID_GAMES_PERMS</code>.</p>
                   8762: <p>An example that illustrates some of the variables described above is
                   8763:     <code class="filename">games/moon-buggy</code>. <code class="varname">OWN_DIRS_PERMS</code> is
                   8764:     used to properly set directory permissions of the directory where the
                   8765:     scorefile is saved, <code class="varname">REQD_FILES_PERMS</code> is used to create a
                   8766:     dummy scorefile (<code class="filename">mbscore</code>) with the proper permissions
                   8767:     and <code class="varname">SPECIAL_PERMS</code> is used to install setgid the game
                   8768:     binary:</p>
                   8769: <pre class="programlisting">
1.112     rillig   8770: USE_GAMESGROUP=         yes
1.100     leot     8771: 
1.112     rillig   8772: BUILD_DEFS+=            VARBASE
1.100     leot     8773: 
1.112     rillig   8774: OWN_DIRS_PERMS+=        ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
                   8775: REQD_FILES_PERMS+=      /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
                   8776: SPECIAL_PERMS+=         ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
1.111     sevan    8777: </pre>
1.100     leot     8778: <p>Various <code class="varname">INSTALL_*</code> variables are also available:
                   8779:     <code class="varname">INSTALL_GAME</code> to install setgid game binaries,
                   8780:     <code class="varname">INSTALL_GAME_DIR</code> to install game directories that are
                   8781:     needed to be accessed by setgid games and
                   8782:     <code class="varname">INSTALL_GAME_DATA</code> to install scorefiles.</p>
1.14      jmcneill 8783: <p>A package should therefore never hard code file ownership or
1.100     leot     8784:     access permissions but rely on <code class="varname">*_PERMS</code> as described above
                   8785:     or alternatively on <code class="varname">INSTALL_GAME</code>,
                   8786:     <code class="varname">INSTALL_GAME_DATA</code> and
                   8787:     <code class="varname">INSTALL_GAME_DIR</code> to set these correctly.</p>
1.1       dsieger  8788: </div>
1.41      asau     8789: <div class="sect2">
1.1       dsieger  8790: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8791: <a name="destdir-support"></a>21.6.4. Adding DESTDIR support to packages</h3></div></div></div>
1.14      jmcneill 8792: <p><code class="varname">DESTDIR</code> support means that a package
                   8793:     installs into a staging directory, not the final location of the
                   8794:     files. Then a binary package is created which can be used for
                   8795:     installation as usual. There are two ways: Either the package must
1.23      wiz      8796:     install as root (<span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span>) or the package can
                   8797:     install as non-root user (<span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>).</p>
1.41      asau     8798: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      8799: <li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be
1.113     leot     8800:       set to <span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>.
                   8801:       By default <code class="varname">PKG_DESTDIR_SUPPORT</code>
1.38      wiz      8802:       is set to <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span> to help catching more
                   8803:       potential packaging problems. If bsd.prefs.mk is included in the Makefile,
1.14      jmcneill 8804:       <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before
                   8805:       the inclusion.</p></li>
1.23      wiz      8806: <li class="listitem"><p>All installation operations have to be prefixed with
1.4       rillig   8807:       <code class="filename">${DESTDIR}</code>.</p></li>
1.23      wiz      8808: <li class="listitem"><p>automake gets this DESTDIR mostly right
1.4       rillig   8809:       automatically. Many manual rules and pre/post-install often are
                   8810:       incorrect; fix them.</p></li>
1.23      wiz      8811: <li class="listitem"><p>If files are installed with special owner/group
1.17      imil     8812:       use <code class="varname">SPECIAL_PERMS</code>.</p></li>
1.23      wiz      8813: <li class="listitem"><p>In general, packages should support
1.4       rillig   8814:       <code class="varname">UNPRIVILEGED</code> to be able to use
                   8815:       DESTDIR.</p></li>
                   8816: </ul></div>
                   8817: </div>
1.41      asau     8818: <div class="sect2">
1.4       rillig   8819: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8820: <a name="hardcoded-paths"></a>21.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div>
1.1       dsieger  8821: <p>Your package may also contain scripts with hardcoded paths to
                   8822:       other interpreters besides (or as well as) perl.  To correct the
                   8823:       full pathname to the script interpreter, you need to set the
                   8824:       following definitions in your <code class="filename">Makefile</code> (we
1.10      hubertf  8825:     shall use <span class="command"><strong>tclsh</strong></span> in this example):</p>
1.1       dsieger  8826: <pre class="programlisting">
                   8827: REPLACE_INTERPRETER+=   tcl
                   8828: REPLACE.tcl.old=        .*/bin/tclsh
                   8829: REPLACE.tcl.new=        ${PREFIX}/bin/tclsh
                   8830: REPLACE_FILES.tcl=      # list of tcl scripts which need to be fixed,
                   8831: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.111     sevan    8832: </pre>
1.41      asau     8833: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  8834: <h3 class="title">Note</h3>
                   8835: <p>Before March 2006, these variables were called
                   8836:     <code class="varname">_REPLACE.*</code> and
                   8837:     <code class="varname">_REPLACE_FILES.*</code>.</p>
                   8838: </div>
                   8839: </div>
1.41      asau     8840: <div class="sect2">
1.1       dsieger  8841: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8842: <a name="perl-modules"></a>21.6.6. Packages installing perl modules</h3></div></div></div>
1.1       dsieger  8843: <p>Makefiles of packages providing perl5 modules should include
                   8844:     the Makefile fragment
                   8845:     <code class="filename">../../lang/perl5/module.mk</code>.  It provides a
1.10      hubertf  8846:     <span class="command"><strong>do-configure</strong></span> target for the standard perl
1.1       dsieger  8847:     configuration for such modules as well as various hooks to tune
                   8848:     this configuration.  See comments in this file for
                   8849:     details.</p>
                   8850: <p>Perl5 modules will install into different places depending
                   8851:     on the version of perl used during the build process.  To
                   8852:     address this, pkgsrc will append lines to the
                   8853:     <code class="filename">PLIST</code> corresponding to the files listed in
                   8854:     the installed <code class="filename">.packlist</code> file generated by
                   8855:     most perl5 modules.  This is invoked by defining
                   8856:     <code class="varname">PERL5_PACKLIST</code> to a space-separated list of
1.47      wiz      8857:     packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code>
                   8858:     (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default),
                   8859:     e.g.:</p>
1.1       dsieger  8860: <pre class="programlisting">
1.47      wiz      8861: PERL5_PACKLIST= auto/Pg/.packlist
1.111     sevan    8862: </pre>
1.47      wiz      8863: <p>The perl5 config variables
                   8864:     <code class="varname">installarchlib</code>,
                   8865:     <code class="varname">installscript</code>,
                   8866:     <code class="varname">installvendorbin</code>,
                   8867:     <code class="varname">installvendorscript</code>,
                   8868:     <code class="varname">installvendorarch</code>,
                   8869:     <code class="varname">installvendorlib</code>,
                   8870:     <code class="varname">installvendorman1dir</code>, and
                   8871:     <code class="varname">installvendorman3dir</code> represent those
                   8872:     locations in which components of perl5 modules may be installed,
                   8873:     provided as variable with uppercase and prefixed with
                   8874:     <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code>
                   8875:     and may be used by perl5 packages that don't have a packlist.
                   8876:     These variables are also substituted for in the
                   8877:     <code class="filename">PLIST</code> as uppercase prefixed with
                   8878:     <code class="varname">PERL5_SUB_</code>.</p>
1.1       dsieger  8879: </div>
1.41      asau     8880: <div class="sect2">
1.1       dsieger  8881: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8882: <a name="faq.info-files"></a>21.6.7. Packages installing info files</h3></div></div></div>
1.1       dsieger  8883: <p>Some packages install info files or use the
1.23      wiz      8884:     <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span>  or <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span>
1.1       dsieger  8885:     commands.  <code class="varname">INFO_FILES</code> should be defined in
                   8886:     the package Makefile so that <code class="filename">INSTALL</code> and
                   8887:     <code class="filename">DEINSTALL</code> scripts will be generated to
                   8888:     handle registration of the info files in the Info directory
1.23      wiz      8889:     file. The <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span> command used for the info
1.1       dsieger  8890:     files registration is either provided by the system, or by a
                   8891:     special purpose package automatically added as dependency if
                   8892:     needed.</p>
                   8893: <p><code class="varname">PKGINFODIR</code> is the directory under
                   8894:     <code class="filename">${PREFIX}</code> where info files are primarily
                   8895:     located. <code class="varname">PKGINFODIR</code> defaults to
1.23      wiz      8896:     <span class="quote">&#8220;<span class="quote">info</span>&#8221;</span> and can be overridden by the user.</p>
1.1       dsieger  8897: <p>The info files for the package should be listed in the
                   8898:     package <code class="filename">PLIST</code>; however any split info files
                   8899:     need not be listed.</p>
1.23      wiz      8900: <p>A package which needs the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command
                   8901:     at build time must add <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> to
1.1       dsieger  8902:     <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum
1.23      wiz      8903:     version of the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command is needed it
1.1       dsieger  8904:     should be noted with the <code class="varname">TEXINFO_REQD</code>
                   8905:     variable in the package <code class="filename">Makefile</code>. By
                   8906:     default, a minimum version of 3.12 is required. If the system
1.10      hubertf  8907:     does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it
1.1       dsieger  8908:     does not match the required minimum, a build dependency on the
1.137     leot     8909:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/gtexinfo/README.html" target="_top"><code class="filename">devel/gtexinfo</code></a> package will
1.1       dsieger  8910:     be added automatically.</p>
                   8911: <p>The build and installation process of the software provided
                   8912:     by the package should not use the
1.10      hubertf  8913:     <span class="command"><strong>install-info</strong></span> command as the registration of
1.1       dsieger  8914:     info files is the task of the package
                   8915:     <code class="filename">INSTALL</code> script, and it must use the
1.10      hubertf  8916:     appropriate <span class="command"><strong>makeinfo</strong></span> command.</p>
1.1       dsieger  8917: <p>To achieve this goal, the pkgsrc infrastructure creates
1.10      hubertf  8918:     overriding scripts for the <span class="command"><strong>install-info</strong></span> and
                   8919:     <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early
1.1       dsieger  8920:     in <code class="varname">PATH</code>.</p>
1.10      hubertf  8921: <p>The script overriding <span class="command"><strong>install-info</strong></span> has
1.1       dsieger  8922:     no effect except the logging of a message. The script overriding
1.10      hubertf  8923:     <span class="command"><strong>makeinfo</strong></span> logs a message and according to the
1.1       dsieger  8924:     value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate
1.10      hubertf  8925:     <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p>
1.1       dsieger  8926: </div>
1.41      asau     8927: <div class="sect2">
1.1       dsieger  8928: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8929: <a name="manpages"></a>21.6.8. Packages installing man pages</h3></div></div></div>
1.1       dsieger  8930: <p>All packages that install manual pages should install them
                   8931:     into the same directory, so that there is one common place to look
                   8932:     for them. In pkgsrc, this place is
                   8933:     <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression
                   8934:     should be used in packages. The default for
                   8935:     <code class="varname">PKGMANDIR</code> is
1.23      wiz      8936:     <span class="quote">&#8220;<span class="quote"><code class="filename">man</code></span>&#8221;</span>. Another often-used value
                   8937:     is <span class="quote">&#8220;<span class="quote"><code class="filename">share/man</code></span>&#8221;</span>.</p>
1.41      asau     8938: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  8939: <h3 class="title">Note</h3>
                   8940: <p>The support for a custom <code class="varname">PKGMANDIR</code>
                   8941:     is far from complete.</p>
                   8942: </div>
                   8943: <p>The <code class="filename">PLIST</code> files can just use
                   8944:     <code class="filename">man/</code> as the top level directory for the man
                   8945:     page file entries, and the pkgsrc framework will convert as
                   8946:     needed. In all other places, the correct
                   8947:     <code class="varname">PKGMANDIR</code> must be used.</p>
                   8948: <p>Packages that are
                   8949:     configured with <code class="varname">GNU_CONFIGURE</code> set as
1.23      wiz      8950:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, by default will use the
1.1       dsieger  8951:     <code class="filename">./configure</code>
                   8952:     --mandir switch to set where the man pages should be installed.
                   8953:     The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults
                   8954:     to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   8955: <p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not
                   8956:     use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code>
1.23      wiz      8957:     to <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>.
1.1       dsieger  8958:     Or if the <code class="filename">./configure</code> script uses
                   8959:     a non-standard use of --mandir, you can set
                   8960:     <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
1.154     rillig   8961: <p>See <a class="xref" href="#manpage-compression" title="15.5. Man page compression">Section 15.5, &#8220;Man page compression&#8221;</a> for
1.1       dsieger  8962:     information on installation of compressed manual pages.</p>
                   8963: </div>
1.41      asau     8964: <div class="sect2">
1.1       dsieger  8965: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   8966: <a name="gconf-data-files"></a>21.6.9. Packages installing GConf data files</h3></div></div></div>
1.1       dsieger  8967: <p>If a package installs <code class="filename">.schemas</code> or
1.7       rillig   8968:     <code class="filename">.entries</code> files, used by GConf,
1.1       dsieger  8969:     you need to take some extra steps to make sure they get registered
                   8970:     in the database:</p>
1.23      wiz      8971: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8972: <li class="listitem"><p>Include <code class="filename">../../devel/GConf/schemas.mk</code>
1.1       dsieger  8973:        instead of its <code class="filename">buildlink3.mk</code> file.  This
1.7       rillig   8974:        takes care of rebuilding the GConf database at installation and
1.1       dsieger  8975:        deinstallation time, and tells the package where to install
1.7       rillig   8976:        GConf data files using some standard configure arguments.  It
1.1       dsieger  8977:        also disallows any access to the database directly from the
                   8978:        package.</p></li>
1.23      wiz      8979: <li class="listitem"><p>Ensure that the package installs its
1.1       dsieger  8980:        <code class="filename">.schemas</code> files under
                   8981:        <code class="filename">${PREFIX}/share/gconf/schemas</code>.  If they get
                   8982:        installed under <code class="filename">${PREFIX}/etc</code>, you will
                   8983:        need to manually patch the package.</p></li>
1.23      wiz      8984: <li class="listitem"><p>Check the PLIST and remove any entries under the etc/gconf
1.1       dsieger  8985:        directory, as they will be handled automatically.  See
1.154     rillig   8986:        <a class="xref" href="#faq.conf" title="10.13. How do I change the location of configuration files?">Section 10.13, &#8220;How do I change the location of configuration files?&#8221;</a> for more information.</p></li>
1.23      wiz      8987: <li class="listitem"><p>Define the <code class="varname">GCONF_SCHEMAS</code> variable in
1.1       dsieger  8988:        your <code class="filename">Makefile</code> with a list of all
                   8989:        <code class="filename">.schemas</code> files installed by the package, if
                   8990:        any.  Names must not contain any directories in them.</p></li>
1.23      wiz      8991: <li class="listitem"><p>Define the <code class="varname">GCONF_ENTRIES</code> variable in
1.1       dsieger  8992:        your <code class="filename">Makefile</code> with a
                   8993:        list of all <code class="filename">.entries</code> files installed by the
                   8994:        package, if any. Names must not contain any directories in
                   8995:        them.</p></li>
                   8996: </ol></div>
                   8997: </div>
1.41      asau     8998: <div class="sect2">
1.1       dsieger  8999: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9000: <a name="scrollkeeper-data-files"></a>21.6.10. Packages installing scrollkeeper/rarian data files</h3></div></div></div>
1.1       dsieger  9001: <p>If a package installs <code class="filename">.omf</code> files, used by
1.18      snj      9002:     scrollkeeper/rarian, you need to take some extra steps to make sure they
1.1       dsieger  9003:     get registered in the database:</p>
1.23      wiz      9004: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9005: <li class="listitem"><p>Include
1.18      snj      9006:        <code class="filename">../../mk/omf-scrollkeeper.mk</code>
                   9007:        instead of rarian's <code class="filename">buildlink3.mk</code> file.  This
1.1       dsieger  9008:        takes care of rebuilding the scrollkeeper database at
                   9009:        installation and deinstallation time, and disallows any access
                   9010:        to it directly from the package.</p></li>
1.23      wiz      9011: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.1       dsieger  9012:        <code class="filename">libdata/scrollkeeper</code> directory, as they
                   9013:        will be handled automatically.</p></li>
1.23      wiz      9014: <li class="listitem"><p>Remove the <code class="filename">share/omf</code> directory from
1.18      snj      9015:        the PLIST.  It will be handled by rarian. (<span class="command"><strong>make
                   9016:        print-PLIST</strong></span> does this automatically.)</p></li>
1.1       dsieger  9017: </ol></div>
                   9018: </div>
1.41      asau     9019: <div class="sect2">
1.1       dsieger  9020: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9021: <a name="x11-fonts"></a>21.6.11. Packages installing X11 fonts</h3></div></div></div>
1.1       dsieger  9022: <p>If a package installs font files, you will need to rebuild
                   9023:     the fonts database in the directory where they get installed at
                   9024:     installation and deinstallation time.  This can be automatically
                   9025:     done by using the pkginstall framework.</p>
                   9026: <p>You can list the directories where fonts are installed in the
                   9027:     <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code>
                   9028:     variables, where <em class="replaceable"><code>type</code></em> can be one of
1.23      wiz      9029:     <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">type1</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">x11</span>&#8221;</span>.
1.1       dsieger  9030:     Also make sure that the database file
                   9031:     <code class="filename">fonts.dir</code> is not listed in the PLIST.</p>
                   9032: <p>Note that you should not create new directories for fonts;
                   9033:     instead use the standard ones to avoid that the user needs to
                   9034:     manually configure his X server to find them.</p>
                   9035: </div>
1.41      asau     9036: <div class="sect2">
1.1       dsieger  9037: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9038: <a name="gtk2-modules"></a>21.6.12. Packages installing GTK2 modules</h3></div></div></div>
1.1       dsieger  9039: <p>If a package installs GTK2 immodules or loaders, you need to
                   9040:     take some extra steps to get them registered in the GTK2 database
                   9041:     properly:</p>
1.23      wiz      9042: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9043: <li class="listitem"><p>Include
1.1       dsieger  9044:       <code class="filename">../../x11/gtk2/modules.mk</code> instead of its
                   9045:       <code class="filename">buildlink3.mk</code> file.  This takes care of
                   9046:       rebuilding the database at installation and deinstallation time.</p></li>
1.23      wiz      9047: <li class="listitem"><p>Set <code class="varname">GTK2_IMMODULES=YES</code> if
1.1       dsieger  9048:       your package installs GTK2 immodules.</p></li>
1.23      wiz      9049: <li class="listitem"><p>Set <code class="varname">GTK2_LOADERS=YES</code> if your package installs
1.1       dsieger  9050:       GTK2 loaders.</p></li>
1.23      wiz      9051: <li class="listitem">
1.1       dsieger  9052: <p>Patch the package to not touch any of the GTK2
                   9053:       databases directly.  These are:</p>
1.41      asau     9054: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      9055: <li class="listitem"><p><code class="filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p></li>
                   9056: <li class="listitem"><p><code class="filename">libdata/gtk-2.0/gtk.immodules</code></p></li>
1.1       dsieger  9057: </ul></div>
                   9058: </li>
1.23      wiz      9059: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove
1.1       dsieger  9060:       any entries under the <code class="filename">libdata/gtk-2.0</code>
                   9061:       directory, as they will be handled automatically.</p></li>
                   9062: </ol></div>
                   9063: </div>
1.41      asau     9064: <div class="sect2">
1.1       dsieger  9065: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9066: <a name="sgml-xml-data"></a>21.6.13. Packages installing SGML or XML data</h3></div></div></div>
1.1       dsieger  9067: <p>If a package installs SGML or XML data files that need to be
                   9068:     registered in system-wide catalogs (like DTDs, sub-catalogs,
                   9069:     etc.), you need to take some extra steps:</p>
1.23      wiz      9070: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9071: <li class="listitem"><p>Include
1.1       dsieger  9072:        <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in
                   9073:        your <code class="filename">Makefile</code>, which takes care of
                   9074:        registering those files in system-wide catalogs at
                   9075:        installation and deinstallation time.</p></li>
1.23      wiz      9076: <li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of
1.1       dsieger  9077:        any SGML catalogs installed by the package.</p></li>
1.23      wiz      9078: <li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of
1.1       dsieger  9079:        any XML catalogs installed by the package.</p></li>
1.23      wiz      9080: <li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries
1.1       dsieger  9081:        to be added to the SGML catalog.  These come in groups of
                   9082:        three strings; see xmlcatmgr(1) for more information
                   9083:        (specifically, arguments recognized by the 'add' action).
                   9084:        Note that you will normally not use this variable.</p></li>
1.23      wiz      9085: <li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries
1.1       dsieger  9086:        to be added to the XML catalog.  These come in groups of three
                   9087:        strings; see xmlcatmgr(1) for more information (specifically,
                   9088:        arguments recognized by the 'add' action).  Note that you will
                   9089:        normally not use this variable.</p></li>
                   9090: </ol></div>
                   9091: </div>
1.41      asau     9092: <div class="sect2">
1.1       dsieger  9093: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9094: <a name="mime-database"></a>21.6.14. Packages installing extensions to the MIME database</h3></div></div></div>
1.1       dsieger  9095: <p>If a package provides extensions to the MIME database by
                   9096:     installing <code class="filename">.xml</code> files inside
                   9097:     <code class="filename">${PREFIX}/share/mime/packages</code>, you
                   9098:     need to take some extra steps to ensure that the database is kept
                   9099:     consistent with respect to these new files:</p>
1.23      wiz      9100: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9101: <li class="listitem"><p>Include
1.1       dsieger  9102:        <code class="filename">../../databases/shared-mime-info/mimedb.mk</code>
                   9103:        (avoid using the <code class="filename">buildlink3.mk</code> file from
                   9104:        this same directory, which is reserved for inclusion from
                   9105:        other <code class="filename">buildlink3.mk</code> files).  It takes
                   9106:        care of rebuilding the MIME database at installation and
                   9107:        deinstallation time, and disallows any access to it directly
                   9108:        from the package.</p></li>
1.23      wiz      9109: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.1       dsieger  9110:        <code class="filename">share/mime</code> directory,
                   9111:        <span class="emphasis"><em>except</em></span> for files saved under
                   9112:        <code class="filename">share/mime/packages</code>.  The former are
                   9113:        handled automatically by
                   9114:        the update-mime-database program, but the latter are
                   9115:        package-dependent and must be removed by the package that
                   9116:        installed them in the first place.</p></li>
1.23      wiz      9117: <li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories
1.1       dsieger  9118:        from the PLIST.  They will be handled by the shared-mime-info
                   9119:        package.</p></li>
                   9120: </ol></div>
                   9121: </div>
1.41      asau     9122: <div class="sect2">
1.1       dsieger  9123: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9124: <a name="intltool"></a>21.6.15. Packages using intltool</h3></div></div></div>
1.1       dsieger  9125: <p>If a package uses intltool during its build, add
                   9126:     <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>,
                   9127:     which forces it to use the intltool package provided by pkgsrc,
                   9128:     instead of the one bundled with the distribution file.</p>
                   9129: <p>This tracks intltool's build-time dependencies and uses the
                   9130:     latest available version; this way, the package benefits of any
                   9131:     bug fixes that may have appeared since it was released.</p>
                   9132: </div>
1.41      asau     9133: <div class="sect2">
1.1       dsieger  9134: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9135: <a name="startup-scripts"></a>21.6.16. Packages installing startup scripts</h3></div></div></div>
1.1       dsieger  9136: <p>If a package contains a rc.d script, it won't be copied into
                   9137:     the startup directory by default, but you can enable it, by adding
                   9138:     the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in
1.10      hubertf  9139:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts
1.1       dsieger  9140:     into <code class="filename">/etc/rc.d</code> when a package is installed, and
                   9141:     it will automatically remove the scripts when the package is
                   9142:     deinstalled.</p>
                   9143: </div>
1.41      asau     9144: <div class="sect2">
1.1       dsieger  9145: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9146: <a name="tex-packages"></a>21.6.17. Packages installing TeX modules</h3></div></div></div>
1.1       dsieger  9147: <p>If a package installs TeX packages into the texmf tree,
                   9148:     the <code class="filename">ls-R</code> database of the tree needs to be
                   9149:     updated.</p>
1.41      asau     9150: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  9151: <h3 class="title">Note</h3>
1.22      jakllsch 9152: <p>Except the main TeX packages such as kpathsea,
1.1       dsieger  9153:     packages should install files
1.22      jakllsch 9154:     into <code class="filename">${PREFIX}/share/texmf-dist</code>,
                   9155:     not <code class="filename">${PREFIX}/share/texmf</code>.</p>
1.1       dsieger  9156: </div>
1.23      wiz      9157: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9158: <li class="listitem"><p>Include
1.22      jakllsch 9159:       <code class="filename">../../print/kpathsea/texmf.mk</code>.  This
1.1       dsieger  9160:       takes care of rebuilding the <code class="filename">ls-R</code>
                   9161:       database at installation and deinstallation time.</p></li>
1.23      wiz      9162: <li class="listitem">
1.1       dsieger  9163: <p>If your package installs files into a texmf
                   9164:       tree other than the one
1.22      jakllsch 9165:       at <code class="filename">${PREFIX}/share/texmf-dist</code>,
                   9166:       set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf
1.1       dsieger  9167:       trees that need database update.</p>
                   9168: <p>If your package also installs font map files that need
1.10      hubertf  9169:       to be registered using <span class="command"><strong>updmap</strong></span>,
1.29      dholland 9170:       include <code class="filename">../../print/tex-tetex/map.mk</code> and
1.22      jakllsch 9171:       set <code class="varname">TEX_MAP_FILES</code> and/or
                   9172:       <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all
1.10      hubertf  9173:       such font map files.  Then <span class="command"><strong>updmap</strong></span> will
1.1       dsieger  9174:       be run automatically at installation/deinstallation to
                   9175:       enable/disable font map files for TeX output
                   9176:       drivers.</p>
                   9177: </li>
1.23      wiz      9178: <li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code>
1.1       dsieger  9179:       databases are included in <code class="filename">PLIST</code>, as
1.29      dholland 9180:       they will be removed only by the kpathsea package.</p></li>
1.1       dsieger  9181: </ol></div>
                   9182: </div>
1.41      asau     9183: <div class="sect2">
1.1       dsieger  9184: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9185: <a name="emulation-packages"></a>21.6.18. Packages supporting running binaries in
1.1       dsieger  9186:     emulation</h3></div></div></div>
                   9187: <p>There are some packages that provide libraries and
                   9188:     executables for running binaries from a one operating system
                   9189:     on a different one (if the latter supports it).  One example
                   9190:     is running Linux binaries on NetBSD.</p>
1.137     leot     9191: <p>The <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/rpm2pkg/README.html" target="_top"><code class="filename">pkgtools/rpm2pkg</code></a>
1.1       dsieger  9192:     helps in extracting and packaging Linux rpm packages.</p>
                   9193: <p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to
1.10      hubertf  9194:     avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests
1.1       dsieger  9195:     if all libraries for each installed executable can be found by
                   9196:     the dynamic linker.  Since the standard dynamic linker is run,
                   9197:     this fails for emulation packages, because the libraries used
                   9198:     by the emulation are not in the standard directories.</p>
                   9199: </div>
1.41      asau     9200: <div class="sect2">
1.1       dsieger  9201: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9202: <a name="hicolor-theme"></a>21.6.19. Packages installing hicolor theme icons</h3></div></div></div>
1.1       dsieger  9203: <p>If a package installs images under the
                   9204:     <code class="filename">share/icons/hicolor</code> and/or updates the
                   9205:     <code class="filename">share/icons/hicolor/icon-theme.cache</code>
                   9206:     database, you need to take some extra steps to make sure that the
                   9207:     shared theme directory is handled appropriately and that the cache
                   9208:     database is rebuilt:</p>
1.23      wiz      9209: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9210: <li class="listitem"><p>Include
1.1       dsieger  9211:        <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li>
1.23      wiz      9212: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the
1.1       dsieger  9213:        entry that refers to the theme cache.</p></li>
1.23      wiz      9214: <li class="listitem"><p>Ensure that the PLIST does not remove the shared icon
1.1       dsieger  9215:          directories from the <code class="filename">share/icons/hicolor</code>
                   9216:          hierarchy because they will be handled automatically.</p></li>
                   9217: </ol></div>
                   9218: <p>The best way to verify that the PLIST is correct with
                   9219:       respect to the last two points is to regenerate it using
1.10      hubertf  9220:       <span class="command"><strong>make print-PLIST</strong></span>.</p>
1.1       dsieger  9221: </div>
1.41      asau     9222: <div class="sect2">
1.1       dsieger  9223: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   9224: <a name="desktop-files"></a>21.6.20. Packages installing desktop files</h3></div></div></div>
1.1       dsieger  9225: <p>If a package installs <code class="filename">.desktop</code> files
                   9226:       under <code class="filename">share/applications</code> and these include
1.53      rodent   9227:       MIME information (MimeType key), you need to take extra steps to
                   9228:       ensure that they are registered into the MIME database:</p>
1.23      wiz      9229: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9230: <li class="listitem"><p>Include
1.1       dsieger  9231:          <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li>
1.23      wiz      9232: <li class="listitem"><p>Check the PLIST and remove the entry that refers to the
1.1       dsieger  9233:          <code class="filename">share/applications/mimeinfo.cache</code> file.
                   9234:          It will be handled automatically.</p></li>
                   9235: </ol></div>
                   9236: <p>The best way to verify that the PLIST is correct with
1.10      hubertf  9237:       respect to the last point is to regenerate it using <span class="command"><strong>make
1.1       dsieger  9238:       print-PLIST</strong></span>.</p>
                   9239: </div>
                   9240: </div>
1.41      asau     9241: <div class="sect1">
1.1       dsieger  9242: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9243: <a name="punting"></a>21.7. Marking packages as having problems</h2></div></div></div>
1.1       dsieger  9244: <p>In some cases one does not have the time to solve a problem
1.22      jakllsch 9245:   immediately. In this case, one can plainly mark a package as broken.  For
                   9246:   this, one just sets the variable <code class="varname">BROKEN</code> to the
                   9247:   reason why the package is broken (similar to the
1.162     rillig   9248:   <code class="varname">PKG_FAIL_REASON</code> variable).  A user trying to build
1.22      jakllsch 9249:   the package will immediately be shown this message, and the build
                   9250:   will not be even tried.</p>
                   9251: <p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular
1.1       dsieger  9252:   intervals.</p>
                   9253: </div>
                   9254: </div>
1.41      asau     9255: <div class="chapter">
1.1       dsieger  9256: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   9257: <a name="debug"></a>Chapter 22. Debugging</h2></div></div></div>
1.1       dsieger  9258: <p>To check out all the gotchas when building a package, here are
                   9259:   the steps that I do in order to get a package working.  Please note
                   9260:   this is basically the same as what was explained in the previous
                   9261:   sections, only with some debugging aids.</p>
1.41      asau     9262: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      9263: <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>
                   9264: <li class="listitem">
1.137     leot     9265: <p>Install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/README.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>,
1.1       dsieger  9266:       create a directory for a new package, change into it, then run
1.10      hubertf  9267:       <span class="command"><strong>url2pkg</strong></span>:</p>
1.1       dsieger  9268: <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>
                   9269: <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>
1.174     leot     9270: <code class="prompt">%</code> <strong class="userinput"><code>url2pkg https://www.example.com/path/to/distfile.tar.gz</code></strong></pre>
1.1       dsieger  9271: </li>
1.23      wiz      9272: <li class="listitem"><p>Edit the <code class="filename">Makefile</code> as requested.</p></li>
                   9273: <li class="listitem"><p>Fill in the <code class="filename">DESCR</code> file</p></li>
                   9274: <li class="listitem"><p>Run <span class="command"><strong>make configure</strong></span></p></li>
                   9275: <li class="listitem"><p>Add any dependencies glimpsed from documentation and the
1.1       dsieger  9276:       configure step to the package's
                   9277:       <code class="filename">Makefile</code>.</p></li>
1.23      wiz      9278: <li class="listitem">
1.1       dsieger  9279: <p>Make the package compile, doing multiple rounds of</p>
                   9280: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
                   9281: <code class="prompt">%</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   9282: <code class="prompt">%</code> <strong class="userinput"><code>mkpatches</code></strong>
                   9283: <code class="prompt">%</code> <strong class="userinput"><code>patchdiff</code></strong>
                   9284: <code class="prompt">%</code> <strong class="userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   9285: <code class="prompt">%</code> <strong class="userinput"><code>make mps</code></strong>
                   9286: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong></pre>
                   9287: <p>Doing this step as non-root user will ensure that no files
                   9288:       are modified that shouldn't be, especially during the build
1.10      hubertf  9289:       phase.  <span class="command"><strong>mkpatches</strong></span>,
                   9290:       <span class="command"><strong>patchdiff</strong></span> and <span class="command"><strong>pkgvi</strong></span> are
1.137     leot     9291:       from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/README.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a>
1.1       dsieger  9292:       package.</p>
                   9293: </li>
1.23      wiz      9294: <li class="listitem"><p>Look at the <code class="filename">Makefile</code>, fix if
1.154     rillig   9295:       necessary; see <a class="xref" href="#components.Makefile" title="13.1. Makefile">Section 13.1, &#8220;<code class="filename">Makefile</code>&#8221;</a>.</p></li>
1.23      wiz      9296: <li class="listitem">
1.1       dsieger  9297: <p>Generate a <code class="filename">PLIST</code>:</p>
                   9298: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                   9299: <code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   9300: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong>
                   9301: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                   9302: <code class="prompt">#</code> <strong class="userinput"><code>make deinstall</code></strong></pre>
                   9303: <p>You usually need to be <code class="username">root</code> to do
                   9304:       this.  Look if there are any files left:</p>
                   9305: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
                   9306: <p>If this reveals any files that are missing in
                   9307:       <code class="filename">PLIST</code>, add them.</p>
                   9308: </li>
1.23      wiz      9309: <li class="listitem">
1.1       dsieger  9310: <p>Now that the <code class="filename">PLIST</code> is OK, install the
                   9311:       package again and make a binary package:</p>
                   9312: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make reinstall</code></strong>
                   9313: <code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong></pre>
                   9314: </li>
1.23      wiz      9315: <li class="listitem">
1.1       dsieger  9316: <p>Delete the installed package:</p>
                   9317: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_delete <em class="replaceable"><code>examplepkg</code></em></code></strong></pre>
                   9318: </li>
1.23      wiz      9319: <li class="listitem">
1.10      hubertf  9320: <p>Repeat the above <span class="command"><strong>make print-PLIST</strong></span>
1.1       dsieger  9321:       command, which shouldn't find anything now:</p>
                   9322: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make print-PLIST</code></strong></pre>
                   9323: </li>
1.23      wiz      9324: <li class="listitem">
1.1       dsieger  9325: <p>Reinstall the binary package:</p>
                   9326: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkg_add .../<em class="replaceable"><code>examplepkg</code></em>.tgz</code></strong></pre>
                   9327: </li>
1.23      wiz      9328: <li class="listitem"><p>Play with it.  Make sure everything works.</p></li>
                   9329: <li class="listitem">
1.137     leot     9330: <p>Run <span class="command"><strong>pkglint</strong></span> from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>, and fix the problems it
1.1       dsieger  9331:       reports:</p>
                   9332: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>pkglint</code></strong></pre>
                   9333: </li>
1.154     rillig   9334: <li class="listitem"><p>Submit (or commit, if you have cvs access); see <a class="xref" href="#submit" title="Chapter 23. Submitting and Committing">Chapter 23, <i>Submitting and Committing</i></a>.</p></li>
1.1       dsieger  9335: </ul></div>
                   9336: </div>
1.41      asau     9337: <div class="chapter">
1.1       dsieger  9338: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   9339: <a name="submit"></a>Chapter 23. Submitting and Committing</h2></div></div></div>
1.1       dsieger  9340: <div class="toc">
                   9341: <p><b>Table of Contents</b></p>
1.100     leot     9342: <dl class="toc">
1.154     rillig   9343: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
                   9344: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
                   9345: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
                   9346: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
                   9347: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
                   9348: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
                   9349: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
                   9350: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
1.1       dsieger  9351: </dl>
                   9352: </div>
1.41      asau     9353: <div class="sect1">
1.1       dsieger  9354: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9355: <a name="submitting-binary-packages"></a>23.1. Submitting binary packages</h2></div></div></div>
1.1       dsieger  9356: <p>Our policy is that we accept binaries only from pkgsrc
                   9357:        developers to guarantee that the packages don't contain any
                   9358:        trojan horses etc. This is not to annoy anyone but rather to
                   9359:        protect our users! You're still free to put up your home-made
                   9360:        binary packages and tell the world where to get them. NetBSD
                   9361:        developers doing bulk builds and wanting to upload them please
1.154     rillig   9362:        see <a class="xref" href="#bulk" title="Chapter 8. Creating binary packages for everything in pkgsrc (bulk builds)">Chapter 8, <i>Creating binary packages for everything in pkgsrc (bulk
1.66      asau     9363: builds)</i></a>.</p>
1.1       dsieger  9364: </div>
1.41      asau     9365: <div class="sect1">
1.1       dsieger  9366: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9367: <a name="submitting-your-package"></a>23.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div>
1.1       dsieger  9368: <p>First, check that your package is complete, compiles and
1.154     rillig   9369:        runs well; see <a class="xref" href="#debug" title="Chapter 22. Debugging">Chapter 22, <i>Debugging</i></a> and the rest of this
1.174     leot     9370:        document. Next, generate an uuencoded gzipped <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?tar+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a>
1.1       dsieger  9371:        archive that contains all files that make up the package.
                   9372:        Finally, send this package to the pkgsrc bug tracking system,
1.174     leot     9373:        either with the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> command, or if you don't have
1.1       dsieger  9374:        that, go to the web page
1.174     leot     9375:        <a class="ulink" href="https://www.NetBSD.org/support/send-pr.html" target="_top">https://www.NetBSD.org/support/send-pr.html</a>,
1.21      snj      9376:        which contains some instructions and a link to a form where you
                   9377:        can submit packages.  The
1.137     leot     9378:        <a href="https://cdn.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
1.21      snj      9379:        also available as a substitute for either of the above two tools.
                   9380:        </p>
1.1       dsieger  9381: <p>In the form of the problem report, the category should be
1.23      wiz      9382:        <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>, the synopsis should include the package name
1.1       dsieger  9383:        and version number, and the description field should contain a
                   9384:        short description of your package (contents of the COMMENT
                   9385:        variable or DESCR file are OK). The uuencoded package data should
1.23      wiz      9386:        go into the <span class="quote">&#8220;<span class="quote">fix</span>&#8221;</span> field.</p>
1.1       dsieger  9387: <p>If you want to submit several packages, please send a
                   9388:        separate PR for each one, it's easier for us to track things
                   9389:        that way.</p>
                   9390: <p>Alternatively, you can also import new packages into
1.23      wiz      9391:        pkgsrc-wip (<span class="quote">&#8220;<span class="quote">pkgsrc work-in-progress</span>&#8221;</span>); see the
1.174     leot     9392:        homepage at <a class="ulink" href="https://pkgsrc.org/wip/" target="_top">https://pkgsrc.org/wip/</a>
1.1       dsieger  9393:        for details.</p>
                   9394: </div>
1.41      asau     9395: <div class="sect1">
1.1       dsieger  9396: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9397: <a name="general-notes-for-changes"></a>23.3. General notes when adding, updating, or removing packages</h2></div></div></div>
1.1       dsieger  9398: <p>Please note all package additions, updates, moves, and
                   9399:        removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very
                   9400:        important to keep this file up to date and conforming to the
                   9401:        existing format, because it will be used by scripts to
1.174     leot     9402:        automatically update pages on <a class="ulink" href="https://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other
1.1       dsieger  9403:        sites. Additionally, check the
                   9404:        <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry
                   9405:        for the package you updated or removed, in case it was mentioned
                   9406:        there.</p>
                   9407: <p>When the <code class="varname">PKGREVISION</code> of a package is
                   9408:        bumped, the change should appear in
                   9409:        <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security
                   9410:        related or otherwise relevant. Mass bumps that result from a
                   9411:        dependency being updated should not be mentioned. In all other
                   9412:        cases it's the developer's decision.</p>
                   9413: <p>There is a make target that helps in creating proper
1.10      hubertf  9414:   <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries:  <span class="command"><strong>make
1.1       dsieger  9415:   changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code>
                   9416:   and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general
                   9417:   usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code>
                   9418:   file is up-to-date (to avoid having to resolve conflicts later-on)
1.10      hubertf  9419:   and then to <span class="command"><strong>cd</strong></span> to the package directory.  For
                   9420:   package updates, <span class="command"><strong>make changes-entry</strong></span> is enough.
1.1       dsieger  9421:   For new packages, or package moves or removals, set the
                   9422:   <code class="varname">CTYPE</code> variable on the command line to "Added",
                   9423:   "Moved", or "Removed".  You can set <code class="varname">NETBSD_LOGIN_NAME</code>
1.10      hubertf  9424:   in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is
1.22      jakllsch 9425:   not the same as your NetBSD login name. The target also automatically
                   9426:   removes possibly existing entries for the package in the
                   9427:   <code class="filename">TODO</code> file. Don't forget to commit
1.66      asau     9428:   the changes, e.g. by using <span class="command"><strong>make commit-changes-entry</strong></span>!
1.22      jakllsch 9429:   If you are not using a checkout directly from cvs.NetBSD.org, but e.g.
                   9430:   a local copy of the repository, you can set USE_NETBSD_REPO=yes. This
                   9431:   makes the cvs commands use the main repository.
                   9432:   </p>
1.1       dsieger  9433: </div>
1.41      asau     9434: <div class="sect1">
1.1       dsieger  9435: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9436: <a name="commit-messages"></a>23.4. Commit Messages</h2></div></div></div>
1.130     wiz      9437: <p>For several years, there have been mirrors of pkgsrc in
                   9438:   fossil, git, and hg. Standard practise when using these tools is to
                   9439:   make the first line of a commit message function as a summary that
                   9440:   can be read without the rest, such as is commonly done with "git log
                   9441:   --oneline". For this reason, we have the following guidelines for
                   9442:   pkgsrc commit messages:</p>
                   9443: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   9444: <li class="listitem"><p>Start the commit message with a line that explains the
1.131     wiz      9445:     big picture in 65 characters or less. When a commit is for one
1.130     wiz      9446:     package, include the name of the package. For updates, include the
                   9447:     version to which it is updated.</p></li>
                   9448: <li class="listitem"><p>Leave the next line empty.</p></li>
                   9449: <li class="listitem"><p>Then come the details for the commit (changes in that
                   9450:     package, reason for a change) and any relevant PRs. Wrap this
                   9451:     section.</p></li>
                   9452: </ul></div>
                   9453: <p>Here is an example:
                   9454:   </p>
                   9455: <pre class="programlisting">
                   9456:   libxslt: update to 1.0.30
                   9457: 
                   9458:   Changes since 1.0.29:
                   9459:   ...
                   9460:   </pre>
                   9461: <p>
                   9462:   </p>
                   9463: <p>Here is another example:
                   9464:   </p>
                   9465: <pre class="programlisting">
                   9466:   mk/bsd.pkg.mk: enable SSP by default on NetBSD
                   9467: 
                   9468:   (rationale)
                   9469:   </pre>
                   9470: <p>
                   9471:   </p>
                   9472: <p>Commit messages are final: no <span class="quote">&#8220;<span class="quote">cvs admin</span>&#8221;</span> is
                   9473:   allowed on the pkgsrc repository to change commit messages.</p>
                   9474: </div>
                   9475: <div class="sect1">
                   9476: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9477: <a name="committing-importing"></a>23.5. Committing: Adding a package to CVS</h2></div></div></div>
1.1       dsieger  9478: <p>This section is only of interest for pkgsrc developers with write
1.33      wiz      9479:   access to the pkgsrc repository.</p>
                   9480: <p>When the package is finished, <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span> the files.
                   9481: Start by adding the directory and then files in the directory. Don't
                   9482: forget to add the new package to the category's
                   9483: <code class="filename">Makefile</code>. Make sure you don't forget any files;
                   9484: you can check by running <span class="quote">&#8220;<span class="quote">cvs status</span>&#8221;</span>. An example:</p>
                   9485: <pre class="programlisting">
                   9486: <code class="prompt">$</code> cd .../pkgsrc/category
                   9487: <code class="prompt">$</code> cvs add pkgname
                   9488: <code class="prompt">$</code> cd pkgname
                   9489: <code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
                   9490: <code class="prompt">$</code> cvs add patches/p*
                   9491: <code class="prompt">$</code> cvs status | less
1.34      wiz      9492: <code class="prompt">$</code> cvs commit
1.33      wiz      9493: <code class="prompt">$</code> cd ..
                   9494: <code class="prompt">$</code> vi Makefile # add SUBDIRS+=pkgname line
1.34      wiz      9495: <code class="prompt">$</code> cvs commit Makefile
1.66      asau     9496: <code class="prompt">$</code> cd pkgname
1.73      jnemeth  9497: <code class="prompt">$</code> make CTYPE=Added commit-changes-entry
1.33      wiz      9498: </pre>
1.1       dsieger  9499: <p>The commit message of the initial import should include part of the
                   9500:   <code class="filename">DESCR</code> file, so people reading the mailing lists know
                   9501:   what the package is/does.</p>
1.33      wiz      9502: <p>Also mention the new package in
                   9503: <code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p>
                   9504: <p>Previously, <span class="quote">&#8220;<span class="quote">cvs import</span>&#8221;</span> was suggested, but it was
                   9505: much easier to get wrong than <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span>.</p>
1.1       dsieger  9506: </div>
1.41      asau     9507: <div class="sect1">
1.1       dsieger  9508: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9509: <a name="updating-package"></a>23.6. Updating a package to a newer version</h2></div></div></div>
1.1       dsieger  9510: <p>Please always put a concise, appropriate and relevant summary of the
                   9511:   changes between old and new versions into the commit log when updating
                   9512:   a package. There are various reasons for this:</p>
1.41      asau     9513: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      9514: <li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely
1.1       dsieger  9515:   or its information may be overwritten by newer information.</p></li>
1.23      wiz      9516: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.1       dsieger  9517:   repository is very useful for people who use either cvs or anoncvs.</p></li>
1.23      wiz      9518: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.1       dsieger  9519:   repository is very useful for people who read the pkgsrc-changes mailing
                   9520:   list, so that they can make tactical decisions about when to upgrade
                   9521:   the package.</p></li>
                   9522: </ul></div>
                   9523: <p>Please also recognize that, just because a new version of a package
                   9524:   has been released, it should not automatically be upgraded in the CVS
                   9525:   repository.  We prefer to be conservative in the packages that are
                   9526:   included in pkgsrc - development or beta packages are not really the
                   9527:   best thing for most places in which pkgsrc is used. Please use your
                   9528:   judgement about what should go into pkgsrc, and bear in mind that
                   9529:   stability is to be preferred above new and possibly untested features.</p>
                   9530: </div>
1.41      asau     9531: <div class="sect1">
1.1       dsieger  9532: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9533: <a name="renaming-package"></a>23.7. Renaming a package in pkgsrc</h2></div></div></div>
1.20      snj      9534: <p>Renaming packages is not recommended.</p>
1.175     gutterid 9535: <p>When renaming packages, be sure to fix any references to the old name
1.20      snj      9536:   in other Makefiles, options, buildlink files, etc.</p>
1.167     leot     9537: <p>
1.175     gutterid 9538:   Also, when renaming a package, please add
1.167     leot     9539:   the package name and version pattern(s) of the previous package
                   9540:   to <code class="varname">SUPERSEDES</code>.
1.20      snj      9541:   This may be repeated for multiple renames.
                   9542:   The new package would be an exact replacement.
1.167     leot     9543:   Example:
1.20      snj      9544: </p>
1.167     leot     9545: <pre class="programlisting">
                   9546: SUPERSEDES+=    p5-IO-Compress-Zlib&lt;2.017
                   9547: SUPERSEDES+=    optcomp-[0-9]*
                   9548: </pre>
1.23      wiz      9549: <p>Note that <span class="quote">&#8220;<span class="quote">successor</span>&#8221;</span> in the
1.20      snj      9550:   CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily
                   9551:   mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may
                   9552:   not be an exact replacement but is a suggestion for the replaced
                   9553:   functionality.</p>
                   9554: </div>
1.41      asau     9555: <div class="sect1">
1.20      snj      9556: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9557: <a name="moving-package"></a>23.8. Moving a package in pkgsrc</h2></div></div></div>
1.20      snj      9558: <p>It is preferred that packages are not renamed or moved, but if needed
                   9559:   please follow these steps.
                   9560: </p>
1.23      wiz      9561: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9562: <li class="listitem"><p>Make a copy of the directory somewhere else.</p></li>
                   9563: <li class="listitem">
1.1       dsieger  9564: <p>Remove all CVS dirs.</p>
                   9565: <p>Alternatively to the first two steps you can also do:</p>
                   9566: <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>
                   9567: <p>and use that for further work.</p>
                   9568: </li>
1.23      wiz      9569: <li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any
                   9570: <code class="varname">DEPENDS</code> paths that just did <span class="quote">&#8220;<span class="quote">../package</span>&#8221;</span>
                   9571: instead of <span class="quote">&#8220;<span class="quote">../../category/package</span>&#8221;</span>.</p></li>
                   9572: <li class="listitem"><p>In the modified package's Makefile, consider setting
1.20      snj      9573: <code class="varname">PREV_PKGPATH</code> to the previous category/package
                   9574: pathname.  The <code class="varname">PREV_PKGPATH</code> can be used by tools
                   9575: for doing an update using pkgsrc building; for example, it can
1.174     leot     9576: search the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?pkg_summary+5.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> database for <code class="varname">PREV_PKGPATH</code>
1.20      snj      9577: (if no <code class="varname">SUPERSEDES</code>) and then use the corresponding
                   9578: new <code class="varname">PKGPATH</code> for that moved package.  Note that
                   9579: it may have multiple matches, so the tool should also check on the
                   9580: <code class="varname">PKGBASE</code> too.  The <code class="varname">PREV_PKGPATH</code>
                   9581: probably has no value unless <code class="varname">SUPERSEDES</code> is not
                   9582: set, i.e.  <code class="varname">PKGBASE</code> stays the same.  </p></li>
1.23      wiz      9583: <li class="listitem"><p><span class="command"><strong>cvs import</strong></span> the modified package in the new
1.1       dsieger  9584: place.</p></li>
1.23      wiz      9585: <li class="listitem">
1.1       dsieger  9586: <p>Check if any package depends on it:
                   9587: </p>
                   9588: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
                   9589: <code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre>
                   9590: </li>
1.23      wiz      9591: <li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li>
                   9592: <li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li>
                   9593: <li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li>
                   9594: <li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li>
                   9595: <li class="listitem">
1.1       dsieger  9596: <p>Commit the changed and removed files:</p>
                   9597: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong></pre>
                   9598: <p>(and any packages from step 5, of course).</p>
                   9599: </li>
                   9600: </ol></div>
                   9601: </div>
                   9602: </div>
1.41      asau     9603: <div class="chapter">
1.1       dsieger  9604: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   9605: <a name="devfaq"></a>Chapter 24. Frequently Asked Questions</h2></div></div></div>
1.1       dsieger  9606: <p>This section contains the answers to questions that may
                   9607:        arise when you are writing a package. If you don't find your
                   9608:        question answered here, first have a look in the other chapters,
                   9609:        and if you still don't have the answer, ask on the
                   9610:        <code class="literal">pkgsrc-users</code> mailing list.</p>
1.41      asau     9611: <div class="qandaset">
1.174     leot     9612: <a name="devfaq.qandaset"></a><dl>
1.154     rillig   9613: <dt>24.1. <a href="#devfaq.makeflags">What is the difference between
1.1       dsieger  9614:        MAKEFLAGS, .MAKEFLAGS and
                   9615:        MAKE_FLAGS?</a>
                   9616: </dt>
1.154     rillig   9617: <dt>24.2. <a href="#devfaq.make">What is the difference between
1.1       dsieger  9618:        MAKE, GMAKE and
                   9619:        MAKE_PROGRAM?</a>
                   9620: </dt>
1.154     rillig   9621: <dt>24.3. <a href="#devfaq.cc">What is the difference between
1.1       dsieger  9622:        CC, PKG_CC and
                   9623:        PKGSRC_COMPILER?</a>
                   9624: </dt>
1.154     rillig   9625: <dt>24.4. <a href="#devfaq.bl3flags">What is the difference between
1.1       dsieger  9626:        BUILDLINK_LDFLAGS,
                   9627:        BUILDLINK_LDADD and
                   9628:        BUILDLINK_LIBS?</a>
                   9629: </dt>
1.154     rillig   9630: <dt>24.5. <a href="#devfaq.bl3prefix">Why does make show-var
1.1       dsieger  9631:        VARNAME=BUILDLINK_PREFIX.foo
                   9632:        say it's empty?</a>
                   9633: </dt>
1.154     rillig   9634: <dt>24.6. <a href="#devfaq.master_sites">What does
1.1       dsieger  9635:        ${MASTER_SITE_SOURCEFORGE:=package/} mean? I
                   9636:        don't understand the := inside
                   9637:        it.</a>
                   9638: </dt>
1.154     rillig   9639: <dt>24.7. <a href="#devfaq.mailinglists">Which mailing lists are there for package
1.1       dsieger  9640:        developers?</a>
                   9641: </dt>
1.154     rillig   9642: <dt>24.8. <a href="#devfaq.documentation">Where is the pkgsrc
1.1       dsieger  9643:        documentation?</a>
                   9644: </dt>
1.174     leot     9645: <dt>24.9. <a href="#devfaq.too-much-time">I have a little time to kill. 
                   9646: What shall I do?</a>
1.1       dsieger  9647: </dt>
                   9648: </dl>
1.41      asau     9649: <table border="0" style="width: 100%;">
                   9650: <colgroup>
1.1       dsieger  9651: <col align="left" width="1%">
1.23      wiz      9652: <col>
1.41      asau     9653: </colgroup>
1.1       dsieger  9654: <tbody>
1.41      asau     9655: <tr class="question">
1.1       dsieger  9656: <td align="left" valign="top">
1.174     leot     9657: <a name="devfaq.makeflags"></a><a name="devfaq.makeflags.q"></a><p><b>24.1.</b></p>
1.1       dsieger  9658: </td>
                   9659: <td align="left" valign="top"><p>What is the difference between
                   9660:        <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
                   9661:        <code class="varname">MAKE_FLAGS</code>?</p></td>
                   9662: </tr>
                   9663: <tr class="answer">
                   9664: <td align="left" valign="top"></td>
                   9665: <td align="left" valign="top"><p><code class="varname">MAKEFLAGS</code> are the flags passed
1.174     leot     9666:        to the pkgsrc-internal invocations of <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>, while
1.1       dsieger  9667:        <code class="varname">MAKE_FLAGS</code> are the flags that are passed to
                   9668:        the <code class="varname">MAKE_PROGRAM</code> when building the
                   9669:        package. [FIXME: What is .MAKEFLAGS for?]</p></td>
                   9670: </tr>
1.41      asau     9671: <tr class="question">
1.1       dsieger  9672: <td align="left" valign="top">
1.174     leot     9673: <a name="devfaq.make"></a><a name="devfaq.make.q"></a><p><b>24.2.</b></p>
1.1       dsieger  9674: </td>
                   9675: <td align="left" valign="top"><p>What is the difference between
                   9676:        <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
                   9677:        <code class="varname">MAKE_PROGRAM</code>?</p></td>
                   9678: </tr>
                   9679: <tr class="answer">
                   9680: <td align="left" valign="top"></td>
                   9681: <td align="left" valign="top"><p><code class="varname">MAKE</code> is the path to the
1.174     leot     9682:        <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> program that is used in the pkgsrc
1.1       dsieger  9683:        infrastructure. <code class="varname">GMAKE</code> is the path to GNU
                   9684:        Make, but you need to say <code class="varname">USE_TOOLS+=gmake</code> to
                   9685:        use that. <code class="varname">MAKE_PROGRAM</code> is the path to the
                   9686:        Make program that is used for building the
                   9687:        package.</p></td>
                   9688: </tr>
1.41      asau     9689: <tr class="question">
1.1       dsieger  9690: <td align="left" valign="top">
1.174     leot     9691: <a name="devfaq.cc"></a><a name="devfaq.cc.q"></a><p><b>24.3.</b></p>
1.1       dsieger  9692: </td>
                   9693: <td align="left" valign="top"><p>What is the difference between
                   9694:        <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
                   9695:        <code class="varname">PKGSRC_COMPILER</code>?</p></td>
                   9696: </tr>
                   9697: <tr class="answer">
                   9698: <td align="left" valign="top"></td>
                   9699: <td align="left" valign="top"><p><code class="varname">CC</code> is the path to the real C
                   9700:        compiler, which can be configured by the pkgsrc user.
                   9701:        <code class="varname">PKG_CC</code> is the path to the compiler wrapper.
                   9702:        <code class="varname">PKGSRC_COMPILER</code> is <span class="emphasis"><em>not</em></span> a
                   9703:        path to a compiler, but the type of compiler that should be
                   9704:        used. See <code class="filename">mk/compiler.mk</code> for more
                   9705:        information about the latter variable.</p></td>
                   9706: </tr>
1.41      asau     9707: <tr class="question">
1.1       dsieger  9708: <td align="left" valign="top">
1.174     leot     9709: <a name="devfaq.bl3flags"></a><a name="devfaq.bl3flags.q"></a><p><b>24.4.</b></p>
1.1       dsieger  9710: </td>
                   9711: <td align="left" valign="top"><p>What is the difference between
                   9712:        <code class="varname">BUILDLINK_LDFLAGS</code>,
                   9713:        <code class="varname">BUILDLINK_LDADD</code> and
                   9714:        <code class="varname">BUILDLINK_LIBS</code>?</p></td>
                   9715: </tr>
                   9716: <tr class="answer">
                   9717: <td align="left" valign="top"></td>
                   9718: <td align="left" valign="top"><p>[FIXME]</p></td>
                   9719: </tr>
1.41      asau     9720: <tr class="question">
1.1       dsieger  9721: <td align="left" valign="top">
1.174     leot     9722: <a name="devfaq.bl3prefix"></a><a name="devfaq.bl3prefix.q"></a><p><b>24.5.</b></p>
1.1       dsieger  9723: </td>
1.10      hubertf  9724: <td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
1.1       dsieger  9725:        VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
                   9726:        say it's empty?</p></td>
                   9727: </tr>
                   9728: <tr class="answer">
                   9729: <td align="left" valign="top"></td>
                   9730: <td align="left" valign="top"><p>For optimization reasons, some variables are only
1.23      wiz      9731:        available in the <span class="quote">&#8220;<span class="quote">wrapper</span>&#8221;</span> phase and later. To
                   9732:        <span class="quote">&#8220;<span class="quote">simulate</span>&#8221;</span> the wrapper phase, append
1.10      hubertf  9733:        <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
1.1       dsieger  9734:        command.</p></td>
                   9735: </tr>
1.41      asau     9736: <tr class="question">
1.1       dsieger  9737: <td align="left" valign="top">
1.174     leot     9738: <a name="devfaq.master_sites"></a><a name="devfaq.master_sites.q"></a><p><b>24.6.</b></p>
1.1       dsieger  9739: </td>
                   9740: <td align="left" valign="top"><p>What does
1.108     rillig   9741:        <code class="code">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
                   9742:        don't understand the <code class="code">:=</code> inside
1.1       dsieger  9743:        it.</p></td>
                   9744: </tr>
                   9745: <tr class="answer">
                   9746: <td align="left" valign="top"></td>
1.108     rillig   9747: <td align="left" valign="top"><p>The <code class="code">:=</code> is not really an
                   9748:        assignment operator, although it looks like it.
1.1       dsieger  9749:        Instead, it is a degenerate form of
1.108     rillig   9750:        <code class="code">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
1.174     leot     9751:        which is documented in the <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?make+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man page and which is
1.108     rillig   9752:        commonly used in the form <code class="code">${SRCS:.c=.o}</code>. In the
1.1       dsieger  9753:        case of <code class="varname">MASTER_SITE_*</code>,
                   9754:        <em class="replaceable"><code>old_string</code></em> is the empty string and
                   9755:        <em class="replaceable"><code>new_string</code></em> is
1.108     rillig   9756:        <code class="code">package/</code>. That's where the
                   9757:        <code class="code">:</code> and the <code class="code">=</code> fall
1.1       dsieger  9758:        together.</p></td>
                   9759: </tr>
1.41      asau     9760: <tr class="question">
1.1       dsieger  9761: <td align="left" valign="top">
1.174     leot     9762: <a name="devfaq.mailinglists"></a><a name="devfaq.mailinglists.q"></a><p><b>24.7.</b></p>
1.1       dsieger  9763: </td>
                   9764: <td align="left" valign="top"><p>Which mailing lists are there for package
                   9765:        developers?</p></td>
                   9766: </tr>
                   9767: <tr class="answer">
                   9768: <td align="left" valign="top"></td>
1.41      asau     9769: <td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
1.174     leot     9770: <dt><span class="term"><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a></span></dt>
1.1       dsieger  9771: <dd><p>This is a list for technical discussions related
                   9772:        to pkgsrc development, e.g. soliciting feedback for changes to
                   9773:        pkgsrc infrastructure, proposed new features, questions related
                   9774:        to porting pkgsrc to a new platform, advice for maintaining a
                   9775:        package, patches that affect many packages, help requests moved
                   9776:        from pkgsrc-users when an infrastructure bug is found,
                   9777:        etc.</p></dd>
1.174     leot     9778: <dt><span class="term"><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-bugs" target="_top">pkgsrc-bugs</a></span></dt>
1.1       dsieger  9779: <dd><p>All bug reports in category "pkg" sent with
1.174     leot     9780:        <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?send-pr+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> appear here. Please do not report your bugs here
1.1       dsieger  9781:        directly; use one of the other mailing
                   9782:        lists.</p></dd>
                   9783: </dl></div></td>
                   9784: </tr>
1.41      asau     9785: <tr class="question">
1.1       dsieger  9786: <td align="left" valign="top">
1.174     leot     9787: <a name="devfaq.documentation"></a><a name="devfaq.documentation.q"></a><p><b>24.8.</b></p>
1.1       dsieger  9788: </td>
                   9789: <td align="left" valign="top"><p>Where is the pkgsrc
                   9790:        documentation?</p></td>
                   9791: </tr>
                   9792: <tr class="answer">
                   9793: <td align="left" valign="top"></td>
                   9794: <td align="left" valign="top">
                   9795: <p>There are many places where you can find
                   9796:        documentation about pkgsrc:</p>
1.41      asau     9797: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      9798: <li class="listitem"><p>The pkgsrc guide (this document) is a collection
1.1       dsieger  9799:        of chapters that explain large parts of pkgsrc, but some
                   9800:        chapters tend to be outdated. Which ones they are is hard to
                   9801:        say.</p></li>
1.174     leot     9802: <li class="listitem"><p>On the mailing list archives (see <a class="ulink" href="https://mail-index.NetBSD.org/" target="_top">https://mail-index.NetBSD.org/</a>), you can find discussions
1.1       dsieger  9803:        about certain features, announcements of new parts of the pkgsrc
                   9804:        infrastructure and sometimes even announcements that a certain
                   9805:        feature has been marked as obsolete. The benefit here is that
                   9806:        each message has a date appended to it.</p></li>
1.23      wiz      9807: <li class="listitem"><p>Many of the files in the
1.1       dsieger  9808:        <code class="filename">mk/</code> directory start with a comment that
                   9809:        describes the purpose of the file and how it can be used by the
                   9810:        pkgsrc user and package authors. An easy way to find this
1.10      hubertf  9811:        documentation is to run <span class="command"><strong>bmake
1.1       dsieger  9812:        help</strong></span>.</p></li>
1.23      wiz      9813: <li class="listitem"><p>The CVS log messages are a rich source of
1.1       dsieger  9814:        information, but they tend to be highly abbreviated, especially
                   9815:        for actions that occur often. Some contain a detailed
                   9816:        description of what has changed, but they are geared towards the
                   9817:        other pkgsrc developers, not towards an average pkgsrc user.
                   9818:        They also only document <span class="emphasis"><em>changes</em></span>, so if you
                   9819:        don't know what has been before, these messages may not be worth
                   9820:        too much to you.</p></li>
1.23      wiz      9821: <li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">&#8220;<span class="quote">implicitly
                   9822:        documented</span>&#8221;</span>, that is the documentation exists only in the
1.1       dsieger  9823:        mind of the developer who wrote the code. To get this
1.10      hubertf  9824:        information, use the <span class="command"><strong>cvs annotate</strong></span> command
1.1       dsieger  9825:        to see who has written it and ask on the
                   9826:        <code class="literal">tech-pkg</code> mailing list, so that others can
                   9827:        find your questions later (see above). To be sure that the
                   9828:        developer in charge reads the mail, you may CC him or
                   9829:        her.</p></li>
                   9830: </ul></div>
                   9831: </td>
                   9832: </tr>
1.41      asau     9833: <tr class="question">
1.1       dsieger  9834: <td align="left" valign="top">
1.174     leot     9835: <a name="devfaq.too-much-time"></a><a name="devfaq.too-much-time.q"></a><p><b>24.9.</b></p>
1.1       dsieger  9836: </td>
1.174     leot     9837: <td align="left" valign="top"><p>I have a little time to kill. 
                   9838: What shall I do?</p></td>
1.1       dsieger  9839: </tr>
                   9840: <tr class="answer">
                   9841: <td align="left" valign="top"></td>
                   9842: <td align="left" valign="top">
                   9843: <p>This is not really an FAQ yet, but here's the answer
                   9844: anyway.</p>
1.41      asau     9845: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      9846: <li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
1.137     leot     9847:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/README.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a> package).  It
1.1       dsieger  9848:     will tell you about newer versions of installed packages that are
                   9849:     available, but not yet updated in pkgsrc.</p></li>
1.23      wiz      9850: <li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code>
1.14      jmcneill 9851:     &mdash; it contains a list of suggested new packages and a list of
1.1       dsieger  9852:     cleanups and enhancements for pkgsrc that would be nice to
                   9853:     have.</p></li>
1.23      wiz      9854: <li class="listitem"><p>Review packages for which review was requested on
1.174     leot     9855:     the <a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a>
1.1       dsieger  9856:     mailing list.</p></li>
                   9857: </ul></div>
                   9858: </td>
                   9859: </tr>
                   9860: </tbody>
                   9861: </table>
                   9862: </div>
                   9863: </div>
1.41      asau     9864: <div class="chapter">
1.1       dsieger  9865: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   9866: <a name="gnome"></a>Chapter 25. GNOME packaging and porting</h2></div></div></div>
1.1       dsieger  9867: <div class="toc">
                   9868: <p><b>Table of Contents</b></p>
1.100     leot     9869: <dl class="toc">
1.154     rillig   9870: <dt><span class="sect1"><a href="#meta-packages">25.1. Meta packages</a></span></dt>
                   9871: <dt><span class="sect1"><a href="#new-package">25.2. Packaging a GNOME application</a></span></dt>
                   9872: <dt><span class="sect1"><a href="#full-update">25.3. Updating GNOME to a newer version</a></span></dt>
                   9873: <dt><span class="sect1"><a href="#patching">25.4. Patching guidelines</a></span></dt>
1.1       dsieger  9874: </dl>
                   9875: </div>
1.174     leot     9876: <p>Quoting <a class="ulink" href="https://www.gnome.org/" target="_top">GNOME's web
1.1       dsieger  9877: site</a>:</p>
                   9878: <div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop
                   9879:   environment, an intuitive and attractive desktop for users, and the
                   9880:   GNOME development platform, an extensive framework for building
                   9881:   applications that integrate into the rest of the desktop.</p></blockquote></div>
                   9882: <p>pkgsrc provides a seamless way to automatically build and install
                   9883: a complete GNOME environment <span class="emphasis"><em>under many different
                   9884: platforms</em></span>.  We can say with confidence that pkgsrc is one of
                   9885: the most advanced build and packaging systems for GNOME due to its
                   9886: included technologies buildlink3, the wrappers and tools framework and
                   9887: automatic configuration file management.  Lots of efforts are put into
                   9888: achieving a completely clean deinstallation of installed software
                   9889: components.</p>
1.174     leot     9890: <p>Given that pkgsrc is <a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system,
1.1       dsieger  9891: the above also means that great efforts are put into making GNOME work
1.174     leot     9892: under this operating system.  Recently, <a class="ulink" href="https://www.dragonflybsd.org/" target="_top">DragonFly BSD</a> also adopted
1.1       dsieger  9893: pkgsrc as its preferred packaging system, contributing lots of
                   9894: portability fixes to make GNOME build and install under it.</p>
                   9895: <p>This chapter is aimed at pkgsrc developers and other people
                   9896: interested in helping our GNOME porting and packaging efforts.  It
                   9897: provides instructions on how to manage the existing packages and some
                   9898: important information regarding their internals.</p>
1.41      asau     9899: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  9900: <h3 class="title">We need your help!</h3>
                   9901: <p>Should you have some spare cycles to devote to NetBSD, pkgsrc
                   9902:   and GNOME and are willing to learn new exciting stuff, please jump
1.174     leot     9903:   straight to the <a class="ulink" href="https://www.NetBSD.org/contrib/projects.html#gnome" target="_top">pending
1.1       dsieger  9904:   work</a> list!  There is still a long way to go to get a
                   9905:   fully-functional GNOME desktop under NetBSD and we need your help to
                   9906:   achieve it!</p>
                   9907: </div>
1.41      asau     9908: <div class="sect1">
1.1       dsieger  9909: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9910: <a name="meta-packages"></a>25.1. Meta packages</h2></div></div></div>
1.1       dsieger  9911: <p>pkgsrc includes three GNOME-related meta packages:</p>
1.41      asau     9912: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.137     leot     9913: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/README.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>: Provides
1.1       dsieger  9914:     the core GNOME desktop environment.  It only includes the necessary
                   9915:     bits to get it to boot correctly, although it may lack important
                   9916:     functionality for daily operation.  The idea behind this package is
                   9917:     to let end users build their own configurations on top of this one,
                   9918:     first installing this meta package to achieve a functional setup and
                   9919:     then adding individual applications.</p></li>
1.137     leot     9920: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/README.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a>: Provides a
1.1       dsieger  9921:     complete installation of the GNOME platform and desktop as defined
                   9922:     by the GNOME project; this is based on the components distributed in
                   9923:     the <code class="filename">platform/x.y/x.y.z/sources</code> and
                   9924:     <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the
                   9925:     official FTP server.  Developer-only tools found in those
                   9926:     directories are not installed unless required by some other
                   9927:     component to work properly.  Similarly, packages from the bindings
                   9928:     set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled
                   9929:     in unless required as a dependency for an end-user component.  This
1.137     leot     9930:     package "extends" <a href="https://cdn.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>
                   9931: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/README.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a>:
1.1       dsieger  9932:     Installs all the tools required to build a GNOME component when
                   9933:     fetched from the CVS repository.  These are required to let the
1.10      hubertf  9934:     <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li>
1.1       dsieger  9935: </ul></div>
                   9936: <p>In all these packages, the <code class="varname">DEPENDS</code> lines are
                   9937: sorted in a way that eases updates: a package may depend on other
                   9938: packages listed before it but not on any listed after it.  It is very
                   9939: important to keep this order to ease updates so... <span class="emphasis"><em>do not
                   9940: change it to alphabetical sorting!</em></span></p>
                   9941: </div>
1.41      asau     9942: <div class="sect1">
1.1       dsieger  9943: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   9944: <a name="new-package"></a>25.2. Packaging a GNOME application</h2></div></div></div>
1.1       dsieger  9945: <p>Almost all GNOME applications are written in C and use a common
                   9946: set of tools as their build system.  Things get different with the new
                   9947: bindings to other languages (such as Python), but the following will
                   9948: give you a general idea on the minimum required tools:</p>
1.41      asau     9949: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      9950: <li class="listitem">
1.1       dsieger  9951: <p>Almost all GNOME applications use the GNU Autotools as their
                   9952:     build system.  As a general rule you will need to tell this to your
                   9953:     package:</p>
                   9954: <pre class="programlisting">
                   9955: GNU_CONFIGURE=yes
                   9956: USE_LIBTOOL=yes
                   9957: USE_TOOLS+=gmake
                   9958: </pre>
                   9959: </li>
1.23      wiz      9960: <li class="listitem">
1.1       dsieger  9961: <p>If the package uses pkg-config to detect dependencies, add this
                   9962:     tool to the list of required utilities:</p>
1.111     sevan    9963: <pre class="programlisting">
                   9964: USE_TOOLS+=pkg-config
                   9965: </pre>
1.137     leot     9966: <p>Also use <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/verifypc/README.html" target="_top"><code class="filename">pkgtools/verifypc</code></a> at
1.1       dsieger  9967:     the end of the build process to ensure that you did not miss to
                   9968:     specify any dependency in your package and that the version
                   9969:     requirements are all correct.</p>
                   9970: </li>
1.23      wiz      9971: <li class="listitem"><p>If the package uses intltool, be sure to add
1.1       dsieger  9972:     <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>
                   9973:     to handle dependencies and to force the package to use the latest
                   9974:     available version.</p></li>
1.23      wiz      9975: <li class="listitem">
1.1       dsieger  9976: <p>If the package uses gtk-doc (a documentation generation
                   9977:     utility), do <span class="emphasis"><em>not</em></span> add a dependency on it.  The
                   9978:     tool is rather big and the distfile should come with pregenerated
                   9979:     documentation anyway; if it does not, it is a bug that you ought to
                   9980:     report.  For such packages you should disable gtk-doc (unless it is
                   9981:     the default):</p>
1.111     sevan    9982: <pre class="programlisting">
                   9983: CONFIGURE_ARGS+=--disable-gtk-doc
                   9984: </pre>
1.1       dsieger  9985: <p>The default location of installed HTML files
                   9986:     (<code class="filename">share/gtk-doc/&lt;package-name&gt;</code>) is correct
                   9987:     and should not be changed unless the package insists on installing
                   9988:     them somewhere else.  Otherwise programs as
1.10      hubertf  9989:     <span class="command"><strong>devhelp</strong></span> will not be able to open them.  You can
1.1       dsieger  9990:     do that with an entry similar to:</p>
1.111     sevan    9991: <pre class="programlisting">
                   9992: CONFIGURE_ARGS+=--with-html-dir=${PREFIX}/share/gtk-doc/...
                   9993: </pre>
1.1       dsieger  9994: </li>
                   9995: </ul></div>
                   9996: <p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and
                   9997: files under the installation prefix to maintain databases.  In this
                   9998: context, shared means that those exact same directories and files are
                   9999: used among several different packages, leading to conflicts in the
                   10000: <code class="filename">PLIST</code>.  pkgsrc currently includes functionality to
                   10001: handle the most common cases, so you have to forget about using
                   10002: <code class="literal">@unexec ${RMDIR}</code> lines in your file lists and
                   10003: omitting shared files from them.  If you find yourself doing those,
                   10004: <span class="emphasis"><em>your package is most likely incorrect</em></span>.</p>
                   10005: <p>The following table lists the common situations that result in
                   10006: using shared directories or files.  For each of them, the appropriate
                   10007: solution is given.  After applying the solution be sure to
                   10008: <span class="emphasis"><em>regenerate the package's file list</em></span> with
1.10      hubertf  10009: <span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p>
1.1       dsieger  10010: <div class="table">
1.154     rillig   10011: <a name="plist-handling"></a><p class="title"><b>Table 25.1. PLIST handling for GNOME packages</b></p>
1.106     tnn      10012: <div class="table-contents"><table class="table" summary="PLIST handling for GNOME packages" border="1">
1.1       dsieger  10013: <colgroup>
                   10014: <col>
                   10015: <col>
                   10016: </colgroup>
                   10017: <thead><tr>
                   10018: <th>If the package...</th>
                   10019: <th>Then...</th>
                   10020: </tr></thead>
                   10021: <tbody>
                   10022: <tr>
                   10023: <td>Installs OMF files under <code class="filename">share/omf</code>.</td>
1.154     rillig   10024: <td>See <a class="xref" href="#scrollkeeper-data-files" title="21.6.10. Packages installing scrollkeeper/rarian data files">Section 21.6.10, &#8220;Packages installing scrollkeeper/rarian data files&#8221;</a>.</td>
1.1       dsieger  10025: </tr>
                   10026: <tr>
                   10027: <td>Installs icons under the
                   10028:         <code class="filename">share/icons/hicolor</code> hierarchy or updates
                   10029:         <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td>
1.154     rillig   10030: <td>See <a class="xref" href="#hicolor-theme" title="21.6.19. Packages installing hicolor theme icons">Section 21.6.19, &#8220;Packages installing hicolor theme icons&#8221;</a>.</td>
1.1       dsieger  10031: </tr>
                   10032: <tr>
                   10033: <td>Installs files under
                   10034:         <code class="filename">share/mime/packages</code>.</td>
1.154     rillig   10035: <td>See <a class="xref" href="#mime-database" title="21.6.14. Packages installing extensions to the MIME database">Section 21.6.14, &#8220;Packages installing extensions to the MIME database&#8221;</a>.</td>
1.1       dsieger  10036: </tr>
                   10037: <tr>
                   10038: <td>Installs <code class="filename">.desktop</code> files under
                   10039:         <code class="filename">share/applications</code> and these include MIME
                   10040:         information.</td>
1.154     rillig   10041: <td>See <a class="xref" href="#desktop-files" title="21.6.20. Packages installing desktop files">Section 21.6.20, &#8220;Packages installing desktop files&#8221;</a>.</td>
1.1       dsieger  10042: </tr>
                   10043: </tbody>
                   10044: </table></div>
                   10045: </div>
                   10046: <br class="table-break">
                   10047: </div>
1.41      asau     10048: <div class="sect1">
1.1       dsieger  10049: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10050: <a name="full-update"></a>25.3. Updating GNOME to a newer version</h2></div></div></div>
1.1       dsieger  10051: <p>When seeing GNOME as a whole, there are two kinds of
                   10052: updates:</p>
1.41      asau     10053: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  10054: <dt><span class="term">Major update</span></dt>
                   10055: <dd>
                   10056: <p>Given that there is still a very long way for GNOME 3 (if it
                   10057:       ever appears), we consider a major update one that goes from a
                   10058:       <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one,
                   10059:       where <code class="literal">Y</code> is even and greater than
                   10060:       <code class="literal">X</code>.  These are hard to achieve because they
                   10061:       introduce lots of changes in the components' code and almost all
                   10062:       GNOME distfiles are updated to newer versions.  Some of them can
                   10063:       even break API and ABI compatibility with the previous major
                   10064:       version series.  As a result, the update needs to be done all at
                   10065:       once to minimize breakage.</p>
                   10066: <p>A major update typically consists of around 80 package
                   10067:       updates and the addition of some new ones.</p>
                   10068: </dd>
                   10069: <dt><span class="term">Minor update</span></dt>
                   10070: <dd>
                   10071: <p>We consider a minor update one that goes from a
                   10072:       <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code>
                   10073:       one where <code class="literal">Y</code> is greater than
                   10074:       <code class="literal">X</code>.  These are easy to achieve because they do
                   10075:       not update all GNOME components, can be done in an incremental way
                   10076:       and do not break API nor ABI compatibility.</p>
                   10077: <p>A minor update typically consists of around 50 package
                   10078:       updates, although the numbers here may vary a lot.</p>
                   10079: </dd>
                   10080: </dl></div>
                   10081: <p>In order to update the GNOME components in pkgsrc to a new stable
                   10082: release (either major or minor), the following steps should be
                   10083: followed:</p>
1.23      wiz      10084: <div class="orderedlist"><ol class="orderedlist" type="1">
                   10085: <li class="listitem">
1.1       dsieger  10086: <p>Get a list of all the tarballs that form the new release by
                   10087:     using the following commands.  These will leave the full list of the
1.18      snj      10088:     components' distfiles into the <code class="filename">list.txt</code>
1.1       dsieger  10089:     file:</p>
                   10090: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
                   10091:     ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
                   10092:     awk '{ print $9 }' &gt;list.txt</code></strong>
                   10093: <code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
                   10094:     ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
                   10095:     awk '{ print $9 }' &gt;&gt;list.txt</code></strong></pre>
                   10096: </li>
1.23      wiz      10097: <li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and
1.1       dsieger  10098:     bump their version to the release you are updating them to.  The
                   10099:     three meta packages should be always consistent with versioning.
                   10100:     Obviously remove any <code class="varname">PKGREVISION</code>s that might be
                   10101:     in them.</p></li>
1.23      wiz      10102: <li class="listitem">
1.1       dsieger  10103: <p>For each meta package, update all its
                   10104:     <code class="varname">DEPENDS</code> lines to match the latest versions as
                   10105:     shown by the above commands.  Do <span class="emphasis"><em>not</em></span> list any
                   10106:     newer version (even if found in the FTP) because the meta packages
                   10107:     are supposed to list the exact versions that form a specific GNOME
                   10108:     release.  Exceptions are permitted here if a newer version solves a
                   10109:     serious issue in the overall desktop experience; these typically
                   10110:     come in the form of a revision bump in pkgsrc, not in newer versions
                   10111:     from the developers.</p>
                   10112: <p>Packages not listed in the <code class="filename">list.txt</code> file
                   10113:     should be updated to the latest version available (if found in
                   10114:     pkgsrc).  This is the case, for example, of the dependencies on the
1.137     leot     10115:     GNU Autotools in the <a href="https://cdn.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>
1.1       dsieger  10116: </li>
1.23      wiz      10117: <li class="listitem">
1.1       dsieger  10118: <p>Generate a patch from the modified meta packages and extract the
                   10119:     list of "new" lines.  This will provide you an outline on what
                   10120:     packages need to be updated in pkgsrc and in what order:</p>
                   10121: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs diff -u gnome-devel gnome-base gnome | grep '^+D' &gt;todo.txt</code></strong></pre>
                   10122: </li>
1.23      wiz      10123: <li class="listitem"><p>For major desktop updates it is recommended to zap all your
1.1       dsieger  10124:     installed packages and start over from scratch at this point.</p></li>
1.23      wiz      10125: <li class="listitem"><p>Now comes the longest step by far: iterate over the contents
1.1       dsieger  10126:     of <code class="filename">todo.txt</code> and update the packages listed in
                   10127:     it in order.  For major desktop updates none of these should be
                   10128:     committed until the entire set is completed because there are chances
                   10129:     of breaking not-yet-updated packages.</p></li>
1.23      wiz      10130: <li class="listitem"><p>Once the packages are up to date and working, commit them to
1.1       dsieger  10131:     the tree one by one with appropriate log messages.  At the end,
                   10132:     commit the three meta package updates and all the corresponding
                   10133:     changes to the <code class="filename">doc/CHANGES-&lt;YEAR&gt;</code> and
                   10134:     <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/doc/TODO?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">pkgsrc/doc/TODO</code></a> files.</p></li>
                   10135: </ol></div>
                   10136: </div>
1.41      asau     10137: <div class="sect1">
1.1       dsieger  10138: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10139: <a name="patching"></a>25.4. Patching guidelines</h2></div></div></div>
1.1       dsieger  10140: <p>GNOME is a very big component in pkgsrc which approaches 100
                   10141: packages.  Please, it is very important that you always, always,
                   10142: <span class="strong"><strong>always</strong></span> feed back any portability
1.154     rillig   10143: fixes you do to a GNOME package to the mainstream developers (see <a class="xref" href="#components.patches.feedback" title="13.3.5. Feedback to the author">Section 13.3.5, &#8220;Feedback to the author&#8221;</a>).  This is the only way to get
1.1       dsieger  10144: their attention on portability issues and to ensure that future versions
                   10145: can be built out-of-the box on NetBSD.  The less custom patches in
                   10146: pkgsrc, the easier further updates are.  Those developers in charge of
                   10147: issuing major GNOME updates will be grateful if you do that.</p>
1.174     leot     10148: <p>The most common places to report bugs are the <a class="ulink" href="https://bugzilla.gnome.org/" target="_top">GNOME's Bugzilla</a> and the <a class="ulink" href="https://bugzilla.freedesktop.org/" target="_top">freedesktop.org's
1.1       dsieger  10149: Bugzilla</a>.  Not all components use these to track bugs, but most
                   10150: of them do.  Do not be short on your reports: always provide detailed
                   10151: explanations of the current failure, how it can be improved to achieve
                   10152: maximum portability and, if at all possible, provide a patch against CVS
                   10153: head.  The more verbose you are, the higher chances of your patch being
                   10154: accepted.</p>
                   10155: <p>Also, please avoid using preprocessor magic to fix portability
                   10156: issues.  While the FreeBSD GNOME people are doing a great job in porting
                   10157: GNOME to their operating system, the official GNOME sources are now
                   10158: plagued by conditionals that check for <code class="varname">__FreeBSD__</code>
                   10159: and similar macros.  This hurts portability.  Please see our patching
1.154     rillig   10160: guidelines (<a class="xref" href="#components.patches.guidelines" title="13.3.4. Patching guidelines">Section 13.3.4, &#8220;Patching guidelines&#8221;</a>) for more
1.1       dsieger  10161: details.</p>
                   10162: </div>
                   10163: </div>
                   10164: </div>
1.41      asau     10165: <div class="part">
1.1       dsieger  10166: <div class="titlepage"><div><div><h1 class="title">
                   10167: <a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div>
1.41      asau     10168: <div class="partintro">
1.1       dsieger  10169: <div></div>
                   10170: <p>This part of the guide deals with everything
                   10171:        from the infrastructure that is behind the interfaces described
                   10172:        in the developer's guide. A casual package maintainer should not
                   10173:        need anything from this part.</p>
                   10174: <div class="toc">
                   10175: <p><b>Table of Contents</b></p>
1.100     leot     10176: <dl class="toc">
1.154     rillig   10177: <dt><span class="chapter"><a href="#infr.design">26. Design of the pkgsrc infrastructure</a></span></dt>
1.1       dsieger  10178: <dd><dl>
1.154     rillig   10179: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
                   10180: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
                   10181: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.1       dsieger  10182: <dd><dl>
1.154     rillig   10183: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
                   10184: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.1       dsieger  10185: </dl></dd>
1.154     rillig   10186: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
                   10187: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.1       dsieger  10188: <dd><dl>
1.154     rillig   10189: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
                   10190: <dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
1.1       dsieger  10191: </dl></dd>
1.154     rillig   10192: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.1       dsieger  10193: <dd><dl>
1.154     rillig   10194: <dt><span class="sect2"><a href="#infr.order.prefs">26.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
                   10195: <dt><span class="sect2"><a href="#infr.order.pkg">26.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.1       dsieger  10196: </dl></dd>
                   10197: </dl></dd>
1.154     rillig   10198: <dt><span class="chapter"><a href="#regression">27. Regression tests</a></span></dt>
1.1       dsieger  10199: <dd><dl>
1.154     rillig   10200: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
                   10201: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.1       dsieger  10202: <dd><dl>
1.154     rillig   10203: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
                   10204: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.1       dsieger  10205: </dl></dd>
                   10206: </dl></dd>
1.154     rillig   10207: <dt><span class="chapter"><a href="#porting">28. Porting pkgsrc</a></span></dt>
                   10208: <dd><dl><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
1.1       dsieger  10209: </dl>
                   10210: </div>
                   10211: </div>
1.41      asau     10212: <div class="chapter">
1.1       dsieger  10213: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   10214: <a name="infr.design"></a>Chapter 26. Design of the pkgsrc infrastructure</h2></div></div></div>
1.1       dsieger  10215: <div class="toc">
                   10216: <p><b>Table of Contents</b></p>
1.100     leot     10217: <dl class="toc">
1.154     rillig   10218: <dt><span class="sect1"><a href="#infr.vardef">26.1. The meaning of variable definitions</a></span></dt>
                   10219: <dt><span class="sect1"><a href="#infr.vardef.problems">26.2. Avoiding problems before they arise</a></span></dt>
                   10220: <dt><span class="sect1"><a href="#infr.var">26.3. Variable evaluation</a></span></dt>
1.1       dsieger  10221: <dd><dl>
1.154     rillig   10222: <dt><span class="sect2"><a href="#infr.var.load">26.3.1. At load time</a></span></dt>
                   10223: <dt><span class="sect2"><a href="#infr.var.run">26.3.2. At runtime</a></span></dt>
1.1       dsieger  10224: </dl></dd>
1.154     rillig   10225: <dt><span class="sect1"><a href="#infr.varspec">26.4. How can variables be specified?</a></span></dt>
                   10226: <dt><span class="sect1"><a href="#infr.design.intf">26.5. Designing interfaces for Makefile fragments</a></span></dt>
1.1       dsieger  10227: <dd><dl>
1.154     rillig   10228: <dt><span class="sect2"><a href="#infr.design.intf.proc">26.5.1. Procedures with parameters</a></span></dt>
                   10229: <dt><span class="sect2"><a href="#infr.design.intf.action">26.5.2. Actions taken on behalf of parameters</a></span></dt>
1.1       dsieger  10230: </dl></dd>
1.154     rillig   10231: <dt><span class="sect1"><a href="#infr.order">26.6. The order in which files are loaded</a></span></dt>
1.1       dsieger  10232: <dd><dl>
1.154     rillig   10233: <dt><span class="sect2"><a href="#infr.order.prefs">26.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
                   10234: <dt><span class="sect2"><a href="#infr.order.pkg">26.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.1       dsieger  10235: </dl></dd>
                   10236: </dl>
                   10237: </div>
                   10238: <p>The pkgsrc infrastructure consists of many small Makefile
                   10239:        fragments. Each such fragment needs a properly specified
                   10240:        interface. This chapter explains how such an interface looks
                   10241:        like.</p>
1.41      asau     10242: <div class="sect1">
1.1       dsieger  10243: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10244: <a name="infr.vardef"></a>26.1. The meaning of variable definitions</h2></div></div></div>
1.1       dsieger  10245: <p>Whenever a variable is defined in the pkgsrc
                   10246:        infrastructure, the location and the way of definition provide
                   10247:        much information about the intended use of that variable.
                   10248:        Additionally, more documentation may be found in a header
                   10249:        comment or in this pkgsrc guide.</p>
                   10250: <p>A special file is
                   10251:        <code class="filename">mk/defaults/mk.conf</code>, which lists all
                   10252:        variables that are intended to be user-defined. They are either
                   10253:        defined using the <code class="literal">?=</code> operator or they are
                   10254:        left undefined because defining them to anything would
1.23      wiz      10255:        effectively mean <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. All these variables may be
1.1       dsieger  10256:        overridden by the pkgsrc user in the <code class="varname">MAKECONF</code>
                   10257:        file.</p>
                   10258: <p>Outside this file, the following conventions apply:
                   10259:        Variables that are defined using the <code class="literal">?=</code>
                   10260:        operator may be overridden by a package.</p>
                   10261: <p>Variables that are defined using the <code class="literal">=</code>
                   10262:        operator may be used read-only at run-time.</p>
                   10263: <p>Variables whose name starts with an underscore must not be
                   10264:        accessed outside the pkgsrc infrastructure at all. They may
                   10265:        change without further notice.</p>
1.41      asau     10266: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  10267: <h3 class="title">Note</h3>
                   10268: <p>These conventions are currently not applied
                   10269:        consistently to the complete pkgsrc
                   10270:        infrastructure.</p>
                   10271: </div>
                   10272: </div>
1.41      asau     10273: <div class="sect1">
1.1       dsieger  10274: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10275: <a name="infr.vardef.problems"></a>26.2. Avoiding problems before they arise</h2></div></div></div>
1.1       dsieger  10276: <p>All variables that contain lists of things should default
                   10277:        to being empty. Two examples that do not follow this rule are
                   10278:        <code class="varname">USE_LANGUAGES</code> and
                   10279:        <code class="varname">DISTFILES</code>. These variables cannot simply be
                   10280:        modified using the <code class="literal">+=</code> operator in package
                   10281:        <code class="filename">Makefile</code>s (or other files included by
                   10282:        them), since there is no guarantee whether the variable is
                   10283:        already set or not, and what its value is. In the case of
1.23      wiz      10284:        <code class="varname">DISTFILES</code>, the packages <span class="quote">&#8220;<span class="quote">know</span>&#8221;</span>
1.1       dsieger  10285:        the default value and just define it as in the following
                   10286:        example.</p>
                   10287: <pre class="programlisting">
                   10288: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
                   10289: </pre>
                   10290: <p>Because of the selection of this default value, the same
                   10291:        value appears in many package Makefiles. Similarly for
                   10292:        <code class="varname">USE_LANGUAGES</code>, but in this case the default
1.23      wiz      10293:        value (<span class="quote">&#8220;<span class="quote"><code class="literal">c</code></span>&#8221;</span>) is so short that it
1.1       dsieger  10294:        doesn't stand out. Nevertheless it is mentioned in many
                   10295:        files.</p>
                   10296: </div>
1.41      asau     10297: <div class="sect1">
1.1       dsieger  10298: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10299: <a name="infr.var"></a>26.3. Variable evaluation</h2></div></div></div>
1.41      asau     10300: <div class="sect2">
1.1       dsieger  10301: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10302: <a name="infr.var.load"></a>26.3.1. At load time</h3></div></div></div>
1.1       dsieger  10303: <p>Variable evaluation takes place either at load time or at
                   10304:        runtime, depending on the context in which they occur. The
                   10305:        contexts where variables are evaluated at load time are:</p>
1.41      asau     10306: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      10307: <li class="listitem"><p>The right hand side of the <code class="literal">:=</code>
1.1       dsieger  10308:        and <code class="literal">!=</code> operators,</p></li>
1.23      wiz      10309: <li class="listitem"><p>Make directives like <code class="literal">.if</code> or
1.1       dsieger  10310:        <code class="literal">.for</code>,</p></li>
1.23      wiz      10311: <li class="listitem"><p>Dependency lines.</p></li>
1.1       dsieger  10312: </ul></div>
                   10313: <p>A special exception are references to the iteration
                   10314:        variables of <code class="literal">.for</code> loops, which are expanded
                   10315:        inline, no matter in which context they appear.</p>
                   10316: <p>As the values of variables may change during load time,
                   10317:        care must be taken not to evaluate them by accident. Typical
                   10318:        examples for variables that should not be evaluated at load time
                   10319:        are <code class="varname">DEPENDS</code> and
                   10320:        <code class="varname">CONFIGURE_ARGS</code>. To make the effect more
                   10321:        clear, here is an example:</p>
                   10322: <pre class="programlisting">
                   10323: CONFIGURE_ARGS=         # none
                   10324: CFLAGS=                 -O
                   10325: CONFIGURE_ARGS+=        CFLAGS=${CFLAGS:Q}
                   10326: 
                   10327: CONFIGURE_ARGS:=        ${CONFIGURE_ARGS}
                   10328: 
                   10329: CFLAGS+=                -Wall
1.111     sevan    10330: </pre>
1.1       dsieger  10331: <p>This code shows how the use of the <code class="literal">:=</code>
                   10332:        operator can quickly lead to unexpected results. The first
                   10333:        paragraph is fairly common code. The second paragraph evaluates
                   10334:        the <code class="varname">CONFIGURE_ARGS</code> variable, which results in
                   10335:        <code class="literal">CFLAGS=-O</code>. In the third paragraph, the
                   10336:        <code class="literal">-Wall</code> is appended to the
                   10337:        <code class="varname">CFLAGS</code>, but this addition will not appear in
                   10338:        <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three
                   10339:        paragraphs from above typically occur in completely unrelated
                   10340:        files.</p>
                   10341: </div>
1.41      asau     10342: <div class="sect2">
1.1       dsieger  10343: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10344: <a name="infr.var.run"></a>26.3.2. At runtime</h3></div></div></div>
1.1       dsieger  10345: <p>After all the files have been loaded, the values of the
                   10346:        variables cannot be changed anymore. Variables that are used in
                   10347:        the shell commands are expanded at this point.</p>
                   10348: </div>
                   10349: </div>
1.41      asau     10350: <div class="sect1">
1.1       dsieger  10351: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10352: <a name="infr.varspec"></a>26.4. How can variables be specified?</h2></div></div></div>
1.1       dsieger  10353: <p>There are many ways in which the definition and use of a
1.108     rillig   10354:        variable can be restricted in order to detect bugs and violations
                   10355:        of the (mostly unwritten) policies. A package can be checked with
                   10356:        <code class="literal">pkglint -Wall</code> to see whether it meets these
                   10357:        rules.</p>
1.1       dsieger  10358: </div>
1.41      asau     10359: <div class="sect1">
1.1       dsieger  10360: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10361: <a name="infr.design.intf"></a>26.5. Designing interfaces for Makefile fragments</h2></div></div></div>
1.1       dsieger  10362: <p>Most of the <code class="filename">.mk</code> files fall into one
                   10363:        of the following classes. Cases where a file falls into more
                   10364:        than one class should be avoided as it often leads to subtle
                   10365:        bugs.</p>
1.41      asau     10366: <div class="sect2">
1.1       dsieger  10367: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10368: <a name="infr.design.intf.proc"></a>26.5.1. Procedures with parameters</h3></div></div></div>
1.1       dsieger  10369: <p>In a traditional imperative programming language some of
                   10370:        the <code class="filename">.mk</code> files could be described as
1.14      jmcneill 10371:        procedures. They take some input parameters and&mdash;after
                   10372:        inclusion&mdash;provide a result in output parameters. Since all
1.1       dsieger  10373:        variables in <code class="filename">Makefile</code>s have global scope
                   10374:        care must be taken not to use parameter names that have already
                   10375:        another meaning. For example, <code class="varname">PKGNAME</code> is a
                   10376:        bad choice for a parameter name.</p>
                   10377: <p>Procedures are completely evaluated at preprocessing time.
                   10378:        That is, when calling a procedure all input parameters must be
                   10379:        completely resolvable. For example,
                   10380:        <code class="varname">CONFIGURE_ARGS</code> should never be an input
                   10381:        parameter since it is very likely that further text will be
                   10382:        added after calling the procedure, which would effectively apply
                   10383:        the procedure to only a part of the variable. Also, references
1.108     rillig   10384:        to other variables will be modified after calling the
1.1       dsieger  10385:        procedure.</p>
                   10386: <p>A procedure can declare its output parameters either as
                   10387:        suitable for use in preprocessing directives or as only
                   10388:        available at runtime. The latter alternative is for variables
                   10389:        that contain references to other runtime variables.</p>
                   10390: <p>Procedures shall be written such that it is possible to
                   10391:        call the procedure more than once. That is, the file must not
                   10392:        contain multiple-inclusion guards.</p>
                   10393: <p>Examples for procedures are
                   10394:        <code class="filename">mk/bsd.options.mk</code> and
                   10395:        <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express
                   10396:        that the parameters are evaluated at load time, they should be
                   10397:        assigned using the <code class="literal">:=</code> operator, which should
                   10398:        be used only for this purpose.</p>
                   10399: </div>
1.41      asau     10400: <div class="sect2">
1.1       dsieger  10401: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10402: <a name="infr.design.intf.action"></a>26.5.2. Actions taken on behalf of parameters</h3></div></div></div>
1.1       dsieger  10403: <p>Action files take some input parameters and may define
                   10404:        runtime variables. They shall not define loadtime variables.
                   10405:        There are action files that are included implicitly by the
                   10406:        pkgsrc infrastructure, while other must be included
                   10407:        explicitly.</p>
                   10408: <p>An example for action files is
                   10409:        <code class="filename">mk/subst.mk</code>.</p>
                   10410: </div>
                   10411: </div>
1.41      asau     10412: <div class="sect1">
1.1       dsieger  10413: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10414: <a name="infr.order"></a>26.6. The order in which files are loaded</h2></div></div></div>
1.1       dsieger  10415: <p>Package <code class="filename">Makefile</code>s usually consist of
                   10416:        a set of variable definitions, and include the file
                   10417:        <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line.
                   10418:        Before that, they may also include various other
                   10419:        <code class="filename">*.mk</code> files if they need to query the
                   10420:        availability of certain features like the type of compiler or
                   10421:        the X11 implementation. Due to the heavy use of preprocessor
                   10422:        directives like <code class="literal">.if</code> and
                   10423:        <code class="literal">.for</code>, the order in which the files are loaded
                   10424:        matters.</p>
                   10425: <p>This section describes at which point the various files
                   10426:        are loaded and gives reasons for that order.</p>
1.41      asau     10427: <div class="sect2">
1.1       dsieger  10428: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10429: <a name="infr.order.prefs"></a>26.6.1. The order in <code class="filename">bsd.prefs.mk</code>
1.1       dsieger  10430: </h3></div></div></div>
                   10431: <p>The very first action in <code class="filename">bsd.prefs.mk</code>
                   10432:        is to define some essential variables like
                   10433:        <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and
                   10434:        <code class="varname">MACHINE_ARCH</code>.</p>
                   10435: <p>Then, the user settings are loaded from the file specified
1.10      hubertf  10436:        in <code class="varname">MAKECONF</code>, which is usually <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.
1.4       rillig   10437:        After that, those variables
1.1       dsieger  10438:        that have not been overridden by the user are loaded from
                   10439:        <code class="filename">mk/defaults/mk.conf</code>.</p>
                   10440: <p>After the user settings, the system settings and platform
                   10441:        settings are loaded, which may override the user
                   10442:        settings.</p>
                   10443: <p>Then, the tool definitions are loaded. The tool wrappers
                   10444:        are not yet in effect. This only happens when building a
                   10445:        package, so the proper variables must be used instead of the
                   10446:        direct tool names.</p>
                   10447: <p>As the last steps, some essential variables from the
                   10448:        wrapper and the package system flavor are loaded, as well as the
                   10449:        variables that have been cached in earlier phases of a package
                   10450:        build.</p>
                   10451: </div>
1.41      asau     10452: <div class="sect2">
1.1       dsieger  10453: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10454: <a name="infr.order.pkg"></a>26.6.2. The order in <code class="filename">bsd.pkg.mk</code>
1.1       dsieger  10455: </h3></div></div></div>
                   10456: <p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p>
                   10457: <p>Then, the various <code class="filename">*-vars.mk</code> files are
                   10458:        loaded, which fill default values for those variables that have
                   10459:        not been defined by the package. These variables may later
                   10460:        be used even in unrelated files.</p>
                   10461: <p>Then, the file <code class="filename">bsd.pkg.error.mk</code>
                   10462:        provides the target <code class="literal">error-check</code> that is added
                   10463:        as a special dependency to all other targets that use
                   10464:        <code class="varname">DELAYED_ERROR_MSG</code> or
                   10465:        <code class="varname">DELAYED_WARNING_MSG</code>.</p>
                   10466: <p>Then, the package-specific hacks from
                   10467:        <code class="filename">hacks.mk</code> are included.</p>
                   10468: <p>Then, various other files follow. Most of them don't have
                   10469:        any dependencies on what they need to have included before or
                   10470:        after them, though some do.</p>
                   10471: <p>The code to check <code class="varname">PKG_FAIL_REASON</code> and
                   10472:        <code class="varname">PKG_SKIP_REASON</code> is then executed, which
                   10473:        restricts the use of these variables to all the files that have
                   10474:        been included before. Appearances in later files will be
                   10475:        silently ignored.</p>
                   10476: <p>Then, the files for the main targets are included, in the
                   10477:        order of later execution, though the actual order should not
                   10478:        matter.</p>
                   10479: <p>At last, some more files are included that don't set any
                   10480:        interesting variables but rather just define make targets to be
                   10481:        executed.</p>
                   10482: </div>
                   10483: </div>
                   10484: </div>
1.41      asau     10485: <div class="chapter">
1.1       dsieger  10486: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   10487: <a name="regression"></a>Chapter 27. Regression tests</h2></div></div></div>
1.1       dsieger  10488: <div class="toc">
                   10489: <p><b>Table of Contents</b></p>
1.100     leot     10490: <dl class="toc">
1.154     rillig   10491: <dt><span class="sect1"><a href="#regression.run">27.1. Running the regression tests</a></span></dt>
                   10492: <dt><span class="sect1"><a href="#regression.new">27.2. Adding a new regression test</a></span></dt>
1.1       dsieger  10493: <dd><dl>
1.154     rillig   10494: <dt><span class="sect2"><a href="#regression.fun.override">27.2.1. Overridable functions</a></span></dt>
                   10495: <dt><span class="sect2"><a href="#regression.fun.helper">27.2.2. Helper functions</a></span></dt>
1.1       dsieger  10496: </dl></dd>
                   10497: </dl>
                   10498: </div>
                   10499: <p>The pkgsrc infrastructure consists of a large codebase,
                   10500:        and there are many corners where every little bit of a file is
                   10501:        well thought out, making pkgsrc likely to fail as soon as
                   10502:        anything is changed near those parts. To prevent most changes
                   10503:        from breaking anything, a suite of regression tests should go
                   10504:        along with every important part of the pkgsrc infrastructure.
                   10505:        This chapter describes how regression tests work in pkgsrc and
                   10506:        how you can add new tests.</p>
1.41      asau     10507: <div class="sect1">
1.1       dsieger  10508: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10509: <a name="regression.run"></a>27.1. Running the regression tests</h2></div></div></div>
1.137     leot     10510: <p>You first need to install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_regress/README.html" target="_top"><code class="filename">pkgtools/pkg_regress</code></a> package, which
1.10      hubertf  10511:        provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
1.1       dsieger  10512:        can simply run that command, which will run all tests in the
1.168     rillig   10513:        <code class="filename">regress/</code> directory.</p>
1.1       dsieger  10514: </div>
1.41      asau     10515: <div class="sect1">
1.1       dsieger  10516: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10517: <a name="regression.new"></a>27.2. Adding a new regression test</h2></div></div></div>
1.168     rillig   10518: <p>Every directory in the <code class="filename">regress/</code>
                   10519:        directory that contains a file called <code class="filename">spec</code>
1.1       dsieger  10520:        is considered a regression test. This file is a shell program
1.10      hubertf  10521:        that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
1.1       dsieger  10522:        The following functions can be overridden to suit your
                   10523:        needs.</p>
1.41      asau     10524: <div class="sect2">
1.1       dsieger  10525: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10526: <a name="regression.fun.override"></a>27.2.1. Overridable functions</h3></div></div></div>
1.108     rillig   10527: <p>These functions do not take any parameters. Although they
                   10528:        are called in <span class="quote">&#8220;<span class="quote">set -e</span>&#8221;</span> mode, they don't stop at the
1.174     leot     10529:        first failing command. See <a class="ulink" href="https://stackoverflow.com/q/4072984" target="_top">this Stack Overflow
1.108     rillig   10530:        question</a> for details.</p>
1.41      asau     10531: <div class="variablelist"><dl class="variablelist">
1.108     rillig   10532: <dt><span class="term"><code class="varname">do_setup</code></span></dt>
1.1       dsieger  10533: <dd><p>This function prepares the environment for the
                   10534:        test. By default it does nothing.</p></dd>
1.108     rillig   10535: <dt><span class="term"><code class="varname">do_test</code></span></dt>
                   10536: <dd>
                   10537: <p>This function runs the actual test. By default,
1.1       dsieger  10538:        it calls <code class="varname">TEST_MAKE</code> with the arguments
                   10539:        <code class="varname">MAKEARGS_TEST</code> and writes its output including
                   10540:        error messages into the file
1.108     rillig   10541:        <code class="varname">TEST_OUTFILE</code>.</p>
                   10542: <p>When defining this function, make sure that all output that
                   10543:        needs to be checked is written to the correct output file.
                   10544:        Example:</p>
                   10545: <pre class="programlisting">
                   10546: do_test() {
1.112     rillig   10547:         echo "Example output"
1.108     rillig   10548: } 1&gt;$TEST_OUTFILE 2&gt;&amp;1
                   10549: </pre>
                   10550: </dd>
                   10551: <dt><span class="term"><code class="varname">check_result</code></span></dt>
                   10552: <dd>
                   10553: <p>This function is run after the test and is
1.1       dsieger  10554:        typically used to compare the actual output from the one that is
                   10555:        expected. It can make use of the various helper functions from
1.108     rillig   10556:        the next section. Example:</p>
                   10557: <pre class="programlisting">
                   10558: check_result() {
1.112     rillig   10559:         exit_status 0
                   10560:         output_require "Example"
                   10561:         output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
                   10562:         output_prohibit "no such file or directory"
1.168     rillig   10563:         regress_fail "expected $expected but got $actual for input $input"
1.108     rillig   10564: }
                   10565: </pre>
                   10566: </dd>
                   10567: <dt><span class="term"><code class="varname">do_cleanup</code></span></dt>
1.1       dsieger  10568: <dd><p>This function cleans everything up after the
                   10569:        test has been run. By default it does nothing.</p></dd>
                   10570: </dl></div>
                   10571: </div>
1.41      asau     10572: <div class="sect2">
1.1       dsieger  10573: <div class="titlepage"><div><div><h3 class="title">
1.154     rillig   10574: <a name="regression.fun.helper"></a>27.2.2. Helper functions</h3></div></div></div>
1.41      asau     10575: <div class="variablelist"><dl class="variablelist">
1.168     rillig   10576: <dt><span class="term"><code class="varname">regress_fail <em class="replaceable"><code>message...</code></em></code></span></dt>
                   10577: <dd><p>This function makes the test fail with the given error message.</p></dd>
1.108     rillig   10578: <dt><span class="term"><code class="varname">exit_status expected</code></span></dt>
1.1       dsieger  10579: <dd><p>This function compares the exitcode of the
1.108     rillig   10580:        <span class="command"><strong>do_test</strong></span> function with its first parameter.
1.1       dsieger  10581:        If they differ, the test will fail.</p></dd>
1.108     rillig   10582: <dt><span class="term"><code class="varname">output_require regex...</code></span></dt>
                   10583: <dd>
                   10584: <p>This function checks for each of its parameters
                   10585:        if the output from <span class="command"><strong>do_test</strong></span> matches the
1.1       dsieger  10586:        extended regular expression. If it does not, the test will
1.108     rillig   10587:        fail. Example:</p>
                   10588: <pre class="programlisting">
                   10589: output_require "looks fine"
                   10590: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
                   10591: </pre>
                   10592: </dd>
1.177     leot     10593: <dt><span class="term"><code class="varname">output_prohibit regex...</code></span></dt>
1.1       dsieger  10594: <dd><p>This function checks for each of its parameters
1.10      hubertf  10595:        if the output from <span class="command"><strong>do_test()</strong></span> does
1.1       dsieger  10596:        <span class="emphasis"><em>not</em></span> match the extended regular expression.
                   10597:        If any of the regular expressions matches, the test will
                   10598:        fail.</p></dd>
                   10599: </dl></div>
                   10600: </div>
                   10601: </div>
                   10602: </div>
1.41      asau     10603: <div class="chapter">
1.1       dsieger  10604: <div class="titlepage"><div><div><h2 class="title">
1.154     rillig   10605: <a name="porting"></a>Chapter 28. Porting pkgsrc</h2></div></div></div>
1.1       dsieger  10606: <div class="toc">
                   10607: <p><b>Table of Contents</b></p>
1.154     rillig   10608: <dl class="toc"><dt><span class="sect1"><a href="#porting.opsys">28.1. Porting pkgsrc to a new operating system</a></span></dt></dl>
1.1       dsieger  10609: </div>
                   10610: <p>The pkgsrc system has already been ported to many
                   10611:        operating systems, hardware architectures and compilers. This
                   10612:        chapter explains the necessary steps to make pkgsrc even more
                   10613:        portable.</p>
1.41      asau     10614: <div class="sect1">
1.1       dsieger  10615: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   10616: <a name="porting.opsys"></a>28.1. Porting pkgsrc to a new operating system</h2></div></div></div>
1.1       dsieger  10617: <p>To port pkgsrc to a new operating system (called
                   10618:        <code class="literal">MyOS</code> in this example), you need to touch the
                   10619:        following files:</p>
1.41      asau     10620: <div class="variablelist"><dl class="variablelist">
1.1       dsieger  10621: <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>
                   10622: <dd><p>This file contains some basic definitions, for
                   10623:        example the name of the C
                   10624:        compiler.</p></dd>
                   10625: <dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt>
                   10626: <dd><p>Insert code that defines the variables
                   10627:        <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>,
                   10628:        <code class="varname">LOWER_OS_VERSION</code>,
                   10629:        <code class="varname">LOWER_VENDOR</code>,
                   10630:        <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>,
                   10631:        <code class="varname">APPEND_ELF</code>, and the other variables that
                   10632:        appear in this file.</p></dd>
                   10633: <dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
                   10634: <dd><p>This file contains the platform-specific
                   10635:        definitions that are used by pkgsrc. Start by copying one of the
                   10636:        other files and edit it to your
                   10637:        needs.</p></dd>
                   10638: <dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
                   10639: <dd><p>This file defines the paths to all the tools
                   10640:        that are needed by one or the other package in pkgsrc, as well
                   10641:        as by pkgsrc itself. Find out where these tools are on your
                   10642:        platform and add them.</p></dd>
                   10643: </dl></div>
                   10644: <p>Now, you should be able to build some basic packages, like
1.137     leot     10645:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/perl5/README.html" target="_top"><code class="filename">lang/perl5</code></a>, <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/bash/README.html" target="_top"><code class="filename">shells/bash</code></a>.</p>
1.1       dsieger  10646: </div>
                   10647: </div>
                   10648: </div>
1.41      asau     10649: <div class="appendix">
                   10650: <div class="titlepage"><div><div><h1 class="title">
                   10651: <a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
1.1       dsieger  10652: <div class="toc">
                   10653: <p><b>Table of Contents</b></p>
1.100     leot     10654: <dl class="toc">
1.1       dsieger  10655: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
                   10656: <dd><dl>
                   10657: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
                   10658: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
                   10659: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.172     rillig   10660: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
1.1       dsieger  10661: </dl></dd>
                   10662: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
                   10663: </dl>
                   10664: </div>
                   10665: <p>We checked to find a piece of software that wasn't in the packages
                   10666:     collection, and picked GNU bison. Quite why someone would want to have
1.10      hubertf  10667:     <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
1.1       dsieger  10668:     present in the tree is beyond us, but it's useful for the purposes of
                   10669:     this exercise.</p>
1.41      asau     10670: <div class="sect1">
1.1       dsieger  10671: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   10672: <a name="example-files"></a>A.1. files</h2></div></div></div>
1.41      asau     10673: <div class="sect2">
1.1       dsieger  10674: <div class="titlepage"><div><div><h3 class="title">
                   10675: <a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
                   10676: <pre class="programlisting">
                   10677: # $NetBSD$
                   10678: #
                   10679: 
                   10680: DISTNAME=       bison-1.25
                   10681: CATEGORIES=     devel
1.171     rillig   10682: MASTER_SITES=   ${MASTER_SITE_GNU:=bison/}
1.1       dsieger  10683: 
1.29      dholland 10684: MAINTAINER=     pkgsrc-users@NetBSD.org
1.174     leot     10685: HOMEPAGE=       https://www.gnu.org/software/bison/bison.html
1.1       dsieger  10686: COMMENT=        GNU yacc clone
                   10687: 
                   10688: GNU_CONFIGURE=  yes
1.46      wiz      10689: INFO_FILES=     yes
1.1       dsieger  10690: 
                   10691: .include "../../mk/bsd.pkg.mk"
                   10692: </pre>
                   10693: </div>
1.41      asau     10694: <div class="sect2">
1.1       dsieger  10695: <div class="titlepage"><div><div><h3 class="title">
                   10696: <a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
                   10697: <pre class="programlisting">
                   10698: GNU version of yacc.  Can make re-entrant parsers, and numerous other
1.174     leot     10699: improvements.  Why you would want this when Berkeley <a class="citerefentry" href="https://netbsd.gw.com/cgi-bin/man-cgi?yacc+1.i386+NetBSD-9.0"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.1       dsieger  10700: of the NetBSD source tree is beyond me.
                   10701: </pre>
                   10702: </div>
1.41      asau     10703: <div class="sect2">
1.1       dsieger  10704: <div class="titlepage"><div><div><h3 class="title">
                   10705: <a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
                   10706: <pre class="programlisting">
                   10707: @comment $NetBSD$
                   10708: bin/bison
                   10709: man/man1/bison.1.gz
                   10710: share/bison.simple
                   10711: share/bison.hairy
                   10712: </pre>
                   10713: </div>
1.41      asau     10714: <div class="sect2">
1.1       dsieger  10715: <div class="titlepage"><div><div><h3 class="title">
1.172     rillig   10716: <a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with pkglint</h3></div></div></div>
1.1       dsieger  10717: <p>The NetBSD package system comes with
1.137     leot     10718:         <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/README.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>
1.1       dsieger  10719:        which helps to check the contents of these
                   10720:        files. After installation it is quite easy to use, just change to the
1.171     rillig   10721:        directory of the package you wish to examine and run
1.10      hubertf  10722:        <span class="command"><strong>pkglint</strong></span>:</p>
1.1       dsieger  10723: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
1.171     rillig   10724: ERROR: Makefile: Each package must define its LICENSE.
                   10725: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
                   10726: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
                   10727: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
                   10728: 1 error, 2 warnings and 1 note found.
                   10729: (Run "pkglint -e" to show explanations.)
                   10730: (Run "pkglint -fs" to show what can be fixed automatically.)
1.172     rillig   10731: (Run "pkglint -F" to automatically fix some issues.)</pre>
1.1       dsieger  10732: <p>Depending on the supplied command line arguments (see pkglint(1)),
1.170     rillig   10733:        more checks will be performed. Use e.g. <span class="command"><strong>pkglint
1.1       dsieger  10734:        -Wall</strong></span> for a very thorough check.</p>
                   10735: </div>
                   10736: </div>
1.41      asau     10737: <div class="sect1">
1.1       dsieger  10738: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   10739: <a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
                   10740: <p>Create the directory where the package lives,
                   10741:       plus any auxiliary directories:</p>
                   10742: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10743: <code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
                   10744: <code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
                   10745: <code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
                   10746: <p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
1.154     rillig   10747:       <code class="filename">PLIST</code> (see <a class="xref" href="#components" title="Chapter 13. Package components - files, directories and contents">Chapter 13, <i>Package components - files, directories and contents</i></a>)
1.1       dsieger  10748:       then continue with fetching the distfile:</p>
                   10749: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
                   10750: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10751: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10752: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10753: ftp: Error retrieving file: 500 Internal error
                   10754: 
                   10755: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10756: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10757: ftp: Error retrieving file: 500 Internal error
                   10758: 
                   10759: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10760: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10761: Successfully retrieved file.</pre>
                   10762: <p>Generate the checksum of the distfile into
                   10763:       <code class="filename">distinfo</code>:</p>
                   10764: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
                   10765: <p>Now compile:</p>
                   10766: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
                   10767: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10768: ===&gt;  Extracting for bison-1.25
                   10769: ===&gt;  Patching for bison-1.25
                   10770: ===&gt;   Ignoring empty patch directory
                   10771: ===&gt;  Configuring for bison-1.25
                   10772: creating cache ./config.cache
                   10773: checking for gcc... cc
                   10774: checking whether we are using GNU C... yes
                   10775: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10776: checking how to run the C preprocessor... cc -E
                   10777: checking for minix/config.h... no
                   10778: checking for POSIXized ISC... no
                   10779: checking whether cross-compiling... no
                   10780: checking for ANSI C header files... yes
                   10781: checking for string.h... yes
                   10782: checking for stdlib.h... yes
                   10783: checking for memory.h... yes
                   10784: checking for working const... yes
                   10785: checking for working alloca.h... no
                   10786: checking for alloca... yes
                   10787: checking for strerror... yes
                   10788: updating cache ./config.cache
                   10789: creating ./config.status
                   10790: creating Makefile
                   10791: ===&gt;  Building for bison-1.25
                   10792: 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
                   10793: 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
                   10794: 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
                   10795: 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
                   10796: 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
                   10797: 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
                   10798: 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
                   10799: 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
                   10800: 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
                   10801: 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
                   10802: 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
                   10803: 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
                   10804: 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
                   10805: 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
                   10806: 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
                   10807: 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
                   10808: 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
                   10809: 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
                   10810: 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
                   10811: 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
                   10812: 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
                   10813: 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
                   10814: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10815: rm -f bison.s1
                   10816: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1</pre>
                   10817: <p>Everything seems OK, so install the files:</p>
                   10818: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                   10819: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10820: ===&gt;  Installing for bison-1.25
                   10821: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10822: rm -f /usr/pkg/bin/bison
                   10823: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10824: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10825: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10826: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10827: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10828: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10829: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10830: ===&gt;  Registering installation for bison-1.25</pre>
                   10831: <p>You can now use bison, and also - if you decide so - remove it with
1.10      hubertf  10832:       <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
1.1       dsieger  10833:       binary package, do this now:</p>
                   10834: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
                   10835: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10836: ===&gt;  Building package for bison-1.25
                   10837: Creating package bison-1.25.tgz
                   10838: Registering depends:.
                   10839: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
                   10840: <p>Now that you don't need the source and object files
                   10841:       any more, clean up:</p>
                   10842: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make clean</code></strong>
                   10843: ===&gt;  Cleaning for bison-1.25</pre>
                   10844: </div>
                   10845: </div>
1.41      asau     10846: <div class="appendix">
                   10847: <div class="titlepage"><div><div><h1 class="title">
                   10848: <a name="logs"></a>Appendix B. Build logs</h1></div></div></div>
1.1       dsieger  10849: <div class="toc">
                   10850: <p><b>Table of Contents</b></p>
1.100     leot     10851: <dl class="toc">
1.1       dsieger  10852: <dt><span class="sect1"><a href="#logs.building">B.1. Building figlet</a></span></dt>
                   10853: <dt><span class="sect1"><a href="#logs.package">B.2. Packaging figlet</a></span></dt>
                   10854: </dl>
                   10855: </div>
1.41      asau     10856: <div class="sect1">
1.1       dsieger  10857: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   10858: <a name="logs.building"></a>B.1. Building figlet</h2></div></div></div>
                   10859: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
                   10860: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10861: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   10862: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   10863: =&gt; [172219 bytes]
                   10864: Connected to ftp.plig.net.
                   10865: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   10866: 331 Guest login ok, send your complete e-mail address as password.
                   10867: 230-You are user #5 of 500 simultaneous users allowed.
                   10868: 230-
                   10869: 230-  ___ _             _ _
                   10870: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___
                   10871: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   10872: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   10873: 230-         |_|   |_|     |___|         |___|
                   10874: 230-
                   10875: 230-** Welcome to ftp.plig.org **
                   10876: 230-
                   10877: 230-Please note that all transfers from this FTP site are logged. If you
                   10878: 230-do not like this, please disconnect now.
                   10879: 230-
1.18      snj      10880: 230-This archive is available via
1.1       dsieger  10881: 230-
                   10882: 230-HTTP:  http://ftp.plig.org/
                   10883: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   10884: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   10885: 230-
                   10886: 230-Please email comments, bug reports and requests for packages to be
                   10887: 230-mirrored to ftp-admin@plig.org.
                   10888: 230-
                   10889: 230-
                   10890: 230 Logged in anonymously.
                   10891: Remote system type is UNIX.
                   10892: Using binary mode to transfer files.
                   10893: 200 Type okay.
                   10894: 250 "/pub" is new cwd.
                   10895: 250-"/pub/figlet" is new cwd.
                   10896: 250-
                   10897: 250-Welcome to the figlet archive at ftp.figlet.org
                   10898: 250-
                   10899: 250-   ftp://ftp.figlet.org/pub/figlet/
                   10900: 250-
                   10901: 250-The official FIGlet web page is:
                   10902: 250-   http://www.figlet.org/
                   10903: 250-
                   10904: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   10905: 250-contribute a font or something else, you can email us.
                   10906: 250
                   10907: 250 "/pub/figlet/program" is new cwd.
                   10908: 250 "/pub/figlet/program/unix" is new cwd.
                   10909: local: figlet221.tar.gz remote: figlet221.tar.gz
                   10910: 502 Unimplemented command.
                   10911: 227 Entering Passive Mode (195,40,6,41,246,104)
                   10912: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   10913: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   10914: 226 Transfer completed.
                   10915: 172219 bytes received in 00:02 (75.99 KB/s)
                   10916: 221 Goodbye.
                   10917: =&gt; Checksum OK for figlet221.tar.gz.
                   10918: ===&gt; Extracting for figlet-2.2.1nb2
                   10919: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   10920: ===&gt; Patching for figlet-2.2.1nb2
                   10921: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   10922: ===&gt; Overriding tools for figlet-2.2.1nb2
                   10923: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   10924: ===&gt; Configuring for figlet-2.2.1nb2
                   10925: ===&gt; Building for figlet-2.2.1nb2
                   10926: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   10927: chmod a+x figlet
                   10928: gcc -O2 -o chkfont chkfont.c
                   10929: =&gt; Unwrapping files-to-be-installed.
                   10930: <code class="prompt">#</code>
                   10931: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                   10932: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10933: ===&gt; Installing for figlet-2.2.1nb2
                   10934: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   10935: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   10936: mkdir -p /usr/pkg/share/figlet
                   10937: cp figlet /usr/pkg/bin
                   10938: cp chkfont /usr/pkg/bin
                   10939: chmod 555 figlist showfigfonts
                   10940: cp figlist /usr/pkg/bin
                   10941: cp showfigfonts /usr/pkg/bin
                   10942: cp fonts/*.flf /usr/pkg/share/figlet
                   10943: cp fonts/*.flc /usr/pkg/share/figlet
                   10944: cp figlet.6 /usr/pkg/man/man6
                   10945: ===&gt; Registering installation for figlet-2.2.1nb2
                   10946: <code class="prompt">#</code></pre>
                   10947: </div>
1.41      asau     10948: <div class="sect1">
1.1       dsieger  10949: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   10950: <a name="logs.package"></a>B.2. Packaging figlet</h2></div></div></div>
                   10951: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
                   10952: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10953: ===&gt; Packaging figlet-2.2.1nb2
                   10954: ===&gt; Building binary package for figlet-2.2.1nb2
                   10955: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   10956: Using SrcDir value of /usr/pkg
                   10957: Registering depends:.
                   10958: <code class="prompt">#</code></pre>
                   10959: </div>
                   10960: </div>
1.41      asau     10961: <div class="appendix">
                   10962: <div class="titlepage"><div><div><h1 class="title">
                   10963: <a name="ftp-layout"></a>Appendix C. Directory layout of the pkgsrc FTP server</h1></div></div></div>
1.1       dsieger  10964: <div class="toc">
                   10965: <p><b>Table of Contents</b></p>
1.100     leot     10966: <dl class="toc">
1.23      wiz      10967: <dt><span class="sect1"><a href="#ftp-distfiles">C.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
                   10968: <dt><span class="sect1"><a href="#ftp-misc">C.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
                   10969: <dt><span class="sect1"><a href="#ftp-packages">C.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
                   10970: <dt><span class="sect1"><a href="#ftp-reports">C.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
                   10971: <dt><span class="sect1"><a href="#ftp-source">C.5. <code class="filename">current</code>,
1.148     leot     10972: <code class="filename">stable</code>,
1.23      wiz      10973: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.1       dsieger  10974: source packages</a></span></dt>
                   10975: </dl>
                   10976: </div>
                   10977: <p>As in other big projects, the directory layout of pkgsrc
                   10978:        is quite complex for newbies. This chapter explains where you
                   10979:        find things on the FTP server. The base directory on
1.10      hubertf  10980:        <code class="filename">ftp.NetBSD.org</code> is <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top"><code class="filename">/pub/pkgsrc/</code></a>.
1.1       dsieger  10981:        On other servers it may be different, but inside this directory,
                   10982:        everything should look the same, no matter on which server you
                   10983:        are. This directory contains some subdirectories, which are
                   10984:        explained below.</p>
1.41      asau     10985: <div class="sect1">
1.1       dsieger  10986: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.22      jakllsch 10987: <a name="ftp-distfiles"></a>C.1. <code class="filename">distfiles</code>: The distributed source files</h2></div></div></div>
1.1       dsieger  10988: <p>The directory <code class="filename">distfiles</code> contains lots
                   10989:        of archive files from all pkgsrc packages, which are mirrored
                   10990:        here. The subdirectories are called after their package names
                   10991:        and are used when the distributed files have names that don't
                   10992:        explicitly contain a version number or are otherwise too generic
                   10993:        (for example <code class="filename">release.tar.gz</code>).</p>
                   10994: </div>
1.41      asau     10995: <div class="sect1">
1.1       dsieger  10996: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.22      jakllsch 10997: <a name="ftp-misc"></a>C.2. <code class="filename">misc</code>: Miscellaneous things</h2></div></div></div>
1.1       dsieger  10998: <p>This directory contains things that individual pkgsrc
                   10999:        developers find worth publishing.</p>
                   11000: </div>
1.41      asau     11001: <div class="sect1">
1.1       dsieger  11002: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.22      jakllsch 11003: <a name="ftp-packages"></a>C.3. <code class="filename">packages</code>: Binary packages</h2></div></div></div>
1.3       rillig   11004: <p>This directory contains binary packages for the various
                   11005:        platforms that are supported by pkgsrc.
                   11006:        Each subdirectory is of the form <em class="replaceable"><code>OPSYS</code></em>/<em class="replaceable"><code>ARCH</code></em>/<em class="replaceable"><code>OSVERSION_TAG</code></em>. The meaning of these variables is:</p>
1.41      asau     11007: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      11008: <li class="listitem"><p><code class="varname">OPSYS</code> is the name of the
1.9       rillig   11009:        operating system for which the packages have been built. The
1.10      hubertf  11010:        name is taken from the output of the <span class="command"><strong>uname</strong></span>
1.9       rillig   11011:        command, so it may differ from the one you are used to
                   11012:        hear.</p></li>
1.23      wiz      11013: <li class="listitem"><p><code class="varname">ARCH</code> is the hardware
1.8       rillig   11014:        architecture of the platform for which the packages have been
1.10      hubertf  11015:        built. It also includes the <code class="varname">ABI</code> (Application
                   11016:        Binary Interface) for platforms that have several of
                   11017:        them.</p></li>
1.23      wiz      11018: <li class="listitem"><p><code class="varname">OSVERSION</code> is the version of
1.8       rillig   11019:        the operating system. For version numbers that change often (for
                   11020:        example NetBSD-current), the often-changing part should be
                   11021:        replaced with an <code class="literal">x</code>, for example
                   11022:        <code class="literal">4.99.x</code>.</p></li>
1.23      wiz      11023: <li class="listitem"><p><code class="varname">TAG</code> is either
1.22      jakllsch 11024:        <code class="literal">20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
1.8       rillig   11025:        for a stable branch, or <code class="literal">head</code> for packages
                   11026:        built from the HEAD branch. The latter should only be used when
                   11027:        the packages are updated on a regular basis. Otherwise the date
                   11028:        from checking out pkgsrc should be appended, for example
                   11029:        <code class="literal">head_20071015</code>.</p></li>
1.3       rillig   11030: </ul></div>
                   11031: <p>The rationale for exactly this scheme is that the pkgsrc users looking for binary packages
                   11032:        can quickly click through the directories on the
                   11033:        server and find the best binary packages for their machines. Since they
                   11034:        usually know the operating system and the hardware architecture, OPSYS
                   11035:        and ARCH are placed first. After these choices, they can select the
                   11036:        best combination of OSVERSION and TAG together, since it is usually the
                   11037:        case that packages stay compatible between different version of the
                   11038:        operating system.</p>
                   11039: <p>In each of these directories, there is a
                   11040:        whole binary packages collection for a specific platform. It has a directory called
1.1       dsieger  11041:        <code class="filename">All</code> which contains all binary packages.
                   11042:        Besides that, there are various category directories that
                   11043:        contain symbolic links to the real binary packages.</p>
                   11044: </div>
1.41      asau     11045: <div class="sect1">
1.1       dsieger  11046: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.22      jakllsch 11047: <a name="ftp-reports"></a>C.4. <code class="filename">reports</code>: Bulk build reports</h2></div></div></div>
1.8       rillig   11048: <p>Here are the reports from bulk builds, for those who want
                   11049:        to fix packages that didn't build on some of the platforms. The
1.23      wiz      11050:        structure of subdirectories should look like the one in <a class="xref" href="#ftp-packages" title="C.3. packages: Binary packages">Section C.3, &#8220;<code class="filename">packages</code>: Binary packages&#8221;</a>.</p>
1.8       rillig   11051: </div>
1.41      asau     11052: <div class="sect1">
1.8       rillig   11053: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.22      jakllsch 11054: <a name="ftp-source"></a>C.5. <code class="filename">current</code>,
1.148     leot     11055: <code class="filename">stable</code>,
1.22      jakllsch 11056: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.1       dsieger  11057: source packages</h2></div></div></div>
1.23      wiz      11058: <p>These directories contain the <span class="quote">&#8220;<span class="quote">real</span>&#8221;</span> pkgsrc,
1.1       dsieger  11059:        that is the files that define how to create binary packages from
                   11060:        source archives.</p>
1.149     leot     11061: <p>Each of the <code class="filename">current</code>,
                   11062:        <code class="filename">stable</code> and
                   11063:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
                   11064:        directories share the same structure.  They each contain a
                   11065:        <code class="filename">pkgsrc</code> directory and
                   11066:        <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> file.</p>
1.1       dsieger  11067: <p>The directory <code class="filename">pkgsrc</code> contains a
                   11068:        snapshot of the CVS repository, which is updated regularly. The
1.149     leot     11069:        file <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> contains the same
                   11070:        as the directory, ready to be downloaded as a whole.</p>
                   11071: <p>The <code class="filename">current</code> directory contains files
                   11072:        related to the HEAD branch of the CVS repository.
                   11073:        In this directory there is an additional file called
                   11074:        <code class="filename">pkgsrc-readmes.tar.{bz,gz,xz}</code> that contains
                   11075:        all pkgsrc <code class="filename">README</code>s with information about
                   11076:        categories and packages.
                   11077:        </p>
                   11078: <p>The <code class="filename">stable</code> directory is a symlink to
                   11079:        the latest 
                   11080:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
                   11081:        </p>
                   11082: <p>The
                   11083:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
                   11084:        directories contain files related to the 
                   11085:        <code class="filename">-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
                   11086:        stable branch of the CVS repository. In these directories there is
                   11087:        an additional file called
                   11088:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em>.tar.{bz,gz,xz}</code>,
1.1       dsieger  11089:        which contains the state of pkgsrc when it was branched.</p>
                   11090: </div>
                   11091: </div>
1.41      asau     11092: <div class="appendix">
                   11093: <div class="titlepage"><div><div><h1 class="title">
1.154     rillig   11094: <a name="help-topics"></a>Appendix D. Help topics</h1></div></div></div>
                   11095: <p>
                   11096:        The following list contains all help topics that are available
                   11097:        when running <span class="command"><strong>bmake help topic=:index</strong></span>.
                   11098: </p>
1.156     leot     11099: <table border="0" summary="Simple list" class="simplelist">
                   11100: <tr>
                   11101: <td>#!</td>
                   11102: <td>-lintl</td>
                   11103: </tr>
                   11104: <tr>
                   11105: <td>64bit</td>
                   11106: <td>ABI</td>
                   11107: </tr>
                   11108: <tr>
                   11109: <td>ACCEPTABLE_LICENSES</td>
                   11110: <td>ACROREAD_FONTPATH</td>
                   11111: </tr>
                   11112: <tr>
                   11113: <td>ADDITIONAL</td>
                   11114: <td>AFAIK</td>
                   11115: </tr>
                   11116: <tr>
                   11117: <td>AIX</td>
                   11118: <td>ALLOW_VULNERABLE_PACKAGES</td>
                   11119: </tr>
                   11120: <tr>
                   11121: <td>ALL_ENV</td>
1.177     leot     11122: <td>ALSA_PC</td>
                   11123: </tr>
                   11124: <tr>
1.175     gutterid 11125: <td>ALTERNATIVES_SRC</td>
1.177     leot     11126: <td>AMANDA_TMP</td>
1.161     leot     11127: </tr>
                   11128: <tr>
1.175     gutterid 11129: <td>AMANDA_USER</td>
1.177     leot     11130: <td>AMANDA_VAR</td>
1.159     rillig   11131: </tr>
                   11132: <tr>
1.175     gutterid 11133: <td>APACHE_GROUP</td>
1.177     leot     11134: <td>APACHE_MODULE_NAME</td>
1.156     leot     11135: </tr>
                   11136: <tr>
1.175     gutterid 11137: <td>APACHE_MODULE_SRC</td>
1.177     leot     11138: <td>APACHE_MODULE_SRCDIR</td>
1.156     leot     11139: </tr>
                   11140: <tr>
1.175     gutterid 11141: <td>APACHE_PKG_PREFIX</td>
1.177     leot     11142: <td>APACHE_SUEXEC_CONFIGURE_ARGS</td>
1.156     leot     11143: </tr>
                   11144: <tr>
1.175     gutterid 11145: <td>APACHE_SUEXEC_DOCROOT</td>
1.177     leot     11146: <td>APACHE_USER</td>
1.156     leot     11147: </tr>
                   11148: <tr>
1.175     gutterid 11149: <td>APPEND_ABI</td>
1.177     leot     11150: <td>APPEND_ELF</td>
1.156     leot     11151: </tr>
                   11152: <tr>
1.175     gutterid 11153: <td>ARLA_CACHE</td>
1.177     leot     11154: <td>AUDIT_PACKAGES_FLAGS</td>
1.156     leot     11155: </tr>
                   11156: <tr>
1.175     gutterid 11157: <td>AUTOCONF_REQD</td>
1.177     leot     11158: <td>AUTOMAKE_OVERRIDE</td>
1.156     leot     11159: </tr>
                   11160: <tr>
1.175     gutterid 11161: <td>AUTOMAKE_REQD</td>
1.177     leot     11162: <td>AUTO_MKDIRS</td>
1.156     leot     11163: </tr>
                   11164: <tr>
1.175     gutterid 11165: <td>BDB185_DEFAULT</td>
1.177     leot     11166: <td>BDBBASE</td>
1.156     leot     11167: </tr>
                   11168: <tr>
1.175     gutterid 11169: <td>BDB_ACCEPTED</td>
1.177     leot     11170: <td>BDB_DEFAULT</td>
1.156     leot     11171: </tr>
                   11172: <tr>
1.175     gutterid 11173: <td>BDB_LIBS</td>
1.177     leot     11174: <td>BDB_TYPE</td>
1.156     leot     11175: </tr>
                   11176: <tr>
1.175     gutterid 11177: <td>BIND_DIR</td>
1.177     leot     11178: <td>BIND_GROUP</td>
1.156     leot     11179: </tr>
                   11180: <tr>
1.175     gutterid 11181: <td>BIND_USER</td>
1.177     leot     11182: <td>BINPKG_SITES</td>
1.156     leot     11183: </tr>
                   11184: <tr>
1.175     gutterid 11185: <td>BIN_INSTALL_FLAGS</td>
1.177     leot     11186: <td>BISON_PKGDATADIR</td>
                   11187: </tr>
                   11188: <tr>
                   11189: <td>BLAS_ACCEPTED</td>
                   11190: <td>BLAS_LIBS</td>
1.156     leot     11191: </tr>
                   11192: <tr>
1.177     leot     11193: <td>BLAS_TYPE</td>
1.156     leot     11194: <td>BOOTSTRAP_DEPENDS</td>
                   11195: </tr>
                   11196: <tr>
                   11197: <td>BOOTSTRAP_SETUPTOOLS</td>
                   11198: <td>BROKEN</td>
                   11199: </tr>
                   11200: <tr>
                   11201: <td>BROKEN_EXCEPT_ON_PLATFORM</td>
                   11202: <td>BROKEN_ON_PLATFORM</td>
                   11203: </tr>
                   11204: <tr>
                   11205: <td>BSDSRCDIR</td>
                   11206: <td>BSDXSRCDIR</td>
                   11207: </tr>
                   11208: <tr>
                   11209: <td>BSD_MAKE_ENV</td>
                   11210: <td>BUILDLINK_AUTO_DIRS</td>
                   11211: </tr>
                   11212: <tr>
                   11213: <td>BUILDLINK_AUTO_VARS</td>
                   11214: <td>BUILDLINK_CFLAGS</td>
                   11215: </tr>
                   11216: <tr>
                   11217: <td>BUILDLINK_CONTENTS_FILTER</td>
                   11218: <td>BUILDLINK_CPPFLAGS</td>
                   11219: </tr>
                   11220: <tr>
                   11221: <td>BUILDLINK_DEPMETHOD</td>
                   11222: <td>BUILDLINK_FILES</td>
                   11223: </tr>
                   11224: <tr>
                   11225: <td>BUILDLINK_FILES_CMD</td>
                   11226: <td>BUILDLINK_FNAME_TRANSFORM</td>
                   11227: </tr>
                   11228: <tr>
                   11229: <td>BUILDLINK_LDFLAGS</td>
                   11230: <td>BUILDLINK_LIBS</td>
                   11231: </tr>
                   11232: <tr>
                   11233: <td>BUILDLINK_OPSYS_SUPPORT_PTHREAD</td>
                   11234: <td>BUILDLINK_PKGNAME</td>
                   11235: </tr>
                   11236: <tr>
                   11237: <td>BUILDLINK_PREFIX</td>
                   11238: <td>BUILDLINK_RPATHDIRS</td>
                   11239: </tr>
                   11240: <tr>
                   11241: <td>BUILDLINK_TREE</td>
                   11242: <td>BUILD_DEFS</td>
                   11243: </tr>
                   11244: <tr>
                   11245: <td>BUILD_DEFS_EFFECTS</td>
                   11246: <td>BUILD_DEPENDS</td>
                   11247: </tr>
                   11248: <tr>
                   11249: <td>BUILD_DIRS</td>
                   11250: <td>BUILD_ENV_SHELL</td>
                   11251: </tr>
                   11252: <tr>
                   11253: <td>BUILD_MAKE_CMD</td>
                   11254: <td>BUILD_MAKE_FLAGS</td>
                   11255: </tr>
                   11256: <tr>
                   11257: <td>BUILD_TARGET</td>
                   11258: <td>BUILTIN_FIND_FILES</td>
                   11259: </tr>
                   11260: <tr>
                   11261: <td>BUILTIN_FIND_FILES_VAR</td>
                   11262: <td>BUILTIN_FIND_GREP</td>
                   11263: </tr>
                   11264: <tr>
                   11265: <td>BUILTIN_FIND_HEADERS</td>
                   11266: <td>BUILTIN_FIND_HEADERS_VAR</td>
                   11267: </tr>
                   11268: <tr>
                   11269: <td>BUILTIN_PKG</td>
                   11270: <td>BUILTIN_TEST_CURSES_DEFINES</td>
                   11271: </tr>
                   11272: <tr>
                   11273: <td>BUILTIN_TEST_CURSES_FUNCS</td>
                   11274: <td>BUILTIN_VERSION_SCRIPT</td>
                   11275: </tr>
                   11276: <tr>
                   11277: <td>BUILTIN_X11_TYPE</td>
                   11278: <td>BUILTIN_X11_VERSION</td>
                   11279: </tr>
                   11280: <tr>
                   11281: <td>CACTI_GROUP</td>
                   11282: <td>CACTI_USER</td>
                   11283: </tr>
                   11284: <tr>
                   11285: <td>CANNA_GROUP</td>
                   11286: <td>CANNA_USER</td>
                   11287: </tr>
                   11288: <tr>
                   11289: <td>CAT</td>
                   11290: <td>CCACHE_BASE</td>
                   11291: </tr>
                   11292: <tr>
                   11293: <td>CCACHE_DIR</td>
                   11294: <td>CCACHE_LOGFILE</td>
                   11295: </tr>
                   11296: <tr>
                   11297: <td>CC_VERSION</td>
                   11298: <td>CC_VERSION_STRING</td>
                   11299: </tr>
                   11300: <tr>
                   11301: <td>CDRECORD_CONF</td>
                   11302: <td>CDROM_PKG_URL_DIR</td>
                   11303: </tr>
                   11304: <tr>
                   11305: <td>CDROM_PKG_URL_HOST</td>
1.177     leot     11306: <td>CHECKOUT_DATE</td>
                   11307: </tr>
                   11308: <tr>
1.180     rillig   11309: <td>CHECK_COMPILER</td>
1.175     gutterid 11310: <td>CHECK_FAKEHOME</td>
1.161     leot     11311: </tr>
                   11312: <tr>
1.180     rillig   11313: <td>CHECK_FILES</td>
1.175     gutterid 11314: <td>CHECK_FILES_SKIP</td>
1.159     rillig   11315: </tr>
                   11316: <tr>
1.180     rillig   11317: <td>CHECK_FILES_STRICT</td>
1.175     gutterid 11318: <td>CHECK_HEADERS</td>
1.156     leot     11319: </tr>
                   11320: <tr>
1.180     rillig   11321: <td>CHECK_HEADERS_SKIP</td>
1.175     gutterid 11322: <td>CHECK_INTERPRETER</td>
1.156     leot     11323: </tr>
                   11324: <tr>
1.180     rillig   11325: <td>CHECK_INTERPRETER_SKIP</td>
1.175     gutterid 11326: <td>CHECK_PERMS</td>
1.156     leot     11327: </tr>
                   11328: <tr>
1.180     rillig   11329: <td>CHECK_PERMS_AUTOFIX</td>
1.175     gutterid 11330: <td>CHECK_PERMS_SKIP</td>
1.156     leot     11331: </tr>
                   11332: <tr>
1.180     rillig   11333: <td>CHECK_PORTABILITY</td>
1.177     leot     11334: <td>CHECK_PORTABILITY_EXPERIMENTAL</td>
1.156     leot     11335: </tr>
                   11336: <tr>
1.180     rillig   11337: <td>CHECK_PORTABILITY_SKIP</td>
1.161     leot     11338: <td>CHECK_RELRO</td>
1.156     leot     11339: </tr>
                   11340: <tr>
1.180     rillig   11341: <td>CHECK_RELRO_SKIP</td>
1.161     leot     11342: <td>CHECK_RELRO_SUPPORTED</td>
1.156     leot     11343: </tr>
                   11344: <tr>
1.180     rillig   11345: <td>CHECK_SHLIBS</td>
1.161     leot     11346: <td>CHECK_SHLIBS_BLACKLIST</td>
1.156     leot     11347: </tr>
                   11348: <tr>
1.180     rillig   11349: <td>CHECK_SHLIBS_SKIP</td>
1.161     leot     11350: <td>CHECK_SHLIBS_SUPPORTED</td>
1.156     leot     11351: </tr>
                   11352: <tr>
1.180     rillig   11353: <td>CHECK_SSP</td>
1.161     leot     11354: <td>CHECK_SSP_SKIP</td>
1.156     leot     11355: </tr>
                   11356: <tr>
1.180     rillig   11357: <td>CHECK_SSP_SUPPORTED</td>
1.161     leot     11358: <td>CHECK_STRIPPED</td>
1.156     leot     11359: </tr>
                   11360: <tr>
1.180     rillig   11361: <td>CHECK_STRIPPED_SKIP</td>
1.161     leot     11362: <td>CHECK_WRKREF</td>
1.156     leot     11363: </tr>
                   11364: <tr>
1.180     rillig   11365: <td>CHECK_WRKREF_EXTRA_DIRS</td>
1.161     leot     11366: <td>CHECK_WRKREF_SKIP</td>
1.156     leot     11367: </tr>
                   11368: <tr>
1.180     rillig   11369: <td>CLAMAV_DBDIR</td>
1.161     leot     11370: <td>CLAMAV_GROUP</td>
1.156     leot     11371: </tr>
                   11372: <tr>
1.180     rillig   11373: <td>CLAMAV_USER</td>
1.161     leot     11374: <td>CLANGBASE</td>
1.156     leot     11375: </tr>
                   11376: <tr>
1.180     rillig   11377: <td>CLEANDEPENDS</td>
1.161     leot     11378: <td>CMAKE_DEPENDENCIES_REWRITE</td>
1.156     leot     11379: </tr>
                   11380: <tr>
1.180     rillig   11381: <td>CMAKE_INSTALL_PREFIX</td>
1.161     leot     11382: <td>CMAKE_MODULE_PATH_OVERRIDE</td>
1.156     leot     11383: </tr>
                   11384: <tr>
1.180     rillig   11385: <td>CMAKE_PKGSRC_BUILD_FLAGS</td>
1.161     leot     11386: <td>CMAKE_PREFIX_PATH</td>
1.156     leot     11387: </tr>
                   11388: <tr>
1.180     rillig   11389: <td>CMAKE_USE_GNU_INSTALL_DIRS</td>
1.177     leot     11390: <td>COMMON_LISP_DOCFILES</td>
                   11391: </tr>
                   11392: <tr>
1.180     rillig   11393: <td>COMMON_LISP_EXAMPLES</td>
1.177     leot     11394: <td>COMMON_LISP_EXTRAFILES</td>
                   11395: </tr>
                   11396: <tr>
1.180     rillig   11397: <td>COMMON_LISP_PACKAGES</td>
1.177     leot     11398: <td>COMMON_LISP_SYSTEM</td>
                   11399: </tr>
                   11400: <tr>
1.180     rillig   11401: <td>COMPILER_RPATH_FLAG</td>
1.156     leot     11402: <td>COMPILER_USE_SYMLINKS</td>
                   11403: </tr>
                   11404: <tr>
1.180     rillig   11405: <td>CONFIGURE_ARGS</td>
1.156     leot     11406: <td>CONFIGURE_DIRS</td>
                   11407: </tr>
                   11408: <tr>
1.180     rillig   11409: <td>CONFIGURE_ENV</td>
1.172     rillig   11410: <td>CONFIGURE_ENV_SHELL</td>
1.156     leot     11411: </tr>
                   11412: <tr>
1.180     rillig   11413: <td>CONFIGURE_HAS_INFODIR</td>
1.156     leot     11414: <td>CONFIGURE_HAS_MANDIR</td>
                   11415: </tr>
                   11416: <tr>
1.180     rillig   11417: <td>CONFIGURE_SCRIPT</td>
1.156     leot     11418: <td>CONFIG_SHELL</td>
                   11419: </tr>
                   11420: <tr>
1.180     rillig   11421: <td>CONFIG_SHELL_FLAGS</td>
1.156     leot     11422: <td>CONF_FILES</td>
                   11423: </tr>
                   11424: <tr>
1.180     rillig   11425: <td>CONF_FILES_MODE</td>
1.156     leot     11426: <td>CONF_FILES_PERMS</td>
                   11427: </tr>
                   11428: <tr>
1.180     rillig   11429: <td>CONSERVER_DEFAULTHOST</td>
1.156     leot     11430: <td>CONSERVER_DEFAULTPORT</td>
                   11431: </tr>
                   11432: <tr>
1.180     rillig   11433: <td>CP</td>
1.156     leot     11434: <td>CPP</td>
                   11435: </tr>
                   11436: <tr>
1.180     rillig   11437: <td>CPP_PRECOMP_FLAGS</td>
1.156     leot     11438: <td>CREATE_WRKDIR_SYMLINK</td>
                   11439: </tr>
                   11440: <tr>
1.180     rillig   11441: <td>CROSSBASE</td>
1.156     leot     11442: <td>CTFCONVERT</td>
                   11443: </tr>
                   11444: <tr>
1.180     rillig   11445: <td>CTF_FILES_SKIP</td>
1.156     leot     11446: <td>CTF_SUPPORTED</td>
                   11447: </tr>
                   11448: <tr>
1.180     rillig   11449: <td>CTYPE</td>
1.156     leot     11450: <td>CUPS_GROUP</td>
                   11451: </tr>
                   11452: <tr>
1.180     rillig   11453: <td>CUPS_SYSTEM_GROUPS</td>
1.156     leot     11454: <td>CUPS_USER</td>
                   11455: </tr>
                   11456: <tr>
1.180     rillig   11457: <td>CURSES_DEFAULT</td>
1.156     leot     11458: <td>CURSES_TYPE</td>
1.177     leot     11459: </tr>
                   11460: <tr>
1.180     rillig   11461: <td>CVS_EXTRACTDIR</td>
1.177     leot     11462: <td>CVS_MODULE</td>
                   11463: </tr>
                   11464: <tr>
1.180     rillig   11465: <td>CVS_PROJECT</td>
1.177     leot     11466: <td>CVS_REPOSITORIES</td>
                   11467: </tr>
                   11468: <tr>
1.180     rillig   11469: <td>CVS_ROOT</td>
1.177     leot     11470: <td>CVS_ROOT_GNU</td>
                   11471: </tr>
                   11472: <tr>
1.180     rillig   11473: <td>CVS_ROOT_NONGNU</td>
1.177     leot     11474: <td>CVS_ROOT_SOURCEFORGE</td>
1.161     leot     11475: </tr>
                   11476: <tr>
1.180     rillig   11477: <td>CVS_TAG</td>
1.160     brook    11478: <td>CXX</td>
1.159     rillig   11479: </tr>
                   11480: <tr>
1.180     rillig   11481: <td>CYRUS_GROUP</td>
1.160     brook    11482: <td>CYRUS_IDLE</td>
1.156     leot     11483: </tr>
                   11484: <tr>
1.180     rillig   11485: <td>CYRUS_USER</td>
1.160     brook    11486: <td>DAEMONTOOLS_GROUP</td>
1.156     leot     11487: </tr>
                   11488: <tr>
1.180     rillig   11489: <td>DAEMONTOOLS_LOG_USER</td>
1.160     brook    11490: <td>DBUS_GROUP</td>
1.156     leot     11491: </tr>
                   11492: <tr>
1.180     rillig   11493: <td>DBUS_USER</td>
1.160     brook    11494: <td>DEFANG_GROUP</td>
1.156     leot     11495: </tr>
                   11496: <tr>
1.180     rillig   11497: <td>DEFANG_USER</td>
1.160     brook    11498: <td>DEFAULT_ACCEPTABLE_LICENSES</td>
1.156     leot     11499: </tr>
                   11500: <tr>
1.180     rillig   11501: <td>DEFAULT_DISTFILES</td>
1.160     brook    11502: <td>DEFAULT_IRC_SERVER</td>
1.156     leot     11503: </tr>
                   11504: <tr>
1.180     rillig   11505: <td>DEFAULT_SERIAL_DEVICE</td>
1.160     brook    11506: <td>DEF_UMASK</td>
1.156     leot     11507: </tr>
                   11508: <tr>
1.180     rillig   11509: <td>DEINSTALLDEPENDS</td>
1.160     brook    11510: <td>DEINSTALL_SRC</td>
1.156     leot     11511: </tr>
                   11512: <tr>
1.180     rillig   11513: <td>DEINSTALL_TEMPLATES</td>
1.160     brook    11514: <td>DELAYED_ERROR_MSG</td>
1.156     leot     11515: </tr>
                   11516: <tr>
1.180     rillig   11517: <td>DELAYED_WARNING_MSG</td>
1.160     brook    11518: <td>DEPENDS</td>
1.156     leot     11519: </tr>
                   11520: <tr>
1.180     rillig   11521: <td>DEPENDS_TARGET</td>
1.160     brook    11522: <td>DEPENDS_TYPE</td>
1.156     leot     11523: </tr>
                   11524: <tr>
1.180     rillig   11525: <td>DESTDIR</td>
1.160     brook    11526: <td>DESTDIR_VARNAME</td>
1.156     leot     11527: </tr>
                   11528: <tr>
1.180     rillig   11529: <td>DIALER_GROUP</td>
1.160     brook    11530: <td>DIGEST_REQD</td>
1.156     leot     11531: </tr>
                   11532: <tr>
1.180     rillig   11533: <td>DISTDIR</td>
1.160     brook    11534: <td>DISTFILES</td>
1.156     leot     11535: </tr>
                   11536: <tr>
1.180     rillig   11537: <td>DISTINFO_FILE</td>
1.160     brook    11538: <td>DISTNAME</td>
1.156     leot     11539: </tr>
                   11540: <tr>
1.180     rillig   11541: <td>DIST_PATH</td>
1.160     brook    11542: <td>DIST_SUBDIR</td>
1.156     leot     11543: </tr>
                   11544: <tr>
1.180     rillig   11545: <td>DJBDNS_AXFR_USER</td>
1.160     brook    11546: <td>DJBDNS_CACHE_USER</td>
1.156     leot     11547: </tr>
                   11548: <tr>
1.180     rillig   11549: <td>DJBDNS_DJBDNS_GROUP</td>
1.160     brook    11550: <td>DJBDNS_LOG_USER</td>
1.156     leot     11551: </tr>
                   11552: <tr>
1.180     rillig   11553: <td>DJBDNS_RBL_USER</td>
1.160     brook    11554: <td>DJBDNS_TINY_USER</td>
1.156     leot     11555: </tr>
                   11556: <tr>
1.180     rillig   11557: <td>DLOPEN_REQUIRE_PTHREADS</td>
1.160     brook    11558: <td>DL_AUTO_VARS</td>
1.156     leot     11559: </tr>
                   11560: <tr>
1.180     rillig   11561: <td>DL_CFLAGS</td>
1.160     brook    11562: <td>DL_LDFLAGS</td>
1.156     leot     11563: </tr>
                   11564: <tr>
1.180     rillig   11565: <td>DL_LIBS</td>
1.160     brook    11566: <td>DNS</td>
1.156     leot     11567: </tr>
                   11568: <tr>
1.180     rillig   11569: <td>DOWNLOADED_DISTFILE</td>
1.160     brook    11570: <td>DT_LAYOUT</td>
1.156     leot     11571: </tr>
                   11572: <tr>
1.180     rillig   11573: <td>DYNAMIC_SITES_CMD</td>
1.160     brook    11574: <td>DYNAMIC_SITES_SCRIPT</td>
1.156     leot     11575: </tr>
                   11576: <tr>
1.180     rillig   11577: <td>ECHO</td>
1.160     brook    11578: <td>ECHO_N</td>
1.156     leot     11579: </tr>
                   11580: <tr>
1.180     rillig   11581: <td>ELK_GUI</td>
1.160     brook    11582: <td>EMACS_TYPE</td>
1.156     leot     11583: </tr>
                   11584: <tr>
1.180     rillig   11585: <td>EMULDIR</td>
1.160     brook    11586: <td>EMULSUBDIR</td>
1.156     leot     11587: </tr>
                   11588: <tr>
1.180     rillig   11589: <td>EMULSUBDIRSLASH</td>
1.160     brook    11590: <td>EMUL_ARCH</td>
1.156     leot     11591: </tr>
                   11592: <tr>
1.180     rillig   11593: <td>EMUL_DISTRO</td>
1.160     brook    11594: <td>EMUL_EXEC_FMT</td>
1.156     leot     11595: </tr>
                   11596: <tr>
1.180     rillig   11597: <td>EMUL_IS_NATIVE</td>
1.160     brook    11598: <td>EMUL_MODULES</td>
1.156     leot     11599: </tr>
                   11600: <tr>
1.180     rillig   11601: <td>EMUL_OPSYS</td>
1.160     brook    11602: <td>EMUL_PKG_FMT</td>
1.156     leot     11603: </tr>
                   11604: <tr>
1.180     rillig   11605: <td>EMUL_PLATFORM</td>
1.160     brook    11606: <td>EMUL_PLATFORMS</td>
1.156     leot     11607: </tr>
                   11608: <tr>
1.180     rillig   11609: <td>EMUL_PREFER</td>
1.160     brook    11610: <td>EMUL_REQD</td>
1.156     leot     11611: </tr>
                   11612: <tr>
1.180     rillig   11613: <td>EMUL_TYPE</td>
1.160     brook    11614: <td>ERROR_MSG</td>
1.156     leot     11615: </tr>
                   11616: <tr>
1.180     rillig   11617: <td>EXIM_GROUP</td>
1.160     brook    11618: <td>EXIM_USER</td>
1.156     leot     11619: </tr>
                   11620: <tr>
1.180     rillig   11621: <td>EXPORT_SYMBOLS_LDFLAGS</td>
1.160     brook    11622: <td>EXTRACTOR</td>
1.156     leot     11623: </tr>
                   11624: <tr>
1.180     rillig   11625: <td>EXTRACT_CMD</td>
1.160     brook    11626: <td>EXTRACT_CMD_DEFAULT</td>
1.156     leot     11627: </tr>
                   11628: <tr>
1.180     rillig   11629: <td>EXTRACT_DIR</td>
1.160     brook    11630: <td>EXTRACT_ELEMENTS</td>
1.156     leot     11631: </tr>
                   11632: <tr>
1.180     rillig   11633: <td>EXTRACT_ENV</td>
1.160     brook    11634: <td>EXTRACT_ONLY</td>
1.156     leot     11635: </tr>
                   11636: <tr>
1.180     rillig   11637: <td>EXTRACT_OPTS</td>
1.160     brook    11638: <td>EXTRACT_SUFX</td>
1.156     leot     11639: </tr>
                   11640: <tr>
1.180     rillig   11641: <td>EXTRACT_USING</td>
1.177     leot     11642: <td>FAIL</td>
                   11643: </tr>
                   11644: <tr>
1.180     rillig   11645: <td>FAILOVER_FETCH</td>
1.175     gutterid 11646: <td>FAIL_MSG</td>
1.156     leot     11647: </tr>
                   11648: <tr>
1.180     rillig   11649: <td>FAKE_NCURSES</td>
1.175     gutterid 11650: <td>FAM</td>
1.156     leot     11651: </tr>
                   11652: <tr>
1.180     rillig   11653: <td>FAM_ACCEPTED</td>
1.175     gutterid 11654: <td>FAM_DEFAULT</td>
1.156     leot     11655: </tr>
                   11656: <tr>
1.180     rillig   11657: <td>FAM_SERVER</td>
1.175     gutterid 11658: <td>FCPATH</td>
1.156     leot     11659: </tr>
                   11660: <tr>
1.180     rillig   11661: <td>FEATURE_CPPFLAGS</td>
1.175     gutterid 11662: <td>FEATURE_LDFLAGS</td>
1.156     leot     11663: </tr>
                   11664: <tr>
1.180     rillig   11665: <td>FEATURE_LIBS</td>
1.175     gutterid 11666: <td>FETCH_AFTER_ARGS</td>
1.156     leot     11667: </tr>
                   11668: <tr>
1.180     rillig   11669: <td>FETCH_BEFORE_ARGS</td>
1.175     gutterid 11670: <td>FETCH_CMD</td>
1.156     leot     11671: </tr>
                   11672: <tr>
1.180     rillig   11673: <td>FETCH_OUTPUT_ARGS</td>
1.175     gutterid 11674: <td>FETCH_PROXY</td>
1.156     leot     11675: </tr>
                   11676: <tr>
1.180     rillig   11677: <td>FETCH_RESUME_ARGS</td>
1.175     gutterid 11678: <td>FETCH_USING</td>
1.156     leot     11679: </tr>
                   11680: <tr>
1.180     rillig   11681: <td>FILES_SUBST</td>
1.175     gutterid 11682: <td>FILES_SUBST_SED</td>
1.156     leot     11683: </tr>
                   11684: <tr>
1.180     rillig   11685: <td>FIX_SYSTEM_HEADERS</td>
1.175     gutterid 11686: <td>FLUXBOX_USE_GNOME</td>
1.156     leot     11687: </tr>
                   11688: <tr>
1.180     rillig   11689: <td>FLUXBOX_USE_KDE</td>
1.175     gutterid 11690: <td>FLUXBOX_USE_XFT</td>
1.156     leot     11691: </tr>
                   11692: <tr>
1.180     rillig   11693: <td>FLUXBOX_USE_XINERAMA</td>
1.177     leot     11694: <td>FONTDIR</td>
1.156     leot     11695: </tr>
                   11696: <tr>
1.180     rillig   11697: <td>FONTS_DIRS</td>
1.172     rillig   11698: <td>FONTS_VERBOSE</td>
1.161     leot     11699: </tr>
                   11700: <tr>
1.180     rillig   11701: <td>FOO_HACKS_MK</td>
1.177     leot     11702: <td>FOSSIL_EXTRACTDIR</td>
                   11703: </tr>
                   11704: <tr>
1.180     rillig   11705: <td>FOSSIL_REPO</td>
1.177     leot     11706: <td>FOSSIL_REPOSITORIES</td>
                   11707: </tr>
                   11708: <tr>
1.180     rillig   11709: <td>FOSSIL_VERSION</td>
1.172     rillig   11710: <td>FOX_USE_XUNICODE</td>
1.156     leot     11711: </tr>
                   11712: <tr>
1.180     rillig   11713: <td>FREEWNN_GROUP</td>
1.172     rillig   11714: <td>FREEWNN_USER</td>
1.156     leot     11715: </tr>
                   11716: <tr>
1.180     rillig   11717: <td>FTP_PKG_URL_DIR</td>
1.172     rillig   11718: <td>FTP_PKG_URL_HOST</td>
1.156     leot     11719: </tr>
                   11720: <tr>
1.180     rillig   11721: <td>GAMEDATAMODE</td>
1.172     rillig   11722: <td>GAMEDATA_PERMS</td>
1.156     leot     11723: </tr>
                   11724: <tr>
1.180     rillig   11725: <td>GAMEDIRMODE</td>
1.172     rillig   11726: <td>GAMEDIR_PERMS</td>
1.156     leot     11727: </tr>
                   11728: <tr>
1.180     rillig   11729: <td>GAMEGRP</td>
1.172     rillig   11730: <td>GAMEMODE</td>
1.156     leot     11731: </tr>
                   11732: <tr>
1.180     rillig   11733: <td>GAMEOWN</td>
1.172     rillig   11734: <td>GAMES_GROUP</td>
1.156     leot     11735: </tr>
                   11736: <tr>
1.180     rillig   11737: <td>GAMES_USER</td>
1.172     rillig   11738: <td>GCC</td>
1.156     leot     11739: </tr>
                   11740: <tr>
1.180     rillig   11741: <td>GCCBASE</td>
1.172     rillig   11742: <td>GCC_REQD</td>
1.156     leot     11743: </tr>
                   11744: <tr>
1.180     rillig   11745: <td>GCC_VERSION_SUFFIX</td>
1.172     rillig   11746: <td>GEM_BUILD</td>
1.156     leot     11747: </tr>
                   11748: <tr>
1.180     rillig   11749: <td>GEM_CLEANBUILD</td>
1.172     rillig   11750: <td>GEM_CLEANBUILD_EXTENSIONS</td>
1.156     leot     11751: </tr>
                   11752: <tr>
1.180     rillig   11753: <td>GEM_DOCDIR</td>
1.172     rillig   11754: <td>GEM_EXTSDIR</td>
1.156     leot     11755: </tr>
                   11756: <tr>
1.180     rillig   11757: <td>GEM_HOME</td>
1.177     leot     11758: <td>GEM_KEEPBUILD</td>
                   11759: </tr>
                   11760: <tr>
1.180     rillig   11761: <td>GEM_LIBDIR</td>
1.156     leot     11762: <td>GEM_NAME</td>
                   11763: </tr>
                   11764: <tr>
1.180     rillig   11765: <td>GEM_PATH</td>
1.156     leot     11766: <td>GEM_SPECFILE</td>
                   11767: </tr>
                   11768: <tr>
1.180     rillig   11769: <td>GENERATE_PLIST</td>
1.156     leot     11770: <td>GHOSTSCRIPT_REQD</td>
                   11771: </tr>
                   11772: <tr>
1.180     rillig   11773: <td>GITHUB_PROJECT</td>
1.156     leot     11774: <td>GITHUB_RELEASE</td>
                   11775: </tr>
                   11776: <tr>
1.180     rillig   11777: <td>GITHUB_TAG</td>
1.156     leot     11778: <td>GITHUB_TYPE</td>
1.177     leot     11779: </tr>
                   11780: <tr>
1.180     rillig   11781: <td>GITLAB_PROJECT</td>
1.177     leot     11782: <td>GITLAB_TAG</td>
                   11783: </tr>
                   11784: <tr>
1.180     rillig   11785: <td>GITLAB_TYPE</td>
1.177     leot     11786: <td>GIT_BRANCH</td>
1.161     leot     11787: </tr>
                   11788: <tr>
1.180     rillig   11789: <td>GIT_ENV</td>
1.177     leot     11790: <td>GIT_EXTRACTDIR</td>
                   11791: </tr>
                   11792: <tr>
1.180     rillig   11793: <td>GIT_REPO</td>
1.177     leot     11794: <td>GIT_REPOSITORIES</td>
                   11795: </tr>
                   11796: <tr>
1.180     rillig   11797: <td>GIT_REVISION</td>
1.177     leot     11798: <td>GIT_TAG</td>
                   11799: </tr>
                   11800: <tr>
1.180     rillig   11801: <td>GNU</td>
1.175     gutterid 11802: <td>GNU_CONFIGURE</td>
1.159     rillig   11803: </tr>
                   11804: <tr>
1.180     rillig   11805: <td>GNU_CONFIGURE_INFODIR</td>
1.175     gutterid 11806: <td>GNU_CONFIGURE_MANDIR</td>
1.156     leot     11807: </tr>
                   11808: <tr>
1.180     rillig   11809: <td>GNU_CONFIGURE_QUIET</td>
1.178     rillig   11810: <td>GNU_CONFIGURE_STRICT</td>
1.156     leot     11811: </tr>
                   11812: <tr>
1.180     rillig   11813: <td>GODEP_REDIRECTS</td>
1.178     rillig   11814: <td>GO_BUILD_PATTERN</td>
1.156     leot     11815: </tr>
                   11816: <tr>
1.180     rillig   11817: <td>GO_DEPS</td>
1.178     rillig   11818: <td>GO_DIST_BASE</td>
1.156     leot     11819: </tr>
                   11820: <tr>
1.180     rillig   11821: <td>GO_MODULE_FILES</td>
1.178     rillig   11822: <td>GO_SRCPATH</td>
1.156     leot     11823: </tr>
                   11824: <tr>
1.180     rillig   11825: <td>GO_VERSION_DEFAULT</td>
1.178     rillig   11826: <td>GROUP_SPECIFIC_PKGS</td>
1.156     leot     11827: </tr>
                   11828: <tr>
1.180     rillig   11829: <td>GRUB_NETWORK_CARDS</td>
1.178     rillig   11830: <td>GRUB_PRESET_COMMAND</td>
1.156     leot     11831: </tr>
                   11832: <tr>
1.180     rillig   11833: <td>GRUB_SCAN_ARGS</td>
1.178     rillig   11834: <td>GZIP</td>
1.156     leot     11835: </tr>
                   11836: <tr>
1.180     rillig   11837: <td>HASKELL_COMPILER</td>
1.178     rillig   11838: <td>HASKELL_ENABLE_HADDOCK_DOCUMENTATION</td>
1.156     leot     11839: </tr>
                   11840: <tr>
1.180     rillig   11841: <td>HASKELL_ENABLE_LIBRARY_PROFILING</td>
1.178     rillig   11842: <td>HASKELL_ENABLE_SHARED_LIBRARY</td>
1.156     leot     11843: </tr>
                   11844: <tr>
1.180     rillig   11845: <td>HASKELL_OPTIMIZATION_LEVEL</td>
1.178     rillig   11846: <td>HAS_CONFIGURE</td>
1.177     leot     11847: </tr>
                   11848: <tr>
1.180     rillig   11849: <td>HEADER_TEMPLATES</td>
1.178     rillig   11850: <td>HG_REPO</td>
1.161     leot     11851: </tr>
                   11852: <tr>
1.180     rillig   11853: <td>HG_REPOSITORIES</td>
1.178     rillig   11854: <td>HG_TAG</td>
1.156     leot     11855: </tr>
                   11856: <tr>
1.180     rillig   11857: <td>HOST_PKGTOOLS_ARGS</td>
1.178     rillig   11858: <td>HOST_SPECIFIC_PKGS</td>
1.156     leot     11859: </tr>
                   11860: <tr>
1.180     rillig   11861: <td>HOWL_GROUP</td>
1.178     rillig   11862: <td>HOWL_USER</td>
1.156     leot     11863: </tr>
                   11864: <tr>
1.180     rillig   11865: <td>ICCBASE</td>
1.178     rillig   11866: <td>ICECAST_CHROOTDIR</td>
1.156     leot     11867: </tr>
                   11868: <tr>
1.180     rillig   11869: <td>ICON_THEMES</td>
1.178     rillig   11870: <td>IDOBASE</td>
1.156     leot     11871: </tr>
                   11872: <tr>
1.180     rillig   11873: <td>IGNORE_CCACHE</td>
1.178     rillig   11874: <td>IGNORE_INFO_DIRS</td>
1.156     leot     11875: </tr>
                   11876: <tr>
1.180     rillig   11877: <td>IGNORE_INTERACTIVE_FETCH</td>
1.178     rillig   11878: <td>IMAKE</td>
1.156     leot     11879: </tr>
                   11880: <tr>
1.180     rillig   11881: <td>IMAKEOPTS</td>
1.178     rillig   11882: <td>IMAKE_MAKE</td>
1.156     leot     11883: </tr>
                   11884: <tr>
1.180     rillig   11885: <td>IMAKE_MANINSTALL</td>
1.178     rillig   11886: <td>IMAP_UW_CCLIENT_MBOX_FMT</td>
1.156     leot     11887: </tr>
                   11888: <tr>
1.180     rillig   11889: <td>IMDICTDIR</td>
1.178     rillig   11890: <td>INCOMPAT_CURSES</td>
1.156     leot     11891: </tr>
                   11892: <tr>
1.180     rillig   11893: <td>INFO_DIR</td>
1.178     rillig   11894: <td>INFO_FILES</td>
1.156     leot     11895: </tr>
                   11896: <tr>
1.180     rillig   11897: <td>INFO_FILES_VERBOSE</td>
1.178     rillig   11898: <td>INFO_MSG</td>
1.156     leot     11899: </tr>
                   11900: <tr>
1.180     rillig   11901: <td>INIT_SYSTEM</td>
1.178     rillig   11902: <td>INN_DATA_DIR</td>
1.156     leot     11903: </tr>
                   11904: <tr>
1.180     rillig   11905: <td>INN_GROUP</td>
1.178     rillig   11906: <td>INN_USER</td>
1.172     rillig   11907: </tr>
                   11908: <tr>
1.180     rillig   11909: <td>INSTALLATION_DIRS</td>
1.178     rillig   11910: <td>INSTALLATION_DIRS_FROM_PLIST</td>
1.156     leot     11911: </tr>
                   11912: <tr>
1.180     rillig   11913: <td>INSTALL_ENV</td>
1.178     rillig   11914: <td>INSTALL_SH_OVERRIDE</td>
1.156     leot     11915: </tr>
                   11916: <tr>
1.180     rillig   11917: <td>INSTALL_SRC</td>
1.178     rillig   11918: <td>INSTALL_TEMPLATES</td>
1.156     leot     11919: </tr>
                   11920: <tr>
1.180     rillig   11921: <td>INSTALL_UNSTRIPPED</td>
1.178     rillig   11922: <td>IRCD_HYBRID_IRC_GROUP</td>
1.156     leot     11923: </tr>
                   11924: <tr>
1.180     rillig   11925: <td>IRCD_HYBRID_IRC_USER</td>
1.178     rillig   11926: <td>IRCD_HYBRID_MAXCONN</td>
1.156     leot     11927: </tr>
                   11928: <tr>
1.180     rillig   11929: <td>IRCD_HYBRID_NICLEN</td>
1.178     rillig   11930: <td>IRCD_HYBRID_SYSLOG_EVENTS</td>
1.156     leot     11931: </tr>
                   11932: <tr>
1.180     rillig   11933: <td>IRCD_HYBRID_SYSLOG_FACILITY</td>
1.178     rillig   11934: <td>IRCD_HYBRID_TOPICLEN</td>
1.156     leot     11935: </tr>
                   11936: <tr>
1.180     rillig   11937: <td>IRIX</td>
1.178     rillig   11938: <td>IRRD_USE_PGP</td>
1.156     leot     11939: </tr>
                   11940: <tr>
1.180     rillig   11941: <td>JABBERD_GROUP</td>
1.178     rillig   11942: <td>JABBERD_LOGDIR</td>
1.156     leot     11943: </tr>
                   11944: <tr>
1.180     rillig   11945: <td>JABBERD_PIDDIR</td>
1.178     rillig   11946: <td>JABBERD_SPOOLDIR</td>
1.156     leot     11947: </tr>
                   11948: <tr>
1.180     rillig   11949: <td>JABBERD_USER</td>
1.178     rillig   11950: <td>JAKARTA_HOME</td>
1.177     leot     11951: </tr>
                   11952: <tr>
1.180     rillig   11953: <td>JAVA_APP_PATH</td>
1.178     rillig   11954: <td>JAVA_APP_TARGETS</td>
1.161     leot     11955: </tr>
                   11956: <tr>
1.180     rillig   11957: <td>JAVA_BINPREFIX</td>
1.178     rillig   11958: <td>JAVA_CLASSPATH</td>
1.156     leot     11959: </tr>
                   11960: <tr>
1.180     rillig   11961: <td>JAVA_HOME</td>
1.178     rillig   11962: <td>JAVA_LD_LIBRARY_PATH</td>
1.156     leot     11963: </tr>
                   11964: <tr>
1.180     rillig   11965: <td>JAVA_NAME</td>
1.178     rillig   11966: <td>JAVA_UNLIMIT</td>
1.156     leot     11967: </tr>
                   11968: <tr>
1.180     rillig   11969: <td>JAVA_WRAPPERS</td>
1.178     rillig   11970: <td>JPEG_ACCEPTED</td>
1.156     leot     11971: </tr>
                   11972: <tr>
1.180     rillig   11973: <td>JPEG_DEFAULT</td>
1.178     rillig   11974: <td>KERBEROS</td>
1.156     leot     11975: </tr>
                   11976: <tr>
1.180     rillig   11977: <td>KERMIT_SUID_UUCP</td>
1.178     rillig   11978: <td>KJS_USE_PCRE</td>
1.156     leot     11979: </tr>
                   11980: <tr>
1.180     rillig   11981: <td>KNEWS_DOMAIN_FILE</td>
1.178     rillig   11982: <td>KNEWS_DOMAIN_NAME</td>
1.156     leot     11983: </tr>
                   11984: <tr>
1.180     rillig   11985: <td>KRB5_ACCEPTED</td>
1.178     rillig   11986: <td>KRB5_DEFAULT</td>
1.177     leot     11987: </tr>
                   11988: <tr>
1.180     rillig   11989: <td>LANGUAGES</td>
1.178     rillig   11990: <td>LAPACK_LIBS</td>
1.156     leot     11991: </tr>
                   11992: <tr>
1.180     rillig   11993: <td>LATEX2HTML_ICONPATH</td>
1.178     rillig   11994: <td>LDCONFIG_ADD_CMD</td>
1.156     leot     11995: </tr>
                   11996: <tr>
1.180     rillig   11997: <td>LDCONFIG_REMOVE_CMD</td>
1.178     rillig   11998: <td>LEAFNODE_DATA_DIR</td>
1.156     leot     11999: </tr>
                   12000: <tr>
1.180     rillig   12001: <td>LEAFNODE_GROUP</td>
1.178     rillig   12002: <td>LEAFNODE_USER</td>
1.156     leot     12003: </tr>
                   12004: <tr>
1.180     rillig   12005: <td>LIBDVDCSS_HOMEPAGE</td>
1.178     rillig   12006: <td>LIBDVDCSS_MASTER_SITES</td>
1.157     leot     12007: </tr>
                   12008: <tr>
1.180     rillig   12009: <td>LIBRSVG_TYPE</td>
1.178     rillig   12010: <td>LIBTOOL</td>
1.156     leot     12011: </tr>
                   12012: <tr>
1.180     rillig   12013: <td>LIBTOOLIZE_PLIST</td>
1.178     rillig   12014: <td>LIBTOOL_M4_OVERRIDE</td>
1.156     leot     12015: </tr>
                   12016: <tr>
1.180     rillig   12017: <td>LIBUSB_TYPE</td>
1.178     rillig   12018: <td>LICENSE</td>
1.177     leot     12019: </tr>
                   12020: <tr>
1.180     rillig   12021: <td>LINKER_RPATH_FLAG</td>
1.178     rillig   12022: <td>LINK_RPATH_FLAG</td>
1.156     leot     12023: </tr>
                   12024: <tr>
1.180     rillig   12025: <td>LINUX_BASE_NODEPS</td>
1.178     rillig   12026: <td>LINUX_BASE_PREFERRED</td>
1.161     leot     12027: </tr>
                   12028: <tr>
1.180     rillig   12029: <td>LINUX_BASE_REQUIRED</td>
1.178     rillig   12030: <td>LINUX_LOCALES</td>
1.156     leot     12031: </tr>
                   12032: <tr>
1.180     rillig   12033: <td>LOCALBASE</td>
1.178     rillig   12034: <td>LOCALBASE_LOCKTYPE</td>
1.156     leot     12035: </tr>
                   12036: <tr>
1.180     rillig   12037: <td>LOCALPATCHES</td>
1.178     rillig   12038: <td>LOVE_DATA</td>
1.156     leot     12039: </tr>
                   12040: <tr>
1.180     rillig   12041: <td>LOVE_GAME</td>
1.178     rillig   12042: <td>LOVE_VERSION</td>
1.156     leot     12043: </tr>
                   12044: <tr>
1.180     rillig   12045: <td>LP64PLATFORMS</td>
1.178     rillig   12046: <td>MACHINE_PLATFORM</td>
1.156     leot     12047: </tr>
                   12048: <tr>
1.180     rillig   12049: <td>MAILAGENT_DOMAIN</td>
1.178     rillig   12050: <td>MAILAGENT_EMAIL</td>
1.156     leot     12051: </tr>
                   12052: <tr>
1.180     rillig   12053: <td>MAILAGENT_FQDN</td>
1.178     rillig   12054: <td>MAILAGENT_ORGANIZATION</td>
1.159     rillig   12055: </tr>
                   12056: <tr>
1.180     rillig   12057: <td>MAJORDOMO_HOMEDIR</td>
1.178     rillig   12058: <td>MAJOR_OS_VERSION</td>
1.156     leot     12059: </tr>
                   12060: <tr>
1.180     rillig   12061: <td>MAKEINFO_ARGS</td>
1.178     rillig   12062: <td>MAKE_DIRS</td>
1.156     leot     12063: </tr>
                   12064: <tr>
1.180     rillig   12065: <td>MAKE_DIRS_PERMS</td>
1.178     rillig   12066: <td>MAKE_ENV</td>
1.156     leot     12067: </tr>
                   12068: <tr>
1.180     rillig   12069: <td>MAKE_FILE</td>
1.178     rillig   12070: <td>MAKE_FLAGS</td>
1.156     leot     12071: </tr>
                   12072: <tr>
1.180     rillig   12073: <td>MAKE_JOBS</td>
1.178     rillig   12074: <td>MAKE_JOBS_SAFE</td>
1.156     leot     12075: </tr>
                   12076: <tr>
1.180     rillig   12077: <td>MAKE_PROGRAM</td>
1.178     rillig   12078: <td>MANINSTALL</td>
1.156     leot     12079: </tr>
                   12080: <tr>
1.180     rillig   12081: <td>MANZ</td>
1.178     rillig   12082: <td>MASTER_SITES</td>
1.156     leot     12083: </tr>
                   12084: <tr>
1.180     rillig   12085: <td>MASTER_SITE_BACKUP</td>
1.178     rillig   12086: <td>MASTER_SITE_LOCAL</td>
1.156     leot     12087: </tr>
                   12088: <tr>
1.180     rillig   12089: <td>MASTER_SITE_MOZILLA</td>
1.178     rillig   12090: <td>MASTER_SITE_OVERRIDE</td>
1.156     leot     12091: </tr>
                   12092: <tr>
1.180     rillig   12093: <td>MASTER_SITE_PERL_CPAN</td>
1.178     rillig   12094: <td>MASTER_SORT</td>
1.156     leot     12095: </tr>
                   12096: <tr>
1.180     rillig   12097: <td>MASTER_SORT_RANDOM</td>
1.178     rillig   12098: <td>MASTER_SORT_REGEX</td>
1.156     leot     12099: </tr>
                   12100: <tr>
1.180     rillig   12101: <td>MECAB_CHARSET</td>
1.178     rillig   12102: <td>MEDIATOMB_GROUP</td>
1.156     leot     12103: </tr>
                   12104: <tr>
1.180     rillig   12105: <td>MEDIATOMB_USER</td>
1.178     rillig   12106: <td>MIPSPROBASE</td>
1.156     leot     12107: </tr>
                   12108: <tr>
1.180     rillig   12109: <td>MIREDO_GROUP</td>
1.178     rillig   12110: <td>MIREDO_USER</td>
1.156     leot     12111: </tr>
                   12112: <tr>
1.180     rillig   12113: <td>MISSING_FEATURES</td>
1.178     rillig   12114: <td>MKDIR</td>
1.156     leot     12115: </tr>
                   12116: <tr>
1.180     rillig   12117: <td>MLDONKEY_GROUP</td>
1.178     rillig   12118: <td>MLDONKEY_HOME</td>
1.156     leot     12119: </tr>
                   12120: <tr>
1.180     rillig   12121: <td>MLDONKEY_USER</td>
1.178     rillig   12122: <td>MONOTONE_GROUP</td>
1.156     leot     12123: </tr>
                   12124: <tr>
1.180     rillig   12125: <td>MONOTONE_USER</td>
1.178     rillig   12126: <td>MOTIFBASE</td>
1.156     leot     12127: </tr>
                   12128: <tr>
1.180     rillig   12129: <td>MOTIF_TYPE</td>
1.178     rillig   12130: <td>MOTIF_TYPE_DEFAULT</td>
1.156     leot     12131: </tr>
                   12132: <tr>
1.180     rillig   12133: <td>MPI_TYPE</td>
1.178     rillig   12134: <td>MSGFMT_STRIP_MSGCTXT</td>
1.156     leot     12135: </tr>
                   12136: <tr>
1.180     rillig   12137: <td>MSGFMT_STRIP_MSGID_PLURAL</td>
1.178     rillig   12138: <td>MTOOLS_ENABLE_FLOPPYD</td>
1.156     leot     12139: </tr>
                   12140: <tr>
1.180     rillig   12141: <td>MUST</td>
1.178     rillig   12142: <td>MV</td>
1.156     leot     12143: </tr>
                   12144: <tr>
1.180     rillig   12145: <td>MYSQL_CHARSET</td>
1.178     rillig   12146: <td>MYSQL_DATADIR</td>
1.156     leot     12147: </tr>
                   12148: <tr>
1.180     rillig   12149: <td>MYSQL_EXTRA_CHARSET</td>
1.178     rillig   12150: <td>MYSQL_GROUP</td>
1.156     leot     12151: </tr>
                   12152: <tr>
1.180     rillig   12153: <td>MYSQL_PKGSRCDIR</td>
1.178     rillig   12154: <td>MYSQL_USER</td>
1.156     leot     12155: </tr>
                   12156: <tr>
1.180     rillig   12157: <td>MYSQL_VERSIONS_ACCEPTED</td>
1.178     rillig   12158: <td>MYSQL_VERSION_DEFAULT</td>
1.156     leot     12159: </tr>
                   12160: <tr>
1.180     rillig   12161: <td>NAGIOSCMD_GROUP</td>
1.178     rillig   12162: <td>NAGIOSDIR</td>
1.156     leot     12163: </tr>
                   12164: <tr>
1.180     rillig   12165: <td>NAGIOS_GROUP</td>
1.178     rillig   12166: <td>NAGIOS_USER</td>
1.156     leot     12167: </tr>
                   12168: <tr>
1.180     rillig   12169: <td>NATIVE_APPEND_ABI</td>
1.178     rillig   12170: <td>NATIVE_APPEND_ELF</td>
1.156     leot     12171: </tr>
                   12172: <tr>
1.180     rillig   12173: <td>NATIVE_EXEC_FMT</td>
1.178     rillig   12174: <td>NATIVE_MACHINE_PLATFORM</td>
1.156     leot     12175: </tr>
                   12176: <tr>
1.180     rillig   12177: <td>NATIVE_OBJECT_FMT</td>
1.178     rillig   12178: <td>NBPAX_PROGRAM_PREFIX</td>
                   12179: </tr>
                   12180: <tr>
1.180     rillig   12181: <td>NETBSD_LOGIN_NAME</td>
1.172     rillig   12182: <td>NMH_EDITOR</td>
1.156     leot     12183: </tr>
                   12184: <tr>
1.180     rillig   12185: <td>NMH_MTA</td>
1.172     rillig   12186: <td>NMH_PAGER</td>
1.156     leot     12187: </tr>
                   12188: <tr>
1.180     rillig   12189: <td>NOLOGIN</td>
1.177     leot     12190: <td>NOTE</td>
1.156     leot     12191: </tr>
                   12192: <tr>
1.180     rillig   12193: <td>NOT_FOR_PLATFORM</td>
1.177     leot     12194: <td>NOT_PAX_ASLR_SAFE</td>
1.156     leot     12195: </tr>
                   12196: <tr>
1.180     rillig   12197: <td>NOT_PAX_MPROTECT_SAFE</td>
1.177     leot     12198: <td>NO_BUILD</td>
1.156     leot     12199: </tr>
                   12200: <tr>
1.180     rillig   12201: <td>NO_CHECKSUM</td>
1.177     leot     12202: <td>NO_CONFIGURE</td>
1.156     leot     12203: </tr>
                   12204: <tr>
1.180     rillig   12205: <td>NO_SKIP</td>
1.177     leot     12206: <td>NS_PREFERRED</td>
1.156     leot     12207: </tr>
                   12208: <tr>
1.180     rillig   12209: <td>NULLMAILER_GROUP</td>
1.177     leot     12210: <td>NULLMAILER_USER</td>
1.156     leot     12211: </tr>
                   12212: <tr>
1.180     rillig   12213: <td>OASIS</td>
1.177     leot     12214: <td>OASIS_BUILD_ARGS</td>
1.156     leot     12215: </tr>
                   12216: <tr>
1.180     rillig   12217: <td>OBJHOSTNAME</td>
1.177     leot     12218: <td>OBJMACHINE</td>
1.156     leot     12219: </tr>
                   12220: <tr>
1.180     rillig   12221: <td>OCAML_FINDLIB_DIRS</td>
1.177     leot     12222: <td>OCAML_FINDLIB_REGISTER</td>
1.156     leot     12223: </tr>
                   12224: <tr>
1.180     rillig   12225: <td>OCAML_FINDLIB_REGISTER_VERBOSE</td>
1.177     leot     12226: <td>OCAML_SITELIBDIR</td>
1.156     leot     12227: </tr>
                   12228: <tr>
1.180     rillig   12229: <td>OCAML_TOPKG_DOCDIR</td>
1.177     leot     12230: <td>OCAML_USE_DUNE</td>
1.156     leot     12231: </tr>
                   12232: <tr>
1.180     rillig   12233: <td>OCAML_USE_FINDLIB</td>
1.177     leot     12234: <td>OCAML_USE_JBUILDER</td>
1.156     leot     12235: </tr>
                   12236: <tr>
1.180     rillig   12237: <td>OCAML_USE_OASIS</td>
1.177     leot     12238: <td>OCAML_USE_OASIS_DYNRUN</td>
1.156     leot     12239: </tr>
                   12240: <tr>
1.180     rillig   12241: <td>OCAML_USE_OPAM</td>
1.177     leot     12242: <td>OCAML_USE_OPT_COMPILER</td>
1.156     leot     12243: </tr>
                   12244: <tr>
1.180     rillig   12245: <td>OCAML_USE_TOPKG</td>
1.177     leot     12246: <td>OMF</td>
1.156     leot     12247: </tr>
                   12248: <tr>
1.180     rillig   12249: <td>ONLY_FOR_COMPILER</td>
1.177     leot     12250: <td>ONLY_FOR_PLATFORM</td>
1.156     leot     12251: </tr>
                   12252: <tr>
1.180     rillig   12253: <td>OPENSSH_CHROOT</td>
1.177     leot     12254: <td>OPENSSH_GROUP</td>
1.156     leot     12255: </tr>
                   12256: <tr>
1.180     rillig   12257: <td>OPENSSH_USER</td>
1.177     leot     12258: <td>OPSYS</td>
1.156     leot     12259: </tr>
                   12260: <tr>
1.180     rillig   12261: <td>OPSYS_EMULDIR</td>
1.177     leot     12262: <td>OSS_TYPE</td>
1.156     leot     12263: </tr>
                   12264: <tr>
1.180     rillig   12265: <td>OSX</td>
1.177     leot     12266: <td>OSX_TOLERATE_SDK_SKEW</td>
                   12267: </tr>
                   12268: <tr>
1.180     rillig   12269: <td>OS_HAVE_ALSA</td>
1.177     leot     12270: <td>OS_HAVE_RCD</td>
1.156     leot     12271: </tr>
                   12272: <tr>
1.180     rillig   12273: <td>OS_VARIANT</td>
1.177     leot     12274: <td>OS_VERSION</td>
1.159     rillig   12275: </tr>
                   12276: <tr>
1.180     rillig   12277: <td>OTF_FONTS_DIR</td>
1.177     leot     12278: <td>OVERRIDE_DIRDEPTH</td>
1.156     leot     12279: </tr>
                   12280: <tr>
1.180     rillig   12281: <td>OVERRIDE_GEMSPEC</td>
1.177     leot     12282: <td>OVERRIDE_GNU_CONFIG_SCRIPTS</td>
1.156     leot     12283: </tr>
                   12284: <tr>
1.180     rillig   12285: <td>OVERRIDE_ROCKSPEC</td>
1.175     gutterid 12286: <td>OWN_DIRS</td>
1.161     leot     12287: </tr>
                   12288: <tr>
1.180     rillig   12289: <td>OWN_DIRS_PERMS</td>
1.175     gutterid 12290: <td>P4GROUP</td>
1.156     leot     12291: </tr>
                   12292: <tr>
1.180     rillig   12293: <td>P4PORT</td>
1.175     gutterid 12294: <td>P4ROOT</td>
1.156     leot     12295: </tr>
                   12296: <tr>
1.180     rillig   12297: <td>P4USER</td>
1.175     gutterid 12298: <td>PACKAGES</td>
1.156     leot     12299: </tr>
                   12300: <tr>
1.180     rillig   12301: <td>PALMOS_DEFAULT_SDK</td>
1.175     gutterid 12302: <td>PAMBASE</td>
1.156     leot     12303: </tr>
                   12304: <tr>
1.180     rillig   12305: <td>PAM_DEFAULT</td>
1.175     gutterid 12306: <td>PAPERSIZE</td>
1.156     leot     12307: </tr>
                   12308: <tr>
1.180     rillig   12309: <td>PASSIVE_FETCH</td>
1.175     gutterid 12310: <td>PATCHDIR</td>
1.156     leot     12311: </tr>
                   12312: <tr>
1.180     rillig   12313: <td>PATCHFILES</td>
1.175     gutterid 12314: <td>PATCH_ARGS</td>
1.156     leot     12315: </tr>
                   12316: <tr>
1.180     rillig   12317: <td>PATCH_DEBUG</td>
1.175     gutterid 12318: <td>PATCH_DIST_ARGS</td>
1.169     rillig   12319: </tr>
                   12320: <tr>
1.180     rillig   12321: <td>PATCH_DIST_CAT</td>
1.175     gutterid 12322: <td>PATCH_DIST_STRIP</td>
1.156     leot     12323: </tr>
                   12324: <tr>
1.180     rillig   12325: <td>PATCH_FUZZ_FACTOR</td>
1.175     gutterid 12326: <td>PATCH_STRIP</td>
1.156     leot     12327: </tr>
                   12328: <tr>
1.180     rillig   12329: <td>PATH</td>
1.169     rillig   12330: <td>PCCBASE</td>
1.156     leot     12331: </tr>
                   12332: <tr>
1.180     rillig   12333: <td>PEAR</td>
1.177     leot     12334: <td>PEAR_CHANNEL</td>
                   12335: </tr>
                   12336: <tr>
1.180     rillig   12337: <td>PEAR_CHANNEL_ALIAS</td>
1.177     leot     12338: <td>PEAR_CHANNEL_VERSION</td>
                   12339: </tr>
                   12340: <tr>
1.180     rillig   12341: <td>PEAR_CMD</td>
1.175     gutterid 12342: <td>PEAR_LIB</td>
1.161     leot     12343: </tr>
                   12344: <tr>
1.180     rillig   12345: <td>PEAR_PACKAGE_XML</td>
1.175     gutterid 12346: <td>PERL5</td>
1.161     leot     12347: </tr>
                   12348: <tr>
1.180     rillig   12349: <td>PERL5_CONFIGURE</td>
1.175     gutterid 12350: <td>PERL5_CONFIGURE_DIRS</td>
1.156     leot     12351: </tr>
                   12352: <tr>
1.180     rillig   12353: <td>PERL5_LDFLAGS</td>
1.175     gutterid 12354: <td>PERL5_LICENSE</td>
1.156     leot     12355: </tr>
                   12356: <tr>
1.180     rillig   12357: <td>PERL5_MODULE_TYPE</td>
1.175     gutterid 12358: <td>PERL5_PACKLIST</td>
1.156     leot     12359: </tr>
                   12360: <tr>
1.180     rillig   12361: <td>PERL5_PACKLIST_DIR</td>
1.175     gutterid 12362: <td>PERL5_PERLBASE</td>
1.156     leot     12363: </tr>
                   12364: <tr>
1.180     rillig   12365: <td>PERL5_SITEBASE</td>
1.175     gutterid 12366: <td>PERL5_USE_PACKLIST</td>
1.156     leot     12367: </tr>
                   12368: <tr>
1.180     rillig   12369: <td>PERL5_VENDORBASE</td>
1.175     gutterid 12370: <td>PFCTL</td>
1.156     leot     12371: </tr>
                   12372: <tr>
1.180     rillig   12373: <td>PFVAR_H</td>
1.175     gutterid 12374: <td>PF_VERSION</td>
1.156     leot     12375: </tr>
                   12376: <tr>
1.180     rillig   12377: <td>PGGROUP</td>
1.175     gutterid 12378: <td>PGHOME</td>
1.156     leot     12379: </tr>
                   12380: <tr>
1.180     rillig   12381: <td>PGPKGSRCDIR</td>
1.175     gutterid 12382: <td>PGSQL_TYPE</td>
1.156     leot     12383: </tr>
                   12384: <tr>
1.180     rillig   12385: <td>PGSQL_VERSIONS_ACCEPTED</td>
1.175     gutterid 12386: <td>PGSQL_VERSION_DEFAULT</td>
1.156     leot     12387: </tr>
                   12388: <tr>
1.180     rillig   12389: <td>PGUSER</td>
1.175     gutterid 12390: <td>PG_LIB_EXT</td>
1.156     leot     12391: </tr>
                   12392: <tr>
1.180     rillig   12393: <td>PHP</td>
1.175     gutterid 12394: <td>PHPCOMMON_MK</td>
1.156     leot     12395: </tr>
                   12396: <tr>
1.180     rillig   12397: <td>PHPPKGSRCDIR</td>
1.175     gutterid 12398: <td>PHP_BASE_VERS</td>
1.156     leot     12399: </tr>
                   12400: <tr>
1.180     rillig   12401: <td>PHP_CHECK_INSTALLED</td>
1.175     gutterid 12402: <td>PHP_EXTENSION_DIR</td>
1.156     leot     12403: </tr>
                   12404: <tr>
1.180     rillig   12405: <td>PHP_INITIAL_TEENY</td>
1.175     gutterid 12406: <td>PHP_PKG_PREFIX</td>
1.156     leot     12407: </tr>
                   12408: <tr>
1.180     rillig   12409: <td>PHP_VERSION</td>
1.175     gutterid 12410: <td>PHP_VERSIONS_ACCEPTED</td>
1.156     leot     12411: </tr>
                   12412: <tr>
1.180     rillig   12413: <td>PHP_VERSIONS_INCOMPATIBLE</td>
1.175     gutterid 12414: <td>PHP_VERSION_DEFAULT</td>
1.156     leot     12415: </tr>
                   12416: <tr>
1.180     rillig   12417: <td>PHP_VERSION_REQD</td>
1.175     gutterid 12418: <td>PILRC_USE_GTK</td>
1.156     leot     12419: </tr>
                   12420: <tr>
1.180     rillig   12421: <td>PKGCONFIG_BASE</td>
1.175     gutterid 12422: <td>PKGCONFIG_FILE</td>
1.156     leot     12423: </tr>
                   12424: <tr>
1.180     rillig   12425: <td>PKGCONFIG_OVERRIDE</td>
1.175     gutterid 12426: <td>PKGCONFIG_OVERRIDE_STAGE</td>
1.156     leot     12427: </tr>
                   12428: <tr>
1.180     rillig   12429: <td>PKGDIR</td>
1.175     gutterid 12430: <td>PKGGNUDIR</td>
1.156     leot     12431: </tr>
                   12432: <tr>
1.180     rillig   12433: <td>PKGINFODIR</td>
1.175     gutterid 12434: <td>PKGLOCALEDIR</td>
1.156     leot     12435: </tr>
                   12436: <tr>
1.180     rillig   12437: <td>PKGMANDIR</td>
1.175     gutterid 12438: <td>PKGNAME</td>
1.156     leot     12439: </tr>
                   12440: <tr>
1.180     rillig   12441: <td>PKGNAME_REQD</td>
1.175     gutterid 12442: <td>PKGPATH</td>
1.156     leot     12443: </tr>
                   12444: <tr>
1.180     rillig   12445: <td>PKGREVISION</td>
1.177     leot     12446: <td>PKGSRC_BLAS_TYPES</td>
                   12447: </tr>
                   12448: <tr>
1.180     rillig   12449: <td>PKGSRC_CHANGES</td>
1.177     leot     12450: <td>PKGSRC_COMPILER</td>
1.156     leot     12451: </tr>
                   12452: <tr>
1.180     rillig   12453: <td>PKGSRC_KEEP_BIN_PKGS</td>
1.177     leot     12454: <td>PKGSRC_LOCKTYPE</td>
1.159     rillig   12455: </tr>
                   12456: <tr>
1.180     rillig   12457: <td>PKGSRC_MAKE_ENV</td>
1.177     leot     12458: <td>PKGSRC_MESSAGE_RECIPIENTS</td>
1.156     leot     12459: </tr>
                   12460: <tr>
1.180     rillig   12461: <td>PKGSRC_MKPIE</td>
1.177     leot     12462: <td>PKGSRC_MKREPRO</td>
1.156     leot     12463: </tr>
                   12464: <tr>
1.180     rillig   12465: <td>PKGSRC_RUN_TEST</td>
1.177     leot     12466: <td>PKGSRC_SETENV</td>
1.156     leot     12467: </tr>
                   12468: <tr>
1.180     rillig   12469: <td>PKGSRC_SLEEPSECS</td>
1.177     leot     12470: <td>PKGSRC_TODO</td>
1.156     leot     12471: </tr>
                   12472: <tr>
1.180     rillig   12473: <td>PKGSRC_USE_CTF</td>
1.177     leot     12474: <td>PKGSRC_USE_FORTIFY</td>
1.156     leot     12475: </tr>
                   12476: <tr>
1.180     rillig   12477: <td>PKGSRC_USE_RELRO</td>
1.177     leot     12478: <td>PKGSRC_USE_SSP</td>
1.156     leot     12479: </tr>
                   12480: <tr>
1.180     rillig   12481: <td>PKGSRC_USE_STACK_CHECK</td>
1.177     leot     12482: <td>PKGTASKS_DATAFILE</td>
1.156     leot     12483: </tr>
                   12484: <tr>
1.180     rillig   12485: <td>PKGTOOLS_ARGS</td>
1.177     leot     12486: <td>PKGTOOLS_ENV</td>
1.156     leot     12487: </tr>
                   12488: <tr>
1.180     rillig   12489: <td>PKG_ALTERNATIVES</td>
1.177     leot     12490: <td>PKG_APACHE</td>
1.156     leot     12491: </tr>
                   12492: <tr>
1.180     rillig   12493: <td>PKG_APACHE_ACCEPTED</td>
1.177     leot     12494: <td>PKG_APACHE_DEFAULT</td>
1.156     leot     12495: </tr>
                   12496: <tr>
1.180     rillig   12497: <td>PKG_BEST_EXISTS</td>
1.177     leot     12498: <td>PKG_BUILD_OPTIONS</td>
1.156     leot     12499: </tr>
                   12500: <tr>
1.180     rillig   12501: <td>PKG_COMPRESSION</td>
1.177     leot     12502: <td>PKG_CONFIG</td>
1.156     leot     12503: </tr>
                   12504: <tr>
1.180     rillig   12505: <td>PKG_CONFIG_PERMS</td>
1.177     leot     12506: <td>PKG_CREATE_USERGROUP</td>
1.156     leot     12507: </tr>
                   12508: <tr>
1.180     rillig   12509: <td>PKG_DB_TMPDIR</td>
1.177     leot     12510: <td>PKG_DEBUG_LEVEL</td>
1.156     leot     12511: </tr>
                   12512: <tr>
1.180     rillig   12513: <td>PKG_DEFAULT_OPTIONS</td>
1.177     leot     12514: <td>PKG_DESTDIR_SUPPORT</td>
1.156     leot     12515: </tr>
                   12516: <tr>
1.180     rillig   12517: <td>PKG_DEVELOPER</td>
1.177     leot     12518: <td>PKG_DISABLED_OPTIONS</td>
1.156     leot     12519: </tr>
                   12520: <tr>
1.180     rillig   12521: <td>PKG_FATAL_ERRORS</td>
1.177     leot     12522: <td>PKG_FC</td>
1.156     leot     12523: </tr>
                   12524: <tr>
1.180     rillig   12525: <td>PKG_FILELIST_CMD</td>
1.177     leot     12526: <td>PKG_GECOS</td>
1.156     leot     12527: </tr>
                   12528: <tr>
1.180     rillig   12529: <td>PKG_GID</td>
1.177     leot     12530: <td>PKG_GROUPS</td>
1.156     leot     12531: </tr>
                   12532: <tr>
1.180     rillig   12533: <td>PKG_GROUPS_VARS</td>
1.177     leot     12534: <td>PKG_HOME</td>
1.156     leot     12535: </tr>
                   12536: <tr>
1.180     rillig   12537: <td>PKG_INIT_SCRIPTS</td>
1.177     leot     12538: <td>PKG_JAVA_HOME</td>
1.156     leot     12539: </tr>
                   12540: <tr>
1.180     rillig   12541: <td>PKG_JVM</td>
1.177     leot     12542: <td>PKG_JVMS_ACCEPTED</td>
1.156     leot     12543: </tr>
                   12544: <tr>
1.180     rillig   12545: <td>PKG_JVM_DEFAULT</td>
1.177     leot     12546: <td>PKG_LEGACY_OPTIONS</td>
1.156     leot     12547: </tr>
                   12548: <tr>
1.180     rillig   12549: <td>PKG_LIBTOOL</td>
1.177     leot     12550: <td>PKG_OPTIONS</td>
1.156     leot     12551: </tr>
                   12552: <tr>
1.180     rillig   12553: <td>PKG_OPTIONS_DEPRECATED_WARNINGS</td>
1.177     leot     12554: <td>PKG_OPTIONS_LEGACY_OPTS</td>
1.156     leot     12555: </tr>
                   12556: <tr>
1.180     rillig   12557: <td>PKG_OPTIONS_LEGACY_VARS</td>
1.177     leot     12558: <td>PKG_OPTIONS_NONEMPTY_SETS</td>
1.156     leot     12559: </tr>
                   12560: <tr>
1.180     rillig   12561: <td>PKG_OPTIONS_OPTIONAL_GROUPS</td>
1.177     leot     12562: <td>PKG_OPTIONS_REQUIRED_GROUPS</td>
1.156     leot     12563: </tr>
                   12564: <tr>
1.180     rillig   12565: <td>PKG_OPTIONS_VAR</td>
1.177     leot     12566: <td>PKG_PHP</td>
1.156     leot     12567: </tr>
                   12568: <tr>
1.180     rillig   12569: <td>PKG_PHP_MAJOR_VERS</td>
1.177     leot     12570: <td>PKG_PHP_VERSION</td>
1.156     leot     12571: </tr>
                   12572: <tr>
1.180     rillig   12573: <td>PKG_RCD_SCRIPTS</td>
1.177     leot     12574: <td>PKG_REFCOUNT_DBDIR</td>
1.156     leot     12575: </tr>
                   12576: <tr>
1.180     rillig   12577: <td>PKG_REGISTER_SHELLS</td>
1.177     leot     12578: <td>PKG_RESUME_TRANSFERS</td>
1.156     leot     12579: </tr>
                   12580: <tr>
1.180     rillig   12581: <td>PKG_SHELL</td>
1.177     leot     12582: <td>PKG_SUGGESTED_OPTIONS</td>
1.156     leot     12583: </tr>
                   12584: <tr>
1.180     rillig   12585: <td>PKG_SUPPORTED_OPTIONS</td>
1.177     leot     12586: <td>PKG_SYSCONFBASE</td>
1.156     leot     12587: </tr>
                   12588: <tr>
1.180     rillig   12589: <td>PKG_SYSCONFBASEDIR</td>
1.177     leot     12590: <td>PKG_SYSCONFDIR</td>
1.156     leot     12591: </tr>
                   12592: <tr>
1.180     rillig   12593: <td>PKG_SYSCONFDIR_PERMS</td>
1.177     leot     12594: <td>PKG_SYSCONFSUBDIR</td>
1.156     leot     12595: </tr>
                   12596: <tr>
1.180     rillig   12597: <td>PKG_SYSCONFVAR</td>
1.177     leot     12598: <td>PKG_TOOLS_BIN</td>
1.156     leot     12599: </tr>
                   12600: <tr>
1.180     rillig   12601: <td>PKG_UID</td>
1.177     leot     12602: <td>PKG_UPDATE_FONTS_DB</td>
1.156     leot     12603: </tr>
                   12604: <tr>
1.180     rillig   12605: <td>PKG_USERS</td>
1.177     leot     12606: <td>PKG_USERS_VARS</td>
1.156     leot     12607: </tr>
                   12608: <tr>
1.180     rillig   12609: <td>PKG_VERBOSE</td>
1.177     leot     12610: <td>PLIST</td>
1.156     leot     12611: </tr>
                   12612: <tr>
1.180     rillig   12613: <td>PLIST_AWK</td>
1.177     leot     12614: <td>PLIST_AWK_ENV</td>
1.156     leot     12615: </tr>
                   12616: <tr>
1.180     rillig   12617: <td>PLIST_SRC</td>
1.177     leot     12618: <td>PLIST_SUBST</td>
1.156     leot     12619: </tr>
                   12620: <tr>
1.180     rillig   12621: <td>PLIST_TYPE</td>
1.177     leot     12622: <td>PLIST_VARS</td>
1.156     leot     12623: </tr>
                   12624: <tr>
1.180     rillig   12625: <td>POPTOP_USE_MPPE</td>
1.177     leot     12626: <td>POSSIBLE_GFORTRAN_VERSION</td>
1.156     leot     12627: </tr>
                   12628: <tr>
1.180     rillig   12629: <td>POST_FETCH_HOOK</td>
1.177     leot     12630: <td>PREFER</td>
1.156     leot     12631: </tr>
                   12632: <tr>
1.180     rillig   12633: <td>PREFER_NATIVE</td>
1.177     leot     12634: <td>PREFER_NATIVE_PTHREADS</td>
1.156     leot     12635: </tr>
                   12636: <tr>
1.180     rillig   12637: <td>PREFER_PKGSRC</td>
1.177     leot     12638: <td>PREFIX</td>
1.156     leot     12639: </tr>
                   12640: <tr>
1.180     rillig   12641: <td>PREPEND_PATH</td>
1.177     leot     12642: <td>PRE_ROOT_CMD</td>
1.156     leot     12643: </tr>
                   12644: <tr>
1.180     rillig   12645: <td>PRIVILEGED_STAGES</td>
1.177     leot     12646: <td>PS</td>
1.156     leot     12647: </tr>
                   12648: <tr>
1.180     rillig   12649: <td>PTHREAD_AUTO_VARS</td>
1.177     leot     12650: <td>PTHREAD_CFLAGS</td>
1.156     leot     12651: </tr>
                   12652: <tr>
1.180     rillig   12653: <td>PTHREAD_LDFLAGS</td>
1.177     leot     12654: <td>PTHREAD_LIBS</td>
1.156     leot     12655: </tr>
                   12656: <tr>
1.180     rillig   12657: <td>PTHREAD_OPTS</td>
1.177     leot     12658: <td>PTHREAD_TYPE</td>
1.156     leot     12659: </tr>
                   12660: <tr>
1.180     rillig   12661: <td>PVM_SSH</td>
1.177     leot     12662: <td>PYPKGPREFIX</td>
1.156     leot     12663: </tr>
                   12664: <tr>
1.180     rillig   12665: <td>PYTHON_FOR_BUILD_ONLY</td>
1.177     leot     12666: <td>PYTHON_SELF_CONFLICT</td>
1.156     leot     12667: </tr>
                   12668: <tr>
1.180     rillig   12669: <td>PYTHON_VERSIONED_DEPENDENCIES</td>
1.177     leot     12670: <td>PYTHON_VERSIONS_ACCEPTED</td>
1.156     leot     12671: </tr>
                   12672: <tr>
1.180     rillig   12673: <td>PYTHON_VERSIONS_INCOMPATIBLE</td>
1.177     leot     12674: <td>PYTHON_VERSION_DEFAULT</td>
1.156     leot     12675: </tr>
                   12676: <tr>
1.180     rillig   12677: <td>PYTHON_VERSION_REQD</td>
1.177     leot     12678: <td>PYVERSSUFFIX</td>
1.156     leot     12679: </tr>
                   12680: <tr>
1.180     rillig   12681: <td>PY_NO_EGG</td>
1.177     leot     12682: <td>QMAILDIR</td>
1.156     leot     12683: </tr>
                   12684: <tr>
1.180     rillig   12685: <td>QMAIL_ALIAS_USER</td>
1.177     leot     12686: <td>QMAIL_DAEMON_USER</td>
1.156     leot     12687: </tr>
                   12688: <tr>
1.180     rillig   12689: <td>QMAIL_LOG_USER</td>
1.177     leot     12690: <td>QMAIL_NOFILES_GROUP</td>
1.156     leot     12691: </tr>
                   12692: <tr>
1.180     rillig   12693: <td>QMAIL_PASSWD_USER</td>
1.177     leot     12694: <td>QMAIL_QMAIL_GROUP</td>
1.156     leot     12695: </tr>
                   12696: <tr>
1.180     rillig   12697: <td>QMAIL_QUEUE_DIR</td>
1.177     leot     12698: <td>QMAIL_QUEUE_EXTRA</td>
1.156     leot     12699: </tr>
                   12700: <tr>
1.180     rillig   12701: <td>QMAIL_QUEUE_USER</td>
1.177     leot     12702: <td>QMAIL_REMOTE_USER</td>
1.156     leot     12703: </tr>
                   12704: <tr>
1.180     rillig   12705: <td>QMAIL_ROOT_USER</td>
1.177     leot     12706: <td>QMAIL_SEND_USER</td>
1.156     leot     12707: </tr>
                   12708: <tr>
1.180     rillig   12709: <td>QPOPPER_FAC</td>
1.177     leot     12710: <td>QPOPPER_SPOOL_DIR</td>
1.156     leot     12711: </tr>
                   12712: <tr>
1.180     rillig   12713: <td>QPOPPER_USER</td>
1.177     leot     12714: <td>RAKE_NAME</td>
1.156     leot     12715: </tr>
                   12716: <tr>
1.180     rillig   12717: <td>RASMOL_DEPTH</td>
1.177     leot     12718: <td>RCD_DIR</td>
1.156     leot     12719: </tr>
                   12720: <tr>
1.180     rillig   12721: <td>RCD_ORDER</td>
1.174     leot     12722: <td>RCD_SCRIPTS</td>
1.177     leot     12723: </tr>
                   12724: <tr>
1.180     rillig   12725: <td>RCD_SCRIPTS_DIR</td>
1.177     leot     12726: <td>RCD_SCRIPTS_EXAMPLEDIR</td>
1.159     rillig   12727: </tr>
                   12728: <tr>
1.180     rillig   12729: <td>RCD_SCRIPTS_MODE</td>
1.177     leot     12730: <td>RCD_SCRIPTS_SHELL</td>
1.156     leot     12731: </tr>
                   12732: <tr>
1.180     rillig   12733: <td>RCD_SCRIPT_SRC</td>
1.177     leot     12734: <td>RCD_SUBR</td>
1.156     leot     12735: </tr>
                   12736: <tr>
1.180     rillig   12737: <td>RDOC</td>
1.175     gutterid 12738: <td>READLINE_DEFAULT</td>
1.161     leot     12739: </tr>
                   12740: <tr>
1.180     rillig   12741: <td>READLINE_TYPE</td>
1.175     gutterid 12742: <td>REAL_ROOT_GROUP</td>
1.156     leot     12743: </tr>
                   12744: <tr>
1.180     rillig   12745: <td>REAL_ROOT_USER</td>
1.175     gutterid 12746: <td>RECURSIVE_MAKE</td>
1.156     leot     12747: </tr>
                   12748: <tr>
1.180     rillig   12749: <td>RELAY_CTRL_DIR</td>
1.175     gutterid 12750: <td>REPLACE_AWK</td>
1.156     leot     12751: </tr>
                   12752: <tr>
1.180     rillig   12753: <td>REPLACE_BASH</td>
1.175     gutterid 12754: <td>REPLACE_CSH</td>
1.156     leot     12755: </tr>
                   12756: <tr>
1.180     rillig   12757: <td>REPLACE_KSH</td>
1.175     gutterid 12758: <td>REPLACE_PERL</td>
1.156     leot     12759: </tr>
                   12760: <tr>
1.180     rillig   12761: <td>REPLACE_PERL6</td>
1.175     gutterid 12762: <td>REPLACE_PHP</td>
1.156     leot     12763: </tr>
                   12764: <tr>
1.180     rillig   12765: <td>REPLACE_PYTHON</td>
1.175     gutterid 12766: <td>REPLACE_RUBY</td>
1.166     leot     12767: </tr>
                   12768: <tr>
1.180     rillig   12769: <td>REPLACE_RUBY_DIRS</td>
1.175     gutterid 12770: <td>REPLACE_RUBY_PAT</td>
1.156     leot     12771: </tr>
                   12772: <tr>
1.180     rillig   12773: <td>REPLACE_SH</td>
1.175     gutterid 12774: <td>REPLACE_TEXLUA</td>
1.156     leot     12775: </tr>
                   12776: <tr>
1.180     rillig   12777: <td>REQD_DIRS</td>
1.175     gutterid 12778: <td>REQD_DIRS_PERMS</td>
1.156     leot     12779: </tr>
                   12780: <tr>
1.180     rillig   12781: <td>REQD_FILES</td>
1.175     gutterid 12782: <td>REQD_FILES_MODE</td>
1.156     leot     12783: </tr>
                   12784: <tr>
1.180     rillig   12785: <td>REQD_FILES_PERMS</td>
1.175     gutterid 12786: <td>RESOLV_AUTO_VARS</td>
1.156     leot     12787: </tr>
                   12788: <tr>
1.180     rillig   12789: <td>RESOLV_LDFLAGS</td>
1.175     gutterid 12790: <td>RESOLV_LIBS</td>
1.156     leot     12791: </tr>
                   12792: <tr>
1.180     rillig   12793: <td>RM</td>
1.177     leot     12794: <td>ROCKSPEC_NAME</td>
                   12795: </tr>
                   12796: <tr>
1.180     rillig   12797: <td>ROCKSPEC_SPECFILE</td>
1.175     gutterid 12798: <td>ROOT_CMD</td>
1.156     leot     12799: </tr>
                   12800: <tr>
1.180     rillig   12801: <td>ROOT_GROUP</td>
1.175     gutterid 12802: <td>ROOT_USER</td>
1.156     leot     12803: </tr>
                   12804: <tr>
1.180     rillig   12805: <td>RPCGEN</td>
1.175     gutterid 12806: <td>RPM</td>
1.156     leot     12807: </tr>
                   12808: <tr>
1.180     rillig   12809: <td>RPM2PKG_PLIST</td>
1.175     gutterid 12810: <td>RPM2PKG_PREFIX</td>
1.156     leot     12811: </tr>
                   12812: <tr>
1.180     rillig   12813: <td>RPM2PKG_STAGE</td>
1.175     gutterid 12814: <td>RPM2PKG_STRIP</td>
1.156     leot     12815: </tr>
                   12816: <tr>
1.180     rillig   12817: <td>RPM2PKG_SUBPREFIX</td>
1.175     gutterid 12818: <td>RPMFILES</td>
1.156     leot     12819: </tr>
                   12820: <tr>
1.180     rillig   12821: <td>RPMIGNOREPATH</td>
1.175     gutterid 12822: <td>RPM_DB_PREFIX</td>
1.156     leot     12823: </tr>
                   12824: <tr>
1.180     rillig   12825: <td>RSSH_CVS_PATH</td>
1.175     gutterid 12826: <td>RSSH_RDIST_PATH</td>
1.156     leot     12827: </tr>
                   12828: <tr>
1.180     rillig   12829: <td>RSSH_RSYNC_PATH</td>
1.175     gutterid 12830: <td>RSSH_SCP_PATH</td>
1.156     leot     12831: </tr>
                   12832: <tr>
1.180     rillig   12833: <td>RSSH_SFTP_SERVER_PATH</td>
1.175     gutterid 12834: <td>RUBY</td>
1.156     leot     12835: </tr>
                   12836: <tr>
1.180     rillig   12837: <td>RUBYGEM</td>
1.175     gutterid 12838: <td>RUBYGEM_NAME</td>
1.156     leot     12839: </tr>
                   12840: <tr>
1.180     rillig   12841: <td>RUBYGEM_OPTIONS</td>
1.175     gutterid 12842: <td>RUBY_ABI_VERSION</td>
1.156     leot     12843: </tr>
                   12844: <tr>
1.180     rillig   12845: <td>RUBY_ARCH</td>
1.175     gutterid 12846: <td>RUBY_ARCHINC</td>
1.156     leot     12847: </tr>
                   12848: <tr>
1.180     rillig   12849: <td>RUBY_ARCHLIB</td>
1.175     gutterid 12850: <td>RUBY_BASE</td>
1.156     leot     12851: </tr>
                   12852: <tr>
1.180     rillig   12853: <td>RUBY_BASERIDIR</td>
1.175     gutterid 12854: <td>RUBY_BUILD_DOCUMENT</td>
1.156     leot     12855: </tr>
                   12856: <tr>
1.180     rillig   12857: <td>RUBY_DLEXT</td>
1.175     gutterid 12858: <td>RUBY_DOC</td>
1.156     leot     12859: </tr>
                   12860: <tr>
1.180     rillig   12861: <td>RUBY_DYNAMIC_DIRS</td>
1.175     gutterid 12862: <td>RUBY_EG</td>
1.156     leot     12863: </tr>
                   12864: <tr>
1.180     rillig   12865: <td>RUBY_ENCODING_ARG</td>
1.175     gutterid 12866: <td>RUBY_EXTCONF</td>
1.156     leot     12867: </tr>
                   12868: <tr>
1.180     rillig   12869: <td>RUBY_EXTCONF_CHECK</td>
1.175     gutterid 12870: <td>RUBY_EXTCONF_DEBUG</td>
1.156     leot     12871: </tr>
                   12872: <tr>
1.180     rillig   12873: <td>RUBY_EXTCONF_MAKEFILE</td>
1.175     gutterid 12874: <td>RUBY_GEM_BASE</td>
1.156     leot     12875: </tr>
                   12876: <tr>
1.180     rillig   12877: <td>RUBY_INC</td>
1.175     gutterid 12878: <td>RUBY_LIB</td>
1.156     leot     12879: </tr>
                   12880: <tr>
1.180     rillig   12881: <td>RUBY_LIB_BASE</td>
1.175     gutterid 12882: <td>RUBY_NAME</td>
1.156     leot     12883: </tr>
                   12884: <tr>
1.180     rillig   12885: <td>RUBY_NOVERSION</td>
1.175     gutterid 12886: <td>RUBY_PKGPREFIX</td>
1.156     leot     12887: </tr>
                   12888: <tr>
1.180     rillig   12889: <td>RUBY_RAILS</td>
1.175     gutterid 12890: <td>RUBY_RAILS51_VERSION</td>
1.156     leot     12891: </tr>
                   12892: <tr>
1.180     rillig   12893: <td>RUBY_RAILS52_VERSION</td>
1.175     gutterid 12894: <td>RUBY_RAILS60_VERSION</td>
1.156     leot     12895: </tr>
                   12896: <tr>
1.180     rillig   12897: <td>RUBY_RAILS_ACCEPTED</td>
1.175     gutterid 12898: <td>RUBY_RAILS_DEFAULT</td>
1.174     leot     12899: </tr>
                   12900: <tr>
1.180     rillig   12901: <td>RUBY_RAILS_REQD</td>
1.175     gutterid 12902: <td>RUBY_RAILS_STRICT_DEP</td>
1.156     leot     12903: </tr>
                   12904: <tr>
1.180     rillig   12905: <td>RUBY_RIDIR</td>
1.175     gutterid 12906: <td>RUBY_SETUP</td>
1.156     leot     12907: </tr>
                   12908: <tr>
1.180     rillig   12909: <td>RUBY_SHLIB</td>
1.175     gutterid 12910: <td>RUBY_SHLIBALIAS</td>
1.156     leot     12911: </tr>
                   12912: <tr>
1.180     rillig   12913: <td>RUBY_SHLIBVER</td>
1.175     gutterid 12914: <td>RUBY_SIMPLE_INSTALL</td>
1.156     leot     12915: </tr>
                   12916: <tr>
1.180     rillig   12917: <td>RUBY_SITEARCHLIB</td>
1.175     gutterid 12918: <td>RUBY_SITELIB</td>
1.156     leot     12919: </tr>
                   12920: <tr>
1.180     rillig   12921: <td>RUBY_SITELIB_BASE</td>
1.175     gutterid 12922: <td>RUBY_SITERIDIR</td>
1.156     leot     12923: </tr>
                   12924: <tr>
1.180     rillig   12925: <td>RUBY_SLEXT</td>
1.175     gutterid 12926: <td>RUBY_SRCDIR</td>
1.156     leot     12927: </tr>
                   12928: <tr>
1.180     rillig   12929: <td>RUBY_STATICLIB</td>
1.175     gutterid 12930: <td>RUBY_SUFFIX</td>
1.156     leot     12931: </tr>
                   12932: <tr>
1.180     rillig   12933: <td>RUBY_SYSRIDIR</td>
1.175     gutterid 12934: <td>RUBY_USE_PTHREAD</td>
1.156     leot     12935: </tr>
                   12936: <tr>
1.180     rillig   12937: <td>RUBY_VENDORARCHLIB</td>
1.175     gutterid 12938: <td>RUBY_VENDORLIB</td>
1.156     leot     12939: </tr>
                   12940: <tr>
1.180     rillig   12941: <td>RUBY_VENDORLIB_BASE</td>
1.175     gutterid 12942: <td>RUBY_VER</td>
1.156     leot     12943: </tr>
                   12944: <tr>
1.180     rillig   12945: <td>RUBY_VERSION</td>
1.175     gutterid 12946: <td>RUBY_VERSIONS_ACCEPTED</td>
1.156     leot     12947: </tr>
                   12948: <tr>
1.180     rillig   12949: <td>RUBY_VERSIONS_INCOMPATIBLE</td>
1.175     gutterid 12950: <td>RUBY_VERSION_DEFAULT</td>
1.156     leot     12951: </tr>
                   12952: <tr>
1.180     rillig   12953: <td>RUBY_VERSION_REQD</td>
1.175     gutterid 12954: <td>RUBY_VER_DIR</td>
1.156     leot     12955: </tr>
                   12956: <tr>
1.180     rillig   12957: <td>RUN</td>
1.175     gutterid 12958: <td>RUN_LDCONFIG</td>
1.156     leot     12959: </tr>
                   12960: <tr>
1.180     rillig   12961: <td>SAWFISH_THEMES</td>
1.175     gutterid 12962: <td>SCO</td>
1.156     leot     12963: </tr>
                   12964: <tr>
1.180     rillig   12965: <td>SCREWS_GROUP</td>
1.175     gutterid 12966: <td>SCREWS_USER</td>
1.156     leot     12967: </tr>
                   12968: <tr>
1.180     rillig   12969: <td>SCRIPTS_ENV</td>
1.175     gutterid 12970: <td>SCROLLKEEPER_DATADIR</td>
1.156     leot     12971: </tr>
                   12972: <tr>
1.180     rillig   12973: <td>SCROLLKEEPER_REBUILDDB</td>
1.175     gutterid 12974: <td>SCROLLKEEPER_UPDATEDB</td>
1.156     leot     12975: </tr>
                   12976: <tr>
1.180     rillig   12977: <td>SDIST_PAWD</td>
1.175     gutterid 12978: <td>SERIAL_DEVICES</td>
1.156     leot     12979: </tr>
                   12980: <tr>
1.180     rillig   12981: <td>SETGIDGAME</td>
1.175     gutterid 12982: <td>SETGID_GAMES_PERMS</td>
1.156     leot     12983: </tr>
                   12984: <tr>
1.180     rillig   12985: <td>SETUID_ROOT_PERMS</td>
1.175     gutterid 12986: <td>SH</td>
1.156     leot     12987: </tr>
                   12988: <tr>
1.180     rillig   12989: <td>SHLIB</td>
1.177     leot     12990: <td>SHORTNAME</td>
                   12991: </tr>
                   12992: <tr>
1.180     rillig   12993: <td>SIGN_PACKAGES</td>
1.177     leot     12994: <td>SILC_CLIENT_WITH_PERL</td>
1.156     leot     12995: </tr>
                   12996: <tr>
1.180     rillig   12997: <td>SITE_SPECIFIC_PKGS</td>
1.177     leot     12998: <td>SKIP_DEPENDS</td>
1.156     leot     12999: </tr>
                   13000: <tr>
1.180     rillig   13001: <td>SMF_INSTANCES</td>
1.177     leot     13002: <td>SMF_MANIFEST</td>
1.159     rillig   13003: </tr>
                   13004: <tr>
1.180     rillig   13005: <td>SMF_METHODS</td>
1.177     leot     13006: <td>SMF_METHOD_SHELL</td>
1.156     leot     13007: </tr>
                   13008: <tr>
1.180     rillig   13009: <td>SMF_METHOD_SRC</td>
1.177     leot     13010: <td>SMF_NAME</td>
1.156     leot     13011: </tr>
                   13012: <tr>
1.180     rillig   13013: <td>SMF_PREFIX</td>
1.177     leot     13014: <td>SMF_SRCDIR</td>
1.156     leot     13015: </tr>
                   13016: <tr>
1.180     rillig   13017: <td>SNIPROXY_GROUP</td>
1.177     leot     13018: <td>SNIPROXY_USER</td>
1.156     leot     13019: </tr>
                   13020: <tr>
1.180     rillig   13021: <td>SOURCE_BUFFSIZE</td>
1.177     leot     13022: <td>SPECIAL_PERMS</td>
1.156     leot     13023: </tr>
                   13024: <tr>
1.180     rillig   13025: <td>SPECIFIC_PKGS</td>
1.177     leot     13026: <td>SSH_SUID</td>
1.156     leot     13027: </tr>
                   13028: <tr>
1.180     rillig   13029: <td>SSP_SUPPORTED</td>
1.177     leot     13030: <td>SSYNC_PAWD</td>
1.156     leot     13031: </tr>
                   13032: <tr>
1.180     rillig   13033: <td>STEP_MSG</td>
1.177     leot     13034: <td>STRIP</td>
1.156     leot     13035: </tr>
                   13036: <tr>
1.180     rillig   13037: <td>STRIP_DBG</td>
1.177     leot     13038: <td>STRIP_DEBUG</td>
1.156     leot     13039: </tr>
                   13040: <tr>
1.180     rillig   13041: <td>STRIP_DEBUG_SUPPORTED</td>
1.177     leot     13042: <td>STRIP_FILES_SKIP</td>
1.156     leot     13043: </tr>
                   13044: <tr>
1.180     rillig   13045: <td>SU</td>
1.177     leot     13046: <td>SUBDIR</td>
1.156     leot     13047: </tr>
                   13048: <tr>
1.180     rillig   13049: <td>SUBST</td>
1.177     leot     13050: <td>SUBST_CLASSES</td>
1.174     leot     13051: </tr>
                   13052: <tr>
1.180     rillig   13053: <td>SUBST_FILES</td>
1.177     leot     13054: <td>SUBST_FILTER_CMD</td>
1.156     leot     13055: </tr>
                   13056: <tr>
1.180     rillig   13057: <td>SUBST_MESSAGE</td>
1.177     leot     13058: <td>SUBST_NOOP_OK</td>
1.156     leot     13059: </tr>
                   13060: <tr>
1.180     rillig   13061: <td>SUBST_SED</td>
1.177     leot     13062: <td>SUBST_SHOW_DIFF</td>
1.156     leot     13063: </tr>
                   13064: <tr>
1.180     rillig   13065: <td>SUBST_SKIP_TEXT_CHECK</td>
1.177     leot     13066: <td>SUBST_STAGE</td>
1.156     leot     13067: </tr>
                   13068: <tr>
1.180     rillig   13069: <td>SUBST_VARS</td>
1.177     leot     13070: <td>SUNWSPROBASE</td>
1.156     leot     13071: </tr>
                   13072: <tr>
1.180     rillig   13073: <td>SUSE_PREFER</td>
1.177     leot     13074: <td>SU_CMD</td>
                   13075: </tr>
                   13076: <tr>
1.180     rillig   13077: <td>SVN_EXTRACTDIR</td>
1.177     leot     13078: <td>SVN_REPO</td>
                   13079: </tr>
                   13080: <tr>
1.180     rillig   13081: <td>SVN_REPOSITORIES</td>
1.177     leot     13082: <td>SVN_REVISION</td>
1.156     leot     13083: </tr>
                   13084: <tr>
1.180     rillig   13085: <td>TERMCAP_TYPE</td>
1.177     leot     13086: <td>TERMINFO_DEFAULT</td>
1.161     leot     13087: </tr>
                   13088: <tr>
1.180     rillig   13089: <td>TERMINFO_TYPE</td>
1.177     leot     13090: <td>TEST</td>
1.159     rillig   13091: </tr>
                   13092: <tr>
1.180     rillig   13093: <td>TEST_DEPENDS</td>
1.177     leot     13094: <td>TEST_DIRS</td>
1.156     leot     13095: </tr>
                   13096: <tr>
1.180     rillig   13097: <td>TEST_ENV</td>
1.177     leot     13098: <td>TEST_ENV_SHELL</td>
1.156     leot     13099: </tr>
                   13100: <tr>
1.180     rillig   13101: <td>TEST_MAKE_CMD</td>
1.177     leot     13102: <td>TEST_MAKE_FLAGS</td>
1.156     leot     13103: </tr>
                   13104: <tr>
1.180     rillig   13105: <td>TEST_TARGET</td>
1.177     leot     13106: <td>TEXLIVE_IGNORE_PATTERNS</td>
1.156     leot     13107: </tr>
                   13108: <tr>
1.180     rillig   13109: <td>TEXLIVE_REV</td>
1.177     leot     13110: <td>TEXLIVE_UNVERSIONED</td>
1.156     leot     13111: </tr>
                   13112: <tr>
1.180     rillig   13113: <td>TEXMFSITE</td>
1.177     leot     13114: <td>TEX_FORMATS</td>
1.156     leot     13115: </tr>
                   13116: <tr>
1.180     rillig   13117: <td>TEX_HYPHEN_DAT</td>
1.177     leot     13118: <td>TEX_HYPHEN_DEF</td>
1.156     leot     13119: </tr>
                   13120: <tr>
1.180     rillig   13121: <td>TEX_TEXMF_DIRS</td>
1.177     leot     13122: <td>THTTPD_LOG_FACILITY</td>
1.156     leot     13123: </tr>
                   13124: <tr>
1.180     rillig   13125: <td>TO</td>
1.177     leot     13126: <td>TOOLS_ALIASES</td>
1.156     leot     13127: </tr>
                   13128: <tr>
1.180     rillig   13129: <td>TOOLS_ALWAYS_WRAP</td>
1.169     rillig   13130: <td>TOOLS_ARGS</td>
1.156     leot     13131: </tr>
                   13132: <tr>
1.180     rillig   13133: <td>TOOLS_BROKEN</td>
1.169     rillig   13134: <td>TOOLS_CMD</td>
1.156     leot     13135: </tr>
                   13136: <tr>
1.180     rillig   13137: <td>TOOLS_CREATE</td>
1.169     rillig   13138: <td>TOOLS_DIR</td>
1.156     leot     13139: </tr>
                   13140: <tr>
1.180     rillig   13141: <td>TOOLS_FAIL</td>
1.169     rillig   13142: <td>TOOLS_GNU_MISSING</td>
1.156     leot     13143: </tr>
                   13144: <tr>
1.180     rillig   13145: <td>TOOLS_LDCONFIG</td>
1.169     rillig   13146: <td>TOOLS_NOOP</td>
1.156     leot     13147: </tr>
                   13148: <tr>
1.180     rillig   13149: <td>TOOLS_PATH</td>
1.169     rillig   13150: <td>TOOLS_SCRIPT</td>
1.156     leot     13151: </tr>
                   13152: <tr>
1.180     rillig   13153: <td>TOOL_DEPENDS</td>
1.177     leot     13154: <td>TTF_FONTDIR</td>
1.161     leot     13155: </tr>
                   13156: <tr>
1.180     rillig   13157: <td>TTF_FONTS_DIR</td>
1.169     rillig   13158: <td>TYPE</td>
1.156     leot     13159: </tr>
                   13160: <tr>
1.180     rillig   13161: <td>UAC_REQD_EXECS</td>
1.169     rillig   13162: <td>UCSPI_SSL_GROUP</td>
1.156     leot     13163: </tr>
                   13164: <tr>
1.180     rillig   13165: <td>UCSPI_SSL_USER</td>
1.169     rillig   13166: <td>UNLIMIT_RESOURCES</td>
1.156     leot     13167: </tr>
                   13168: <tr>
1.180     rillig   13169: <td>UNPRIVILEGED</td>
1.169     rillig   13170: <td>UNPRIVILEGED_GROUP</td>
1.156     leot     13171: </tr>
                   13172: <tr>
1.180     rillig   13173: <td>UNPRIVILEGED_GROUPS</td>
1.169     rillig   13174: <td>UNPRIVILEGED_USER</td>
1.156     leot     13175: </tr>
                   13176: <tr>
1.180     rillig   13177: <td>UNWRAP_FILES</td>
1.169     rillig   13178: <td>UNWRAP_PATTERNS</td>
1.156     leot     13179: </tr>
                   13180: <tr>
1.180     rillig   13181: <td>UPDATE_GEMSPEC</td>
1.169     rillig   13182: <td>UPDATE_TARGET</td>
1.156     leot     13183: </tr>
                   13184: <tr>
1.180     rillig   13185: <td>URI</td>
1.175     gutterid 13186: <td>USERGROUP_PHASE</td>
1.156     leot     13187: </tr>
                   13188: <tr>
1.180     rillig   13189: <td>USERPPP_GROUP</td>
1.175     gutterid 13190: <td>USER_SPECIFIC_PKGS</td>
1.156     leot     13191: </tr>
                   13192: <tr>
1.180     rillig   13193: <td>USE_ABI_DEPENDS</td>
1.175     gutterid 13194: <td>USE_APR</td>
1.156     leot     13195: </tr>
                   13196: <tr>
1.180     rillig   13197: <td>USE_BSD_MAKEFILE</td>
1.175     gutterid 13198: <td>USE_BUILTIN</td>
1.156     leot     13199: </tr>
                   13200: <tr>
1.180     rillig   13201: <td>USE_CROSS_COMPILE</td>
1.175     gutterid 13202: <td>USE_CURSES</td>
1.156     leot     13203: </tr>
                   13204: <tr>
1.180     rillig   13205: <td>USE_CWRAPPERS</td>
1.175     gutterid 13206: <td>USE_DB185</td>
1.156     leot     13207: </tr>
                   13208: <tr>
1.180     rillig   13209: <td>USE_FEATURES</td>
1.175     gutterid 13210: <td>USE_GAMESGROUP</td>
1.156     leot     13211: </tr>
                   13212: <tr>
1.180     rillig   13213: <td>USE_GCC_RUNTIME</td>
1.175     gutterid 13214: <td>USE_IMAKE</td>
1.156     leot     13215: </tr>
                   13216: <tr>
1.180     rillig   13217: <td>USE_JAVA</td>
1.175     gutterid 13218: <td>USE_JAVA2</td>
1.156     leot     13219: </tr>
                   13220: <tr>
1.180     rillig   13221: <td>USE_LANGUAGES</td>
1.175     gutterid 13222: <td>USE_LIBTOOL</td>
1.156     leot     13223: </tr>
                   13224: <tr>
1.180     rillig   13225: <td>USE_NATIVE_GCC</td>
1.175     gutterid 13226: <td>USE_NETBSD_REPO</td>
1.156     leot     13227: </tr>
                   13228: <tr>
1.180     rillig   13229: <td>USE_PKGSRC_GCC</td>
1.175     gutterid 13230: <td>USE_PKGSRC_GCC_RUNTIME</td>
1.156     leot     13231: </tr>
                   13232: <tr>
1.180     rillig   13233: <td>USE_PKGTASKS</td>
1.175     gutterid 13234: <td>USE_PKG_ADMIN_DIGEST</td>
1.156     leot     13235: </tr>
                   13236: <tr>
1.180     rillig   13237: <td>USE_RUBY_EXTCONF</td>
1.175     gutterid 13238: <td>USE_RUBY_INSTALL</td>
1.156     leot     13239: </tr>
                   13240: <tr>
1.180     rillig   13241: <td>USE_RUBY_SETUP</td>
1.175     gutterid 13242: <td>USE_RUBY_SETUP_PKG</td>
1.156     leot     13243: </tr>
                   13244: <tr>
1.180     rillig   13245: <td>USE_TOOLS</td>
1.175     gutterid 13246: <td>UUCP_GROUP</td>
1.156     leot     13247: </tr>
                   13248: <tr>
1.180     rillig   13249: <td>UUCP_USER</td>
1.175     gutterid 13250: <td>VARBASE</td>
1.156     leot     13251: </tr>
                   13252: <tr>
1.180     rillig   13253: <td>VARNAME</td>
1.175     gutterid 13254: <td>VIM_EXTRA_OPTS</td>
1.156     leot     13255: </tr>
                   13256: <tr>
1.180     rillig   13257: <td>WARNING_MSG</td>
1.175     gutterid 13258: <td>WCALC_CGIDIR</td>
1.156     leot     13259: </tr>
                   13260: <tr>
1.180     rillig   13261: <td>WCALC_CGIPATH</td>
1.175     gutterid 13262: <td>WCALC_HTMLDIR</td>
1.156     leot     13263: </tr>
                   13264: <tr>
1.180     rillig   13265: <td>WCALC_HTMLPATH</td>
1.175     gutterid 13266: <td>WDM_MANAGERS</td>
1.156     leot     13267: </tr>
                   13268: <tr>
1.180     rillig   13269: <td>WRAPPER_REORDER_CMDS</td>
1.175     gutterid 13270: <td>WRKDIR</td>
1.156     leot     13271: </tr>
                   13272: <tr>
1.180     rillig   13273: <td>WRKDIR_BASENAME</td>
1.175     gutterid 13274: <td>WRKDIR_LOCKTYPE</td>
1.156     leot     13275: </tr>
                   13276: <tr>
1.180     rillig   13277: <td>WRKLOG</td>
1.175     gutterid 13278: <td>WRKOBJDIR</td>
1.156     leot     13279: </tr>
                   13280: <tr>
1.180     rillig   13281: <td>WRKSRC</td>
1.175     gutterid 13282: <td>X10_PORT</td>
1.156     leot     13283: </tr>
                   13284: <tr>
1.180     rillig   13285: <td>X11</td>
1.175     gutterid 13286: <td>X11BASE</td>
1.156     leot     13287: </tr>
                   13288: <tr>
1.180     rillig   13289: <td>X11_PKGSRCDIR</td>
1.175     gutterid 13290: <td>X11_TYPE</td>
1.156     leot     13291: </tr>
                   13292: <tr>
1.180     rillig   13293: <td>X509_CERTIFICATE</td>
1.175     gutterid 13294: <td>X509_KEY</td>
1.156     leot     13295: </tr>
                   13296: <tr>
1.180     rillig   13297: <td>XAW_TYPE</td>
1.175     gutterid 13298: <td>XLOCK_DEFAULT_MODE</td>
1.156     leot     13299: </tr>
                   13300: <tr>
1.180     rillig   13301: <td>XMKMF_FLAGS</td>
1.172     rillig   13302: <td>XXX</td>
1.156     leot     13303: </tr>
                   13304: <tr>
1.180     rillig   13305: <td>XXXX</td>
1.172     rillig   13306: <td>YES</td>
1.159     rillig   13307: </tr>
                   13308: <tr>
1.180     rillig   13309: <td>ZSH_STATIC</td>
1.174     leot     13310: <td>__stdc__</td>
1.156     leot     13311: </tr>
                   13312: <tr>
1.180     rillig   13313: <td>_vargroups</td>
1.174     leot     13314: <td>accept</td>
                   13315: </tr>
                   13316: <tr>
1.180     rillig   13317: <td>acquire-localbase-lock</td>
1.174     leot     13318: <td>acquire-lock</td>
1.156     leot     13319: </tr>
                   13320: <tr>
1.180     rillig   13321: <td>add</td>
1.174     leot     13322: <td>administrator</td>
1.156     leot     13323: </tr>
                   13324: <tr>
1.180     rillig   13325: <td>alloca</td>
1.159     rillig   13326: <td>alternatives</td>
1.174     leot     13327: </tr>
                   13328: <tr>
1.180     rillig   13329: <td>aslr</td>
1.174     leot     13330: <td>asprintf</td>
1.156     leot     13331: </tr>
                   13332: <tr>
1.180     rillig   13333: <td>atlas</td>
1.174     leot     13334: <td>autoconf</td>
1.161     leot     13335: </tr>
                   13336: <tr>
1.180     rillig   13337: <td>automake</td>
1.174     leot     13338: <td>autoreconf</td>
1.156     leot     13339: </tr>
                   13340: <tr>
1.180     rillig   13341: <td>awk</td>
1.174     leot     13342: <td>bash</td>
1.156     leot     13343: </tr>
                   13344: <tr>
1.180     rillig   13345: <td>big-endian</td>
1.174     leot     13346: <td>bin-install</td>
1.156     leot     13347: </tr>
                   13348: <tr>
1.180     rillig   13349: <td>bind</td>
1.172     rillig   13350: <td>binpkg-list</td>
1.177     leot     13351: </tr>
                   13352: <tr>
1.180     rillig   13353: <td>blas</td>
1.172     rillig   13354: <td>bootstrap-depends</td>
1.159     rillig   13355: </tr>
                   13356: <tr>
1.180     rillig   13357: <td>broken</td>
1.172     rillig   13358: <td>broken_on_platform</td>
1.156     leot     13359: </tr>
                   13360: <tr>
1.180     rillig   13361: <td>bsd</td>
1.174     leot     13362: <td>bsd.prog.mk</td>
                   13363: </tr>
                   13364: <tr>
1.180     rillig   13365: <td>build</td>
1.172     rillig   13366: <td>build-env</td>
1.156     leot     13367: </tr>
                   13368: <tr>
1.180     rillig   13369: <td>buildlink-directories</td>
1.172     rillig   13370: <td>buildlink-oss-soundcard-h</td>
1.156     leot     13371: </tr>
                   13372: <tr>
1.180     rillig   13373: <td>c</td>
1.172     rillig   13374: <td>c++</td>
1.156     leot     13375: </tr>
                   13376: <tr>
1.180     rillig   13377: <td>ccache</td>
1.172     rillig   13378: <td>cce</td>
1.156     leot     13379: </tr>
                   13380: <tr>
1.180     rillig   13381: <td>cdefs</td>
1.174     leot     13382: <td>ceil</td>
                   13383: </tr>
                   13384: <tr>
1.180     rillig   13385: <td>changes</td>
1.174     leot     13386: <td>changes-entry</td>
1.156     leot     13387: </tr>
                   13388: <tr>
1.180     rillig   13389: <td>changes-entry-noupdate</td>
1.174     leot     13390: <td>check</td>
1.156     leot     13391: </tr>
                   13392: <tr>
1.180     rillig   13393: <td>check-clean</td>
1.174     leot     13394: <td>check-files</td>
1.156     leot     13395: </tr>
                   13396: <tr>
1.180     rillig   13397: <td>check-files-clean</td>
1.174     leot     13398: <td>check-vulnerable</td>
1.156     leot     13399: </tr>
                   13400: <tr>
1.180     rillig   13401: <td>checksum</td>
1.174     leot     13402: <td>checksum-phase</td>
1.156     leot     13403: </tr>
                   13404: <tr>
1.180     rillig   13405: <td>clean</td>
1.174     leot     13406: <td>clean-depends</td>
1.156     leot     13407: </tr>
                   13408: <tr>
1.180     rillig   13409: <td>cleandir</td>
1.174     leot     13410: <td>commit</td>
1.156     leot     13411: </tr>
                   13412: <tr>
1.180     rillig   13413: <td>commit-changes-entry</td>
1.174     leot     13414: <td>compact</td>
1.156     leot     13415: </tr>
                   13416: <tr>
1.180     rillig   13417: <td>compiler</td>
1.174     leot     13418: <td>conf</td>
1.156     leot     13419: </tr>
                   13420: <tr>
1.180     rillig   13421: <td>config.guess</td>
1.174     leot     13422: <td>config.sub</td>
1.156     leot     13423: </tr>
                   13424: <tr>
1.180     rillig   13425: <td>configuration</td>
1.174     leot     13426: <td>configure</td>
1.156     leot     13427: </tr>
                   13428: <tr>
1.180     rillig   13429: <td>configure-env</td>
1.174     leot     13430: <td>configure-help</td>
1.156     leot     13431: </tr>
                   13432: <tr>
1.180     rillig   13433: <td>configure_args</td>
1.174     leot     13434: <td>connect</td>
1.156     leot     13435: </tr>
                   13436: <tr>
1.180     rillig   13437: <td>cos</td>
1.166     leot     13438: <td>cputime</td>
1.174     leot     13439: </tr>
                   13440: <tr>
1.180     rillig   13441: <td>create-usergroup</td>
1.174     leot     13442: <td>csh</td>
1.156     leot     13443: </tr>
                   13444: <tr>
1.180     rillig   13445: <td>ctf</td>
1.177     leot     13446: <td>cvs</td>
1.161     leot     13447: </tr>
                   13448: <tr>
1.180     rillig   13449: <td>debug</td>
1.174     leot     13450: <td>declaration</td>
1.156     leot     13451: </tr>
                   13452: <tr>
1.180     rillig   13453: <td>declare</td>
1.174     leot     13454: <td>defined</td>
1.156     leot     13455: </tr>
                   13456: <tr>
1.180     rillig   13457: <td>depend</td>
1.174     leot     13458: <td>dependencies</td>
1.156     leot     13459: </tr>
                   13460: <tr>
1.180     rillig   13461: <td>depends</td>
1.174     leot     13462: <td>depends-checksum</td>
1.156     leot     13463: </tr>
                   13464: <tr>
1.180     rillig   13465: <td>depends-fetch</td>
1.174     leot     13466: <td>deps</td>
1.156     leot     13467: </tr>
                   13468: <tr>
1.180     rillig   13469: <td>describe</td>
1.174     leot     13470: <td>destdir</td>
1.156     leot     13471: </tr>
                   13472: <tr>
1.180     rillig   13473: <td>disable</td>
1.174     leot     13474: <td>distclean</td>
1.162     rillig   13475: </tr>
                   13476: <tr>
1.180     rillig   13477: <td>distinfo</td>
1.174     leot     13478: <td>dl</td>
1.156     leot     13479: </tr>
                   13480: <tr>
1.180     rillig   13481: <td>dlopen</td>
1.174     leot     13482: <td>do-build</td>
1.156     leot     13483: </tr>
                   13484: <tr>
1.180     rillig   13485: <td>do-buildlink</td>
1.174     leot     13486: <td>do-clean</td>
1.156     leot     13487: </tr>
                   13488: <tr>
1.180     rillig   13489: <td>do-configure</td>
1.174     leot     13490: <td>do-configure-post-hook</td>
1.170     rillig   13491: </tr>
                   13492: <tr>
1.180     rillig   13493: <td>do-extract</td>
1.174     leot     13494: <td>do-fetch</td>
1.177     leot     13495: </tr>
                   13496: <tr>
1.180     rillig   13497: <td>do-install</td>
1.174     leot     13498: <td>emul</td>
                   13499: </tr>
                   13500: <tr>
1.180     rillig   13501: <td>emul-distinfo</td>
1.174     leot     13502: <td>emul-fetch</td>
1.156     leot     13503: </tr>
                   13504: <tr>
1.180     rillig   13505: <td>emulation</td>
1.174     leot     13506: <td>emulator</td>
1.159     rillig   13507: </tr>
                   13508: <tr>
1.180     rillig   13509: <td>enable</td>
1.174     leot     13510: <td>endian</td>
1.156     leot     13511: </tr>
                   13512: <tr>
1.180     rillig   13513: <td>endif</td>
1.170     rillig   13514: <td>enomem</td>
1.156     leot     13515: </tr>
                   13516: <tr>
1.180     rillig   13517: <td>err</td>
1.170     rillig   13518: <td>errx</td>
1.156     leot     13519: </tr>
                   13520: <tr>
1.180     rillig   13521: <td>etc</td>
1.174     leot     13522: <td>exp</td>
                   13523: </tr>
                   13524: <tr>
1.180     rillig   13525: <td>extract-rpm</td>
1.174     leot     13526: <td>fabs</td>
1.156     leot     13527: </tr>
                   13528: <tr>
1.180     rillig   13529: <td>feature</td>
1.159     rillig   13530: <td>features</td>
1.156     leot     13531: </tr>
                   13532: <tr>
1.180     rillig   13533: <td>fetch</td>
1.159     rillig   13534: <td>fetch-list</td>
1.156     leot     13535: </tr>
                   13536: <tr>
1.180     rillig   13537: <td>follows</td>
1.159     rillig   13538: <td>forbids</td>
1.156     leot     13539: </tr>
                   13540: <tr>
1.180     rillig   13541: <td>form</td>
1.159     rillig   13542: <td>format</td>
1.156     leot     13543: </tr>
                   13544: <tr>
1.180     rillig   13545: <td>fortify</td>
1.159     rillig   13546: <td>fortify_source</td>
1.177     leot     13547: </tr>
                   13548: <tr>
1.180     rillig   13549: <td>fossil</td>
1.157     leot     13550: <td>friend</td>
1.156     leot     13551: </tr>
                   13552: <tr>
1.180     rillig   13553: <td>fts</td>
1.170     rillig   13554: <td>fts_close</td>
1.156     leot     13555: </tr>
                   13556: <tr>
1.180     rillig   13557: <td>fts_open</td>
1.170     rillig   13558: <td>fts_read</td>
1.156     leot     13559: </tr>
                   13560: <tr>
1.180     rillig   13561: <td>fts_set</td>
1.174     leot     13562: <td>gcc</td>
                   13563: </tr>
                   13564: <tr>
1.180     rillig   13565: <td>gethostbyaddr</td>
1.174     leot     13566: <td>gethostbyname</td>
1.156     leot     13567: </tr>
                   13568: <tr>
1.180     rillig   13569: <td>gethostbyname2</td>
1.170     rillig   13570: <td>getopt_long</td>
1.156     leot     13571: </tr>
                   13572: <tr>
1.180     rillig   13573: <td>getprogname</td>
1.174     leot     13574: <td>getservbyname</td>
                   13575: </tr>
                   13576: <tr>
1.180     rillig   13577: <td>getservbyport</td>
1.174     leot     13578: <td>getservent</td>
                   13579: </tr>
                   13580: <tr>
1.180     rillig   13581: <td>gettext</td>
1.177     leot     13582: <td>git</td>
1.156     leot     13583: </tr>
                   13584: <tr>
1.180     rillig   13585: <td>github</td>
1.177     leot     13586: <td>gitlab</td>
                   13587: </tr>
                   13588: <tr>
1.180     rillig   13589: <td>glob</td>
1.175     gutterid 13590: <td>gnu</td>
1.159     rillig   13591: </tr>
                   13592: <tr>
1.180     rillig   13593: <td>gnu_configure_strict</td>
1.175     gutterid 13594: <td>go</td>
1.156     leot     13595: </tr>
                   13596: <tr>
1.180     rillig   13597: <td>go-deps</td>
1.175     gutterid 13598: <td>golang</td>
1.156     leot     13599: </tr>
                   13600: <tr>
1.180     rillig   13601: <td>guess-license</td>
1.175     gutterid 13602: <td>hashbang</td>
1.156     leot     13603: </tr>
                   13604: <tr>
1.180     rillig   13605: <td>heimdal</td>
1.170     rillig   13606: <td>help</td>
1.156     leot     13607: </tr>
                   13608: <tr>
1.180     rillig   13609: <td>hg</td>
1.170     rillig   13610: <td>imake</td>
1.161     leot     13611: </tr>
                   13612: <tr>
1.180     rillig   13613: <td>increment</td>
1.174     leot     13614: <td>inet_aton</td>
1.156     leot     13615: </tr>
                   13616: <tr>
1.180     rillig   13617: <td>interp</td>
1.157     leot     13618: <td>interpreter</td>
1.156     leot     13619: </tr>
                   13620: <tr>
1.180     rillig   13621: <td>intl</td>
1.157     leot     13622: <td>iso</td>
1.156     leot     13623: </tr>
                   13624: <tr>
1.180     rillig   13625: <td>kerberos</td>
1.157     leot     13626: <td>krb</td>
1.156     leot     13627: </tr>
                   13628: <tr>
1.180     rillig   13629: <td>krb5</td>
1.157     leot     13630: <td>ksh</td>
1.177     leot     13631: </tr>
                   13632: <tr>
1.180     rillig   13633: <td>lapack</td>
1.175     gutterid 13634: <td>latex</td>
1.156     leot     13635: </tr>
                   13636: <tr>
1.180     rillig   13637: <td>libintl_bindtextdomain</td>
1.175     gutterid 13638: <td>libintl_gettext</td>
1.174     leot     13639: </tr>
                   13640: <tr>
1.180     rillig   13641: <td>libintl_textdomain</td>
1.175     gutterid 13642: <td>libnbcompat</td>
1.159     rillig   13643: </tr>
                   13644: <tr>
1.180     rillig   13645: <td>libs</td>
1.175     gutterid 13646: <td>libtool</td>
1.156     leot     13647: </tr>
                   13648: <tr>
1.180     rillig   13649: <td>licence</td>
1.175     gutterid 13650: <td>license</td>
1.156     leot     13651: </tr>
                   13652: <tr>
1.180     rillig   13653: <td>lintl</td>
1.175     gutterid 13654: <td>little-endian</td>
1.156     leot     13655: </tr>
                   13656: <tr>
1.180     rillig   13657: <td>lock</td>
1.175     gutterid 13658: <td>locking</td>
1.156     leot     13659: </tr>
                   13660: <tr>
1.180     rillig   13661: <td>lvalue</td>
1.175     gutterid 13662: <td>make</td>
1.156     leot     13663: </tr>
                   13664: <tr>
1.180     rillig   13665: <td>makesum</td>
1.174     leot     13666: <td>memory</td>
1.161     leot     13667: </tr>
                   13668: <tr>
1.180     rillig   13669: <td>mercurial</td>
1.174     leot     13670: <td>meta</td>
1.156     leot     13671: </tr>
                   13672: <tr>
1.180     rillig   13673: <td>meta-package</td>
1.174     leot     13674: <td>meta_package</td>
1.156     leot     13675: </tr>
                   13676: <tr>
1.180     rillig   13677: <td>mit-krb5</td>
1.174     leot     13678: <td>mk.conf</td>
1.177     leot     13679: </tr>
                   13680: <tr>
1.180     rillig   13681: <td>mkl</td>
1.175     gutterid 13682: <td>mount</td>
1.159     rillig   13683: </tr>
                   13684: <tr>
1.180     rillig   13685: <td>mprotect</td>
1.175     gutterid 13686: <td>mremap</td>
1.156     leot     13687: </tr>
                   13688: <tr>
1.180     rillig   13689: <td>nb</td>
1.175     gutterid 13690: <td>nbcompat</td>
1.156     leot     13691: </tr>
                   13692: <tr>
1.180     rillig   13693: <td>obstack</td>
1.175     gutterid 13694: <td>obstack_ptr_grow</td>
1.156     leot     13695: </tr>
                   13696: <tr>
1.180     rillig   13697: <td>occurs</td>
1.159     rillig   13698: <td>only</td>
1.161     leot     13699: </tr>
                   13700: <tr>
1.180     rillig   13701: <td>openblas</td>
1.158     brook    13702: <td>options</td>
1.156     leot     13703: </tr>
                   13704: <tr>
1.180     rillig   13705: <td>options.mk</td>
1.158     brook    13706: <td>order</td>
1.156     leot     13707: </tr>
                   13708: <tr>
1.180     rillig   13709: <td>override</td>
1.158     brook    13710: <td>override-intltool</td>
1.156     leot     13711: </tr>
                   13712: <tr>
1.180     rillig   13713: <td>override-message-intltool</td>
1.158     brook    13714: <td>package</td>
1.156     leot     13715: </tr>
                   13716: <tr>
1.180     rillig   13717: <td>parallel</td>
1.170     rillig   13718: <td>path</td>
1.156     leot     13719: </tr>
                   13720: <tr>
1.180     rillig   13721: <td>pax</td>
1.170     rillig   13722: <td>paxctl</td>
1.156     leot     13723: </tr>
                   13724: <tr>
1.180     rillig   13725: <td>pbulk-index</td>
1.170     rillig   13726: <td>pc</td>
1.156     leot     13727: </tr>
                   13728: <tr>
1.180     rillig   13729: <td>perl</td>
1.170     rillig   13730: <td>perl5</td>
1.156     leot     13731: </tr>
                   13732: <tr>
1.180     rillig   13733: <td>perms</td>
1.170     rillig   13734: <td>php</td>
1.156     leot     13735: </tr>
                   13736: <tr>
1.180     rillig   13737: <td>pkg-build-options</td>
1.170     rillig   13738: <td>pkg-config</td>
1.156     leot     13739: </tr>
                   13740: <tr>
1.180     rillig   13741: <td>pkg_build_options</td>
1.170     rillig   13742: <td>platform</td>
1.156     leot     13743: </tr>
                   13744: <tr>
1.180     rillig   13745: <td>plist</td>
1.170     rillig   13746: <td>post-extract</td>
1.156     leot     13747: </tr>
                   13748: <tr>
1.180     rillig   13749: <td>post-fetch</td>
1.170     rillig   13750: <td>post-wrapper</td>
1.156     leot     13751: </tr>
                   13752: <tr>
1.180     rillig   13753: <td>pre-build-checks-hook</td>
1.158     brook    13754: <td>pre-configure</td>
1.174     leot     13755: </tr>
                   13756: <tr>
1.180     rillig   13757: <td>pre-configure-checks-hook</td>
1.170     rillig   13758: <td>pre-extract</td>
1.156     leot     13759: </tr>
                   13760: <tr>
1.180     rillig   13761: <td>pre-fetch</td>
1.170     rillig   13762: <td>print-go-deps</td>
1.156     leot     13763: </tr>
                   13764: <tr>
1.180     rillig   13765: <td>print-plist</td>
1.170     rillig   13766: <td>print-summary-data</td>
1.156     leot     13767: </tr>
                   13768: <tr>
1.180     rillig   13769: <td>privileged-install-hook</td>
1.170     rillig   13770: <td>pypi</td>
1.156     leot     13771: </tr>
                   13772: <tr>
1.180     rillig   13773: <td>python</td>
1.170     rillig   13774: <td>readme-all</td>
1.156     leot     13775: </tr>
                   13776: <tr>
1.180     rillig   13777: <td>recv</td>
1.174     leot     13778: <td>recvfrom</td>
                   13779: </tr>
                   13780: <tr>
1.180     rillig   13781: <td>regcomp</td>
1.174     leot     13782: <td>release-localbase-lock</td>
                   13783: </tr>
                   13784: <tr>
1.180     rillig   13785: <td>release-lock</td>
1.170     rillig   13786: <td>relro</td>
1.156     leot     13787: </tr>
                   13788: <tr>
1.180     rillig   13789: <td>rename</td>
1.170     rillig   13790: <td>reorder</td>
1.156     leot     13791: </tr>
                   13792: <tr>
1.180     rillig   13793: <td>replace</td>
1.170     rillig   13794: <td>replace_interpreter</td>
1.156     leot     13795: </tr>
                   13796: <tr>
1.180     rillig   13797: <td>reproducible</td>
1.170     rillig   13798: <td>resolv</td>
1.156     leot     13799: </tr>
                   13800: <tr>
1.180     rillig   13801: <td>root</td>
1.170     rillig   13802: <td>ruby</td>
1.174     leot     13803: </tr>
                   13804: <tr>
1.180     rillig   13805: <td>send</td>
1.174     leot     13806: <td>sendfile</td>
1.156     leot     13807: </tr>
                   13808: <tr>
1.180     rillig   13809: <td>sendto</td>
1.158     brook    13810: <td>setenv</td>
1.156     leot     13811: </tr>
                   13812: <tr>
1.180     rillig   13813: <td>setgid</td>
1.158     brook    13814: <td>setprogname</td>
1.156     leot     13815: </tr>
                   13816: <tr>
1.180     rillig   13817: <td>setuid</td>
1.158     brook    13818: <td>sh</td>
1.156     leot     13819: </tr>
                   13820: <tr>
1.181   ! rillig   13821: <td>shebang</td>
1.180     rillig   13822: <td>show</td>
1.181   ! rillig   13823: </tr>
        !          13824: <tr>
1.158     brook    13825: <td>show-all</td>
1.181   ! rillig   13826: <td>show-build-defs</td>
1.156     leot     13827: </tr>
                   13828: <tr>
1.158     brook    13829: <td>show-depends</td>
1.181   ! rillig   13830: <td>show-deps</td>
1.156     leot     13831: </tr>
                   13832: <tr>
1.158     brook    13833: <td>show-distfiles</td>
1.181   ! rillig   13834: <td>show-downlevel</td>
1.156     leot     13835: </tr>
                   13836: <tr>
1.158     brook    13837: <td>show-subdir-var</td>
1.181   ! rillig   13838: <td>show-tools</td>
1.156     leot     13839: </tr>
                   13840: <tr>
1.158     brook    13841: <td>show-var</td>
1.181   ! rillig   13842: <td>show-vars</td>
1.156     leot     13843: </tr>
                   13844: <tr>
1.158     brook    13845: <td>snprintf</td>
1.181   ! rillig   13846: <td>socket</td>
1.174     leot     13847: </tr>
                   13848: <tr>
1.170     rillig   13849: <td>ssp</td>
1.181   ! rillig   13850: <td>st_mode</td>
1.156     leot     13851: </tr>
                   13852: <tr>
1.170     rillig   13853: <td>stage-install</td>
1.181   ! rillig   13854: <td>strcasestr</td>
1.156     leot     13855: </tr>
                   13856: <tr>
1.162     rillig   13857: <td>strict</td>
1.181   ! rillig   13858: <td>strip</td>
1.162     rillig   13859: </tr>
                   13860: <tr>
1.174     leot     13861: <td>strndup</td>
1.181   ! rillig   13862: <td>strnlen</td>
1.156     leot     13863: </tr>
                   13864: <tr>
1.174     leot     13865: <td>strsep</td>
1.181   ! rillig   13866: <td>subst</td>
1.174     leot     13867: </tr>
                   13868: <tr>
                   13869: <td>substitutions</td>
1.181   ! rillig   13870: <td>subversion</td>
1.177     leot     13871: </tr>
                   13872: <tr>
1.175     gutterid 13873: <td>sun</td>
1.181   ! rillig   13874: <td>sunpro</td>
1.156     leot     13875: </tr>
                   13876: <tr>
                   13877: <td>sunwspro</td>
1.181   ! rillig   13878: <td>svn</td>
1.156     leot     13879: </tr>
                   13880: <tr>
1.161     leot     13881: <td>symlink</td>
1.181   ! rillig   13882: <td>test</td>
1.161     leot     13883: </tr>
                   13884: <tr>
1.174     leot     13885: <td>test-env</td>
1.181   ! rillig   13886: <td>tex</td>
1.156     leot     13887: </tr>
                   13888: <tr>
1.174     leot     13889: <td>texlive</td>
1.181   ! rillig   13890: <td>tmp</td>
1.156     leot     13891: </tr>
                   13892: <tr>
1.174     leot     13893: <td>tool</td>
1.181   ! rillig   13894: <td>tools</td>
1.156     leot     13895: </tr>
                   13896: <tr>
1.174     leot     13897: <td>tools-libtool-m4-override</td>
1.181   ! rillig   13898: <td>type</td>
1.156     leot     13899: </tr>
                   13900: <tr>
1.174     leot     13901: <td>ulimit</td>
1.181   ! rillig   13902: <td>undefined</td>
1.156     leot     13903: </tr>
                   13904: <tr>
1.174     leot     13905: <td>undo-replace</td>
1.181   ! rillig   13906: <td>unlimit</td>
1.156     leot     13907: </tr>
                   13908: <tr>
1.174     leot     13909: <td>unprivileged</td>
1.181   ! rillig   13910: <td>unprivileged-install-hook</td>
1.156     leot     13911: </tr>
                   13912: <tr>
1.174     leot     13913: <td>unstripped</td>
1.181   ! rillig   13914: <td>update</td>
1.156     leot     13915: </tr>
                   13916: <tr>
1.174     leot     13917: <td>upload</td>
1.181   ! rillig   13918: <td>upload-distfiles</td>
1.156     leot     13919: </tr>
                   13920: <tr>
1.157     leot     13921: <td>use_tools</td>
1.181   ! rillig   13922: <td>user</td>
1.156     leot     13923: </tr>
                   13924: <tr>
1.157     leot     13925: <td>utimes</td>
1.181   ! rillig   13926: <td>vasprintf</td>
1.156     leot     13927: </tr>
                   13928: <tr>
1.157     leot     13929: <td>verbose</td>
1.181   ! rillig   13930: <td>vsnprintf</td>
1.156     leot     13931: </tr>
                   13932: <tr>
1.157     leot     13933: <td>warn</td>
1.181   ! rillig   13934: <td>warning</td>
1.156     leot     13935: </tr>
                   13936: <tr>
1.157     leot     13937: <td>warnings</td>
1.181   ! rillig   13938: <td>warnx</td>
1.156     leot     13939: </tr>
                   13940: <tr>
1.174     leot     13941: <td>wattr_off</td>
1.181   ! rillig   13942: <td>wattr_on</td>
1.156     leot     13943: </tr>
                   13944: <tr>
1.174     leot     13945: <td>work</td>
1.181   ! rillig   13946: <td>wrapper</td>
1.156     leot     13947: </tr>
                   13948: <tr>
1.174     leot     13949: <td>wrkdir</td>
1.181   ! rillig   13950: <td> </td>
1.156     leot     13951: </tr>
                   13952: </table>
1.154     rillig   13953: </div>
                   13954: <div class="appendix">
                   13955: <div class="titlepage"><div><div><h1 class="title">
                   13956: <a name="editing"></a>Appendix E. Editing guidelines for the pkgsrc guide</h1></div></div></div>
1.1       dsieger  13957: <div class="toc">
                   13958: <p><b>Table of Contents</b></p>
1.100     leot     13959: <dl class="toc">
1.154     rillig   13960: <dt><span class="sect1"><a href="#targets">E.1. Make targets</a></span></dt>
                   13961: <dt><span class="sect1"><a href="#procedure">E.2. Procedure</a></span></dt>
1.1       dsieger  13962: </dl>
                   13963: </div>
                   13964: <p>This section contains information on editing the pkgsrc
                   13965:        guide itself.</p>
1.41      asau     13966: <div class="sect1">
1.1       dsieger  13967: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   13968: <a name="targets"></a>E.1. Make targets</h2></div></div></div>
1.1       dsieger  13969: <p>The pkgsrc guide's source code is stored in
                   13970:        <code class="filename">pkgsrc/doc/guide/files</code>, and several files
                   13971:        are created from it:</p>
1.41      asau     13972: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.23      wiz      13973: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.txt</code></p></li>
                   13974: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.html</code></p></li>
1.174     leot     13975: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/docs/pkgsrc/" target="_top">https://www.NetBSD.org/docs/pkgsrc/</a></p></li>
                   13976: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf" target="_top">https://www.NetBSD.org/docs/pkgsrc/pkgsrc.pdf</a>:
1.1       dsieger  13977:        The PDF version of the pkgsrc guide.</p></li>
1.174     leot     13978: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps" target="_top">https://www.NetBSD.org/docs/pkgsrc/pkgsrc.ps</a>:
1.1       dsieger  13979:        PostScript version of the pkgsrc guide.</p></li>
                   13980: </ul></div>
                   13981: </div>
1.41      asau     13982: <div class="sect1">
1.1       dsieger  13983: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.154     rillig   13984: <a name="procedure"></a>E.2. Procedure</h2></div></div></div>
1.1       dsieger  13985: <p>The procedure to edit the pkgsrc guide is:</p>
1.23      wiz      13986: <div class="procedure"><ol class="procedure" type="1">
1.41      asau     13987: <li class="step"><p>Make sure you have the packages needed to
1.1       dsieger  13988:        regenerate the pkgsrc guide (and other XML-based NetBSD
1.45      obache   13989:        documentation) installed. These are automatically installed when
1.137     leot     13990:        you install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/pkgsrc-guide-tools/README.html" target="_top"><code class="filename">meta-pkgs/pkgsrc-guide-tools</code></a> package.</p></li>
1.41      asau     13991: <li class="step"><p>Run <span class="command"><strong>cd doc/guide</strong></span> to get to the
1.1       dsieger  13992:        right directory. All further steps will take place
                   13993:        here.</p></li>
1.41      asau     13994: <li class="step"><p>Edit the XML file(s) in
1.1       dsieger  13995:        <code class="filename">files/</code>.</p></li>
1.41      asau     13996: <li class="step"><p>Run <span class="command"><strong>bmake</strong></span> to check the pkgsrc
1.1       dsieger  13997:        guide for valid XML and to build the final output files. If you
                   13998:        get any errors at this stage, you can just edit the files, as
                   13999:        there are only symbolic links in the working directory, pointing
                   14000:        to the files in <code class="filename">files/</code>.</p></li>
1.41      asau     14001: <li class="step"><p><span class="command"><strong>(cd files &amp;&amp; cvs
1.1       dsieger  14002:        commit)</strong></span></p></li>
1.41      asau     14003: <li class="step"><p>Run <span class="command"><strong>bmake clean &amp;&amp; bmake</strong></span> to
1.1       dsieger  14004:        regenerate the output files with the proper RCS
                   14005:        Ids.</p></li>
1.41      asau     14006: <li class="step">
1.10      hubertf  14007: <p>Run <span class="command"><strong>bmake regen</strong></span> to install and
1.1       dsieger  14008:        commit the files in both <code class="filename">pkgsrc/doc</code> and
                   14009:        <code class="filename">htdocs</code>.</p>
1.41      asau     14010: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.1       dsieger  14011: <h3 class="title">Note</h3>
                   14012: <p>If you have added, removed or renamed some chapters,
1.10      hubertf  14013:        you need to synchronize them using <span class="command"><strong>cvs add</strong></span> or
                   14014:        <span class="command"><strong>cvs delete</strong></span> in the htdocs
1.1       dsieger  14015:        directory.</p>
                   14016: </div>
                   14017: </li>
                   14018: </ol></div>
                   14019: </div>
                   14020: </div>
                   14021: </div></body>
                   14022: </html>

CVSweb <webmaster@jp.NetBSD.org>