Annotation of pkgsrc/doc/pkgsrc.html, revision 1.347

1.75      rillig      1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      2: <html>
1.1       grant       3: <head>
1.75      rillig      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                      5: <title>The pkgsrc guide</title>
1.132     spz         6: <link rel="stylesheet" type="text/css" href="/global.css">
1.75      rillig      7: <meta name="generator" content="DocBook XSL Stylesheets VX.X.X">
1.91      rillig      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.">
1.75      rillig      9: </head>
1.148     asau       10: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book">
1.75      rillig     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.110     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.75      rillig     22: </div>
                     23: <div class="author">
                     24: <h3 class="author">
                     25: <span class="firstname">Hubert</span> <span class="surname">Feyrer</span>
                     26: </h3>
1.110     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.75      rillig     28: </div>
                     29: <h3 class="corpauthor">
                     30:         The pkgsrc Developers
                     31:       </h3>
                     32: </div></div>
1.346     jnemeth    33: <div><p class="copyright">Copyright © 1994-2023 The NetBSD Foundation, Inc</p></div>
                     34: <div><p class="pubdate">$NetBSD: pkgsrc.xml,v 1.42 2023/01/02 05:45:23 jnemeth Exp $</p></div>
1.148     asau       35: <div><div class="abstract">
1.75      rillig     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.210     leot       48: <dl class="toc">
1.75      rillig     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>
1.82      rillig     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>
1.75      rillig     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>
1.88      wiz        58: <dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd>
1.75      rillig     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.267     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.75      rillig     65: <dd><dl>
1.267     rillig     66: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.75      rillig     67: <dd><dl>
1.267     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.75      rillig     70: </dl></dd>
1.267     rillig     71: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.75      rillig     72: <dd><dl>
1.267     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.75      rillig     75: </dl></dd>
                     76: </dl></dd>
1.267     rillig     77: <dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
1.75      rillig     78: <dd><dl>
1.267     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.75      rillig     81: </dl></dd>
1.267     rillig     82: <dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
1.75      rillig     83: <dd><dl>
1.267     rillig     84: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.75      rillig     85: <dd><dl>
1.267     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>
1.317     nia        88: <dt><span class="sect2"><a href="#using.pkgin_update">5.1.3. Updating packages</a></span></dt>
                     89: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.4. Deinstalling packages</a></span></dt>
                     90: <dt><span class="sect2"><a href="#using.pkg_info">5.1.5. Getting information about installed packages</a></span></dt>
                     91: <dt><span class="sect2"><a href="#vulnerabilities">5.1.6. Checking for security vulnerabilities in installed packages</a></span></dt>
                     92: <dt><span class="sect2"><a href="#pkg_versions">5.1.7. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
                     93: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.8. Other administrative functions</a></span></dt>
1.75      rillig     94: </dl></dd>
1.267     rillig     95: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.75      rillig     96: <dd><dl>
1.267     rillig     97: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
                     98: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
                     99: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.75      rillig    100: </dl></dd>
                    101: </dl></dd>
1.267     rillig    102: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.75      rillig    103: <dd><dl>
1.267     rillig    104: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
                    105: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
                    106: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
                    107: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1.88      wiz       108: <dd><dl>
1.267     rillig    109: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
                    110: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
                    111: <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.88      wiz       112: </dl></dd>
1.267     rillig    113: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
                    114: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.75      rillig    115: </dl></dd>
1.267     rillig    116: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.75      rillig    117: <dd><dl>
1.267     rillig    118: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
                    119: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.106     rillig    120: </dl></dd>
1.267     rillig    121: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.106     rillig    122: builds)</a></span></dt>
1.75      rillig    123: <dd><dl>
1.267     rillig    124: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.295     rillig    125: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.267     rillig    126: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
                    127: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.293     rillig    128: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
                    129: <dd><dl>
1.294     rillig    130: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
                    131: <dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
1.296     rillig    132: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
                    133: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
                    134: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
                    135: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
                    136: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
                    137: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
                    138: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
                    139: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.293     rillig    140: </dl></dd>
                    141: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
                    142: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.267     rillig    143: </dl></dd>
                    144: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
                    145: <dd><dl>
                    146: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
                    147: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
                    148: </dl></dd>
                    149: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
                    150: <dd><dl>
                    151: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
                    152: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
                    153: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
                    154: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
                    155: <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>
                    156: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
                    157: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
                    158: <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>
                    159: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
                    160: <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.128     wiz       161: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
1.267     rillig    162: <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>
1.336     nia       163: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' or `priv` with pkgsrc</a></span></dt>
1.267     rillig    164: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
                    165: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
                    166: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
                    167: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build.  What shall I do?</a></span></dt>
                    168: <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.75      rillig    169: </dl></dd>
                    170: </dl></dd>
                    171: <dt><span class="part"><a href="#developers-guide">II. The pkgsrc developer's guide</a></span></dt>
                    172: <dd><dl>
1.267     rillig    173: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
1.299     rillig    174: <dt><span class="chapter"><a href="#components">12. Package components - files, directories and contents</a></span></dt>
1.91      rillig    175: <dd><dl>
1.299     rillig    176: <dt><span class="sect1"><a href="#components.Makefile">12.1. <code class="filename">Makefile</code></a></span></dt>
                    177: <dt><span class="sect1"><a href="#components.distinfo">12.2. <code class="filename">distinfo</code></a></span></dt>
                    178: <dt><span class="sect1"><a href="#components.patches">12.3. <code class="filename">patches/*</code></a></span></dt>
1.91      rillig    179: <dd><dl>
1.299     rillig    180: <dt><span class="sect2"><a href="#components.patch.structure">12.3.1. Structure of a single patch file</a></span></dt>
                    181: <dt><span class="sect2"><a href="#components.patches.caveats">12.3.2. Creating patch files</a></span></dt>
                    182: <dt><span class="sect2"><a href="#components.patches.sources">12.3.3. Sources where the patch files come from</a></span></dt>
                    183: <dt><span class="sect2"><a href="#components.patches.guidelines">12.3.4. Patching guidelines</a></span></dt>
                    184: <dt><span class="sect2"><a href="#components.patches.feedback">12.3.5. Feedback to the author</a></span></dt>
1.91      rillig    185: </dl></dd>
1.299     rillig    186: <dt><span class="sect1"><a href="#other-mandatory-files">12.4. Other mandatory files</a></span></dt>
                    187: <dt><span class="sect1"><a href="#components.optional">12.5. Optional files</a></span></dt>
                    188: <dd><dl>
                    189: <dt><span class="sect2"><a href="#components.optional.bin">12.5.1. Files affecting the binary package</a></span></dt>
                    190: <dt><span class="sect2"><a href="#components.optional.build">12.5.2. Files affecting the build process</a></span></dt>
                    191: <dt><span class="sect2"><a href="#components.optional.none">12.5.3. Files affecting nothing at all</a></span></dt>
                    192: </dl></dd>
                    193: <dt><span class="sect1"><a href="#work-dir">12.6. <code class="filename">work*</code></a></span></dt>
                    194: <dt><span class="sect1"><a href="#files-dir">12.7. <code class="filename">files/*</code></a></span></dt>
1.106     rillig    195: </dl></dd>
1.299     rillig    196: <dt><span class="chapter"><a href="#build">13. The build process</a></span></dt>
1.106     rillig    197: <dd><dl>
1.299     rillig    198: <dt><span class="sect1"><a href="#build.intro">13.1. Introduction</a></span></dt>
                    199: <dt><span class="sect1"><a href="#build.prefix">13.2. Program location</a></span></dt>
                    200: <dt><span class="sect1"><a href="#build.builddirs">13.3. Directories used during the build process</a></span></dt>
                    201: <dt><span class="sect1"><a href="#build.running">13.4. Running a phase</a></span></dt>
                    202: <dt><span class="sect1"><a href="#build.fetch">13.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
1.106     rillig    203: <dd><dl>
1.299     rillig    204: <dt><span class="sect2"><a href="#build.fetch.what">13.5.1. What to fetch and where to get it from</a></span></dt>
                    205: <dt><span class="sect2"><a href="#build.fetch.how">13.5.2. How are the files fetched?</a></span></dt>
1.106     rillig    206: </dl></dd>
1.299     rillig    207: <dt><span class="sect1"><a href="#build.checksum">13.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
                    208: <dt><span class="sect1"><a href="#build.extract">13.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
                    209: <dt><span class="sect1"><a href="#build.patch">13.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
                    210: <dt><span class="sect1"><a href="#build.tools">13.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
                    211: <dt><span class="sect1"><a href="#build.wrapper">13.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
                    212: <dt><span class="sect1"><a href="#build.configure">13.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                    213: <dt><span class="sect1"><a href="#build.build">13.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                    214: <dt><span class="sect1"><a href="#build.test">13.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
                    215: <dt><span class="sect1"><a href="#build.install">13.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                    216: <dt><span class="sect1"><a href="#build.package">13.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
                    217: <dt><span class="sect1"><a href="#build.clean">13.16. Cleaning up</a></span></dt>
                    218: <dt><span class="sect1"><a href="#build.helpful-targets">13.17. Other helpful targets</a></span></dt>
                    219: </dl></dd>
                    220: <dt><span class="chapter"><a href="#creating">14. Creating a new pkgsrc package from scratch</a></span></dt>
                    221: <dd><dl>
                    222: <dt><span class="sect1"><a href="#creating.common">14.1. Common types of packages</a></span></dt>
1.106     rillig    223: <dd><dl>
1.334     nia       224: <dt><span class="sect2"><a href="#creating.python-module">14.1.1. Python modules and programs</a></span></dt>
                    225: <dt><span class="sect2"><a href="#creating.R-package">14.1.2. R packages</a></span></dt>
                    226: <dt><span class="sect2"><a href="#creating.TeX-package">14.1.3. TeXlive packages</a></span></dt>
1.106     rillig    227: </dl></dd>
1.299     rillig    228: <dt><span class="sect1"><a href="#creating.examples">14.2. Examples</a></span></dt>
                    229: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">14.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.106     rillig    230: </dl></dd>
1.299     rillig    231: <dt><span class="chapter"><a href="#makefile">15. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.106     rillig    232: <dd><dl>
1.299     rillig    233: <dt><span class="sect1"><a href="#makefile.style">15.1. Caveats</a></span></dt>
                    234: <dt><span class="sect1"><a href="#makefile.variables">15.2. <code class="filename">Makefile</code> variables</a></span></dt>
                    235: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">15.2.1. Naming conventions</a></span></dt></dl></dd>
                    236: <dt><span class="sect1"><a href="#makefile.code">15.3. Code snippets</a></span></dt>
1.106     rillig    237: <dd><dl>
1.299     rillig    238: <dt><span class="sect2"><a href="#adding-to-list">15.3.1. Adding things to a list</a></span></dt>
                    239: <dt><span class="sect2"><a href="#echo-literal">15.3.2. Echoing a string exactly as-is</a></span></dt>
                    240: <dt><span class="sect2"><a href="#cflags-gnu-configure">15.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
                    241: <dt><span class="sect2"><a href="#empty-variables">15.3.4. Handling possibly empty variables</a></span></dt>
1.344     gutterid  242: <dt><span class="sect2"><a href="#makefile.yesno">15.3.5. Testing yes/no variables in conditions</a></span></dt>
1.106     rillig    243: </dl></dd>
                    244: </dl></dd>
1.299     rillig    245: <dt><span class="chapter"><a href="#options">16. Options handling</a></span></dt>
1.106     rillig    246: <dd><dl>
1.299     rillig    247: <dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
                    248: <dt><span class="sect1"><a href="#converting-to-options">16.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
                    249: <dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
                    250: <dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
1.106     rillig    251: </dl></dd>
1.299     rillig    252: <dt><span class="chapter"><a href="#tools">17. Tools needed for building or running</a></span></dt>
1.106     rillig    253: <dd><dl>
1.299     rillig    254: <dt><span class="sect1"><a href="#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
                    255: <dt><span class="sect1"><a href="#package-tools">17.2. Tools needed by packages</a></span></dt>
                    256: <dt><span class="sect1"><a href="#platform-tools">17.3. Tools provided by platforms</a></span></dt>
                    257: </dl></dd>
                    258: <dt><span class="chapter"><a href="#buildlink">18. Buildlink methodology</a></span></dt>
                    259: <dd><dl>
                    260: <dt><span class="sect1"><a href="#converting-to-buildlink3">18.1. Converting packages to use buildlink3</a></span></dt>
                    261: <dt><span class="sect1"><a href="#creating-buildlink3.mk">18.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106     rillig    262: <dd><dl>
1.299     rillig    263: <dt><span class="sect2"><a href="#anatomy-of-bl3">18.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
                    264: <dt><span class="sect2"><a href="#updating-buildlink-depends">18.2.2. Updating
1.133     wiz       265:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                    266:       and
                    267:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                    268:       in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106     rillig    269: </dl></dd>
1.299     rillig    270: <dt><span class="sect1"><a href="#writing-builtin.mk">18.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
                    271: <dd><dl>
                    272: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">18.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
                    273: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">18.3.2. Global preferences for native or pkgsrc software</a></span></dt>
                    274: </dl></dd>
                    275: </dl></dd>
                    276: <dt><span class="chapter"><a href="#plist">19. PLIST issues</a></span></dt>
1.106     rillig    277: <dd><dl>
1.299     rillig    278: <dt><span class="sect1"><a href="#rcs-id">19.1. RCS ID</a></span></dt>
                    279: <dt><span class="sect1"><a href="#automatic-plist-generation">19.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
                    280: <dt><span class="sect1"><a href="#print-PLIST">19.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
                    281: <dt><span class="sect1"><a href="#plist.misc">19.4. Variable substitution in PLIST</a></span></dt>
                    282: <dt><span class="sect1"><a href="#manpage-compression">19.5. Man page compression</a></span></dt>
                    283: <dt><span class="sect1"><a href="#using-PLIST_SRC">19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
                    284: <dt><span class="sect1"><a href="#platform-specific-plist">19.7. Platform-specific and differing PLISTs</a></span></dt>
                    285: <dt><span class="sect1"><a href="#build-plist">19.8. Build-specific PLISTs</a></span></dt>
                    286: <dt><span class="sect1"><a href="#faq.common-dirs">19.9. Sharing directories between packages</a></span></dt>
1.106     rillig    287: </dl></dd>
1.299     rillig    288: <dt><span class="chapter"><a href="#pkginstall">20. The pkginstall framework</a></span></dt>
                    289: <dd><dl>
                    290: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">20.1. Files and directories outside the installation prefix</a></span></dt>
                    291: <dd><dl>
                    292: <dt><span class="sect2"><a href="#dirs-outside-prefix">20.1.1. Directory manipulation</a></span></dt>
                    293: <dt><span class="sect2"><a href="#files-outside-prefix">20.1.2. File manipulation</a></span></dt>
1.106     rillig    294: </dl></dd>
1.299     rillig    295: <dt><span class="sect1"><a href="#conf-files">20.2. Configuration files</a></span></dt>
1.106     rillig    296: <dd><dl>
1.299     rillig    297: <dt><span class="sect2"><a href="#conf-files-sysconfdir">20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
                    298: <dt><span class="sect2"><a href="#conf-files-configure">20.2.2. Telling the software where configuration files are</a></span></dt>
                    299: <dt><span class="sect2"><a href="#conf-files-patching">20.2.3. Patching installations</a></span></dt>
                    300: <dt><span class="sect2"><a href="#conf-files-disable">20.2.4. Disabling handling of configuration files</a></span></dt>
                    301: </dl></dd>
                    302: <dt><span class="sect1"><a href="#rcd-scripts">20.3. System startup scripts</a></span></dt>
                    303: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">20.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
                    304: <dt><span class="sect1"><a href="#users-and-groups">20.4. System users and groups</a></span></dt>
                    305: <dt><span class="sect1"><a href="#shells">20.5. System shells</a></span></dt>
                    306: <dd><dl><dt><span class="sect2"><a href="#shells-disable">20.5.1. Disabling shell registration</a></span></dt></dl></dd>
                    307: <dt><span class="sect1"><a href="#fonts">20.6. Fonts</a></span></dt>
                    308: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">20.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
1.267     rillig    309: </dl></dd>
                    310: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
                    311: <dd><dl>
                    312: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
                    313: <dd><dl>
                    314: <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>
                    315: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
                    316: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
                    317: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
                    318: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
                    319: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
                    320: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
                    321: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
                    322: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
                    323: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
                    324: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
                    325: </dl></dd>
                    326: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                    327: <dd><dl>
                    328: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
                    329: <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>
                    330: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
                    331: </dl></dd>
                    332: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                    333: <dd><dl>
                    334: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
                    335: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
                    336: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
1.338     nia       337: <dt><span class="sect2"><a href="#meson">21.3.4. Meson / ninja</a></span></dt>
1.267     rillig    338: </dl></dd>
                    339: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
                    340: <dd><dl>
                    341: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
                    342: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
1.320     wiz       343: <dt><span class="sect2"><a href="#go-programming-language">21.4.3. Go</a></span></dt>
1.338     nia       344: <dt><span class="sect2"><a href="#rust-programming-language">21.4.4. Rust</a></span></dt>
                    345: <dt><span class="sect2"><a href="#perl-scripts">21.4.5. Packages containing Perl scripts</a></span></dt>
                    346: <dt><span class="sect2"><a href="#shell-scripts">21.4.6. Packages containing shell scripts</a></span></dt>
                    347: <dt><span class="sect2"><a href="#other-programming-languages">21.4.7. Other programming languages</a></span></dt>
1.267     rillig    348: </dl></dd>
                    349: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                    350: <dd><dl>
                    351: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
                    352: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.287     rillig    353: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
                    354: <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>
                    355: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.267     rillig    356: </dl></dd>
                    357: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                    358: <dd><dl>
                    359: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
                    360: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
                    361: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
                    362: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
                    363: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
1.318     nia       364: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing Perl modules</a></span></dt>
1.267     rillig    365: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
                    366: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
1.318     nia       367: <dt><span class="sect2"><a href="#x11-fonts">21.6.9. Packages installing X11 fonts</a></span></dt>
                    368: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.10. Packages installing SGML or XML data</a></span></dt>
                    369: <dt><span class="sect2"><a href="#mime-database">21.6.11. Packages installing extensions to the MIME database</a></span></dt>
                    370: <dt><span class="sect2"><a href="#intltool">21.6.12. Packages using intltool</a></span></dt>
                    371: <dt><span class="sect2"><a href="#startup-scripts">21.6.13. Packages installing startup scripts</a></span></dt>
                    372: <dt><span class="sect2"><a href="#tex-packages">21.6.14. Packages installing TeX modules</a></span></dt>
                    373: <dt><span class="sect2"><a href="#emulation-packages">21.6.15. Packages supporting running binaries in
1.87      wiz       374:     emulation</a></span></dt>
1.318     nia       375: <dt><span class="sect2"><a href="#hicolor-theme">21.6.16. Packages installing hicolor icons</a></span></dt>
                    376: <dt><span class="sect2"><a href="#desktop-files">21.6.17. Packages installing desktop files</a></span></dt>
1.77      rillig    377: </dl></dd>
1.267     rillig    378: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.77      rillig    379: </dl></dd>
1.299     rillig    380: <dt><span class="chapter"><a href="#gnome">22. GNOME packaging and porting</a></span></dt>
                    381: <dd><dl>
                    382: <dt><span class="sect1"><a href="#meta-packages">22.1. Meta packages</a></span></dt>
                    383: <dt><span class="sect1"><a href="#new-package">22.2. Packaging a GNOME application</a></span></dt>
                    384: <dt><span class="sect1"><a href="#full-update">22.3. Updating GNOME to a newer version</a></span></dt>
                    385: <dt><span class="sect1"><a href="#patching">22.4. Patching guidelines</a></span></dt>
                    386: </dl></dd>
1.267     rillig    387: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.77      rillig    388: <dd><dl>
1.267     rillig    389: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
                    390: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
                    391: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
                    392: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
                    393: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
                    394: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
                    395: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
                    396: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
                    397: </dl></dd>
                    398: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
1.75      rillig    399: </dl></dd>
                    400: <dt><span class="part"><a href="#infrastructure">III. The pkgsrc infrastructure internals</a></span></dt>
                    401: <dd><dl>
1.299     rillig    402: <dt><span class="chapter"><a href="#infr.design">25. Design of the pkgsrc infrastructure</a></span></dt>
1.75      rillig    403: <dd><dl>
1.299     rillig    404: <dt><span class="sect1"><a href="#infr.vardef">25.1. The meaning of variable definitions</a></span></dt>
                    405: <dt><span class="sect1"><a href="#infr.vardef.problems">25.2. Avoiding problems before they arise</a></span></dt>
                    406: <dt><span class="sect1"><a href="#infr.var">25.3. Variable evaluation</a></span></dt>
1.81      rillig    407: <dd><dl>
1.299     rillig    408: <dt><span class="sect2"><a href="#infr.var.load">25.3.1. At load time</a></span></dt>
                    409: <dt><span class="sect2"><a href="#infr.var.run">25.3.2. At runtime</a></span></dt>
1.81      rillig    410: </dl></dd>
1.299     rillig    411: <dt><span class="sect1"><a href="#infr.varspec">25.4. How can variables be specified?</a></span></dt>
                    412: <dt><span class="sect1"><a href="#infr.design.intf">25.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75      rillig    413: <dd><dl>
1.299     rillig    414: <dt><span class="sect2"><a href="#infr.design.intf.proc">25.5.1. Procedures with parameters</a></span></dt>
                    415: <dt><span class="sect2"><a href="#infr.design.intf.action">25.5.2. Actions taken on behalf of parameters</a></span></dt>
1.75      rillig    416: </dl></dd>
1.299     rillig    417: <dt><span class="sect1"><a href="#infr.order">25.6. The order in which files are loaded</a></span></dt>
1.75      rillig    418: <dd><dl>
1.299     rillig    419: <dt><span class="sect2"><a href="#infr.order.prefs">25.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">25.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.75      rillig    421: </dl></dd>
                    422: </dl></dd>
1.299     rillig    423: <dt><span class="chapter"><a href="#regression">26. Regression tests</a></span></dt>
1.75      rillig    424: <dd><dl>
1.299     rillig    425: <dt><span class="sect1"><a href="#regression.run">26.1. Running the regression tests</a></span></dt>
                    426: <dt><span class="sect1"><a href="#regression.new">26.2. Adding a new regression test</a></span></dt>
1.75      rillig    427: <dd><dl>
1.299     rillig    428: <dt><span class="sect2"><a href="#regression.fun.override">26.2.1. Overridable functions</a></span></dt>
                    429: <dt><span class="sect2"><a href="#regression.fun.helper">26.2.2. Helper functions</a></span></dt>
1.75      rillig    430: </dl></dd>
                    431: </dl></dd>
1.299     rillig    432: <dt><span class="chapter"><a href="#porting">27. Porting pkgsrc</a></span></dt>
                    433: <dd><dl><dt><span class="sect1"><a href="#porting.opsys">27.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
1.75      rillig    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.287     rillig    442: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
1.75      rillig    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>
1.322     leot      446: <dt><span class="appendix"><a href="#hardening">B. Security hardening</a></span></dt>
1.75      rillig    447: <dd><dl>
1.322     leot      448: <dt><span class="sect1"><a href="#hardening.mechanisms">B.1. Mechanisms</a></span></dt>
                    449: <dd><dl>
                    450: <dt><span class="sect2"><a href="#hardening.mechanisms.enabled">B.1.1. Enabled by default</a></span></dt>
                    451: <dt><span class="sect2"><a href="#hardening.mechanisms.disabled">B.1.2. Not enabled by default</a></span></dt>
                    452: </dl></dd>
                    453: <dt><span class="sect1"><a href="#hardening.caveats">B.2. Caveats</a></span></dt>
                    454: <dd><dl>
                    455: <dt><span class="sect2"><a href="#hardening.caveats.pie">B.2.1. Problems with PKGSRC_MKPIE</a></span></dt>
                    456: <dt><span class="sect2"><a href="#hardening.caveats.fortify">B.2.2. Problems with PKGSRC_USE_FORTIFY</a></span></dt>
                    457: <dt><span class="sect2"><a href="#hardening.caveats.relro">B.2.3. Problems with PKGSRC_USE_RELRO</a></span></dt>
                    458: <dt><span class="sect2"><a href="#hardening.caveats.ssp">B.2.4. Problems with PKGSRC_USE_SSP</a></span></dt>
                    459: </dl></dd>
                    460: <dt><span class="sect1"><a href="#hardening.audit">B.3. Auditing the system</a></span></dt>
                    461: <dd><dl>
                    462: <dt><span class="sect2"><a href="#hardening.audit.pie">B.3.1. Checking for PIE</a></span></dt>
                    463: <dt><span class="sect2"><a href="#hardening.audit.relropartial">B.3.2. Checking for partial RELRO</a></span></dt>
                    464: <dt><span class="sect2"><a href="#hardening.audit.relrofull">B.3.3. Checking for full RELRO</a></span></dt>
                    465: <dt><span class="sect2"><a href="#hardening.audit.ssp">B.3.4. Checking for SSP</a></span></dt>
                    466: </dl></dd>
                    467: </dl></dd>
                    468: <dt><span class="appendix"><a href="#logs">C. Build logs</a></span></dt>
                    469: <dd><dl>
                    470: <dt><span class="sect1"><a href="#logs.building">C.1. Building figlet</a></span></dt>
                    471: <dt><span class="sect1"><a href="#logs.package">C.2. Packaging figlet</a></span></dt>
1.75      rillig    472: </dl></dd>
1.322     leot      473: <dt><span class="appendix"><a href="#ftp-layout">D. Directory layout of the pkgsrc FTP server</a></span></dt>
1.76      rillig    474: <dd><dl>
1.322     leot      475: <dt><span class="sect1"><a href="#ftp-distfiles">D.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
                    476: <dt><span class="sect1"><a href="#ftp-misc">D.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
                    477: <dt><span class="sect1"><a href="#ftp-packages">D.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
                    478: <dt><span class="sect1"><a href="#ftp-reports">D.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
                    479: <dt><span class="sect1"><a href="#ftp-source">D.5. <code class="filename">current</code>,
1.261     leot      480: <code class="filename">stable</code>,
1.128     wiz       481: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76      rillig    482: source packages</a></span></dt>
                    483: </dl></dd>
1.322     leot      484: <dt><span class="appendix"><a href="#help-topics">E. Help topics</a></span></dt>
                    485: <dt><span class="appendix"><a href="#editing">F. Editing guidelines for the pkgsrc guide</a></span></dt>
1.75      rillig    486: <dd><dl>
1.322     leot      487: <dt><span class="sect1"><a href="#targets">F.1. Make targets</a></span></dt>
                    488: <dt><span class="sect1"><a href="#procedure">F.2. Procedure</a></span></dt>
1.75      rillig    489: </dl></dd>
                    490: </dl>
                    491: </div>
1.82      rillig    492: <div class="list-of-tables">
                    493: <p><b>List of Tables</b></p>
                    494: <dl>
                    495: <dt>1.1. <a href="#supported-platforms">Platforms supported by pkgsrc</a>
                    496: </dt>
1.299     rillig    497: <dt>12.1. <a href="#patch-examples">Patching examples</a>
1.85      jmmv      498: </dt>
1.299     rillig    499: <dt>22.1. <a href="#plist-handling">PLIST handling for GNOME packages</a>
1.85      jmmv      500: </dt>
1.82      rillig    501: </dl>
                    502: </div>
1.148     asau      503: <div class="chapter">
                    504: <div class="titlepage"><div><div><h1 class="title">
                    505: <a name="introduction"></a>Chapter 1. What is pkgsrc?</h1></div></div></div>
1.75      rillig    506: <div class="toc">
                    507: <p><b>Table of Contents</b></p>
1.210     leot      508: <dl class="toc">
1.75      rillig    509: <dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
1.82      rillig    510: <dd><dl>
                    511: <dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt>
                    512: <dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
                    513: </dl></dd>
1.75      rillig    514: <dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt>
                    515: <dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
1.88      wiz       516: <dd><dl><dt><span class="sect2"><a href="#term.roles">1.3.1. Roles involved in pkgsrc</a></span></dt></dl></dd>
1.75      rillig    517: <dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
                    518: </dl>
                    519: </div>
1.148     asau      520: <div class="sect1">
1.75      rillig    521: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    522: <a name="introduction-section"></a>1.1. Introduction</h2></div></div></div>
1.82      rillig    523: <p>There is a lot of software freely available for Unix-based
                    524: systems, which is usually available in form of the source code. Before
                    525: such software can be used, it needs to be configured to the local
                    526: system, compiled and installed, and this is exactly what The NetBSD
                    527: Packages Collection (pkgsrc) does. pkgsrc also has some basic commands
                    528: to handle binary packages, so that not every user has to build the
                    529: packages for himself, which is a time-costly task.</p>
1.75      rillig    530: <p>pkgsrc currently contains several thousand packages,
                    531:       including:</p>
1.148     asau      532: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot      533: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/index.html" target="_top"><code class="filename">www/apache24</code></a> - The Apache
1.75      rillig    534:          web server</p></li>
1.322     leot      535: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/index.html" target="_top"><code class="filename">www/firefox</code></a> - The Firefox
1.75      rillig    536:          web browser</p></li>
1.322     leot      537: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/index.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a> - The GNOME
1.75      rillig    538:          Desktop Environment</p></li>
1.322     leot      539: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/index.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a> - The K
1.75      rillig    540:          Desktop Environment</p></li>
                    541: </ul></div>
1.219     rillig    542: <p>&#8230; just to name a few.</p>
1.75      rillig    543: <p>pkgsrc has built-in support for handling varying dependencies,
                    544:       such as pthreads and X11, and extended features such as IPv6 support on
                    545:       a range of platforms.</p>
1.148     asau      546: <div class="sect2">
1.82      rillig    547: <div class="titlepage"><div><div><h3 class="title">
                    548: <a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div>
                    549: <p>
                    550: pkgsrc provides the following key features:
                    551: </p>
1.148     asau      552: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz       553: <li class="listitem"><p>Easy building of software from source as well as the creation
1.82      rillig    554:   and installation of binary packages. The source and latest
                    555:   patches are retrieved from a master or mirror download site, checksum
                    556:   verified, then built on your system. Support for binary-only
                    557:   distributions is available for both native platforms and NetBSD
                    558:   emulated platforms.</p></li>
1.128     wiz       559: <li class="listitem"><p>All packages are installed in a consistent directory tree,
1.82      rillig    560:   including binaries, libraries, man pages and other
                    561:   documentation.</p></li>
1.214     sevan     562: <li class="listitem"><p>Tracking of package dependencies automatically, including when
                    563:   performing updates, to ensure required packages are installed. The
                    564:   configuration files of various packages are handled automatically during
                    565:   updates, so local changes are preserved.</p></li>
1.128     wiz       566: <li class="listitem"><p>Like NetBSD, pkgsrc is designed with portability in mind and
1.82      rillig    567:   consists of highly portable code. This allows the greatest speed of
1.132     spz       568:   development when porting to a new platform. This portability also
1.82      rillig    569:   ensures that pkgsrc is <span class="emphasis"><em>consistent across all
                    570:   platforms</em></span>.</p></li>
1.128     wiz       571: <li class="listitem"><p>The installation prefix, acceptable software licenses,
1.82      rillig    572:   international encryption requirements and build-time options for a
                    573:   large number of packages are all set in a simple, central
                    574:   configuration file.</p></li>
1.128     wiz       575: <li class="listitem"><p>The entire source (not including the distribution files) is
1.82      rillig    576:   freely available under a BSD license, so you may extend and adapt
                    577:   pkgsrc to your needs. Support for local packages and patches is
                    578:   available right out of the box, so you can configure it specifically
                    579:   for your environment.</p></li>
                    580: </ul></div>
1.91      rillig    581: <p>The following principles are basic to pkgsrc:</p>
1.148     asau      582: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz       583: <li class="listitem"><p><span class="quote">&#8220;<span class="quote">It should only work if it's right.</span>&#8221;</span>
1.126     jakllsch  584: &mdash; That means, if a package contains bugs, it's better to find
1.91      rillig    585: them and to complain about them rather than to just install the package
                    586: and hope that it works. There are numerous checks in pkgsrc that try to
1.322     leot      587: find such bugs: static analysis tools (<a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/index.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>), build-time checks (portability
1.91      rillig    588: of shell scripts), and post-installation checks (installed files,
                    589: references to shared libraries, script interpreters).</p></li>
1.128     wiz       590: <li class="listitem"><p><span class="quote">&#8220;<span class="quote">If it works, it should work everywhere</span>&#8221;</span>
1.126     jakllsch  591: &mdash; Like NetBSD has been ported to many hardware architectures,
1.91      rillig    592: pkgsrc has been ported to many operating systems. Care is taken that
                    593: packages behave the same on all platforms.</p></li>
                    594: </ul></div>
1.82      rillig    595: </div>
1.148     asau      596: <div class="sect2">
1.82      rillig    597: <div class="titlepage"><div><div><h3 class="title">
                    598: <a name="intro.platforms"></a>1.1.2. Supported platforms</h3></div></div></div>
                    599: <p>pkgsrc consists of both a source distribution and a binary
                    600: distribution for these operating systems. After retrieving the required
                    601: source or binaries, you can be up and running with pkgsrc in just
                    602: minutes!</p>
1.75      rillig    603: <p>pkgsrc was derived from FreeBSD's ports system, and
                    604:       initially developed for NetBSD only. Since then, pkgsrc has
                    605:       grown a lot, and now supports the following platforms:</p>
1.82      rillig    606: <div class="table">
                    607: <a name="supported-platforms"></a><p class="title"><b>Table 1.1. Platforms supported by pkgsrc</b></p>
1.216     tnn       608: <div class="table-contents"><table class="table" summary="Platforms supported by pkgsrc" border="1">
1.82      rillig    609: <colgroup>
                    610: <col>
                    611: <col>
1.202     sevan     612: <col>
1.82      rillig    613: </colgroup>
                    614: <thead><tr>
                    615: <th>Platform</th>
                    616: <th>Date Support Added</th>
1.202     sevan     617: <th>Notes</th>
1.82      rillig    618: </tr></thead>
                    619: <tbody>
                    620: <tr>
1.289     leot      621: <td><a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a></td>
1.82      rillig    622: <td align="center">Aug 1997</td>
1.202     sevan     623: <td class="auto-generated"> </td>
1.82      rillig    624: </tr>
                    625: <tr>
1.110     hubertf   626: <td><a class="ulink" href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td>
1.82      rillig    627: <td align="center">Mar 1999</td>
1.264     sevan     628: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Solaris" target="_top">README.Solaris</a></td>
1.82      rillig    629: </tr>
                    630: <tr>
1.289     leot      631: <td><a class="ulink" href="https://www.kernel.org/" target="_top">Linux</a></td>
1.82      rillig    632: <td align="center">Jun 1999</td>
1.264     sevan     633: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Linux" target="_top">README.Linux</a></td>
1.82      rillig    634: </tr>
                    635: <tr>
                    636: <td>
1.230     sevan     637:           <a class="ulink" href="https://developer.apple.com/macos/" target="_top">Darwin / Mac OS X / OS X / macOS</a>
1.82      rillig    638:         </td>
                    639: <td align="center">Oct 2001</td>
1.305     bacon     640: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.macOS" target="_top">README.macOS</a></td>
1.82      rillig    641: </tr>
                    642: <tr>
1.289     leot      643: <td><a class="ulink" href="https://www.freebsd.org/" target="_top">FreeBSD</a></td>
1.82      rillig    644: <td align="center">Nov 2002</td>
1.264     sevan     645: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.FreeBSD" target="_top">README.FreeBSD</a></td>
1.82      rillig    646: </tr>
                    647: <tr>
1.289     leot      648: <td><a class="ulink" href="https://www.openbsd.org/" target="_top">OpenBSD</a></td>
1.82      rillig    649: <td align="center">Nov 2002</td>
1.264     sevan     650: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OpenBSD" target="_top">README.OpenBSD</a></td>
1.82      rillig    651: </tr>
                    652: <tr>
1.289     leot      653: <td><a class="ulink" href="https://www.sgi.com/software/irix/" target="_top">IRIX</a></td>
1.82      rillig    654: <td align="center">Dec 2002</td>
1.202     sevan     655: <td>
1.264     sevan     656:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX" target="_top">README.IRIX</a>
1.202     sevan     657:        </td>
1.82      rillig    658: </tr>
                    659: <tr>
                    660: <td>BSD/OS</td>
                    661: <td align="center">Dec 2003</td>
1.202     sevan     662: <td class="auto-generated"> </td>
1.82      rillig    663: </tr>
                    664: <tr>
1.289     leot      665: <td><a class="ulink" href="https://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td>
1.82      rillig    666: <td align="center">Dec 2003</td>
1.264     sevan     667: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.AIX" target="_top">README.AIX</a></td>
1.82      rillig    668: </tr>
                    669: <tr>
                    670: <td>
1.289     leot      671:           <a class="ulink" href="https://www.microsoft.com/windows/sfu/" target="_top">Interix</a>
1.82      rillig    672:           (Microsoft Windows Services for Unix)
                    673:         </td>
                    674: <td align="center">Mar 2004</td>
1.264     sevan     675: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Interix" target="_top">README.Interix</a></td>
1.82      rillig    676: </tr>
                    677: <tr>
1.289     leot      678: <td><a class="ulink" href="https://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td>
1.82      rillig    679: <td align="center">Oct 2004</td>
1.202     sevan     680: <td class="auto-generated"> </td>
1.82      rillig    681: </tr>
                    682: <tr>
1.110     hubertf   683: <td><a class="ulink" href="http://www.tru64.org/" target="_top">OSF/1</a></td>
1.82      rillig    684: <td align="center">Nov 2004</td>
1.264     sevan     685: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.OSF1" target="_top">README.OSF1</a></td>
1.82      rillig    686: </tr>
1.98      wiz       687: <tr>
1.289     leot      688: <td><a class="ulink" href="https://www.hp.com/products1/unix/" target="_top">HP-UX</a></td>
1.98      wiz       689: <td align="center">Apr 2007</td>
1.264     sevan     690: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.HPUX" target="_top">README.HPUX</a></td>
1.98      wiz       691: </tr>
1.128     wiz       692: <tr>
1.289     leot      693: <td><a class="ulink" href="https://www.haiku-os.org/" target="_top">Haiku</a></td>
1.128     wiz       694: <td align="center">Sep 2010</td>
1.264     sevan     695: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Haiku" target="_top">README.Haiku</a></td>
1.128     wiz       696: </tr>
1.151     obache    697: <tr>
1.289     leot      698: <td><a class="ulink" href="https://www.mirbsd.org/" target="_top">MirBSD</a></td>
1.163     bsiegert  699: <td align="center">Jan 2011</td>
1.202     sevan     700: <td class="auto-generated"> </td>
1.151     obache    701: </tr>
                    702: <tr>
1.289     leot      703: <td><a class="ulink" href="https://www.minix3.org/" target="_top">Minix3</a></td>
1.151     obache    704: <td align="center">Nov 2011</td>
1.264     sevan     705: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Minix3" target="_top">README.Minix3</a></td>
1.151     obache    706: </tr>
                    707: <tr>
1.289     leot      708: <td><a class="ulink" href="https://cygwin.com/" target="_top">Cygwin</a></td>
1.151     obache    709: <td align="center">Mar 2013</td>
1.264     sevan     710: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.Cygwin" target="_top">README.Cygwin</a></td>
1.151     obache    711: </tr>
1.166     jnemeth   712: <tr>
1.289     leot      713: <td><a class="ulink" href="https://www.debian.org/ports/kfreebsd-gnu/" target="_top">GNU/kFreeBSD</a></td>
1.166     jnemeth   714: <td align="center">Jul 2013</td>
1.264     sevan     715: <td><a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.GNUkFreeBSD" target="_top">README.GNUkFreeBSD</a></td>
1.166     jnemeth   716: </tr>
1.214     sevan     717: <tr>
1.289     leot      718: <td><a class="ulink" href="https://www.bitrig.org/" target="_top">Bitrig</a></td>
1.214     sevan     719: <td align="center">Jun 2014</td>
1.344     gutterid  720: <td>Removed from pkgsrc Sep 2022</td>
1.214     sevan     721: </tr>
1.82      rillig    722: </tbody>
1.91      rillig    723: </table></div>
1.82      rillig    724: </div>
1.91      rillig    725: <br class="table-break">
1.82      rillig    726: </div>
1.75      rillig    727: </div>
1.148     asau      728: <div class="sect1">
1.75      rillig    729: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    730: <a name="overview"></a>1.2. Overview</h2></div></div></div>
                    731: <p>This document is divided into three parts. The first,
1.110     hubertf   732:        <a class="link" href="#users-guide" title="Part I. The pkgsrc user's guide">The pkgsrc user's guide</a>,
1.75      rillig    733:        describes how one can use one of the packages in the Package
                    734:        Collection, either by installing a precompiled binary package,
1.93      rillig    735:        or by building one's own copy using the NetBSD package system.
1.110     hubertf   736:        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.75      rillig    737:        package so it can be easily built by other NetBSD users without
                    738:        knowing about the package's building details. The third part,
1.110     hubertf   739:        <a class="link" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">The pkgsrc infrastructure internals</a>
1.75      rillig    740:        is intended for those who want to understand how pkgsrc is
                    741:        implemented.</p>
                    742: <p>This document is available in various formats:
1.110     hubertf   743:        <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.75      rillig    744: </div>
1.148     asau      745: <div class="sect1">
1.75      rillig    746: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    747: <a name="terminology"></a>1.3. Terminology</h2></div></div></div>
1.128     wiz       748: <p>There has been a lot of talk about <span class="quote">&#8220;<span class="quote">ports</span>&#8221;</span>,
                    749:       <span class="quote">&#8220;<span class="quote">packages</span>&#8221;</span>, etc. so far. Here is a description of all the
1.75      rillig    750:       terminology used within this document.</p>
1.148     asau      751: <div class="variablelist"><dl class="variablelist">
1.75      rillig    752: <dt><span class="term">Package</span></dt>
                    753: <dd><p>A set of files and building instructions
                    754:            that describe what's necessary
                    755:            to build a certain piece of software using
                    756:             pkgsrc. Packages are traditionally stored under
1.236     wiz       757:            <code class="filename">/usr/pkgsrc</code>,
                    758:            but may be stored in any location,
                    759:            referred to as <code class="varname">PKGSRCDIR</code>.</p></dd>
1.75      rillig    760: <dt><span class="term">The NetBSD package system</span></dt>
1.128     wiz       761: <dd><p>This is the former name of <span class="quote">&#8220;<span class="quote">pkgsrc</span>&#8221;</span>.  It
1.87      wiz       762:          is part of the NetBSD operating system and can be bootstrapped
                    763:          to run on non-NetBSD operating systems as well.  It handles
                    764:          building (compiling), installing, and removing of
                    765:          packages.</p></dd>
1.75      rillig    766: <dt><span class="term">Distfile</span></dt>
                    767: <dd><p>This term describes the file or files that are
                    768:            provided by the author of the piece of software to
                    769:            distribute his work. All the changes necessary to build on
                    770:            NetBSD are reflected in the corresponding package. Usually
                    771:            the distfile is in the form of a compressed tar-archive,
                    772:            but other types are possible, too. Distfiles are usually
                    773:            stored below
1.76      rillig    774:            <code class="filename">/usr/pkgsrc/distfiles</code>.</p></dd>
1.75      rillig    775: <dt><span class="term">Port</span></dt>
                    776: <dd><p>This is the term used by FreeBSD and OpenBSD people
                    777:            for what we call a package.
1.128     wiz       778:            In NetBSD terminology, <span class="quote">&#8220;<span class="quote">port</span>&#8221;</span> refers to a different
1.75      rillig    779:            architecture.</p></dd>
                    780: <dt><span class="term">Precompiled/binary package</span></dt>
                    781: <dd>
                    782: <p>A set of binaries built with pkgsrc from a distfile
1.76      rillig    783:            and stuffed together in a single <code class="filename">.tgz</code>
1.75      rillig    784:            file so it can be installed on machines of the same
                    785:            machine architecture without the need to
                    786:            recompile. Packages are usually generated in
1.76      rillig    787:            <code class="filename">/usr/pkgsrc/packages</code>; there is also
1.132     spz       788:            an archive on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/" target="_top">ftp.NetBSD.org</a>.</p>
1.128     wiz       789: <p>Sometimes, this is referred to by the term <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> too,
1.75      rillig    790:            especially in the context of precompiled packages.</p>
                    791: </dd>
                    792: <dt><span class="term">Program</span></dt>
1.88      wiz       793: <dd><p>The piece of software to be installed which will be
                    794:          constructed from all the files in the distfile by the
                    795:          actions defined in the corresponding package.</p></dd>
1.75      rillig    796: </dl></div>
1.148     asau      797: <div class="sect2">
1.75      rillig    798: <div class="titlepage"><div><div><h3 class="title">
1.88      wiz       799: <a name="term.roles"></a>1.3.1. Roles involved in pkgsrc</h3></div></div></div>
1.148     asau      800: <div class="variablelist"><dl class="variablelist">
1.75      rillig    801: <dt><span class="term">pkgsrc users</span></dt>
                    802: <dd>
                    803: <p>The
                    804:        pkgsrc users are people who use the packages provided by pkgsrc.
                    805:        Typically they are system administrators. The people using the
1.128     wiz       806:        software that is inside the packages (maybe called <span class="quote">&#8220;<span class="quote">end
                    807:        users</span>&#8221;</span>) are not covered by the pkgsrc guide.</p>
1.75      rillig    808: <p>There are two kinds of pkgsrc users: Some only want to
                    809:        install pre-built binary packages. Others build the pkgsrc
                    810:        packages from source, either for installing them directly or for
1.110     hubertf   811:        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.75      rillig    812:        documentation.</p>
                    813: </dd>
                    814: <dt><span class="term">package maintainers</span></dt>
                    815: <dd><p>A
1.110     hubertf   816:        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.75      rillig    817: <dt><span class="term">infrastructure developers</span></dt>
                    818: <dd><p>These people are involved in all those files
1.76      rillig    819:        that live in the <code class="filename">mk/</code> directory and below.
1.110     hubertf   820:        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.75      rillig    821:        too.</p></dd>
                    822: </dl></div>
                    823: </div>
                    824: </div>
1.148     asau      825: <div class="sect1">
1.75      rillig    826: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                    827: <a name="typography"></a>1.4. Typography</h2></div></div></div>
                    828: <p>When giving examples for commands, shell prompts are used to
                    829:       show if the command should/can be issued as root, or if
1.128     wiz       830:       <span class="quote">&#8220;<span class="quote">normal</span>&#8221;</span> user privileges are sufficient. We use a
1.226     sevan     831:       <code class="prompt">#</code> for root's shell prompt, a <code class="prompt">%</code> for users'
                    832:       shell prompt, assuming they use the C-shell or tcsh and a <code class="prompt">$</code> for
1.344     gutterid  833:       Bourne shell and derivatives.</p>
1.75      rillig    834: </div>
                    835: </div>
1.148     asau      836: <div class="part">
1.75      rillig    837: <div class="titlepage"><div><div><h1 class="title">
                    838: <a name="users-guide"></a>Part I. The pkgsrc user's guide</h1></div></div></div>
                    839: <div class="toc">
                    840: <p><b>Table of Contents</b></p>
1.210     leot      841: <dl class="toc">
1.267     rillig    842: <dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt>
                    843: <dt><span class="chapter"><a href="#getting">3. Where to get pkgsrc and how to keep it up-to-date</a></span></dt>
1.75      rillig    844: <dd><dl>
1.267     rillig    845: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.75      rillig    846: <dd><dl>
1.267     rillig    847: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
                    848: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.75      rillig    849: </dl></dd>
1.267     rillig    850: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.75      rillig    851: <dd><dl>
1.267     rillig    852: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
                    853: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.75      rillig    854: </dl></dd>
                    855: </dl></dd>
1.267     rillig    856: <dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
1.75      rillig    857: <dd><dl>
1.267     rillig    858: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
                    859: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.75      rillig    860: </dl></dd>
1.267     rillig    861: <dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
1.75      rillig    862: <dd><dl>
1.267     rillig    863: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.75      rillig    864: <dd><dl>
1.267     rillig    865: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
                    866: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
1.317     nia       867: <dt><span class="sect2"><a href="#using.pkgin_update">5.1.3. Updating packages</a></span></dt>
                    868: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.4. Deinstalling packages</a></span></dt>
                    869: <dt><span class="sect2"><a href="#using.pkg_info">5.1.5. Getting information about installed packages</a></span></dt>
                    870: <dt><span class="sect2"><a href="#vulnerabilities">5.1.6. Checking for security vulnerabilities in installed packages</a></span></dt>
                    871: <dt><span class="sect2"><a href="#pkg_versions">5.1.7. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
                    872: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.8. Other administrative functions</a></span></dt>
1.75      rillig    873: </dl></dd>
1.267     rillig    874: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.75      rillig    875: <dd><dl>
1.267     rillig    876: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
                    877: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
                    878: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.75      rillig    879: </dl></dd>
                    880: </dl></dd>
1.267     rillig    881: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.75      rillig    882: <dd><dl>
1.267     rillig    883: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
                    884: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
                    885: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
                    886: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
1.88      wiz       887: <dd><dl>
1.267     rillig    888: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
                    889: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
                    890: <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.88      wiz       891: </dl></dd>
1.267     rillig    892: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
                    893: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.75      rillig    894: </dl></dd>
1.267     rillig    895: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.75      rillig    896: <dd><dl>
1.267     rillig    897: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
                    898: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.106     rillig    899: </dl></dd>
1.267     rillig    900: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.106     rillig    901: builds)</a></span></dt>
1.75      rillig    902: <dd><dl>
1.267     rillig    903: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.295     rillig    904: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.267     rillig    905: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
                    906: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.293     rillig    907: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
                    908: <dd><dl>
1.294     rillig    909: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
                    910: <dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
1.296     rillig    911: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
                    912: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
                    913: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
                    914: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
                    915: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
                    916: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
                    917: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
                    918: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.293     rillig    919: </dl></dd>
                    920: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
                    921: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.267     rillig    922: </dl></dd>
                    923: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
                    924: <dd><dl>
                    925: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
                    926: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
                    927: </dl></dd>
                    928: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
                    929: <dd><dl>
                    930: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
                    931: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
                    932: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
                    933: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
                    934: <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>
                    935: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
                    936: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
                    937: <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>
                    938: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
                    939: <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.128     wiz       940: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
1.267     rillig    941: <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>
1.336     nia       942: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' or `priv` with pkgsrc</a></span></dt>
1.267     rillig    943: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
                    944: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
                    945: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
                    946: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build.  What shall I do?</a></span></dt>
                    947: <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.75      rillig    948: </dl></dd>
                    949: </dl>
                    950: </div>
1.148     asau      951: <div class="chapter">
1.75      rillig    952: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig    953: <a name="help-user"></a>Chapter 2. Getting help</h2></div></div></div>
                    954: <p>
                    955:        To get help when using pkgsrc, the definitive source is this
                    956:        document, the pkgsrc guide. If you don't find anything here,
                    957:        there are alternatives:
                    958: </p>
                    959: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                    960: <li class="listitem">
                    961: <p>
                    962:        The built-in pkgsrc help, which is available after bootstrapping
                    963:        pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get
                    964:        help for any topic, such as a variable name like
                    965:        <code class="varname">BUILD_DEFS</code>, a make target like
                    966:        <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
                    967:        <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
1.322     leot      968: <p>The available help topics are listed in <a class="xref" href="#help-topics" title="Appendix E. Help topics">Appendix E, <i>Help topics</i></a>.</p>
1.267     rillig    969: </li>
                    970: <li class="listitem"><p>
1.278     rillig    971:        To see the value of a single variable, run <span class="command"><strong>bmake
                    972:        show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
                    973: </p></li>
                    974: <li class="listitem"><p>
                    975:        To see the values of the most common variables, run
                    976:        <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
                    977:        topic. To see the variables for a single topic, run
                    978:        <span class="command"><strong>bmake
                    979:        show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
                    980:        <span class="command"><strong>bmake show-all-fetch</strong></span>.
                    981: </p></li>
                    982: <li class="listitem"><p>
1.267     rillig    983:        The pkgsrc-users mailing list, to which
                    984:        <a class="ulink" href="https://www.NetBSD.org/mailinglists/#pkgsrc-users" target="_top">you
                    985:        can subscribe</a> and then <a class="ulink" href="mailto:pkgsrc-users@NetBSD.org" target="_top">ask your
                    986:        questions</a>.</p></li>
                    987: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
                    988:        <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
                    989:        or by using a specialized chat program such as
                    990:        <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
                    991:        Pick any user name and join the channel #pkgsrc.</p></li>
                    992: </ul></div>
                    993: </div>
                    994: <div class="chapter">
                    995: <div class="titlepage"><div><div><h2 class="title">
                    996: <a name="getting"></a>Chapter 3. Where to get pkgsrc and how to keep it up-to-date</h2></div></div></div>
1.75      rillig    997: <div class="toc">
                    998: <p><b>Table of Contents</b></p>
1.210     leot      999: <dl class="toc">
1.267     rillig   1000: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.75      rillig   1001: <dd><dl>
1.267     rillig   1002: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
                   1003: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.75      rillig   1004: </dl></dd>
1.267     rillig   1005: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.75      rillig   1006: <dd><dl>
1.267     rillig   1007: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
                   1008: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.75      rillig   1009: </dl></dd>
                   1010: </dl>
                   1011: </div>
1.91      rillig   1012: <p>Before you download and extract the files, you need to decide
                   1013: where you want to extract them. When using pkgsrc as root user, pkgsrc
                   1014: is usually installed in <code class="filename">/usr/pkgsrc</code>. You are though
                   1015: free to install the sources and binary packages wherever you want in
                   1016: your filesystem, provided that the pathname does not contain white-space
                   1017: or other characters that are interpreted specially by the shell and some
                   1018: other programs. A safe bet is to use only letters, digits, underscores
                   1019: and dashes.</p>
1.148     asau     1020: <div class="sect1">
1.75      rillig   1021: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1022: <a name="getting-first"></a>3.1. Getting pkgsrc for the first time</h2></div></div></div>
1.75      rillig   1023: <p>Before you download any pkgsrc files, you should decide
                   1024:        whether you want the <span class="emphasis"><em>current</em></span> branch or the
                   1025:        <span class="emphasis"><em>stable</em></span> branch. The latter is forked on a
                   1026:        quarterly basis from the current branch and only gets modified
                   1027:        for security updates. The names of the stable branches are built
                   1028:        from the year and the quarter, for example
1.329     leot     1029:        <code class="literal">2021Q4</code>.</p>
1.75      rillig   1030: <p>The second step is to decide <span class="emphasis"><em>how</em></span> you
1.128     wiz      1031:        want to download pkgsrc. You can get it as a tar file or via CVS.
                   1032:        Both ways are described here.</p>
1.157     asau     1033: <p>Note that tar archive contains CVS working copy.
                   1034:        Thus you can switch to using CVS at any later time.</p>
1.148     asau     1035: <div class="sect2">
1.75      rillig   1036: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1037: <a name="getting-via-tar"></a>3.1.1. As tar archive</h3></div></div></div>
1.75      rillig   1038: <p>The primary download location for all pkgsrc files is
1.264     sevan    1039:        <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/" target="_top">https://cdn.NetBSD.org/pub/pkgsrc/</a> or
1.157     asau     1040:        <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/" target="_top">ftp://ftp.NetBSD.org/pub/pkgsrc/</a>
                   1041:        (it points to the same location).
                   1042:        There are a number of subdirectories for different purposes,
1.322     leot     1043:        which are described in detail in <a class="xref" href="#ftp-layout" title="Appendix D. Directory layout of the pkgsrc FTP server">Appendix D, <i>Directory layout of the pkgsrc FTP server</i></a>.</p>
1.157     asau     1044: <p>The tar archive for the current branch is in the directory
1.264     sevan    1045:        <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.230     sevan    1046:        It is autogenerated weekly.</p>
1.157     asau     1047: <p>To save download time we provide bzip2- and
                   1048:        xz-compressed archives which are published at
1.264     sevan    1049:        <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.157     asau     1050:        and
1.264     sevan    1051:        <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.157     asau     1052:        respectively.
                   1053:        </p>
                   1054: <p>You can fetch the same files using FTP.</p>
1.329     leot     1055: <p>The tar file for the stable branch 2021Q4 is in the
                   1056:        directory <code class="filename">pkgsrc-2021Q4</code> and is also called <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q4/pkgsrc.tar.gz" target="_top"><code class="filename">pkgsrc.tar.gz</code></a>.</p>
1.249     leot     1057: <p>To download the latest pkgsrc stable tarball, run:</p>
1.112     weinem   1058: <pre class="screen">
1.329     leot     1059: <code class="prompt">$</code> <strong class="userinput"><code>ftp ftp://ftp.NetBSD.org/pub/pkgsrc/pkgsrc-2021Q4/pkgsrc.tar.gz</code></strong></pre>
1.188     snj      1060: <p>If you prefer, you can also fetch it using "wget", "curl",
1.157     asau     1061:        or your web browser.</p>
1.112     weinem   1062: <p>Then, extract it with:</p>
1.188     snj      1063: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>tar -xzf pkgsrc.tar.gz -C /usr</code></strong></pre>
1.112     weinem   1064: <p>This will create the directory <code class="filename">pkgsrc/</code>
                   1065:        in <code class="filename">/usr/</code> and all the package source will be 
                   1066:        stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                   1067: <p>To download pkgsrc-current, run:</p>
                   1068: <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.75      rillig   1069: </div>
1.148     asau     1070: <div class="sect2">
1.75      rillig   1071: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1072: <a name="getting-via-cvs"></a>3.1.2. Via anonymous CVS</h3></div></div></div>
1.128     wiz      1073: <p>To fetch a specific pkgsrc stable branch, run:</p>
1.329     leot     1074: <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-2021Q4 -P pkgsrc</code></strong>
1.128     wiz      1075: </pre>
                   1076: <p>This will create the directory <code class="filename">pkgsrc/</code> 
                   1077:        in your <code class="filename">/usr/</code> directory and all the package source 
                   1078:        will be stored under <code class="filename">/usr/pkgsrc/</code>.</p>
                   1079: <p>To fetch the pkgsrc current branch, run:</p>
1.146     wiz      1080: <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       grant    1081: </pre>
1.289     leot     1082: <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.128     wiz      1083: <p>If you get error messages from <code class="literal">rsh</code>, you need to set CVS_RSH variable. E.g.:</p>
1.146     wiz      1084: <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.128     wiz      1085: </pre>
                   1086: <p>Refer to documentation on your command shell how to set CVS_RSH=ssh permanently.
                   1087:        For Bourne shells, you can set it in your <code class="filename">.profile</code>
                   1088:        or better globally in <code class="filename">/etc/profile</code>:</p>
                   1089: <pre class="programlisting">
                   1090: # set CVS remote shell command
                   1091: CVS_RSH=ssh
                   1092: export CVS_RSH
                   1093: </pre>
                   1094: <p>By default, CVS doesn't do things like most people would expect it to do.
                   1095:        But there is a way to convince CVS, by creating a file called <code class="filename">.cvsrc</code>
                   1096:        in your home directory and saving the following lines to it.
                   1097:        This file will save you lots of headache and some bug reports, so we strongly recommend it.
                   1098:        You can find an explanation of this file in the CVS documentation.</p>
1.101     rillig   1099: <pre class="programlisting">
                   1100: # recommended CVS configuration file from the pkgsrc guide
1.268     sevan    1101: cvs -q
1.101     rillig   1102: checkout -P
1.103     wiz      1103: update -dP
                   1104: diff -upN
1.101     rillig   1105: rdiff -u
1.128     wiz      1106: release -d
1.101     rillig   1107: </pre>
1.75      rillig   1108: </div>
                   1109: </div>
1.148     asau     1110: <div class="sect1">
1.75      rillig   1111: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1112: <a name="uptodate"></a>3.2. Keeping pkgsrc up-to-date</h2></div></div></div>
1.75      rillig   1113: <p>The preferred way to keep pkgsrc up-to-date is via CVS
                   1114:        (which also works if you have first installed it via a tar
                   1115:        file). It saves bandwidth and hard disk activity, compared to
                   1116:        downloading the tar file again.</p>
1.148     asau     1117: <div class="sect2">
1.75      rillig   1118: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1119: <a name="uptodate-tar"></a>3.2.1. Via tar files</h3></div></div></div>
1.148     asau     1120: <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75      rillig   1121: <h3 class="title">Warning</h3>
1.77      rillig   1122: <p>When updating from a tar file, you first need to
                   1123:        completely remove the old pkgsrc directory. Otherwise those
                   1124:        files that have been removed from pkgsrc in the mean time will
                   1125:        not be removed on your local disk, resulting in inconsistencies.
                   1126:        When removing the old files, any changes that you have done to
                   1127:        the pkgsrc files will be lost after updating. Therefore updating
                   1128:        via CVS is strongly recommended.</p>
1.75      rillig   1129: </div>
1.82      rillig   1130: <p>Note that by default the distfiles and the binary packages
                   1131:        are saved in the pkgsrc tree, so don't forget to rescue them
1.188     snj      1132:        before updating. You can also configure pkgsrc to store distfiles
                   1133:         and packages in directories outside the pkgsrc tree by setting the
1.82      rillig   1134:        <code class="varname">DISTDIR</code> and <code class="varname">PACKAGES</code>
1.267     rillig   1135:        variables. See <a class="xref" href="#configuring" title="Chapter 6. Configuring pkgsrc">Chapter 6, <i>Configuring pkgsrc</i></a> for the details.</p>
1.75      rillig   1136: <p>To update pkgsrc from a tar file, download the tar file as
                   1137:        explained above. Then, make sure that you have not made any
                   1138:        changes to the files in the pkgsrc directory. Remove the pkgsrc
                   1139:        directory and extract the new tar file. Done.</p>
                   1140: </div>
1.148     asau     1141: <div class="sect2">
1.75      rillig   1142: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1143: <a name="uptodate-cvs"></a>3.2.2. Via CVS</h3></div></div></div>
1.132     spz      1144: <p>To update pkgsrc via CVS, change to the <code class="filename">pkgsrc</code> directory and run cvs:</p>
                   1145: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc &amp;&amp; cvs update -dP</code></strong>
                   1146: </pre>
                   1147: <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>
                   1148: <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>
                   1149: </pre>
1.148     asau     1150: <div class="sect3">
1.75      rillig   1151: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   1152: <a name="uptodate-cvs-switch"></a>3.2.2.1. Switching between different pkgsrc branches</h4></div></div></div>
1.75      rillig   1153: <p>When updating pkgsrc, the CVS program keeps track of the
                   1154:        branch you selected. But if you, for whatever reason, want to
                   1155:        switch from the stable branch to the current one, you can do it
1.128     wiz      1156:        by adding the option <span class="quote">&#8220;<span class="quote">-A</span>&#8221;</span> after the
                   1157:        <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> keyword. To switch from the current branch
1.75      rillig   1158:        back to the stable branch, add the
1.329     leot     1159:        <span class="quote">&#8220;<span class="quote">-rpkgsrc-2021Q4</span>&#8221;</span> option.</p>
1.75      rillig   1160: </div>
1.148     asau     1161: <div class="sect3">
1.75      rillig   1162: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   1163: <a name="uptodate-cvs-changes"></a>3.2.2.2. What happens to my changes when updating?</h4></div></div></div>
1.75      rillig   1164: <p>When you update pkgsrc, the CVS program will only touch
                   1165:        those files that are registered in the CVS repository. That
                   1166:        means that any packages that you created on your own will stay
                   1167:        unmodified. If you change files that are managed by CVS, later
                   1168:        updates will try to merge your changes with those that have been
                   1169:        done by others. See the CVS manual, chapter
1.128     wiz      1170:        <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for details.</p>
1.75      rillig   1171: </div>
                   1172: </div>
                   1173: </div>
                   1174: </div>
1.148     asau     1175: <div class="chapter">
1.75      rillig   1176: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   1177: <a name="platforms"></a>Chapter 4. Using pkgsrc on systems other than NetBSD</h2></div></div></div>
1.75      rillig   1178: <div class="toc">
                   1179: <p><b>Table of Contents</b></p>
1.210     leot     1180: <dl class="toc">
1.267     rillig   1181: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
                   1182: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.75      rillig   1183: </dl>
                   1184: </div>
1.148     asau     1185: <div class="sect1">
1.75      rillig   1186: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1187: <a name="binarydist"></a>4.1. Binary distribution</h2></div></div></div>
                   1188: <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.82      rillig   1189: </div>
1.148     asau     1190: <div class="sect1">
1.82      rillig   1191: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1192: <a name="bootstrapping-pkgsrc"></a>4.2. Bootstrapping pkgsrc</h2></div></div></div>
1.149     asau     1193: <p>pkgsrc can be bootstrapped for use in two different modes:
                   1194:     privileged and unprivileged one. In unprivileged mode in contrast
1.150     asau     1195:     to privileged one all programs are installed under one particular user
1.149     asau     1196:     and cannot utilise privileged operations (packages don't create
                   1197:     special users and all special file permissions like setuid are ignored).
                   1198:     </p>
1.82      rillig   1199: <p>Installing the bootstrap kit from source should be as simple as:</p>
1.75      rillig   1200: <pre class="screen">
1.167     asau     1201: <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.75      rillig   1202: <code class="prompt">#</code> <strong class="userinput"><code>cd pkgsrc/bootstrap</code></strong>
1.87      wiz      1203: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap</code></strong>
                   1204:     </pre>
1.149     asau     1205: <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>
                   1206: <p>By default, in privileged mode pkgsrc uses
                   1207:     <code class="filename">/usr/pkg</code> for <span class="emphasis"><em>prefix</em></span>
                   1208:     where programs will be installed in,
1.230     sevan    1209:     and <code class="filename">/usr/pkg/pkgdb</code> for the package database
1.149     asau     1210:     directory where pkgsrc will do its internal bookkeeping,
                   1211:     <code class="filename">/var</code> is used as <span class="emphasis"><em>varbase</em></span>,
                   1212:     where packages install their persistent data.
                   1213:     In unprivileged mode pkgsrc uses
                   1214:     <code class="filename">~/pkg</code> for <span class="emphasis"><em>prefix</em></span>,
1.230     sevan    1215:     <code class="filename">~/pkg/pkgdb</code> for the package database,
1.149     asau     1216:     and <code class="filename">~/pkg/var</code> for <span class="emphasis"><em>varbase</em></span>.
                   1217:     </p>
                   1218: <p>You can change default layout using command-line arguments.
                   1219:     Run <span class="quote">&#8220;<span class="quote">./bootstrap --help</span>&#8221;</span> to get details.
                   1220:     </p>
1.148     asau     1221: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75      rillig   1222: <h3 class="title">Note</h3>
1.110     hubertf  1223: <p>The bootstrap installs a <span class="command"><strong>bmake</strong></span> tool.
                   1224:       Use this <span class="command"><strong>bmake</strong></span> when building via pkgsrc.
                   1225:       For examples in this guide, use <span class="command"><strong>bmake</strong></span>
1.128     wiz      1226:       instead of <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span>.</p>
1.75      rillig   1227: </div>
1.149     asau     1228: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   1229: <h3 class="title">Note</h3>
                   1230: <p>It is possible to bootstrap multiple instances of pkgsrc
                   1231:       using non-intersecting directories. Use <span class="command"><strong>bmake</strong></span>
                   1232:       corresponding to the installation you're working with to build
                   1233:       and install packages.
                   1234:       </p>
                   1235: </div>
1.75      rillig   1236: </div>
                   1237: </div>
1.148     asau     1238: <div class="chapter">
1.75      rillig   1239: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   1240: <a name="using"></a>Chapter 5. Using pkgsrc</h2></div></div></div>
1.75      rillig   1241: <div class="toc">
                   1242: <p><b>Table of Contents</b></p>
1.210     leot     1243: <dl class="toc">
1.267     rillig   1244: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.75      rillig   1245: <dd><dl>
1.267     rillig   1246: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
                   1247: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
1.317     nia      1248: <dt><span class="sect2"><a href="#using.pkgin_update">5.1.3. Updating packages</a></span></dt>
                   1249: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.4. Deinstalling packages</a></span></dt>
                   1250: <dt><span class="sect2"><a href="#using.pkg_info">5.1.5. Getting information about installed packages</a></span></dt>
                   1251: <dt><span class="sect2"><a href="#vulnerabilities">5.1.6. Checking for security vulnerabilities in installed packages</a></span></dt>
                   1252: <dt><span class="sect2"><a href="#pkg_versions">5.1.7. Finding if newer versions of your installed packages are in pkgsrc</a></span></dt>
                   1253: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.8. Other administrative functions</a></span></dt>
1.267     rillig   1254: </dl></dd>
                   1255: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
                   1256: <dd><dl>
                   1257: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
                   1258: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
                   1259: <dt><span class="sect2"><a href="#how-to-build-and-install">5.2.3. How to build and install</a></span></dt>
1.75      rillig   1260: </dl></dd>
                   1261: </dl>
                   1262: </div>
                   1263: <p>Basically, there are two ways of using pkgsrc. The first
1.88      wiz      1264: is to only install the package tools and to use binary packages
1.128     wiz      1265: that someone else has prepared. This is the <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>
                   1266: in pkgsrc. The second way is to install the <span class="quote">&#8220;<span class="quote">src</span>&#8221;</span>
1.88      wiz      1267: of pkgsrc, too. Then you are able to build your own packages,
                   1268: and you can still use binary packages from someone else.</p>
1.148     asau     1269: <div class="sect1">
1.75      rillig   1270: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1271: <a name="using-pkg"></a>5.1. Using binary packages</h2></div></div></div>
1.317     nia      1272: <p>On the <a class="ulink" href="https://cdn.NetBSD.org/" target="_top">cdn.NetBSD.org</a>
1.264     sevan    1273:   site and mirrors, there are collections of binary packages,
1.109     rillig   1274:   ready to be installed. These binary packages have been built using the
                   1275:   default settings for the directories, that is:</p>
1.148     asau     1276: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      1277: <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>
                   1278: <li class="listitem"><p><code class="filename">/usr/pkg/etc</code> for configuration files,</p></li>
                   1279: <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.109     rillig   1280: </ul></div>
                   1281: <p>If you cannot use these directories for whatever reasons (maybe
                   1282:   because you're not root), you cannot use these binary packages, but
1.267     rillig   1283:   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.148     asau     1284: <div class="sect2">
1.75      rillig   1285: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1286: <a name="finding-binary-packages"></a>5.1.1. Finding binary packages</h3></div></div></div>
1.105     weinem   1287: <p>To install binary packages, you first need to know from where
                   1288:     to get them. The first place where you should look is on the main
1.317     nia      1289:     pkgsrc CDN in the directory <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/packages/" target="_top"><code class="filename">/pub/pkgsrc/packages</code></a>.</p>
1.105     weinem   1290: <p>This directory contains binary packages for multiple
1.341     gutterid 1291:     platforms. First, select your operating system. Then, select your
                   1292:     hardware architecture, and in the third step, the OS version and
                   1293:     the <span class="quote">&#8220;<span class="quote">version</span>&#8221;</span> of pkgsrc.</p>
                   1294: <p>In this directory, you may find a file called
1.109     rillig   1295:     <code class="filename">bootstrap.tar.gz</code> which contains the package
                   1296:     management tools. If the file is missing, it is likely that your
                   1297:     operating system already provides those tools. Download the file and
                   1298:     extract it in the <code class="filename">/</code> directory. It will create
                   1299:     the directories <code class="filename">/usr/pkg</code> (containing the tools
1.230     sevan    1300:     for managing binary packages and the database of installed packages).</p>
1.75      rillig   1301: </div>
1.148     asau     1302: <div class="sect2">
1.75      rillig   1303: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1304: <a name="installing-binary-packages"></a>5.1.2. Installing binary packages</h3></div></div></div>
1.109     rillig   1305: <p>In the directory from the last section, there is a
1.196     wiz      1306:     subdirectory called <code class="filename">All/</code>, which contains all the
1.109     rillig   1307:     binary packages that are available for the platform, excluding those
1.317     nia      1308:     that may not be distributed via HTTP or FTP.</p>
1.109     rillig   1309: <p>To install packages directly from an FTP or HTTP server, run
                   1310:     the following commands in a Bourne-compatible shell (be sure to
1.110     hubertf  1311:     <span class="command"><strong>su</strong></span> to root first):</p>
1.109     rillig   1312: <pre class="screen">
1.317     nia      1313: <code class="prompt">#</code> <strong class="userinput"><code>PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"</code></strong>
                   1314: <code class="prompt">#</code> <strong class="userinput"><code>PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"</code></strong>
1.284     rillig   1315: <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.109     rillig   1316: <code class="prompt">#</code> <strong class="userinput"><code>export PATH PKG_PATH</code></strong>
1.317     nia      1317: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add pkgin</code></strong>
1.109     rillig   1318: </pre>
                   1319: <p>Instead of URLs, you can also use local paths, for example if
                   1320:     you are installing from a set of CDROMs, DVDs or an NFS-mounted
                   1321:     repository. If you want to install packages from multiple sources,
                   1322:     you can separate them by a semicolon in
                   1323:     <code class="varname">PKG_PATH</code>.</p>
                   1324: <p>After these preparations, installing a package is very
                   1325:     easy:</p>
                   1326: <pre class="screen">
1.317     nia      1327: <code class="prompt">#</code> <strong class="userinput"><code>pkgin search nginx</code></strong>
                   1328: nginx-1.19.6         Lightweight HTTP server and mail proxy server
                   1329: nginx-1.18.0nb8      Lightweight HTTP server and mail proxy server
                   1330: <code class="prompt">#</code> <strong class="userinput"><code>pkgin install zsh nginx-1.19.6 vim</code></strong>
                   1331: </pre>
                   1332: <p>Note that <span class="command"><strong>pkgin</strong></span> is a user-friendly frontend
                   1333:     to the <span class="command"><strong>pkg_*</strong></span> tools.</p>
                   1334: <p>Any prerequisite packages needed to run the
1.88      wiz      1335:     package in question will be installed, too, assuming they are
1.317     nia      1336:     present in the repository.</p>
1.75      rillig   1337: <p>After you've installed packages, be sure to have
1.88      wiz      1338:     <code class="filename">/usr/pkg/bin</code> and <code class="filename">/usr/pkg/sbin</code> in your
                   1339:     <code class="varname">PATH</code> so you can actually start the just
                   1340:     installed program.</p>
1.75      rillig   1341: </div>
1.148     asau     1342: <div class="sect2">
1.75      rillig   1343: <div class="titlepage"><div><div><h3 class="title">
1.317     nia      1344: <a name="using.pkgin_update"></a>5.1.3. Updating packages</h3></div></div></div>
                   1345: <p>To update binary packages, it is recommended that you use
                   1346:     <span class="command"><strong>pkgin upgrade</strong></span>.  This will compare the remote
                   1347:     package repository to your locally installed packages and safely
                   1348:     replace any older packages.</p>
                   1349: <p>Note that pkgsrc is released as quarterly branches.
                   1350:     If you are updating to a newer quarterly branch of pkgsrc, you may
                   1351:     need to adjust the repository in
                   1352:     <code class="filename">/usr/pkg/etc/pkgin/repositories.conf</code>.</p>
                   1353: </div>
                   1354: <div class="sect2">
                   1355: <div class="titlepage"><div><div><h3 class="title">
                   1356: <a name="using.pkg_delete"></a>5.1.4. Deinstalling packages</h3></div></div></div>
1.82      rillig   1357: <p>To deinstall a package, it does not matter whether it was
1.317     nia      1358:     installed from source code or from a binary package. Neither the
                   1359:     <span class="command"><strong>pkgin</strong></span> or the <span class="command"><strong>pkg_delete</strong></span>
                   1360:     command need to know.</p>
                   1361: <p>To delete a package, you can just run <span class="command"><strong>pkgin remove
1.88      wiz      1362:     <em class="replaceable"><code>package-name</code></em></strong></span>. The package
1.317     nia      1363:     name can be given with or without version number.</p>
1.82      rillig   1364: </div>
1.148     asau     1365: <div class="sect2">
1.82      rillig   1366: <div class="titlepage"><div><div><h3 class="title">
1.317     nia      1367: <a name="using.pkg_info"></a>5.1.5. Getting information about installed packages</h3></div></div></div>
1.110     hubertf  1368: <p>The <span class="command"><strong>pkg_info</strong></span> shows information about
1.317     nia      1369:     installed packages or binary package files.
                   1370:     As with other management tools, it works with packages installed
                   1371:     from source or binaries.</p>
1.82      rillig   1372: </div>
1.148     asau     1373: <div class="sect2">
1.82      rillig   1374: <div class="titlepage"><div><div><h3 class="title">
1.317     nia      1375: <a name="vulnerabilities"></a>5.1.6. Checking for security vulnerabilities in installed packages</h3></div></div></div>
1.82      rillig   1376: <p>
1.279     leot     1377:       The pkgsrc Security Team and Packages Groups maintain a list of
1.317     nia      1378:       known vulnerabilities to packages which are (or have been)
1.88      wiz      1379:       included in pkgsrc.  The list is available from the NetBSD
1.317     nia      1380:       CDN at <a class="ulink" href="https://cdn.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities" target="_top">https://cdn.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities</a>.
                   1381:     </p>
                   1382: <p>
                   1383:       Please note that not every "vulnerability" with a CVE assignment is
                   1384:       exploitable in every configuration.
                   1385:       Some bugs are marked as active simply because an fix was not
                   1386:       marked as such.
                   1387:       Operating system specific hardening and mitigation features may also
                   1388:       reduce the impact of bugs.
1.88      wiz      1389:     </p>
1.82      rillig   1390: <p>
1.125     wiz      1391:       Through <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
1.88      wiz      1392:       this list can be downloaded
                   1393:       automatically, and a security audit of all packages installed on a system
                   1394:       can take place.
                   1395:     </p>
1.82      rillig   1396: <p>
1.125     wiz      1397:       There are two components to auditing.  The first
                   1398:       step, <span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>,
                   1399:       is for downloading
1.88      wiz      1400:       the list of vulnerabilities from the NetBSD FTP site.  The second
1.125     wiz      1401:       step, <span class="command"><strong>pkg_admin audit</strong></span>, checks to see if any of your
1.88      wiz      1402:       installed packages are vulnerable.  If a package is vulnerable, you
                   1403:       will see output similar to the following:
                   1404:     </p>
1.82      rillig   1405: <pre class="screen">Package samba-2.0.9 has a local-root-shell vulnerability, see
1.289     leot     1406:     https://www.samba.org/samba/whatsnew/macroexploit.html</pre>
1.82      rillig   1407: <p>
1.125     wiz      1408:       You may wish to have the
1.317     nia      1409:       <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/distfiles/vulnerabilities" target="_top">vulnerabilities</a>
1.125     wiz      1410:       file downloaded daily so that
                   1411:       it remains current.  This may be done by adding an appropriate entry
1.322     leot     1412:       to the root users <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/crontab.5"><span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span></a> entry.  For example the entry
1.125     wiz      1413:       </p>
                   1414: <pre class="screen">
1.233     sevan    1415: # Download vulnerabilities file
1.230     sevan    1416: 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities &gt;/dev/null 2&gt;&amp;1
1.233     sevan    1417: # Audit the installed packages and email results to root
                   1418: 9 3 * * * /usr/pkg/sbin/pkg_admin audit |mail -s "Installed package audit result" \
                   1419:            root &gt;/dev/null 2&gt;&amp;1
1.125     wiz      1420:       </pre>
                   1421: <p>
1.230     sevan    1422:       will update the vulnerability list every day at 3AM, followed by an audit
                   1423:       at 3:09AM. The result of the audit are then emailed to root.
1.125     wiz      1424: 
1.230     sevan    1425:       On NetBSD this may be accomplished instead by adding the following
                   1426:       line to <code class="filename">/etc/daily.conf</code>:
                   1427:       </p>
                   1428: <pre class="screen">
                   1429: fetch_pkg_vulnerabilities=YES
                   1430:       </pre>
                   1431: <p>
                   1432:       to fetch the vulnerability list from the daily security script. The system
                   1433:       is set to audit the packages by default but can be set explicitly, if
1.235     yyamano  1434:       desired (not required), by adding the following line to
1.230     sevan    1435: <code class="filename">/etc/security.conf</code>:
1.125     wiz      1436:       </p>
                   1437: <pre class="screen">
1.230     sevan    1438: check_pkg_vulnerabilities=YES
1.125     wiz      1439:       </pre>
                   1440: <p>
1.322     leot     1441:       see <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/daily.conf.5"><span class="citerefentry"><span class="refentrytitle">daily.conf</span>(5)</span></a> and <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/security.conf.5"><span class="citerefentry"><span class="refentrytitle">security.conf</span>(5)</span></a> for more details.
1.88      wiz      1442:     </p>
1.82      rillig   1443: </div>
1.148     asau     1444: <div class="sect2">
1.82      rillig   1445: <div class="titlepage"><div><div><h3 class="title">
1.317     nia      1446: <a name="pkg_versions"></a>5.1.7. Finding if newer versions of your installed packages are in pkgsrc</h3></div></div></div>
1.82      rillig   1447: <p>
1.322     leot     1448:       Install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/index.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a> and run
1.128     wiz      1449:       <span class="command"><strong>lintpkgsrc</strong></span> with the <span class="quote">&#8220;<span class="quote">-i</span>&#8221;</span>
1.317     nia      1450:       argument to check if any packages are stale, e.g.
1.88      wiz      1451:     </p>
                   1452: <pre class="screen">
                   1453: <code class="prompt">%</code> <strong class="userinput"><code>lintpkgsrc -i</code></strong>
1.82      rillig   1454: ...
1.88      wiz      1455: Version mismatch: 'tcsh' 6.09.00 vs 6.10.00
                   1456:     </pre>
1.82      rillig   1457: </div>
1.148     asau     1458: <div class="sect2">
1.82      rillig   1459: <div class="titlepage"><div><div><h3 class="title">
1.317     nia      1460: <a name="using.pkg_admin"></a>5.1.8. Other administrative functions</h3></div></div></div>
1.110     hubertf  1461: <p>The <span class="command"><strong>pkg_admin</strong></span> executes various
1.88      wiz      1462:     administrative functions on the package system.</p>
1.82      rillig   1463: </div>
1.75      rillig   1464: </div>
1.148     asau     1465: <div class="sect1">
1.75      rillig   1466: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1467: <a name="building-packages-from-source"></a>5.2. Building packages from source</h2></div></div></div>
1.88      wiz      1468: <p>After obtaining pkgsrc, the <code class="filename">pkgsrc</code>
                   1469:   directory now contains a set of packages, organized into
                   1470:   categories. You can browse the online index of packages, or run
1.110     hubertf  1471:   <span class="command"><strong>make readme</strong></span> from the <code class="filename">pkgsrc</code>
1.88      wiz      1472:   directory to build local <code class="filename">README.html</code> files for
1.322     leot     1473:   all packages, viewable with any web browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/lynx/index.html" target="_top"><code class="filename">www/lynx</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/index.html" target="_top"><code class="filename">www/firefox</code></a>.</p>
1.88      wiz      1474: <p>The default <span class="emphasis"><em>prefix</em></span> for installed packages
                   1475:   is <code class="filename">/usr/pkg</code>. If you wish to change this, you
                   1476:   should do so by setting <code class="varname">LOCALBASE</code> in
1.110     hubertf  1477:   <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. You should not try to use multiple
1.88      wiz      1478:   different <code class="varname">LOCALBASE</code> definitions on the same
                   1479:   system (inside a chroot is an exception). </p>
                   1480: <p>The rest of this chapter assumes that the package is already
1.110     hubertf  1481:   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.88      wiz      1482:   instructions how to create your own packages.</p>
1.148     asau     1483: <div class="sect2">
1.75      rillig   1484: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1485: <a name="requirements"></a>5.2.1. Requirements</h3></div></div></div>
1.82      rillig   1486: <p>To build packages from source, you need a working C
1.88      wiz      1487:     compiler. On NetBSD, you need to install the
1.128     wiz      1488:     <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.88      wiz      1489:     sets. If you want to build X11-related packages, the
1.128     wiz      1490:     <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.88      wiz      1491:     sets are required, too.</p>
1.75      rillig   1492: </div>
1.148     asau     1493: <div class="sect2">
1.75      rillig   1494: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1495: <a name="fetching-distfiles"></a>5.2.2. Fetching distfiles</h3></div></div></div>
1.75      rillig   1496: <p>The first step for building a package is downloading the
1.88      wiz      1497:     distfiles (i.e. the unmodified source). If they have not yet been
                   1498:     downloaded, pkgsrc will fetch them automatically.</p>
                   1499: <p>If you have all files that you need in the
                   1500:     <code class="filename">distfiles</code> directory,
                   1501:     you don't need to connect. If the distfiles are on CD-ROM, you can
                   1502:     mount the CD-ROM on <code class="filename">/cdrom</code> and add:
                   1503:     </p>
1.82      rillig   1504: <pre class="screen">DISTDIR=/cdrom/pkgsrc/distfiles</pre>
                   1505: <p>
1.110     hubertf  1506:     to your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.91      rillig   1507: <p>By default a list of distribution sites will be randomly
                   1508:     intermixed to prevent huge load on servers which holding popular
                   1509:     packages (for example, SourceForge.net mirrors). Thus, every
                   1510:     time when you need to fetch yet another distfile all the mirrors
                   1511:     will be tried in new (random) order. You can turn this feature
                   1512:     off by setting <code class="varname">MASTER_SORT_RANDOM=NO</code> (for
                   1513:     <code class="varname">PKG_DEVELOPER</code>s it's already disabled).</p>
1.88      wiz      1514: <p>You can overwrite some of the major distribution sites to
                   1515:     fit to sites that are close to your own.  By setting one or two
                   1516:     variables you can modify the order in which the master sites are
                   1517:     accessed.  <code class="varname">MASTER_SORT</code> contains a whitespace
                   1518:     delimited list of domain suffixes.
                   1519:     <code class="varname">MASTER_SORT_REGEX</code> is even more flexible, it
                   1520:     contains a whitespace delimited list of regular expressions.  It
                   1521:     has higher priority than <code class="varname">MASTER_SORT</code>.  Have a
                   1522:     look at <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   1523:     some examples.  This may save some of your bandwidth and
                   1524:     time.</p>
1.75      rillig   1525: <p>You can change these settings either in your shell's environment, or,
1.88      wiz      1526:     if you want to keep the settings, by editing the
1.110     hubertf  1527:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file,
1.88      wiz      1528:     and adding the definitions there.</p>
1.82      rillig   1529: <p>
1.88      wiz      1530:       If a package depends on many other packages (such as
1.322     leot     1531:       <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/kde4/index.html" target="_top"><code class="filename">meta-pkgs/kde4</code></a>), the build process may
1.88      wiz      1532:       alternate between periods of
                   1533:       downloading source, and compiling. To ensure you have all the source
                   1534:       downloaded initially you can run the command:
                   1535:       </p>
1.82      rillig   1536: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch-list | sh</code></strong></pre>
                   1537: <p>
1.88      wiz      1538:       which will output and run a set of shell commands to fetch the
                   1539:       necessary files into the <code class="filename">distfiles</code> directory.  You can
                   1540:       also choose to download the files manually.
                   1541:     </p>
1.75      rillig   1542: </div>
1.148     asau     1543: <div class="sect2">
1.75      rillig   1544: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1545: <a name="how-to-build-and-install"></a>5.2.3. How to build and install</h3></div></div></div>
1.82      rillig   1546: <p>
1.88      wiz      1547:       Once the software has downloaded, any patches will be applied, then it
                   1548:       will be compiled for you. This may take some time depending on your
                   1549:       computer, and how many other packages the software depends on and their
                   1550:       compile time.
                   1551:     </p>
1.148     asau     1552: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75      rillig   1553: <h3 class="title">Note</h3>
                   1554: <p>If using bootstrap or pkgsrc on a non-NetBSD system,
1.110     hubertf  1555:     use the pkgsrc <span class="command"><strong>bmake</strong></span> command instead of
1.128     wiz      1556:     <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> in the examples in this guide.</p>
1.75      rillig   1557: </div>
1.87      wiz      1558: <p>For example, type</p>
1.88      wiz      1559: <pre class="screen">
                   1560: <code class="prompt">%</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
                   1561: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
                   1562:     </pre>
1.75      rillig   1563: <p>at the shell prompt to build the various components of the
1.88      wiz      1564:     package.</p>
1.82      rillig   1565: <p>The next stage is to actually install the newly compiled
1.88      wiz      1566:     program onto your system. Do this by entering:
1.82      rillig   1567: 
1.88      wiz      1568:     </p>
1.82      rillig   1569: <pre class="screen">
1.88      wiz      1570: <code class="prompt">%</code> <strong class="userinput"><code>make install</code></strong>
                   1571:     </pre>
1.82      rillig   1572: <p>
                   1573: 
1.88      wiz      1574:     while you are still in the directory for whatever package you
                   1575:     are installing.</p>
1.82      rillig   1576: <p>Installing the package on your system may require you to
1.88      wiz      1577:     be root.  However, pkgsrc has a
                   1578:     <span class="emphasis"><em>just-in-time-su</em></span> feature, which allows you
                   1579:     to only become root for the actual installation step.</p>
1.82      rillig   1580: <p>That's it, the software should now be installed and setup for use.
1.88      wiz      1581:     You can now enter:
1.82      rillig   1582: 
1.88      wiz      1583:     </p>
1.82      rillig   1584: <pre class="screen">
1.88      wiz      1585: <code class="prompt">%</code> <strong class="userinput"><code>make clean</code></strong>
                   1586:     </pre>
1.82      rillig   1587: <p>
                   1588: 
1.88      wiz      1589:     to remove the compiled files in the work directory, as you shouldn't need
                   1590:     them any more. If other packages were also added to your system
                   1591:     (dependencies) to allow your program to compile, you can tidy these up
                   1592:     also with the command:</p>
1.82      rillig   1593: <pre class="screen">
1.88      wiz      1594: <code class="prompt">%</code> <strong class="userinput"><code>make clean-depends</code></strong>
                   1595:     </pre>
1.75      rillig   1596: <p>Taking the figlet utility as an example, we can install it on our
1.322     leot     1597:     system by building as shown in <a class="xref" href="#logs" title="Appendix C. Build logs">Appendix C, <i>Build logs</i></a>.</p>
1.88      wiz      1598: <p>The program is installed under the default root of the
                   1599:     packages tree - <code class="filename">/usr/pkg</code>. Should this not
                   1600:     conform to your tastes, set the <code class="varname">LOCALBASE</code>
                   1601:     variable in your environment, and it will use that value as the
                   1602:     root of your packages tree. So, to use
                   1603:     <code class="filename">/usr/local</code>, set
                   1604:     <code class="varname">LOCALBASE=/usr/local</code> in your environment.
                   1605:     Please note that you should use a directory which is dedicated to
                   1606:     packages and not shared with other programs (i.e., do not try and
                   1607:     use <code class="varname">LOCALBASE=/usr</code>).  Also, you should not try
                   1608:     to add any of your own files or directories (such as
                   1609:     <code class="filename">src/</code>, <code class="filename">obj/</code>, or
                   1610:     <code class="filename">pkgsrc/</code>) below the
                   1611:     <code class="varname">LOCALBASE</code> tree.  This is to prevent possible
                   1612:     conflicts between programs and other files installed by the
                   1613:     package system and whatever else may have been installed
                   1614:     there.</p>
1.110     hubertf  1615: <p>Some packages look in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.88      wiz      1616:     alter some configuration options at build time.  Have a look at
                   1617:     <code class="filename">pkgsrc/mk/defaults/mk.conf</code> to get an overview
                   1618:     of what will be set there by default.  Environment variables such
                   1619:     as <code class="varname">LOCALBASE</code> can be set in
1.110     hubertf  1620:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to save having to remember to
1.88      wiz      1621:     set them each time you want to use pkgsrc.</p>
1.128     wiz      1622: <p>Occasionally, people want to <span class="quote">&#8220;<span class="quote">look under the
                   1623:     covers</span>&#8221;</span> to see what is going on when a package is building
1.88      wiz      1624:     or being installed. This may be for debugging purposes, or out of
                   1625:     simple curiosity. A number of utility values have been added to
                   1626:     help with this.</p>
1.128     wiz      1627: <div class="orderedlist"><ol class="orderedlist" type="1">
                   1628: <li class="listitem">
1.322     leot     1629: <p>If you invoke the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> command with
1.88      wiz      1630:        <code class="varname">PKG_DEBUG_LEVEL=2</code>, then a huge amount of
                   1631:        information will be displayed. For example,</p>
1.75      rillig   1632: <pre class="screen"><strong class="userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong></pre>
1.88      wiz      1633: <p>will show all the commands that are invoked, up to and
1.128     wiz      1634:        including the <span class="quote">&#8220;<span class="quote">patch</span>&#8221;</span> stage.</p>
1.75      rillig   1635: </li>
1.128     wiz      1636: <li class="listitem">
1.322     leot     1637: <p>If you want to know the value of a certain <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1.88      wiz      1638:        definition, then the <code class="varname">VARNAME</code> definition
                   1639:        should be used, in conjunction with the show-var
1.322     leot     1640:        target. e.g. to show the expansion of the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>
1.88      wiz      1641:        variable <code class="varname">LOCALBASE</code>:</p>
                   1642: <pre class="screen">
                   1643: <code class="prompt">%</code> <strong class="userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.75      rillig   1644: /usr/pkg
                   1645: <code class="prompt">%</code>
1.88      wiz      1646:        </pre>
1.75      rillig   1647: </li>
                   1648: </ol></div>
                   1649: <p>If you want to install a binary package that you've either
1.88      wiz      1650:     created yourself (see next section), that you put into
                   1651:     pkgsrc/packages manually or that is located on a remote FTP
                   1652:     server, you can use the "bin-install" target. This target will
1.322     leot     1653:     install a binary package - if available - via <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_add.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>,
1.110     hubertf  1654:     else do a <span class="command"><strong>make package</strong></span>.  The list of remote FTP
1.88      wiz      1655:     sites searched is kept in the variable
                   1656:     <code class="varname">BINPKG_SITES</code>, which defaults to
1.322     leot     1657:     ftp.NetBSD.org. Any flags that should be added to <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_add.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>
1.88      wiz      1658:     can be put into <code class="varname">BIN_INSTALL_FLAGS</code>.  See
                   1659:     <code class="filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   1660:     details.</p>
                   1661: <p>A final word of warning: If you set up a system that has a
                   1662:     non-standard setting for <code class="varname">LOCALBASE</code>, be sure to
                   1663:     set that before any packages are installed, as you cannot use
                   1664:     several directories for the same purpose. Doing so will result in
                   1665:     pkgsrc not being able to properly detect your installed packages,
                   1666:     and fail miserably. Note also that precompiled binary packages are
                   1667:     usually built with the default <code class="varname">LOCALBASE</code> of
                   1668:     <code class="filename">/usr/pkg</code>, and that you should
                   1669:     <span class="emphasis"><em>not</em></span> install any if you use a non-standard
                   1670:     <code class="varname">LOCALBASE</code>.</p>
1.75      rillig   1671: </div>
                   1672: </div>
                   1673: </div>
1.148     asau     1674: <div class="chapter">
1.75      rillig   1675: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   1676: <a name="configuring"></a>Chapter 6. Configuring pkgsrc</h2></div></div></div>
1.75      rillig   1677: <div class="toc">
                   1678: <p><b>Table of Contents</b></p>
1.210     leot     1679: <dl class="toc">
1.267     rillig   1680: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
                   1681: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
                   1682: <dt><span class="sect1"><a href="#variables-affecting-installation">6.3. Variables affecting the installation process</a></span></dt>
                   1683: <dt><span class="sect1"><a href="#conf.compiler">6.4. Selecting and configuring the compiler</a></span></dt>
                   1684: <dd><dl>
                   1685: <dt><span class="sect2"><a href="#selecting-the-compiler">6.4.1. Selecting the compiler</a></span></dt>
                   1686: <dt><span class="sect2"><a href="#conf.cflags">6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
                   1687: <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.88      wiz      1688: </dl></dd>
1.267     rillig   1689: <dt><span class="sect1"><a href="#developer-advanced-settings">6.5. Developer/advanced settings</a></span></dt>
                   1690: <dt><span class="sect1"><a href="#selecting-build-options">6.6. Selecting Build Options</a></span></dt>
1.75      rillig   1691: </dl>
                   1692: </div>
1.104     rillig   1693: <a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually
1.89      rillig   1694: called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for
                   1695: that file depends on the installation. On NetBSD, when you use
1.322     leot     1696: <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> from the base system, it is in the directory
1.89      rillig   1697: <code class="filename">/etc/</code>. In all other cases the default location is
                   1698: <code class="literal">${PREFIX}/etc/</code>, depending on where you told the
                   1699: bootstrap program to install the binary packages.</p>
                   1700: <p>The format of the configuration file is that of the usual
                   1701: BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration
                   1702: is done by setting variables in this file. Note that you can define all
                   1703: kinds of variables, and no special error checking (for example for
1.223     rillig   1704: spelling mistakes) takes place.</p>
1.148     asau     1705: <div class="sect1">
1.75      rillig   1706: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1707: <a name="general-configuration"></a>6.1. General configuration</h2></div></div></div>
1.223     rillig   1708: <p>The following variables apply to all
1.89      rillig   1709:     pkgsrc packages. A complete list of the variables that can be
                   1710:     configured by the user is available in
                   1711:     <code class="filename">mk/defaults/mk.conf</code>, together with some
                   1712:     comments that describe each variable's intent.</p>
1.148     asau     1713: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      1714: <li class="listitem"><p><code class="varname">LOCALBASE</code>: Where
1.75      rillig   1715:            packages will be installed. The default is
1.76      rillig   1716:            <code class="filename">/usr/pkg</code>. Do not mix binary packages
1.75      rillig   1717:            with different <code class="varname">LOCALBASE</code>s!</p></li>
1.128     wiz      1718: <li class="listitem"><p><code class="varname">CROSSBASE</code>: Where
                   1719:            <span class="quote">&#8220;<span class="quote">cross</span>&#8221;</span> category packages will be
1.75      rillig   1720:            installed. The default is
1.76      rillig   1721:            <code class="filename">${LOCALBASE}/cross</code>.</p></li>
1.128     wiz      1722: <li class="listitem"><p><code class="varname">X11BASE</code>: Where
1.75      rillig   1723:            X11 is installed on the system. The default is
1.194     bsiegert 1724:            <code class="filename">/usr/X11R7</code>.</p></li>
1.128     wiz      1725: <li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the
1.75      rillig   1726:            downloaded copies of the original source distributions used
                   1727:            for building pkgsrc packages. The default is
1.76      rillig   1728:            <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li>
1.128     wiz      1729: <li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the
1.97      rillig   1730:            database about installed packages is stored.  The default is
1.230     sevan    1731:            <code class="filename">/usr/pkg/pkgdb</code>.</p></li>
1.128     wiz      1732: <li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>:
1.75      rillig   1733:            If set, override the packages'
                   1734:            <code class="varname">MASTER_SITES</code> with this value.</p></li>
1.128     wiz      1735: <li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>:
1.75      rillig   1736:            Backup location(s) for distribution files and patch files
                   1737:            if not found locally or in
1.76      rillig   1738:            <code class="filename">${MASTER_SITES}</code> or
                   1739:            <code class="filename">${PATCH_SITES}</code> respectively.
1.230     sevan    1740:            The defaults is
                   1741:            <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li>
1.128     wiz      1742: <li class="listitem"><p><code class="varname">BINPKG_SITES</code>:
1.93      rillig   1743:            List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and
                   1744:            <em class="replaceable"><code>arch</code></em> are replaced with OS
1.128     wiz      1745:            release (<span class="quote">&#8220;<span class="quote">2.0</span>&#8221;</span>, etc.) and architecture
                   1746:            (<span class="quote">&#8220;<span class="quote">mipsel</span>&#8221;</span>, etc.).</p></li>
                   1747: <li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
1.125     wiz      1748:            List of acceptable licenses. License names are case-sensitive.
                   1749:            Whenever you try to build a package whose license is not in this
                   1750:            list, you will get an error message. If the license condition is
                   1751:            simple enough, the error message will include specific
                   1752:            instructions on how to change this variable.</p></li>
1.75      rillig   1753: </ul></div>
                   1754: </div>
1.148     asau     1755: <div class="sect1">
1.75      rillig   1756: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1757: <a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div>
1.219     rillig   1758: <p>
1.75      rillig   1759:       </p>
1.148     asau     1760: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      1761: <li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
1.75      rillig   1762:            directory for the binary packages. The default is
1.76      rillig   1763:            <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
1.128     wiz      1764: <li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
1.75      rillig   1765:            The top level directory where, if defined, the separate
                   1766:            working directories will get created, and symbolically
1.76      rillig   1767:            linked to from <code class="filename">${WRKDIR}</code> (see below).
1.75      rillig   1768:            This is useful for building packages on several
1.76      rillig   1769:            architectures, then <code class="filename">${PKGSRCDIR}</code>
                   1770:            can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
1.75      rillig   1771:            is local to every architecture. (It should be noted that
                   1772:            <code class="varname">PKGSRCDIR</code> should not be set by the user
1.126     jakllsch 1773:            &mdash; it is an internal definition which refers to the
1.75      rillig   1774:            root of the pkgsrc tree. It is possible to have many
                   1775:            pkgsrc tree instances.)</p></li>
1.128     wiz      1776: <li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
1.75      rillig   1777:            Directory for local patches that aren't part of pkgsrc.
1.299     rillig   1778:            See <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more
1.93      rillig   1779:            information.</p></li>
1.128     wiz      1780: <li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
1.110     hubertf  1781:            the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
1.75      rillig   1782:            BSD-style Makefile. If this is not set,
                   1783:            <code class="varname">MAKECONF</code> is set to
1.76      rillig   1784:            <code class="filename">/dev/null</code> to avoid picking up
                   1785:            settings used by builds in <code class="filename">/usr/src</code>.</p></li>
1.75      rillig   1786: </ul></div>
                   1787: </div>
1.148     asau     1788: <div class="sect1">
1.75      rillig   1789: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1790: <a name="variables-affecting-installation"></a>6.3. Variables affecting the installation process</h2></div></div></div>
1.312     gdt      1791: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="varname">PKGSRC_KEEP_BIN_PKGS</code>:
1.256     maya     1792:                 By default, binary packages of built packages are
1.263     leot     1793:                 preserved in <code class="filename">${PACKAGES}/All</code>. Setting
1.256     maya     1794:                this variable to "no" prevents this.</p></li></ul></div>
1.217     jnemeth  1795: <p>Packages have to support installation into a
1.103     wiz      1796:     subdirectory of <code class="varname">WRKDIR</code>. This allows a package
                   1797:     to be built, before the actual filesystem is touched. DESTDIR
                   1798:     support exists in two variations:</p>
1.148     asau     1799: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      1800: <li class="listitem"><p>Basic DESTDIR support means that the package
1.131     wiz      1801:       installation and packaging is still run as root.</p></li>
                   1802: <li class="listitem"><p>Full DESTDIR support can run the complete
                   1803:       build, installation and packaging as normal user. Root
                   1804:       privileges are only needed to add packages.</p></li>
                   1805: </ul></div>
1.103     wiz      1806: <p>With basic DESTDIR support, <strong class="userinput"><code>make
                   1807:     clean</code></strong> needs to be run as root.</p>
1.118     imil     1808: <p>Considering the <code class="filename">foo/bar</code> package,
                   1809:     DESTDIR full support can be tested using the following commands
                   1810: 
                   1811: </p>
                   1812: <pre class="programlisting">
                   1813: <code class="prompt">$</code> id
                   1814: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
                   1815: <code class="prompt">$</code> mkdir $HOME/packages
                   1816: <code class="prompt">$</code> cd $PKGSRCDIR/foo/bar
                   1817: </pre>
                   1818: <p>
                   1819: 
                   1820:     Verify <code class="varname">DESTDIR</code> full support, no root privileges
                   1821:     should be needed
                   1822: 
                   1823: </p>
                   1824: <pre class="programlisting">
1.174     asau     1825: <code class="prompt">$</code> make stage-install
1.118     imil     1826: </pre>
                   1827: <p>
                   1828: 
                   1829:     Create a package without root privileges
                   1830: 
                   1831: </p>
                   1832: <pre class="programlisting">
1.174     asau     1833: <code class="prompt">$</code> make PACKAGES=$HOME/packages package
1.118     imil     1834: </pre>
                   1835: <p>
                   1836: 
                   1837:     For the following command, you must be able to gain root
1.322     leot     1838:     privileges using <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/su.1"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a>
1.118     imil     1839: 
                   1840: </p>
                   1841: <pre class="programlisting">
1.174     asau     1842: <code class="prompt">$</code> make PACKAGES=$HOME/packages install
1.118     imil     1843: </pre>
                   1844: <p>
                   1845: 
                   1846:     Then, as a simple user
                   1847: 
                   1848: </p>
                   1849: <pre class="programlisting">
                   1850: <code class="prompt">$</code> make clean
                   1851: </pre>
                   1852: <p>
                   1853: 
                   1854:     </p>
1.103     wiz      1855: </div>
1.148     asau     1856: <div class="sect1">
1.103     wiz      1857: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1858: <a name="conf.compiler"></a>6.4. Selecting and configuring the compiler</h2></div></div></div>
1.148     asau     1859: <div class="sect2">
1.78      rillig   1860: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1861: <a name="selecting-the-compiler"></a>6.4.1. Selecting the compiler</h3></div></div></div>
1.89      rillig   1862: <p>By default, pkgsrc will use GCC to build packages.  This may be
                   1863:     overridden by setting the following variables in /etc/mk.conf:</p>
1.148     asau     1864: <div class="variablelist"><dl class="variablelist">
1.89      rillig   1865: <dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt>
                   1866: <dd>
                   1867: <p>This is a list of values specifying the chain of
                   1868:          compilers to invoke when building packages.  Valid values
                   1869:          are:</p>
1.148     asau     1870: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.174     asau     1871: <li class="listitem"><p><code class="varname">ccc</code>:
                   1872:            Compaq C Compilers (Tru64)</p></li>
                   1873: <li class="listitem"><p><code class="varname">ccache</code>:
                   1874:            compiler cache (chainable)</p></li>
                   1875: <li class="listitem"><p><code class="varname">clang</code>:
                   1876:            Clang C and Objective-C compiler</p></li>
1.128     wiz      1877: <li class="listitem"><p><code class="varname">distcc</code>:
1.89      rillig   1878:            distributed C/C++ (chainable)</p></li>
1.174     asau     1879: <li class="listitem"><p><code class="varname">f2c</code>:
                   1880:            Fortran 77 to C compiler (chainable)</p></li>
                   1881: <li class="listitem"><p><code class="varname">icc</code>:
                   1882:            Intel C++ Compiler (Linux)</p></li>
                   1883: <li class="listitem"><p><code class="varname">ido</code>:
                   1884:            SGI IRIS Development Option cc (IRIX 5)</p></li>
1.128     wiz      1885: <li class="listitem"><p><code class="varname">gcc</code>:
1.89      rillig   1886:            GNU C/C++ Compiler</p></li>
1.174     asau     1887: <li class="listitem"><p><code class="varname">hp</code>:
                   1888:            HP-UX C/aC++ compilers</p></li>
1.128     wiz      1889: <li class="listitem"><p><code class="varname">mipspro</code>:
1.89      rillig   1890:            Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li>
1.174     asau     1891: <li class="listitem"><p><code class="varname">mipspro-ucode</code>:
1.89      rillig   1892:            Silicon Graphics, Inc. MIPSpro (o32)</p></li>
1.128     wiz      1893: <li class="listitem"><p><code class="varname">sunpro</code>:
1.89      rillig   1894:            Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li>
1.174     asau     1895: <li class="listitem"><p><code class="varname">xlc</code>:
1.230     sevan    1896:            IBM's XL C/C++ compiler suite</p></li>
1.89      rillig   1897: </ul></div>
                   1898: <p>The default is
1.128     wiz      1899:          <span class="quote">&#8220;<span class="quote"><code class="varname">gcc</code></span>&#8221;</span>.  You can use
1.89      rillig   1900:          <code class="varname">ccache</code> and/or
                   1901:          <code class="varname">distcc</code> with an appropriate
                   1902:          <code class="varname">PKGSRC_COMPILER</code> setting,
1.128     wiz      1903:          e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">ccache gcc</code></span>&#8221;</span>.  This
1.94      dmcmahil 1904:          variable should always be terminated with a value for
                   1905:          a real compiler.  Note that only one real compiler
1.128     wiz      1906:          should be listed (e.g. <span class="quote">&#8220;<span class="quote"><code class="varname">sunpro gcc</code></span>&#8221;</span>
1.94      dmcmahil 1907:          is not allowed).</p>
1.89      rillig   1908: </dd>
                   1909: <dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt>
                   1910: <dd><p>This specifies the minimum version of GCC to use
                   1911:          when building packages.  If the system GCC doesn't
                   1912:          satisfy this requirement, then pkgsrc will build and
                   1913:          install one of the GCC packages to use instead.</p></dd>
1.266     leot     1914: <dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt>
1.225     maya     1915: <dd><p>Specifies which version of python to use when several
                   1916:          options are available.</p></dd>
                   1917: <dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt>
1.291     gutterid 1918: <dd><p>Specifies the Fortran compiler to use.
                   1919:          The default is <code class="varname">gfortran</code>.</p></dd>
1.225     maya     1920: <dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt>
                   1921: <dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code>
                   1922:          <code class="varname">gfortran</code> is used, this option specifies which
                   1923:          version to use.</p></dd>
1.89      rillig   1924: </dl></div>
                   1925: </div>
1.148     asau     1926: <div class="sect2">
1.89      rillig   1927: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1928: <a name="conf.cflags"></a>6.4.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div>
1.78      rillig   1929: <p>If you wish to set the <code class="varname">CFLAGS</code> variable,
                   1930:        please make sure to use the <code class="literal">+=</code> operator
                   1931:        instead of the <code class="literal">=</code> operator:</p>
                   1932: <pre class="programlisting">
1.100     rillig   1933: CFLAGS+=        -your -flags
1.78      rillig   1934: </pre>
                   1935: <p>Using <code class="varname">CFLAGS=</code> (i.e. without the
1.128     wiz      1936:        <span class="quote">&#8220;<span class="quote">+</span>&#8221;</span>) may lead to problems with packages that
1.117     jnemeth  1937:        need to add their own flags.  You may want to take a look
1.322     leot     1938:        at the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/index.html" target="_top"><code class="filename">devel/cpuflags</code></a>
1.128     wiz      1939:        package if you're interested in optimization specifically
                   1940:        for the current CPU. </p>
1.78      rillig   1941: </div>
1.148     asau     1942: <div class="sect2">
1.88      wiz      1943: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   1944: <a name="conf.ldflags"></a>6.4.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div>
1.88      wiz      1945: <p>If you want to pass flags to the linker, both in the configure
                   1946: step and the build step, you can do this in two ways.  Either set
                   1947: <code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>.  The difference
                   1948: between the two is that <code class="varname">LIBS</code> will be appended to
                   1949: the command line, while <code class="varname">LDFLAGS</code> come earlier.
                   1950: <code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF
                   1951: machines depending on the setting of <code class="varname">USE_IMAKE</code> or
                   1952: the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>.  As with
                   1953: <code class="varname">CFLAGS</code>, if you do not wish to override these
                   1954: settings, use the <code class="literal">+=</code> operator:</p>
                   1955: <pre class="programlisting">
1.100     rillig   1956: LDFLAGS+=        -your -linkerflags
1.88      wiz      1957: </pre>
                   1958: </div>
1.78      rillig   1959: </div>
1.148     asau     1960: <div class="sect1">
1.78      rillig   1961: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1962: <a name="developer-advanced-settings"></a>6.5. Developer/advanced settings</h2></div></div></div>
1.194     bsiegert 1963: <p>
1.75      rillig   1964:       </p>
1.148     asau     1965: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      1966: <li class="listitem">
1.75      rillig   1967: <p><code class="varname">PKG_DEVELOPER</code>:
1.347   ! gutterid 1968:         Run some sanity checks that package developers want:
        !          1969:         </p>
1.148     asau     1970: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
1.128     wiz      1971: <li class="listitem"><p>make sure patches apply with zero
1.347   ! gutterid 1972:             fuzz</p></li>
1.128     wiz      1973: <li class="listitem"><p>run check-shlibs to see that all
1.347   ! gutterid 1974:             binaries will find their shared libs.</p></li>
1.75      rillig   1975: </ul></div>
                   1976: </li>
1.347   ! gutterid 1977: <li class="listitem"><p><code class="varname">CHECK_FILES_STRICT</code>: 
        !          1978:         Also check <code class="varname">VARBASE</code> and <code class="varname">PKG_SYSCONFDIR
        !          1979:         </code> values in PLIST entries.
        !          1980:         </p></li>
1.128     wiz      1981: <li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level
1.347   ! gutterid 1982:         of debugging output which is displayed whilst making and
        !          1983:         installing the package.  The default value for this is 0,
        !          1984:         which will not display the commands as they are executed
        !          1985:         (normal, default, quiet operation); the value 1 will display
        !          1986:         all shell commands before their invocation, and the value 2
        !          1987:         will display both the shell commands before their invocation,
        !          1988:         as well as their actual execution progress with <span class="command"><strong>set
        !          1989:         -x</strong></span>.</p></li>
1.75      rillig   1990: </ul></div>
                   1991: <p>
                   1992:     </p>
                   1993: </div>
1.148     asau     1994: <div class="sect1">
1.75      rillig   1995: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   1996: <a name="selecting-build-options"></a>6.6. Selecting Build Options</h2></div></div></div>
1.88      wiz      1997: <p>Some packages have build time options, usually to select
                   1998:     between different dependencies, enable optional support for big
                   1999:     dependencies or enable experimental features.</p>
1.75      rillig   2000: <p>To see which options, if any, a package supports, and which
1.110     hubertf  2001:     options are mutually exclusive, run <span class="command"><strong>make
1.88      wiz      2002:     show-options</strong></span>, for example:</p>
1.75      rillig   2003: <pre class="programlisting">
                   2004:     The following options are supported by this package:
                   2005:         ssl      Enable SSL support.
                   2006:     Exactly one of the following gecko options is required:
                   2007:         firefox  Use firefox as gecko rendering engine.
                   2008:         mozilla  Use mozilla as gecko rendering engine.
                   2009:     At most one of the following database options may be selected:
                   2010:         mysql    Enable support for MySQL database.
                   2011:         pgsql    Enable support for PostgreSQL database.
1.1       grant    2012: 
1.75      rillig   2013:     These options are enabled by default: firefox
                   2014:     These options are currently enabled: mozilla ssl
1.1       grant    2015: </pre>
1.75      rillig   2016: <p>The following variables can be defined in
1.110     hubertf  2017:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to select which options to
1.88      wiz      2018:     enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>,
                   2019:     which can be used to select or disable options for all packages
                   2020:     that support them, and
                   2021:     <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>,
                   2022:     which can be used to select or disable options specifically for
                   2023:     package <em class="replaceable"><code>pkgbase</code></em>.  Options listed in
1.128     wiz      2024:     these variables are selected, options preceded by <span class="quote">&#8220;<span class="quote">-</span>&#8221;</span>
1.88      wiz      2025:     are disabled. A few examples:</p>
1.75      rillig   2026: <pre class="screen">
1.110     hubertf  2027: <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.75      rillig   2028: PKG_DEFAULT_OPTIONS=    -arts -dvdread -esound
                   2029: PKG_OPTIONS.kdebase=    debug -sasl
                   2030: PKG_OPTIONS.apache=     suexec </pre>
1.111     rillig   2031: <p>It is important to note that options that were specifically
1.120     snj      2032:     suggested by the package maintainer must be explicitly removed if
1.111     rillig   2033:     you do not wish to include the option.  If you are unsure you can view
                   2034:     the current state with <span class="command"><strong>make show-options</strong></span>.</p>
1.88      wiz      2035: <p>The following settings are consulted in the order given, and
                   2036:     the last setting that selects or disables an option is
                   2037:     used:</p>
1.128     wiz      2038: <div class="orderedlist"><ol class="orderedlist" type="1">
                   2039: <li class="listitem"><p>the default options as suggested by the package
1.88      wiz      2040:       maintainer</p></li>
1.128     wiz      2041: <li class="listitem"><p>the options implied by the settings of legacy
1.88      wiz      2042:       variables (see below)</p></li>
1.128     wiz      2043: <li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li>
                   2044: <li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li>
1.75      rillig   2045: </ol></div>
                   2046: <p>For groups of mutually exclusive options, the last option
1.88      wiz      2047:     selected is used, all others are automatically disabled.  If an
                   2048:     option of the group is explicitly disabled, the previously
                   2049:     selected option, if any, is used.  It is an error if no option
                   2050:     from a required group of options is selected, and building the
                   2051:     package will fail.</p>
                   2052: <p>Before the options framework was introduced, build options
                   2053:     were selected by setting a variable (often named
                   2054:     <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in
1.110     hubertf  2055:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> for each option.  To ease
1.88      wiz      2056:     transition to the options framework for the user, these legacy
                   2057:     variables are converted to the appropriate options setting
                   2058:     (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>)
                   2059:     automatically.  A warning is issued to prompt the user to update
1.110     hubertf  2060:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework
1.88      wiz      2061:     directly.  Support for the legacy variables will be removed
                   2062:     eventually.</p>
1.75      rillig   2063: </div>
                   2064: </div>
1.148     asau     2065: <div class="chapter">
1.75      rillig   2066: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   2067: <a name="binary"></a>Chapter 7. Creating binary packages</h2></div></div></div>
1.75      rillig   2068: <div class="toc">
                   2069: <p><b>Table of Contents</b></p>
1.210     leot     2070: <dl class="toc">
1.267     rillig   2071: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
                   2072: <dt><span class="sect1"><a href="#settings-for-creationg-of-binary-packages">7.2. Settings for creation of binary packages</a></span></dt>
1.75      rillig   2073: </dl>
                   2074: </div>
1.148     asau     2075: <div class="sect1">
1.75      rillig   2076: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2077: <a name="building-a-single-binary-package"></a>7.1. Building a single binary package</h2></div></div></div>
1.87      wiz      2078: <p>Once you have built and installed a package, you can create
                   2079:     a <span class="emphasis"><em>binary package</em></span> which can be installed on
1.322     leot     2080:     another system with <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_add.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>. This saves having to build
1.87      wiz      2081:     the same package on a group of hosts and wasting CPU time. It also
                   2082:     provides a simple means for others to install your package, should
                   2083:     you distribute it.</p>
                   2084: <p>To create a binary package, change into the appropriate
1.110     hubertf  2085:     directory in pkgsrc, and run <span class="command"><strong>make
1.87      wiz      2086:     package</strong></span>:</p>
                   2087: <pre class="screen">
1.223     rillig   2088: <code class="prompt">$</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
                   2089: <code class="prompt">$</code> <strong class="userinput"><code>make package</code></strong>
                   2090: </pre>
1.87      wiz      2091: <p>This will build and install your package (if not already done),
                   2092:     and then build a binary package from what was installed. You can
1.110     hubertf  2093:     then use the <span class="command"><strong>pkg_*</strong></span> tools to manipulate
1.87      wiz      2094:     it. Binary packages are created by default in
                   2095:     <code class="filename">/usr/pkgsrc/packages</code>, in the form of a
1.322     leot     2096:     gzipped tar file. See <a class="xref" href="#logs.package" title="C.2. Packaging figlet">Section C.2, &#8220;Packaging figlet&#8221;</a> for a
                   2097:     continuation of the above <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/misc/figlet/index.html" target="_top"><code class="filename">misc/figlet</code></a> example.</p>
1.267     rillig   2098: <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.87      wiz      2099:     such a binary package.</p>
1.75      rillig   2100: </div>
1.148     asau     2101: <div class="sect1">
1.75      rillig   2102: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2103: <a name="settings-for-creationg-of-binary-packages"></a>7.2. Settings for creation of binary packages</h2></div></div></div>
1.299     rillig   2104: <p>See <a class="xref" href="#build.helpful-targets" title="13.17. Other helpful targets">Section 13.17, &#8220;Other helpful targets&#8221;</a>.</p>
1.106     rillig   2105: </div>
                   2106: </div>
1.148     asau     2107: <div class="chapter">
1.106     rillig   2108: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   2109: <a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk
1.106     rillig   2110: builds)</h2></div></div></div>
                   2111: <div class="toc">
                   2112: <p><b>Table of Contents</b></p>
1.210     leot     2113: <dl class="toc">
1.267     rillig   2114: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.295     rillig   2115: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.267     rillig   2116: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
                   2117: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.293     rillig   2118: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
                   2119: <dd><dl>
1.294     rillig   2120: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
                   2121: <dt><span class="sect2"><a href="#bulk.var.comperr">8.4.2. Detect classes of bugs by forcing compiler warnings</a></span></dt>
1.296     rillig   2122: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
                   2123: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
                   2124: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
                   2125: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
                   2126: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
                   2127: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
                   2128: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
                   2129: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.293     rillig   2130: </dl></dd>
                   2131: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
                   2132: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.106     rillig   2133: </dl>
                   2134: </div>
1.290     gutterid 2135: <p>For a number of reasons, you may want to build binary packages
                   2136: for a large selected set of packages in pkgsrc, or even for all pkgsrc packages.
1.180     wiz      2137: For instance, when you have multiple machines that should run the same software,
                   2138: it is wasted time if they all build their packages themselves from source.
                   2139: Or you may want to build a list of packages you want and check them before
1.290     gutterid 2140: deploying onto production systems.
1.180     wiz      2141: There is a way of getting a set of binary packages:
1.290     gutterid 2142: the bulk build system, or pbulk ("p" stands for "parallel").
1.223     rillig   2143: This chapter describes how to set it up.</p>
1.148     asau     2144: <div class="sect1">
1.106     rillig   2145: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2146: <a name="bulk.pre"></a>8.1. Preparations</h2></div></div></div>
1.180     wiz      2147: <p>First of all, you have to decide whether you build all packages
                   2148: or a limited set of them. Full bulk builds usually consume a lot more resources,
                   2149: both space and time, than builds for some practical sets of packages.
1.290     gutterid 2150: A number of particularly heavy packages exist that are not actually
                   2151: interesting to a wide audience. (The approximate resource consumption for a
                   2152: 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>.)
                   2153: For limited bulk builds you need to make a list of packages you want to build.
1.223     rillig   2154: Note that all their dependencies will be built, so you don't need to track them manually.
1.180     wiz      2155: </p>
                   2156: <p>During bulk builds various packages are installed and deinstalled
                   2157: in <code class="filename">/usr/pkg</code> (or whatever <code class="filename">LOCALBASE</code> is),
                   2158: so make sure that you don't need any package during the builds.
1.223     rillig   2159: Essentially, you should provide a fresh system, either a chroot environment
1.180     wiz      2160: or something even more restrictive, depending on what the operating system provides,
                   2161: or dedicate the whole physical machine.
                   2162: As a useful side effect this makes sure that bulk builds cannot
                   2163: break anything in your system. There have been numerous cases where
1.106     rillig   2164: certain packages tried to install files outside the
                   2165: <code class="filename">LOCALBASE</code> or wanted to edit some files in
1.180     wiz      2166: <code class="filename">/etc</code>.
                   2167: </p>
1.106     rillig   2168: </div>
1.148     asau     2169: <div class="sect1">
1.106     rillig   2170: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.295     rillig   2171: <a name="bulk.pbulk"></a>8.2. Running a bulk build</h2></div></div></div>
                   2172: <p>Running a bulk build works roughly as follows:</p>
1.148     asau     2173: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      2174: <li class="listitem"><p>First, build the pbulk infrastructure in a fresh pkgsrc location.</p></li>
                   2175: <li class="listitem"><p>Then, build each of the packages from a clean installation directory using the infrastructure.</p></li>
1.116     rillig   2176: </ul></div>
1.148     asau     2177: <div class="sect2">
1.116     rillig   2178: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   2179: <a name="bulk.pbulk.conf"></a>8.2.1. Configuration</h3></div></div></div>
1.223     rillig   2180: <p>To simplify configuration, we provide the helper script <code class="filename">mk/pbulk/pbulk.sh</code>.</p>
1.178     asau     2181: <p>In order to use it, prepare a clear system (real one, chroot environment, jail, zone, virtual machine).
                   2182: Configure network access to fetch distribution files.
1.223     rillig   2183: Create a user with name "pbulk".</p>
1.178     asau     2184: <p>Fetch and extract pkgsrc. Use a command like one of these:</p>
                   2185: <pre class="screen">
1.264     sevan    2186: <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>
                   2187: <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.181     wiz      2188: <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.178     asau     2189: </pre>
                   2190: <p>Or any other way that fits (e.g., curl, wget).</p>
                   2191: <p>Deploy and configure pbulk tools, e.g.:</p>
                   2192: <pre class="screen">
1.230     sevan    2193: <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.178     asau     2194: <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>
                   2195: <code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build</code></strong>
                   2196: </pre>
                   2197: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   2198: <h3 class="title">Note</h3>
                   2199: <p><code class="filename">mk.conf.frag</code> is a fragment of
                   2200: <code class="filename">mk.conf</code> that contains settings you want to
                   2201: apply to packages you build. For instance,</p>
                   2202: <pre class="programlisting">
1.223     rillig   2203: PKG_DEVELOPER=          yes     # perform more checks
                   2204: X11_TYPE=               modular # use pkgsrc X11
                   2205: SKIP_LICENSE_CHECK=     yes     # accept all licences (useful
                   2206:                                 # when building all packages)
1.178     asau     2207: </pre>
                   2208: </div>
                   2209: <p>If configured for limited list, replace the list in <code class="filename">/usr/pbulk/etc/pbulk.list</code>
1.223     rillig   2210: with your list of packages, one per line without empty lines or comments. E.g.:</p>
1.178     asau     2211: <pre class="programlisting">
                   2212: www/firefox
                   2213: mail/thunderbird
                   2214: misc/libreoffice4
                   2215: </pre>
1.179     asau     2216: <p>At this point you can also review configuration in <code class="filename">/usr/pbulk/etc</code>
                   2217: and make final amendments, if wanted.</p>
1.178     asau     2218: <p>Start it:</p>
                   2219: <pre class="screen">
                   2220: <code class="prompt">#</code> <strong class="userinput"><code>/usr/pbulk/bin/bulkbuild</code></strong>
                   2221: </pre>
                   2222: <p>After it finishes, you'll have <code class="filename">/mnt</code> filled with distribution files, binary packages, and reports,
                   2223: plain text summary in <code class="filename">/mnt/bulklog/meta/report.txt</code>
                   2224: </p>
                   2225: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   2226: <h3 class="title">Note</h3>
                   2227: <p>The <code class="filename">pbulk.sh</code> script does not cover all possible use cases.
                   2228: While being ready to run, it serves as a good starting point to understand and build more complex setups.
                   2229: The script is kept small enough for better understanding.</p>
                   2230: </div>
                   2231: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   2232: <h3 class="title">Note</h3>
                   2233: <p>The <code class="filename">pbulk.sh</code> script supports running
1.320     wiz      2234: unprivileged bulk build and helps configuring distributed bulk builds.
                   2235: Distributed bulk builds support either building in worker chroots
                   2236: (each node is a path to a different chroot)
                   2237: that replicate the target system, including the pbulk prefix,
                   2238: or remote machines (each node is
                   2239: an IP address that must be accessible over SSH without a password).</p>
1.178     asau     2240: </div>
1.106     rillig   2241: </div>
                   2242: </div>
1.148     asau     2243: <div class="sect1">
1.106     rillig   2244: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2245: <a name="bulk.req"></a>8.3. Requirements of a full bulk build</h2></div></div></div>
1.180     wiz      2246: <p>A complete bulk build requires lots of disk space. Some of the
                   2247: disk space can be read-only, some other must be writable. Some can be on
                   2248: remote filesystems (such as NFS) and some should be local. Some can be
                   2249: temporary filesystems, others must survive a sudden reboot.</p>
                   2250: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.320     wiz      2251: <li class="listitem"><p>70 GB for the distfiles (read-write, remote, temporary)</p></li>
                   2252: <li class="listitem"><p>60 GB for the binary packages (read-write, remote, permanent)</p></li>
1.180     wiz      2253: <li class="listitem"><p>1 GB for the pkgsrc tree (read-only, remote, permanent)</p></li>
                   2254: <li class="listitem"><p>5 GB for <code class="filename">LOCALBASE</code> (read-write, local, temporary)</p></li>
                   2255: <li class="listitem"><p>10 GB for the log files (read-write, remote, permanent)</p></li>
                   2256: <li class="listitem"><p>5 GB for temporary files (read-write, local, temporary)</p></li>
                   2257: </ul></div>
                   2258: </div>
                   2259: <div class="sect1">
                   2260: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.293     rillig   2261: <a name="bulk.var"></a>8.4. Bulk build variants</h2></div></div></div>
                   2262: <p>To ensure that pkgsrc packages work in different configurations, it
                   2263: makes sense to run non-default bulk builds from time to time. This
                   2264: section lists some ideas for bulk builds that intentionally let packages
                   2265: fail if they don't follow the pkgsrc style.</p>
                   2266: <div class="sect2">
                   2267: <div class="titlepage"><div><div><h3 class="title">
1.294     rillig   2268: <a name="bulk.var.confopt"></a>8.4.1. Detect unknown configure options</h3></div></div></div>
1.293     rillig   2269: <p>Add the following line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2270: <pre class="programlisting">
                   2271: GNU_CONFIGURE_STRICT=   yes
                   2272: </pre>
                   2273: <p>When a package fails this additional check, the most common cause
                   2274: is that the configure option was valid for an older version of the
                   2275: package but does not apply anymore. In that case, just remove it.</p>
                   2276: </div>
                   2277: <div class="sect2">
                   2278: <div class="titlepage"><div><div><h3 class="title">
1.294     rillig   2279: <a name="bulk.var.comperr"></a>8.4.2. Detect classes of bugs by forcing compiler warnings</h3></div></div></div>
1.293     rillig   2280: <p>The job of a compiler is not restricted to producing executable
1.294     rillig   2281: code, most compilers also detect typical programming mistakes. The pkgsrc
                   2282: compiler wrappers make it easy to force compiler options when the package
                   2283: is built. This can be used to find typical bugs across all packages that
                   2284: are in pkgsrc. By reporting these bugs upstream, the packages will be
                   2285: more reliable with the next updates.</p>
                   2286: <p>Add some of the following lines to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
1.293     rillig   2287: <pre class="programlisting">
                   2288: CFLAGS+=        -Werror=char-subscripts
1.294     rillig   2289: CFLAGS+=        -Werror=implicit-function-declaration
1.293     rillig   2290: </pre>
1.294     rillig   2291: <p>When a package fails to build using these stricter compiler
                   2292: options, document the circumstances in which the compiler produced the
                   2293: error message. This includes:</p>
1.293     rillig   2294: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   2295: <li class="listitem"><p>The platform
                   2296: (<code class="varname">MACHINE_PLATFORM</code>)</p></li>
                   2297: <li class="listitem"><p>The source file</p></li>
                   2298: <li class="listitem"><p>An excerpt of the code. GCC and Clang already do this as
                   2299: part of the diagnostic.</p></li>
1.294     rillig   2300: <li class="listitem"><p>The exact error message from the compiler.</p></li>
1.293     rillig   2301: </ul></div>
                   2302: <p>If a package produces these error messages, but the package is
1.294     rillig   2303: 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
                   2304: in the next builds:</p>
1.293     rillig   2305: <pre class="programlisting">
1.294     rillig   2306: .if ${PKGPATH} == category/package
1.293     rillig   2307: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
                   2308: # error message
                   2309: # code
1.294     rillig   2310: # Reason why the code does not need to be fixed.
1.293     rillig   2311: BUILDLINK_TRANSFORM+=   rm:-Werror=char-subscripts
1.294     rillig   2312: .endif
1.293     rillig   2313: </pre>
                   2314: <p>If the error messages from the compiler are valid and the code
1.294     rillig   2315: needs to be fixed, prepare a local patch (see
                   2316: <code class="varname">LOCALPATCHES</code>) and report the bug to the upstream
                   2317: authors of the package, providing them with the information you collected
                   2318: above.</p>
                   2319: <p>Patches that are not essential for the package to work should only
                   2320: be reported upstream but not committed to pkgsrc, to make future updates
                   2321: easier.</p>
1.293     rillig   2322: </div>
                   2323: <div class="sect2">
                   2324: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2325: <a name="bulk.var.builderr"></a>8.4.3. Force compiler options only in the build phase</h3></div></div></div>
                   2326: <p>When adding custom compiler flags via <code class="varname">CFLAGS</code>,
                   2327: these apply to all phases of the package build process. Especially in the
                   2328: configure phase, adding <code class="literal">-Werror</code> leads to wrong
                   2329: decisions. The GNU configure scripts feed many small test programs to the
                   2330: C compiler to see whether certain headers are available, functions are
                   2331: defined in a library and programs can be run. In many cases these
                   2332: programs would not survive a strict compiler run with <code class="literal">-Wall
                   2333: -Wextra -Werror</code>.</p>
                   2334: <p>The pkgsrc infrastructure is flexible enough to support compiler
                   2335: options being added between the <code class="literal">configure</code> and
                   2336: <code class="literal">build</code> phases. It's a little more complicated than the
                   2337: other examples in this section but still easy enough.</p>
                   2338: <p>The basic idea is to use the pkgsrc compiler wrapper to inject the
                   2339: desired compiler options. The compiler wrapper's original task is to hide
                   2340: unwanted directories of include files and to normalize compiler options.
                   2341: It does this by wrapping the compiler command and rewriting the command
                   2342: line. To see this in action, run <span class="command"><strong>bmake patch</strong></span> in a
                   2343: package directory and examine the
                   2344: <code class="filename">work/.cwrappers/config</code> directory. It contains
                   2345: individual configurations for the C compiler and the related tools. The
                   2346: plan is to find a hook between the configure and build phases, and to
                   2347: modify these configuration files at that point.</p>
                   2348: <p>To find this hook, have a look at
                   2349: <code class="filename">mk/build/build.mk</code>, which contains among others the
                   2350: <code class="literal">pre-build-checks-hook</code>. The word
                   2351: <code class="literal">checks</code> doesn't quite fit, but the
                   2352: <code class="literal">pre-build-hook</code> sounds good enough.</p>
                   2353: <p>The code to be included in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> is:</p>
                   2354: <pre class="programlisting">
                   2355: # Just a few example options.
                   2356: BUILD_ONLY_CFLAGS=      -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
                   2357: 
                   2358: .if ${BUILD_ONLY_CFLAGS:U:M*}
                   2359: pre-build-checks-hook: add-build-only-cflags
                   2360: 
                   2361: add-build-only-cflags: .PHONY
                   2362:         ${RUN} cd ${CWRAPPERS_CONFIG_DIR};      \
                   2363:         ${TEST} ! -f ${.TARGET} || exit 0;      \
                   2364:         for flag in ${BUILD_ONLY_CFLAGS}; do    \
                   2365:                 ${ECHO} "append=$$flag" &gt;&gt; cc;  \
                   2366:         done;                                   \
                   2367:         &gt; ${.TARGET}
                   2368: .endif
                   2369: </pre>
                   2370: <p>(When editing the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, make sure that the commands of the
                   2371: <code class="literal">add-build-only-cflags</code> target are indented with a tab,
                   2372: not with spaces.)</p>
                   2373: <p>The condition in the <code class="literal">.if</code> statement contains the
                   2374: <code class="literal">:U</code> modifier to prevent parse errors if the variable
                   2375: should be undefined, possibly because it is only defined for a subset of
                   2376: the packages. The <code class="literal">:M*</code> modifier ensures that there is
                   2377: at least one compiler option, to prevent a syntax error in the shell
                   2378: parser.</p>
                   2379: <p>The code around the <code class="literal">${.TARGET}</code> variable ensures
                   2380: that the additional compiler options are only appended once, even if
                   2381: <span class="command"><strong>bmake build</strong></span> is run multiple times. To do this, it
                   2382: creates a marker file.</p>
                   2383: <p>To verify that this setup works, run <span class="command"><strong>bmake
                   2384: configure</strong></span> in a package directory. Up to now, everything works
                   2385: as usual. Examine the directory
                   2386: <code class="filename">work/.cwrappers/config</code> to see that the compiler
                   2387: options from <code class="varname">BUILD_ONLY_CFLAGS</code> are not yet added to
                   2388: the file <code class="filename">cc</code>. Examine the tail of the
                   2389: <code class="filename">work/.work.log</code> file to see that the normal compiler
                   2390: options are used.</p>
                   2391: <p>Now run <span class="command"><strong>bmake build</strong></span>. This will append the
                   2392: options to the file <code class="filename">cc</code> and will create the marker
                   2393: file in the same directory. After that, the build starts as usual, but
                   2394: with the added compiler options. Examine the tail of the file
                   2395: <code class="filename">work/.work.log</code> to see that the lines starting with
                   2396: <code class="literal">[*]</code> don't contain the compiler options, but the
                   2397: corresponding lines starting with <code class="literal">&lt;.&gt;</code> do end
                   2398: with these options.</p>
                   2399: <p>Building packages using this setup variant and fixing the resulting
                   2400: 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>
                   2401: </div>
                   2402: <div class="sect2">
                   2403: <div class="titlepage"><div><div><h3 class="title">
                   2404: <a name="bulk.var.dirs"></a>8.4.4. Use custom directories</h3></div></div></div>
1.293     rillig   2405: <p>Some directories like <code class="varname">PREFIX</code>,
                   2406: <code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>,
                   2407: <code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be
                   2408: configured in pkgsrc. Set these to arbitrary paths during bootstrap or
                   2409: afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2410: <pre class="programlisting">
                   2411: PREFIX=         /a-random-uuid
                   2412: PKG_SYSCONFDIR= /a-random-uuid
                   2413: VARBASE=        /a-random-uuid
                   2414: PKGMANDIR=     a-random-uuid
                   2415: PKG_INFODIR=   a-random-uuid
                   2416: </pre>
                   2417: </div>
                   2418: <div class="sect2">
                   2419: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2420: <a name="bulk.var.warn"></a>8.4.5. Turn warnings into errors</h3></div></div></div>
1.293     rillig   2421: <p>When building a package, warnings are typically ignored since they
                   2422: just flow by and do not cause the build to fail immediately. To find
                   2423: these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2424: <pre class="programlisting">
                   2425: DELAYED_WARNING_MSG=    ${DELAYED_ERROR_MSG} "(was warning)"
                   2426: WARNING_MSG=            ${FAIL_MSG} "(was warning)"
                   2427: </pre>
                   2428: <p>(There are many more classes of warnings in pkgsrc, and most of
                   2429: them can be redefined with a simple definition like above.</p>
1.294     rillig   2430: <p>If a package suggests to add <code class="varname">USE_TOOLS+=perl</code> to
1.293     rillig   2431: the package Makefile, research whether the package actually needs Perl.
                   2432: If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package
                   2433: Makefile, and if it doesn't, add
                   2434: <code class="varname">TOOLS_BROKEN+=perl</code>.</p>
                   2435: </div>
                   2436: <div class="sect2">
                   2437: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2438: <a name="bulk.var.pkglint"></a>8.4.6. Reject packages for which pkglint reports errors</h3></div></div></div>
1.293     rillig   2439: <p>Using pkglint as part of the regular build process is mostly a
                   2440: waste of time. If you want to fix some of the warnings, just run pkglint
                   2441: recursively on the whole pkgsrc tree. This will take a few minutes (up to
                   2442: 10), which is much faster than a complete bulk build.</p>
                   2443: </div>
                   2444: <div class="sect2">
                   2445: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2446: <a name="bulk.var.strings"></a>8.4.7. Reject packages that contain forbidden strings</h3></div></div></div>
1.293     rillig   2447: <p>To ensure that the binary packages don't contain references to the
                   2448: build directory, there is already <code class="varname">CHECK_WRKREF</code>. If
                   2449: that variable includes the item <code class="literal">extra</code>, it is
                   2450: possible to define additional patterns that must not appear in any
                   2451: installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2452: <pre class="programlisting">
                   2453: CHECK_WRKREF=                   extra
                   2454: CHECK_WRKREF_EXTRA_DIRS+=       /usr/local
                   2455: CHECK_WRKREF_EXTRA_DIRS+=       /usr/pkg
                   2456: CHECK_WRKREF_EXTRA_DIRS+=      @[A-Z][A-Z]*@
                   2457: </pre>
                   2458: <p>The above patterns will probably generate many false positives,
                   2459: therefore the results need to be taken with a grain of salt.</p>
                   2460: </div>
                   2461: <div class="sect2">
                   2462: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2463: <a name="bulk.var.test"></a>8.4.8. Reject packages whose self-test fails</h3></div></div></div>
1.293     rillig   2464: <p>To run the test suites that come with each package, add this line
                   2465: to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2466: <pre class="programlisting">
                   2467: PKGSRC_RUN_TEST=        yes
                   2468: </pre>
                   2469: <p>Be prepared that even the most basic packages fail this test. When
                   2470: doing a bulk build with this, it will often abort in the early phase
                   2471: where the packages are scanned for their dependencies since there are
                   2472: cyclic dependencies. There is still a lot to do in this area.</p>
                   2473: </div>
                   2474: <div class="sect2">
                   2475: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2476: <a name="bulk.var.shvar"></a>8.4.9. Reject packages that use undefined shell variables</h3></div></div></div>
1.293     rillig   2477: <p>To catch typos in the shell snippets from the Makefile fragments,
                   2478: add the <code class="literal">-u</code> flag to most of the commands by adding this
                   2479: line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2480: <pre class="programlisting">
                   2481: RUN=    @set -eu;
                   2482: </pre>
1.296     rillig   2483: <p>After that, ensure that none of the bulk build log files (even
                   2484: those for successfully built packages) contains the string
                   2485: <code class="literal">parameter not set</code> or whatever error message the
                   2486: command <span class="command"><strong>sh -ceu '$undefined'</strong></span> outputs.</p>
1.293     rillig   2487: <p>See <code class="filename">mk/misc/common.mk</code> for the existing
                   2488: definition.</p>
                   2489: </div>
                   2490: <div class="sect2">
                   2491: <div class="titlepage"><div><div><h3 class="title">
1.296     rillig   2492: <a name="bulk.var.quiet"></a>8.4.10. Turn off verbose logging</h3></div></div></div>
1.293     rillig   2493: <p>The build logs of a package are often quite long. This allows error
                   2494: messages or other interesting details to hide between the noise. To make
                   2495: the actual error message stand out more, add these lines to
                   2496: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
                   2497: <pre class="programlisting">
                   2498: GNU_CONFIGURE_QUIET=    yes
                   2499: MAKE_FLAGS+=            -s
                   2500: </pre>
                   2501: <p>The <code class="literal">-s</code> option works for both GNU Make and BSD
                   2502: Make. On exotic platforms with their own make, it may be a little
                   2503: different.</p>
                   2504: </div>
                   2505: </div>
                   2506: <div class="sect1">
                   2507: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   2508: <a name="creating-cdroms"></a>8.5. Creating a multiple CD-ROM packages collection</h2></div></div></div>
1.87      wiz      2509: <p>After your pkgsrc bulk-build has completed, you may wish to
                   2510:     create a CD-ROM set of the resulting binary packages to assist
                   2511:     in installing packages on other machines.  The
1.322     leot     2512:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/cdpack/index.html" target="_top"><code class="filename">pkgtools/cdpack</code></a> package provides
1.87      wiz      2513:     a simple tool for creating the ISO 9660 images.
1.110     hubertf  2514:     <span class="command"><strong>cdpack</strong></span> arranges the packages on the CD-ROMs in a
1.87      wiz      2515:     way that keeps all the dependencies for a given package on the same
                   2516:     CD as that package.</p>
1.148     asau     2517: <div class="sect2">
1.75      rillig   2518: <div class="titlepage"><div><div><h3 class="title">
1.293     rillig   2519: <a name="cdpack-example"></a>8.5.1. Example of cdpack</h3></div></div></div>
1.87      wiz      2520: <p>Complete documentation for cdpack is found in the cdpack(1)
                   2521:       man page. The following short example assumes that the binary
                   2522:       packages are left in
                   2523:       <code class="filename">/usr/pkgsrc/packages/All</code> and that
                   2524:       sufficient disk space exists in <code class="filename">/u2</code> to
                   2525:       hold the ISO 9660 images.</p>
                   2526: <pre class="screen">
                   2527: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /u2/images</code></strong>
1.75      rillig   2528: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
1.87      wiz      2529: <code class="prompt">#</code> <strong class="userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
                   2530:       </pre>
                   2531: <p>If you wish to include a common set of files
                   2532:       (<code class="filename">COPYRIGHT</code>, <code class="filename">README</code>,
                   2533:       etc.) on each CD in the collection, then you need to create a
1.290     gutterid 2534:       directory which contains these files, e.g.:</p>
1.87      wiz      2535: <pre class="screen">
                   2536: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common</code></strong>
1.75      rillig   2537: <code class="prompt">#</code> <strong class="userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   2538: <code class="prompt">#</code> <strong class="userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   2539: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common/bin</code></strong>
                   2540: <code class="prompt">#</code> <strong class="userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   2541: <code class="prompt">#</code> <strong class="userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
1.87      wiz      2542: <code class="prompt">#</code> <strong class="userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
                   2543:       </pre>
1.75      rillig   2544: <p>Now create the images:</p>
                   2545: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong></pre>
1.76      rillig   2546: <p>Each image will contain <code class="filename">README</code>,
1.87      wiz      2547:       <code class="filename">COPYING</code>, and <code class="filename">bin/myscript</code>
                   2548:       in their root directories.</p>
1.75      rillig   2549: </div>
                   2550: </div>
                   2551: </div>
1.148     asau     2552: <div class="chapter">
1.75      rillig   2553: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   2554: <a name="files"></a>Chapter 9. Directory layout of the installed files</h2></div></div></div>
1.90      rillig   2555: <div class="toc">
                   2556: <p><b>Table of Contents</b></p>
1.210     leot     2557: <dl class="toc">
1.267     rillig   2558: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
                   2559: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
1.90      rillig   2560: </dl>
                   2561: </div>
                   2562: <p>The files that are installed by pkgsrc are organized in a way that
                   2563: is similar to what you find in the <code class="filename">/usr</code> directory
                   2564: of the base system. But some details are different. This is because
                   2565: pkgsrc initially came from FreeBSD and had adopted its file system
                   2566: hierarchy. Later it was largely influenced by NetBSD. But no matter
                   2567: which operating system you are using pkgsrc with, you can expect the
                   2568: same layout for pkgsrc.</p>
1.91      rillig   2569: <p>There are mainly four root directories for pkgsrc, which are all
                   2570: configurable in the <code class="filename">bootstrap/bootstrap</code> script.
                   2571: When pkgsrc has been installed as root, the default locations
                   2572: are:</p>
                   2573: <pre class="programlisting">
1.100     rillig   2574: LOCALBASE=              /usr/pkg
                   2575: PKG_SYSCONFBASE=        /usr/pkg/etc
                   2576: VARBASE=                /var
1.231     sevan    2577: PKG_DBDIR=              /usr/pkg/pkgdb
1.91      rillig   2578: </pre>
                   2579: <p>In unprivileged mode (when pkgsrc has been installed as any other
                   2580: user), the default locations are:</p>
                   2581: <pre class="programlisting">
1.100     rillig   2582: LOCALBASE=              ${HOME}/pkg
                   2583: PKG_SYSCONFBASE=        ${HOME}/pkg/etc
                   2584: VARBASE=                ${HOME}/pkg/var
1.231     sevan    2585: PKG_DBDIR=              ${HOME}/pkg/pkgdb
1.91      rillig   2586: </pre>
                   2587: <p>What these four directories are for, and what they look like is
                   2588: explained below.</p>
1.148     asau     2589: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      2590: <li class="listitem"><p><code class="varname">LOCALBASE</code> corresponds to the
1.90      rillig   2591: <code class="filename">/usr</code> directory in the base system. It is the
1.128     wiz      2592: <span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> directory where the files are installed and contains
1.90      rillig   2593: the well-known subdirectories like <code class="filename">bin</code>,
                   2594: <code class="filename">include</code>, <code class="filename">lib</code>,
                   2595: <code class="filename">share</code> and
                   2596: <code class="filename">sbin</code>.</p></li>
1.128     wiz      2597: <li class="listitem"><p><code class="varname">VARBASE</code> corresponds to
1.90      rillig   2598: <code class="filename">/var</code> in the base system. Some programs (especially
                   2599: games, network daemons) need write access to it during normal
                   2600: operation.</p></li>
1.128     wiz      2601: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR</code> corresponds to
1.90      rillig   2602: <code class="filename">/etc</code> in the base system. It contains configuration
1.110     hubertf  2603: files of the packages, as well as pkgsrc's <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
1.90      rillig   2604: itself.</p></li>
                   2605: </ul></div>
1.148     asau     2606: <div class="sect1">
1.90      rillig   2607: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2608: <a name="files.localbase"></a>9.1. File system layout in <code class="literal">${LOCALBASE}</code>
1.93      rillig   2609: </h2></div></div></div>
1.90      rillig   2610: <p>The following directories exist in a typical pkgsrc installation
1.91      rillig   2611: in <code class="filename">${LOCALBASE}</code>.</p>
1.148     asau     2612: <div class="variablelist"><dl class="variablelist">
1.90      rillig   2613: <dt><span class="term"><code class="filename">bin</code></span></dt>
                   2614: <dd><p>Contains executable programs that are intended to be
                   2615: directly used by the end user.</p></dd>
                   2616: <dt><span class="term"><code class="filename">emul</code></span></dt>
                   2617: <dd><p>Contains files for the emulation layers of various other
                   2618: operating systems, especially for
                   2619: NetBSD.</p></dd>
                   2620: <dt><span class="term"><code class="filename">etc</code> (the usual location of
                   2621: <code class="filename">${PKG_SYSCONFDIR}</code>)</span></dt>
                   2622: <dd><p>Contains
                   2623: the configuration files.</p></dd>
                   2624: <dt><span class="term"><code class="filename">include</code></span></dt>
                   2625: <dd><p>Contains headers for the C and C++ programming
                   2626: languages.</p></dd>
                   2627: <dt><span class="term"><code class="filename">info</code></span></dt>
                   2628: <dd><p>Contains GNU info files of various
                   2629: packages.</p></dd>
                   2630: <dt><span class="term"><code class="filename">lib</code></span></dt>
                   2631: <dd><p>Contains shared and static
                   2632: libraries.</p></dd>
                   2633: <dt><span class="term"><code class="filename">libdata</code></span></dt>
                   2634: <dd><p>Contains data files that don't change after
                   2635: installation. Other data files belong into
                   2636: <code class="filename">${VARBASE}</code>.</p></dd>
                   2637: <dt><span class="term"><code class="filename">libexec</code></span></dt>
                   2638: <dd><p>Contains programs that are not intended to be used by
                   2639: end users, such as helper programs or network
                   2640: daemons.</p></dd>
                   2641: <dt><span class="term"><code class="filename">libexec/cgi-bin</code></span></dt>
                   2642: <dd><p>Contains programs that are intended to be executed as
                   2643: CGI scripts by a web server.</p></dd>
                   2644: <dt><span class="term"><code class="filename">man</code> (the usual value of
                   2645: <code class="filename">${PKGMANDIR}</code>)</span></dt>
                   2646: <dd><p>Contains brief
                   2647: documentation in form of manual pages.</p></dd>
                   2648: <dt><span class="term"><code class="filename">sbin</code></span></dt>
                   2649: <dd><p>Contains programs that are intended to be used only by
                   2650: the super-user.</p></dd>
                   2651: <dt><span class="term"><code class="filename">share</code></span></dt>
                   2652: <dd><p>Contains platform-independent data files that don't
                   2653: change after installation.</p></dd>
                   2654: <dt><span class="term"><code class="filename">share/doc</code></span></dt>
                   2655: <dd><p>Contains documentation files provided by the
                   2656: packages.</p></dd>
                   2657: <dt><span class="term"><code class="filename">share/examples</code></span></dt>
                   2658: <dd><p>Contains example files provided by the packages. Among
                   2659: others, the original configuration files are saved here and copied to
                   2660: <code class="filename">${PKG_SYSCONFDIR}</code> during
                   2661: installation.</p></dd>
                   2662: <dt><span class="term"><code class="filename">share/examples/rc.d</code></span></dt>
                   2663: <dd><p>Contains the original files for rc.d
                   2664: scripts.</p></dd>
                   2665: <dt><span class="term"><code class="filename">var</code> (the usual location of
                   2666: <code class="filename">${VARBASE}</code>)</span></dt>
                   2667: <dd><p>Contains files
                   2668: that may be modified after
                   2669: installation.</p></dd>
                   2670: </dl></div>
                   2671: </div>
1.148     asau     2672: <div class="sect1">
1.90      rillig   2673: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2674: <a name="files.varbase"></a>9.2. File system layout in <code class="literal">${VARBASE}</code>
1.93      rillig   2675: </h2></div></div></div>
1.148     asau     2676: <div class="variablelist"><dl class="variablelist">
1.90      rillig   2677: <dt><span class="term"><code class="filename">db/pkg</code> (the usual location of
                   2678: <code class="filename">${PKG_DBDIR}</code>)</span></dt>
                   2679: <dd><p>Contains
                   2680: information about the currently installed
                   2681: packages.</p></dd>
                   2682: <dt><span class="term"><code class="filename">games</code></span></dt>
                   2683: <dd><p>Contains highscore
                   2684: files.</p></dd>
                   2685: <dt><span class="term"><code class="filename">log</code></span></dt>
                   2686: <dd><p>Contains log files.</p></dd>
                   2687: <dt><span class="term"><code class="filename">run</code></span></dt>
                   2688: <dd><p>Contains informational files about daemons that are
                   2689: currently running.</p></dd>
                   2690: </dl></div>
                   2691: </div>
                   2692: </div>
1.148     asau     2693: <div class="chapter">
1.90      rillig   2694: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   2695: <a name="faq"></a>Chapter 10. Frequently Asked Questions</h2></div></div></div>
1.75      rillig   2696: <div class="toc">
                   2697: <p><b>Table of Contents</b></p>
1.210     leot     2698: <dl class="toc">
1.267     rillig   2699: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
                   2700: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
                   2701: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
                   2702: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
                   2703: <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>
                   2704: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
                   2705: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
                   2706: <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>
                   2707: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
                   2708: <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.128     wiz      2709: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</a></span></dt>
1.267     rillig   2710: <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>
1.336     nia      2711: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' or `priv` with pkgsrc</a></span></dt>
1.267     rillig   2712: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
                   2713: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
                   2714: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
                   2715: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build.  What shall I do?</a></span></dt>
                   2716: <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.75      rillig   2717: </dl>
                   2718: </div>
                   2719: <p>This section contains hints, tips &amp; tricks on special things in
                   2720: pkgsrc that we didn't find a better place for in the previous chapters, and
                   2721: it contains items for both pkgsrc users and developers.</p>
1.148     asau     2722: <div class="sect1">
1.75      rillig   2723: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2724: <a name="mailing-list-pointers"></a>10.1. Are there any mailing lists for pkg-related discussion?</h2></div></div></div>
1.75      rillig   2725: <p>The following mailing lists may be of interest to pkgsrc users:</p>
1.148     asau     2726: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      2727: <li class="listitem"><p><a class="ulink" href="http://www.NetBSD.org/mailinglists/index.html#pkgsrc-users" target="_top">pkgsrc-users</a>:
1.78      rillig   2728:          This is a general purpose list for most issues regarding
                   2729:          pkgsrc, regardless of platform, e.g. soliciting user help
                   2730:          for pkgsrc configuration, unexpected build failures, using
                   2731:          particular packages, upgrading pkgsrc installations,
                   2732:          questions regarding the pkgsrc release branches, etc.  General announcements or
                   2733:          proposals for changes that impact the pkgsrc user community,
                   2734:          e.g. major infrastructure changes, new features, package
                   2735:          removals, etc., may also be posted.</p></li>
1.289     leot     2736: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-bulk" target="_top">pkgsrc-bulk</a>:
1.75      rillig   2737:          A list where the results of pkgsrc bulk builds are sent and
                   2738:          discussed.</p></li>
1.289     leot     2739: <li class="listitem"><p><a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#pkgsrc-changes" target="_top">pkgsrc-changes</a>:
1.75      rillig   2740:          This list is for those who are interested in getting a
                   2741:          commit message for every change committed to pkgsrc. It is
                   2742:          also available in digest form, meaning one daily message
                   2743:          containing all commit messages for changes to the package
                   2744:          source tree in that 24 hour period.</p></li>
                   2745: </ul></div>
                   2746: <p>To subscribe, do:</p>
                   2747: <pre class="programlisting">
1.100     rillig   2748: <code class="prompt">%</code> echo subscribe <em class="replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.75      rillig   2749: </pre>
                   2750: <p>Archives for all these mailing lists are available from
1.289     leot     2751: <a class="ulink" href="https://mail-index.NetBSD.org/" target="_top">https://mail-index.NetBSD.org/</a>.</p>
1.75      rillig   2752: </div>
1.148     asau     2753: <div class="sect1">
1.75      rillig   2754: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2755: <a name="faq-pkgtools"></a>10.2. Utilities for package management (pkgtools)</h2></div></div></div>
1.80      rillig   2756: <p>The directory <code class="filename">pkgsrc/pkgtools</code> contains
1.75      rillig   2757: a number of useful utilities for both users and developers of pkgsrc.  This
1.233     sevan    2758: section attempts only to make the reader aware of some of the utilities and when
1.75      rillig   2759: they might be useful, and not to duplicate the documentation that comes
                   2760: with each package.</p>
                   2761: <p>Utilities used by pkgsrc (automatically installed when needed):</p>
1.322     leot     2762: <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/index.html" target="_top"><code class="filename">pkgtools/x11-links</code></a>:
1.75      rillig   2763:       Symlinks for use by buildlink.</p></li></ul></div>
                   2764: <p>OS tool augmentation (automatically installed when needed):</p>
1.148     asau     2765: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot     2766: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/digest/index.html" target="_top"><code class="filename">pkgtools/digest</code></a>:
1.233     sevan    2767:       Calculates various kinds of checksums (including SHA3).</p></li>
1.322     leot     2768: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libnbcompat/index.html" target="_top"><code class="filename">pkgtools/libnbcompat</code></a>:
1.75      rillig   2769:       Compatibility library for pkgsrc tools.</p></li>
1.322     leot     2770: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/mtree/index.html" target="_top"><code class="filename">pkgtools/mtree</code></a>: Installed on
1.87      wiz      2771:       non-BSD systems due to lack of native mtree.</p></li>
1.322     leot     2772: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/index.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a>:
1.75      rillig   2773:       Up-to-date replacement for
1.76      rillig   2774:       <code class="filename">/usr/sbin/pkg_install</code>, or for use on operating
1.75      rillig   2775:       systems where pkg_install is not present.</p></li>
                   2776: </ul></div>
                   2777: <p>Utilities used by pkgsrc (not automatically installed):</p>
1.148     asau     2778: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot     2779: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/index.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a>:
1.75      rillig   2780:       Create a binary package from an
1.110     hubertf  2781:       already-installed package.  Used by <span class="command"><strong>make replace</strong></span> to
1.75      rillig   2782:       save the old package.</p></li>
1.322     leot     2783: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/dfdisk/index.html" target="_top"><code class="filename">pkgtools/dfdisk</code></a>:
1.75      rillig   2784:       Adds extra functionality to pkgsrc, allowing it to fetch distfiles
                   2785:       from multiple locations. It currently supports the following
                   2786:       methods: multiple CD-ROMs and network FTP/HTTP connections.</p></li>
1.322     leot     2787: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/cpuflags/index.html" target="_top"><code class="filename">devel/cpuflags</code></a>: Determine
1.117     jnemeth  2788:       the best compiler flags to optimise code for your current
1.128     wiz      2789:       CPU and compiler. </p></li>
1.75      rillig   2790: </ul></div>
                   2791: <p>Utilities for keeping track of installed packages, being up to date,
                   2792: etc:</p>
1.148     asau     2793: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot     2794: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgin/index.html" target="_top"><code class="filename">pkgtools/pkgin</code></a>: A package
1.173     wiz      2795:     update tool similar to apt(1). Download, install, and upgrade
                   2796:     binary packages easily.</p></li>
1.322     leot     2797: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/index.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a>: Reports on
1.75      rillig   2798:       packages whose installed versions do not match the latest pkgsrc
                   2799:       entries.</p></li>
1.322     leot     2800: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdep/index.html" target="_top"><code class="filename">pkgtools/pkgdep</code></a>: Makes
1.75      rillig   2801:       dependency graphs of packages, to aid in choosing a strategy for
                   2802:       updating.</p></li>
1.322     leot     2803: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdepgraph/index.html" target="_top"><code class="filename">pkgtools/pkgdepgraph</code></a>: Makes
                   2804:       graphs from the output of <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdep/index.html" target="_top"><code class="filename">pkgtools/pkgdep</code></a> (uses graphviz).</p></li>
                   2805: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/index.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>: The
1.112     weinem   2806:       pkglint(1) program checks a pkgsrc entry for errors.</p></li>
1.322     leot     2807: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/lintpkgsrc/index.html" target="_top"><code class="filename">pkgtools/lintpkgsrc</code></a>: The lintpkgsrc(1) program
1.75      rillig   2808:       does various checks on the complete pkgsrc system.</p></li>
1.322     leot     2809: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgsurvey/index.html" target="_top"><code class="filename">pkgtools/pkgsurvey</code></a>: Report what
1.75      rillig   2810:       packages you have installed.</p></li>
                   2811: </ul></div>
                   2812: <p>Utilities for people maintaining or creating individual packages:</p>
1.148     asau     2813: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot     2814: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/index.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a>: Automate
1.75      rillig   2815:       making and maintaining patches for a package (includes pkgdiff,
                   2816:       pkgvi, mkpatches, etc.).</p></li>
1.322     leot     2817: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/url2pkg/index.html" target="_top"><code class="filename">pkgtools/url2pkg</code></a>: Aids in
1.75      rillig   2818:       converting to pkgsrc.</p></li>
                   2819: </ul></div>
                   2820: <p>Utilities for people maintaining pkgsrc (or: more obscure pkg
                   2821: utilities)</p>
1.148     asau     2822: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot     2823: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_comp/index.html" target="_top"><code class="filename">pkgtools/pkg_comp</code></a>: Build
1.75      rillig   2824:       packages in a chrooted area.</p></li>
1.322     leot     2825: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/libkver/index.html" target="_top"><code class="filename">pkgtools/libkver</code></a>: Spoof
1.75      rillig   2826:       kernel version for chrooted cross builds.</p></li>
                   2827: </ul></div>
                   2828: </div>
1.148     asau     2829: <div class="sect1">
1.75      rillig   2830: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2831: <a name="non-root-pkgsrc"></a>10.3. How to use pkgsrc as non-root</h2></div></div></div>
1.219     rillig   2832: <p>To install packages from source as a non-root user, download
1.267     rillig   2833: 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.219     rillig   2834: directory and run the command <span class="command"><strong>./bootstrap/bootstrap
                   2835: --unprivileged</strong></span>.</p>
                   2836: <p>This will install the binary part of pkgsrc to
                   2837: <code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
                   2838: into <code class="filename">~/pkg/etc</code>.</p>
                   2839: <p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p>
1.75      rillig   2840: </div>
1.148     asau     2841: <div class="sect1">
1.75      rillig   2842: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2843: <a name="resume-transfers"></a>10.4. How to resume transfers when fetching distfiles?</h2></div></div></div>
1.75      rillig   2844: <p>By default, resuming transfers in pkgsrc is disabled, but you can
                   2845: enable this feature by adding the option
                   2846: <code class="varname">PKG_RESUME_TRANSFERS=YES</code> into
1.110     hubertf  2847: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.  If, during a fetch step, an incomplete
1.75      rillig   2848: distfile is found, pkgsrc will try to resume it.</p>
                   2849: <p>You can also
1.168     wiz      2850: use a different program than the platform default program by changing the
1.117     jnemeth  2851: <code class="varname">FETCH_USING</code> variable.  You can specify the program by
                   2852: using of ftp, fetch, wget or curl.  Alternatively, fetching can be disabled
                   2853: by using the value manual.  A value of custom disables the system defaults
                   2854: and dependency tracking for the fetch program.  In that case you have to
                   2855: provide <code class="varname">FETCH_CMD</code>, <code class="varname">FETCH_BEFORE_ARGS</code>,
                   2856: <code class="varname">FETCH_RESUME_ARGS</code>, <code class="varname">FETCH_OUTPUT_ARGS</code>,
                   2857: <code class="varname">FETCH_AFTER_ARGS</code>.</p>
1.75      rillig   2858: <p>For example, if you want to use
1.117     jnemeth  2859: <code class="filename">wget</code> to download, you'll have to use something
1.75      rillig   2860: like:</p>
                   2861: <pre class="programlisting">
1.223     rillig   2862: FETCH_USING=    wget
1.1       grant    2863: </pre>
1.75      rillig   2864: </div>
1.148     asau     2865: <div class="sect1">
1.75      rillig   2866: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2867: <a name="x.org-from-pkgsrc"></a>10.5. How can I install/use modular X.org from pkgsrc?</h2></div></div></div>
1.103     wiz      2868: <p>If you want to use modular X.org from pkgsrc instead of your system's own X11
1.76      rillig   2869: (<code class="filename">/usr/X11R6</code>, <code class="filename">/usr/openwin</code>, ...)
1.75      rillig   2870: you will have to add the following line into
1.110     hubertf  2871: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
1.75      rillig   2872: <pre class="programlisting">
1.103     wiz      2873: X11_TYPE=modular
1.1       grant    2874: </pre>
1.75      rillig   2875: </div>
1.148     asau     2876: <div class="sect1">
1.75      rillig   2877: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2878: <a name="fetch-behind-firewall"></a>10.6. How to fetch files from behind a firewall</h2></div></div></div>
1.75      rillig   2879: <p>If you are sitting behind a firewall which does not allow direct
                   2880: connections to Internet hosts (i.e. non-NAT), you may specify the
                   2881: relevant proxy hosts.  This is done using an environment variable in the
                   2882: form of a URL, e.g. in Amdahl, the machine
1.128     wiz      2883: <span class="quote">&#8220;<span class="quote">orpheus.amdahl.com</span>&#8221;</span> is one of the firewalls, and it uses
1.75      rillig   2884: port 80 as the proxy port number.  So the proxy environment variables
                   2885: are:</p>
                   2886: <pre class="programlisting">
1.100     rillig   2887: ftp_proxy=ftp://orpheus.amdahl.com:80/
                   2888: http_proxy=http://orpheus.amdahl.com:80/
1.1       grant    2889: </pre>
1.75      rillig   2890: </div>
1.148     asau     2891: <div class="sect1">
1.75      rillig   2892: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2893: <a name="fetch-https"></a>10.7. How to fetch files from HTTPS sites</h2></div></div></div>
1.173     wiz      2894: <p>Some fetch tools are not prepared to support HTTPS by default
                   2895: (for example, the one in NetBSD 6.0), or the one installed by the
                   2896: pkgsrc bootstrap (to avoid an openssl dependency that low in the
                   2897: dependency graph).</p>
                   2898: <p>Usually you won't notice, because distribution files are
                   2899: mirrored weekly to <span class="quote">&#8220;<span class="quote">ftp.NetBSD.org</span>&#8221;</span>, but that might not
                   2900: be often enough if you are following pkgsrc-current. In that case, set
                   2901: <code class="varname">FETCH_USING</code> in your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file to
                   2902: <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
                   2903: with HTTPS support by default. Of course, these tools need to be
                   2904: installed before you can use them this way.</p>
                   2905: </div>
                   2906: <div class="sect1">
                   2907: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2908: <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.75      rillig   2909: <p>This depends on which utility is used to retrieve distfiles.  From
1.76      rillig   2910: <code class="filename">bsd.pkg.mk</code>, <code class="varname">FETCH_CMD</code> is assigned
1.75      rillig   2911: the first available command from the following list:</p>
1.148     asau     2912: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      2913: <li class="listitem"><p><code class="filename">${LOCALBASE}/bin/ftp</code></p></li>
                   2914: <li class="listitem"><p><code class="filename">/usr/bin/ftp</code></p></li>
1.75      rillig   2915: </ul></div>
                   2916: <p>On a default NetBSD installation, this will be
1.76      rillig   2917: <code class="filename">/usr/bin/ftp</code>, which automatically tries passive
1.75      rillig   2918: connections first, and falls back to active connections if the server
                   2919: refuses to do passive.  For the other tools, add the following to your
1.110     hubertf  2920: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file:
1.75      rillig   2921: <code class="varname">PASSIVE_FETCH=1</code>.</p>
                   2922: <p>Having that option present will prevent
1.76      rillig   2923: <code class="filename">/usr/bin/ftp</code> from falling back to active
1.75      rillig   2924: transfers.</p>
                   2925: </div>
1.148     asau     2926: <div class="sect1">
1.75      rillig   2927: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2928: <a name="fetching-all-distfiles"></a>10.9. How to fetch all distfiles at once</h2></div></div></div>
1.88      wiz      2929: <p>You would like to download all the distfiles in a single batch
1.110     hubertf  2930: from work or university, where you can't run a <span class="command"><strong>make
1.132     spz      2931: 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.75      rillig   2932: but downloading the entire directory may not be appropriate.</p>
1.110     hubertf  2933: <p>The answer here is to do a <span class="command"><strong>make fetch-list</strong></span> in
1.76      rillig   2934: <code class="filename">/usr/pkgsrc</code> or one of its subdirectories, carry the
1.75      rillig   2935: resulting list to your machine at work/school and use it there.  If you
1.322     leot     2936: don't have a NetBSD-compatible <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/ftp.1"><span class="citerefentry"><span class="refentrytitle">ftp</span>(1)</span></a> (like tnftp) at work, don't
1.75      rillig   2937: forget to set <code class="varname">FETCH_CMD</code> to something that fetches a
                   2938: URL:</p>
                   2939: <p>At home:</p>
                   2940: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
                   2941: <code class="prompt">%</code> <strong class="userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   2942: <code class="prompt">%</code> <strong class="userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong></pre>
                   2943: <p>At work:</p>
                   2944: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>sh /tmp/fetch.sh</code></strong></pre>
1.76      rillig   2945: <p>then tar up <code class="filename">/tmp/distfiles</code> and take it
1.75      rillig   2946: home.</p>
                   2947: <p>If you have a machine running NetBSD, and you want to get
1.88      wiz      2948: <span class="emphasis"><em>all</em></span> distfiles (even ones that aren't for your
                   2949: machine architecture), you can do so by using the above-mentioned
1.110     hubertf  2950: <span class="command"><strong>make fetch-list</strong></span> approach, or fetch the distfiles
1.88      wiz      2951: directly by running:</p>
1.75      rillig   2952: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make mirror-distfiles</code></strong></pre>
                   2953: <p>If you even decide to ignore
                   2954: <code class="varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you can get everything
                   2955: by running:</p>
                   2956: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch NO_SKIP=yes</code></strong></pre>
                   2957: </div>
1.148     asau     2958: <div class="sect1">
1.75      rillig   2959: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2960: <a name="tmac.andoc-missing"></a>10.10. What does <span class="quote">&#8220;<span class="quote">Don't know how to make
1.128     wiz      2961: /usr/share/tmac/tmac.andoc</span>&#8221;</span> mean?</h2></div></div></div>
1.322     leot     2962: <p>When compiling the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/index.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a>
1.75      rillig   2963: package, you get the error from make that it doesn't know how to make
1.76      rillig   2964: <code class="filename">/usr/share/tmac/tmac.andoc</code>? This indicates that
1.128     wiz      2965: you don't have installed the <span class="quote">&#8220;<span class="quote">text</span>&#8221;</span> set (nroff, ...) from
1.75      rillig   2966: the NetBSD base distribution on your machine.  It is recommended to do
                   2967: that to format man pages.</p>
1.322     leot     2968: <p>In the case of the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/index.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a> package, you
1.75      rillig   2969: can get away with setting <code class="varname">NOMAN=YES</code> either in the
1.110     hubertf  2970: environment or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75      rillig   2971: </div>
1.148     asau     2972: <div class="sect1">
1.75      rillig   2973: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   2974: <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.87      wiz      2975: <p>You didn't install the compiler set, <code class="filename">comp.tgz</code>,
1.75      rillig   2976: when you installed your NetBSD machine.  Please get and install it, by
1.76      rillig   2977: extracting it in <code class="filename">/</code>:</p>
1.75      rillig   2978: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /</code></strong>
                   2979: <code class="prompt">#</code> <strong class="userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong></pre>
1.76      rillig   2980: <p><code class="filename">comp.tgz</code> is part of every NetBSD release.  Get
1.110     hubertf  2981: the one that corresponds to your release (determine via <span class="command"><strong>uname
1.75      rillig   2982: -r</strong></span>).</p>
                   2983: </div>
1.148     asau     2984: <div class="sect1">
1.75      rillig   2985: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.336     nia      2986: <a name="using-sudo-with-pkgsrc"></a>10.12. Using 'sudo' or `priv` with pkgsrc</h2></div></div></div>
1.75      rillig   2987: <p>When installing packages as non-root user and using the just-in-time
1.322     leot     2988: <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/su.1"><span class="citerefentry"><span class="refentrytitle">su</span>(1)</span></a> feature of pkgsrc, it can become annoying to type in the root
1.75      rillig   2989: password for each required package installed.  To avoid this, the sudo
                   2990: package can be used, which does password caching over a limited time.  To
1.336     nia      2991: use it, install <span class="command"><strong>sudo</strong></span> or
                   2992: <span class="command"><strong>priv</strong></span> (either as binary package, from
                   2993: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/priv/index.html" target="_top"><code class="filename">security/priv</code></a>, or
1.322     leot     2994: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/security/sudo/index.html" target="_top"><code class="filename">security/sudo</code></a>) and then put the
1.110     hubertf  2995: following into your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, somewhere
1.98      wiz      2996: <span class="emphasis"><em>after</em></span> the definition of the
                   2997: <code class="varname">LOCALBASE</code> variable:</p>
1.75      rillig   2998: <pre class="programlisting">
1.100     rillig   2999: .if exists(${LOCALBASE}/bin/sudo)
                   3000: SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
                   3001: .endif
1.1       grant    3002: </pre>
1.75      rillig   3003: </div>
1.148     asau     3004: <div class="sect1">
1.75      rillig   3005: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   3006: <a name="faq.conf"></a>10.13. How do I change the location of configuration files?</h2></div></div></div>
1.75      rillig   3007: <p>As the system administrator, you can choose where configuration files
                   3008: are installed.  The default settings make all these files go into
1.76      rillig   3009: <code class="filename">${PREFIX}/etc</code> or some of its subdirectories; this may
1.75      rillig   3010: be suboptimal depending on your expectations (e.g., a read-only,
                   3011: NFS-exported <code class="varname">PREFIX</code> with a need of per-machine
                   3012: configuration of the provided packages).</p>
                   3013: <p>In order to change the defaults, you can modify the
                   3014: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.110     hubertf  3015: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>) to point to your preferred configuration
1.76      rillig   3016: directory; some common examples include <code class="filename">/etc</code> or
                   3017: <code class="filename">/etc/pkg</code>.</p>
1.75      rillig   3018: <p>Furthermore, you can change this value on a per-package basis by
                   3019: setting the <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> variable.
                   3020: <code class="varname">PKG_SYSCONFVAR</code>'s value usually matches the name of the
                   3021: package you would like to modify, that is, the contents of
                   3022: <code class="varname">PKGBASE</code>.</p>
                   3023: <p>Note that after changing these settings, you must rebuild and
                   3024: reinstall any affected packages.</p>
                   3025: </div>
1.148     asau     3026: <div class="sect1">
1.75      rillig   3027: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   3028: <a name="audit-packages"></a>10.14. Automated security checks</h2></div></div></div>
1.75      rillig   3029: <p>Please be aware that there can often be bugs in third-party software,
                   3030: and some of these bugs can leave a machine vulnerable to exploitation by
                   3031: attackers.  In an effort to lessen the exposure, the NetBSD packages team
                   3032: maintains a database of known-exploits to packages which have at one time
                   3033: been included in pkgsrc.  The database can be downloaded automatically, and
                   3034: a security audit of all packages installed on a system can take place.  To
1.114     jmcneill 3035: do this, refer to the following two tools (installed as part of the
1.322     leot     3036: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_install/index.html" target="_top"><code class="filename">pkgtools/pkg_install</code></a> package):</p>
1.128     wiz      3037: <div class="orderedlist"><ol class="orderedlist" type="1">
                   3038: <li class="listitem">
1.122     reed     3039: <p><span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, an easy way to
1.75      rillig   3040:     download a list of the security vulnerabilities information.  This list
1.132     spz      3041:     is kept up to date by the pkgsrc security team, and is distributed
                   3042:     from the NetBSD ftp server:</p>
1.292     leot     3043: <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.75      rillig   3044: </li>
1.128     wiz      3045: <li class="listitem"><p><span class="command"><strong>pkg_admin audit</strong></span>, an easy way to audit the
                   3046:     current machine, checking each known vulnerability.  If a
1.75      rillig   3047:     vulnerable package is installed, it will be shown by output to stdout,
                   3048:     including a description of the type of vulnerability, and a URL
                   3049:     containing more information.</p></li>
                   3050: </ol></div>
1.233     sevan    3051: <p>Use of these tools is strongly recommended!
1.317     nia      3052: See <a class="xref" href="#vulnerabilities" title="5.1.6. Checking for security vulnerabilities in installed packages">Section 5.1.6, &#8220;Checking for security vulnerabilities in installed packages&#8221;</a> for instructions on how to automate checking and
1.233     sevan    3053: reporting.</p>
                   3054: <p>If this database is installed, pkgsrc builds will use it to
                   3055: perform a security check before building any package.</p>
1.75      rillig   3056: </div>
1.148     asau     3057: <div class="sect1">
1.75      rillig   3058: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   3059: <a name="ufaq-cflags"></a>10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</h2></div></div></div>
1.75      rillig   3060: <p>When you add your own preferences to the
                   3061:        <code class="varname">CFLAGS</code> variable in your
1.110     hubertf  3062:        <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, these flags are passed in
1.76      rillig   3063:        environment variables to the <code class="filename">./configure</code>
1.322     leot     3064:        scripts and to <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>. Some package authors ignore the
1.75      rillig   3065:        <code class="varname">CFLAGS</code> from the environment variable by
1.76      rillig   3066:        overriding them in the <code class="filename">Makefile</code>s of their
1.75      rillig   3067:        package.</p>
                   3068: <p>Currently there is no solution to this problem. If you
                   3069:        really need the package to use your <code class="varname">CFLAGS</code>
1.110     hubertf  3070:        you should run <span class="command"><strong>make patch</strong></span> in the package
1.76      rillig   3071:        directory and then inspect any <code class="filename">Makefile</code> and
                   3072:        <code class="filename">Makefile.in</code> for whether they define
1.75      rillig   3073:        <code class="varname">CFLAGS</code> explicitly. Usually you can remove
1.128     wiz      3074:        these lines. But be aware that some <span class="quote">&#8220;<span class="quote">smart</span>&#8221;</span>
1.75      rillig   3075:        programmers write so bad code that it only works for the
                   3076:        specific combination of <code class="varname">CFLAGS</code> they have
                   3077:        chosen.</p>
1.287     rillig   3078: <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>
                   3079: <pre class="programlisting">
                   3080: CPPFLAGS+=              -Dpkgsrc___CPPFLAGS
                   3081: CFLAGS+=                -Dpkgsrc___CFLAGS
                   3082: CXXFLAGS+=              -Dpkgsrc___CXXFLAGS
                   3083: </pre>
                   3084: <p>Then run <span class="command"><strong>bmake show-all-configure show-all-build</strong></span>
                   3085: to see whether the above flags are passed to the actual build
                   3086: commands in general.</p>
                   3087: <p>To find out whether the flags are passed to individual compiler
                   3088: commands, have a look at the file <code class="filename">work/.work.log</code>. In
                   3089: most cases, the flags from the original command lines (the lines starting
                   3090: with <code class="literal">[*]</code>) are passed unmodified to the actual compiler
                   3091: (the lines starting with <code class="literal">&lt;.&gt;</code>). If the flag is
                   3092: missing from the actual compiler command, it must have been removed by
1.299     rillig   3093: the <a class="link" href="#build.wrapper" title="13.10. The wrapper phase">pkgsrc compiler wrappers</a>.</p>
1.75      rillig   3094: </div>
1.148     asau     3095: <div class="sect1">
1.80      rillig   3096: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   3097: <a name="ufaq-fail"></a>10.16. A package does not build.  What shall I do?</h2></div></div></div>
1.128     wiz      3098: <div class="procedure"><ol class="procedure" type="1">
1.148     asau     3099: <li class="step"><p>Make sure that your copy of pkgsrc is consistent. A
1.80      rillig   3100:        case that occurs often is that people only update pkgsrc in
                   3101:        parts, because of performance reasons. Since pkgsrc is one large
                   3102:        system, not a collection of many small systems, there are
                   3103:        sometimes changes that only work when the whole pkgsrc tree is
                   3104:        updated.</p></li>
1.148     asau     3105: <li class="step"><p>Make sure that you don't have any CVS conflicts.
1.128     wiz      3106:        Search for <span class="quote">&#8220;<span class="quote">&lt;&lt;&lt;&lt;&lt;&lt;</span>&#8221;</span> or
                   3107:        <span class="quote">&#8220;<span class="quote">&gt;&gt;&gt;&gt;&gt;&gt;</span>&#8221;</span> in all your pkgsrc
1.80      rillig   3108:        files.</p></li>
1.148     asau     3109: <li class="step"><p>Make sure that you don't have old copies of the packages
1.110     hubertf  3110:        extracted. Run <span class="command"><strong>make clean clean-depends</strong></span> to
1.80      rillig   3111:        verify this.</p></li>
1.218     rillig   3112: <li class="step"><p>If you are a package developer who wants to invest
1.267     rillig   3113:        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.148     asau     3114: <li class="step"><p>If the problem still exists, write a mail to the
1.80      rillig   3115:        <code class="literal">pkgsrc-users</code> mailing list.</p></li>
                   3116: </ol></div>
                   3117: </div>
1.148     asau     3118: <div class="sect1">
1.88      wiz      3119: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   3120: <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.89      rillig   3121: <p>You have modified a file from pkgsrc, and someone else has
                   3122: modified that same file afterwards in the CVS repository. Both changes
                   3123: are in the same region of the file, so when you updated pkgsrc, the
                   3124: <code class="literal">cvs</code> command marked the conflicting changes in the
                   3125: file. Because of these markers, the file is no longer a valid
                   3126: <code class="filename">Makefile</code>.</p>
                   3127: <p>Have a look at that file, and if you don't need your local changes
1.110     hubertf  3128: anymore, you can remove that file and run <span class="command"><strong>cvs -q update
1.89      rillig   3129: -dP</strong></span> in that directory to download the current version.</p>
                   3130: </div>
1.75      rillig   3131: </div>
                   3132: </div>
1.148     asau     3133: <div class="part">
1.75      rillig   3134: <div class="titlepage"><div><div><h1 class="title">
                   3135: <a name="developers-guide"></a>Part II. The pkgsrc developer's guide</h1></div></div></div>
1.148     asau     3136: <div class="partintro">
1.77      rillig   3137: <div></div>
                   3138: <p>This part of the book deals with creating and
1.128     wiz      3139:        modifying packages. It starts with a <span class="quote">&#8220;<span class="quote">HOWTO</span>&#8221;</span>-like
1.77      rillig   3140:        guide on creating a new package. The remaining chapters are more
                   3141:        like a reference manual for pkgsrc.</p>
1.75      rillig   3142: <div class="toc">
                   3143: <p><b>Table of Contents</b></p>
1.210     leot     3144: <dl class="toc">
1.267     rillig   3145: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
1.299     rillig   3146: <dt><span class="chapter"><a href="#components">12. Package components - files, directories and contents</a></span></dt>
1.91      rillig   3147: <dd><dl>
1.299     rillig   3148: <dt><span class="sect1"><a href="#components.Makefile">12.1. <code class="filename">Makefile</code></a></span></dt>
                   3149: <dt><span class="sect1"><a href="#components.distinfo">12.2. <code class="filename">distinfo</code></a></span></dt>
                   3150: <dt><span class="sect1"><a href="#components.patches">12.3. <code class="filename">patches/*</code></a></span></dt>
1.91      rillig   3151: <dd><dl>
1.299     rillig   3152: <dt><span class="sect2"><a href="#components.patch.structure">12.3.1. Structure of a single patch file</a></span></dt>
                   3153: <dt><span class="sect2"><a href="#components.patches.caveats">12.3.2. Creating patch files</a></span></dt>
                   3154: <dt><span class="sect2"><a href="#components.patches.sources">12.3.3. Sources where the patch files come from</a></span></dt>
                   3155: <dt><span class="sect2"><a href="#components.patches.guidelines">12.3.4. Patching guidelines</a></span></dt>
                   3156: <dt><span class="sect2"><a href="#components.patches.feedback">12.3.5. Feedback to the author</a></span></dt>
1.91      rillig   3157: </dl></dd>
1.299     rillig   3158: <dt><span class="sect1"><a href="#other-mandatory-files">12.4. Other mandatory files</a></span></dt>
                   3159: <dt><span class="sect1"><a href="#components.optional">12.5. Optional files</a></span></dt>
                   3160: <dd><dl>
                   3161: <dt><span class="sect2"><a href="#components.optional.bin">12.5.1. Files affecting the binary package</a></span></dt>
                   3162: <dt><span class="sect2"><a href="#components.optional.build">12.5.2. Files affecting the build process</a></span></dt>
                   3163: <dt><span class="sect2"><a href="#components.optional.none">12.5.3. Files affecting nothing at all</a></span></dt>
                   3164: </dl></dd>
                   3165: <dt><span class="sect1"><a href="#work-dir">12.6. <code class="filename">work*</code></a></span></dt>
                   3166: <dt><span class="sect1"><a href="#files-dir">12.7. <code class="filename">files/*</code></a></span></dt>
1.106     rillig   3167: </dl></dd>
1.299     rillig   3168: <dt><span class="chapter"><a href="#build">13. The build process</a></span></dt>
1.106     rillig   3169: <dd><dl>
1.299     rillig   3170: <dt><span class="sect1"><a href="#build.intro">13.1. Introduction</a></span></dt>
                   3171: <dt><span class="sect1"><a href="#build.prefix">13.2. Program location</a></span></dt>
                   3172: <dt><span class="sect1"><a href="#build.builddirs">13.3. Directories used during the build process</a></span></dt>
                   3173: <dt><span class="sect1"><a href="#build.running">13.4. Running a phase</a></span></dt>
                   3174: <dt><span class="sect1"><a href="#build.fetch">13.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
1.106     rillig   3175: <dd><dl>
1.299     rillig   3176: <dt><span class="sect2"><a href="#build.fetch.what">13.5.1. What to fetch and where to get it from</a></span></dt>
                   3177: <dt><span class="sect2"><a href="#build.fetch.how">13.5.2. How are the files fetched?</a></span></dt>
1.106     rillig   3178: </dl></dd>
1.299     rillig   3179: <dt><span class="sect1"><a href="#build.checksum">13.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
                   3180: <dt><span class="sect1"><a href="#build.extract">13.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
                   3181: <dt><span class="sect1"><a href="#build.patch">13.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
                   3182: <dt><span class="sect1"><a href="#build.tools">13.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
                   3183: <dt><span class="sect1"><a href="#build.wrapper">13.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
                   3184: <dt><span class="sect1"><a href="#build.configure">13.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   3185: <dt><span class="sect1"><a href="#build.build">13.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   3186: <dt><span class="sect1"><a href="#build.test">13.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
                   3187: <dt><span class="sect1"><a href="#build.install">13.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   3188: <dt><span class="sect1"><a href="#build.package">13.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
                   3189: <dt><span class="sect1"><a href="#build.clean">13.16. Cleaning up</a></span></dt>
                   3190: <dt><span class="sect1"><a href="#build.helpful-targets">13.17. Other helpful targets</a></span></dt>
                   3191: </dl></dd>
                   3192: <dt><span class="chapter"><a href="#creating">14. Creating a new pkgsrc package from scratch</a></span></dt>
                   3193: <dd><dl>
                   3194: <dt><span class="sect1"><a href="#creating.common">14.1. Common types of packages</a></span></dt>
1.106     rillig   3195: <dd><dl>
1.334     nia      3196: <dt><span class="sect2"><a href="#creating.python-module">14.1.1. Python modules and programs</a></span></dt>
                   3197: <dt><span class="sect2"><a href="#creating.R-package">14.1.2. R packages</a></span></dt>
                   3198: <dt><span class="sect2"><a href="#creating.TeX-package">14.1.3. TeXlive packages</a></span></dt>
1.106     rillig   3199: </dl></dd>
1.299     rillig   3200: <dt><span class="sect1"><a href="#creating.examples">14.2. Examples</a></span></dt>
                   3201: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">14.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
1.106     rillig   3202: </dl></dd>
1.299     rillig   3203: <dt><span class="chapter"><a href="#makefile">15. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.106     rillig   3204: <dd><dl>
1.299     rillig   3205: <dt><span class="sect1"><a href="#makefile.style">15.1. Caveats</a></span></dt>
                   3206: <dt><span class="sect1"><a href="#makefile.variables">15.2. <code class="filename">Makefile</code> variables</a></span></dt>
                   3207: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">15.2.1. Naming conventions</a></span></dt></dl></dd>
                   3208: <dt><span class="sect1"><a href="#makefile.code">15.3. Code snippets</a></span></dt>
1.106     rillig   3209: <dd><dl>
1.299     rillig   3210: <dt><span class="sect2"><a href="#adding-to-list">15.3.1. Adding things to a list</a></span></dt>
                   3211: <dt><span class="sect2"><a href="#echo-literal">15.3.2. Echoing a string exactly as-is</a></span></dt>
                   3212: <dt><span class="sect2"><a href="#cflags-gnu-configure">15.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
                   3213: <dt><span class="sect2"><a href="#empty-variables">15.3.4. Handling possibly empty variables</a></span></dt>
1.344     gutterid 3214: <dt><span class="sect2"><a href="#makefile.yesno">15.3.5. Testing yes/no variables in conditions</a></span></dt>
1.106     rillig   3215: </dl></dd>
                   3216: </dl></dd>
1.299     rillig   3217: <dt><span class="chapter"><a href="#options">16. Options handling</a></span></dt>
1.106     rillig   3218: <dd><dl>
1.299     rillig   3219: <dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
                   3220: <dt><span class="sect1"><a href="#converting-to-options">16.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
                   3221: <dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
                   3222: <dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
1.106     rillig   3223: </dl></dd>
1.299     rillig   3224: <dt><span class="chapter"><a href="#tools">17. Tools needed for building or running</a></span></dt>
1.106     rillig   3225: <dd><dl>
1.299     rillig   3226: <dt><span class="sect1"><a href="#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
                   3227: <dt><span class="sect1"><a href="#package-tools">17.2. Tools needed by packages</a></span></dt>
                   3228: <dt><span class="sect1"><a href="#platform-tools">17.3. Tools provided by platforms</a></span></dt>
                   3229: </dl></dd>
                   3230: <dt><span class="chapter"><a href="#buildlink">18. Buildlink methodology</a></span></dt>
                   3231: <dd><dl>
                   3232: <dt><span class="sect1"><a href="#converting-to-buildlink3">18.1. Converting packages to use buildlink3</a></span></dt>
                   3233: <dt><span class="sect1"><a href="#creating-buildlink3.mk">18.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106     rillig   3234: <dd><dl>
1.299     rillig   3235: <dt><span class="sect2"><a href="#anatomy-of-bl3">18.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
                   3236: <dt><span class="sect2"><a href="#updating-buildlink-depends">18.2.2. Updating
1.133     wiz      3237:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   3238:       and
                   3239:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   3240:       in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106     rillig   3241: </dl></dd>
1.299     rillig   3242: <dt><span class="sect1"><a href="#writing-builtin.mk">18.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
                   3243: <dd><dl>
                   3244: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">18.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
                   3245: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">18.3.2. Global preferences for native or pkgsrc software</a></span></dt>
                   3246: </dl></dd>
                   3247: </dl></dd>
                   3248: <dt><span class="chapter"><a href="#plist">19. PLIST issues</a></span></dt>
1.106     rillig   3249: <dd><dl>
1.299     rillig   3250: <dt><span class="sect1"><a href="#rcs-id">19.1. RCS ID</a></span></dt>
                   3251: <dt><span class="sect1"><a href="#automatic-plist-generation">19.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
                   3252: <dt><span class="sect1"><a href="#print-PLIST">19.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
                   3253: <dt><span class="sect1"><a href="#plist.misc">19.4. Variable substitution in PLIST</a></span></dt>
                   3254: <dt><span class="sect1"><a href="#manpage-compression">19.5. Man page compression</a></span></dt>
                   3255: <dt><span class="sect1"><a href="#using-PLIST_SRC">19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
                   3256: <dt><span class="sect1"><a href="#platform-specific-plist">19.7. Platform-specific and differing PLISTs</a></span></dt>
                   3257: <dt><span class="sect1"><a href="#build-plist">19.8. Build-specific PLISTs</a></span></dt>
                   3258: <dt><span class="sect1"><a href="#faq.common-dirs">19.9. Sharing directories between packages</a></span></dt>
1.106     rillig   3259: </dl></dd>
1.299     rillig   3260: <dt><span class="chapter"><a href="#pkginstall">20. The pkginstall framework</a></span></dt>
                   3261: <dd><dl>
                   3262: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">20.1. Files and directories outside the installation prefix</a></span></dt>
                   3263: <dd><dl>
                   3264: <dt><span class="sect2"><a href="#dirs-outside-prefix">20.1.1. Directory manipulation</a></span></dt>
                   3265: <dt><span class="sect2"><a href="#files-outside-prefix">20.1.2. File manipulation</a></span></dt>
1.106     rillig   3266: </dl></dd>
1.299     rillig   3267: <dt><span class="sect1"><a href="#conf-files">20.2. Configuration files</a></span></dt>
1.106     rillig   3268: <dd><dl>
1.299     rillig   3269: <dt><span class="sect2"><a href="#conf-files-sysconfdir">20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
                   3270: <dt><span class="sect2"><a href="#conf-files-configure">20.2.2. Telling the software where configuration files are</a></span></dt>
                   3271: <dt><span class="sect2"><a href="#conf-files-patching">20.2.3. Patching installations</a></span></dt>
                   3272: <dt><span class="sect2"><a href="#conf-files-disable">20.2.4. Disabling handling of configuration files</a></span></dt>
                   3273: </dl></dd>
                   3274: <dt><span class="sect1"><a href="#rcd-scripts">20.3. System startup scripts</a></span></dt>
                   3275: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">20.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
                   3276: <dt><span class="sect1"><a href="#users-and-groups">20.4. System users and groups</a></span></dt>
                   3277: <dt><span class="sect1"><a href="#shells">20.5. System shells</a></span></dt>
                   3278: <dd><dl><dt><span class="sect2"><a href="#shells-disable">20.5.1. Disabling shell registration</a></span></dt></dl></dd>
                   3279: <dt><span class="sect1"><a href="#fonts">20.6. Fonts</a></span></dt>
                   3280: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">20.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
1.267     rillig   3281: </dl></dd>
                   3282: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
                   3283: <dd><dl>
                   3284: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
                   3285: <dd><dl>
                   3286: <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>
                   3287: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
                   3288: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
                   3289: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
                   3290: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
                   3291: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
                   3292: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
                   3293: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
                   3294: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
                   3295: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
                   3296: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
                   3297: </dl></dd>
                   3298: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   3299: <dd><dl>
                   3300: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
                   3301: <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>
                   3302: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
                   3303: </dl></dd>
                   3304: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   3305: <dd><dl>
                   3306: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
                   3307: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
                   3308: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
1.338     nia      3309: <dt><span class="sect2"><a href="#meson">21.3.4. Meson / ninja</a></span></dt>
1.267     rillig   3310: </dl></dd>
                   3311: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
                   3312: <dd><dl>
                   3313: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
                   3314: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
1.320     wiz      3315: <dt><span class="sect2"><a href="#go-programming-language">21.4.3. Go</a></span></dt>
1.338     nia      3316: <dt><span class="sect2"><a href="#rust-programming-language">21.4.4. Rust</a></span></dt>
                   3317: <dt><span class="sect2"><a href="#perl-scripts">21.4.5. Packages containing Perl scripts</a></span></dt>
                   3318: <dt><span class="sect2"><a href="#shell-scripts">21.4.6. Packages containing shell scripts</a></span></dt>
                   3319: <dt><span class="sect2"><a href="#other-programming-languages">21.4.7. Other programming languages</a></span></dt>
1.267     rillig   3320: </dl></dd>
                   3321: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   3322: <dd><dl>
                   3323: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
                   3324: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.287     rillig   3325: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
                   3326: <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>
                   3327: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.267     rillig   3328: </dl></dd>
                   3329: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   3330: <dd><dl>
                   3331: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
                   3332: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
                   3333: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
                   3334: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
                   3335: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
1.318     nia      3336: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing Perl modules</a></span></dt>
1.267     rillig   3337: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
                   3338: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
1.318     nia      3339: <dt><span class="sect2"><a href="#x11-fonts">21.6.9. Packages installing X11 fonts</a></span></dt>
                   3340: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.10. Packages installing SGML or XML data</a></span></dt>
                   3341: <dt><span class="sect2"><a href="#mime-database">21.6.11. Packages installing extensions to the MIME database</a></span></dt>
                   3342: <dt><span class="sect2"><a href="#intltool">21.6.12. Packages using intltool</a></span></dt>
                   3343: <dt><span class="sect2"><a href="#startup-scripts">21.6.13. Packages installing startup scripts</a></span></dt>
                   3344: <dt><span class="sect2"><a href="#tex-packages">21.6.14. Packages installing TeX modules</a></span></dt>
                   3345: <dt><span class="sect2"><a href="#emulation-packages">21.6.15. Packages supporting running binaries in
1.87      wiz      3346:     emulation</a></span></dt>
1.318     nia      3347: <dt><span class="sect2"><a href="#hicolor-theme">21.6.16. Packages installing hicolor icons</a></span></dt>
                   3348: <dt><span class="sect2"><a href="#desktop-files">21.6.17. Packages installing desktop files</a></span></dt>
1.77      rillig   3349: </dl></dd>
1.267     rillig   3350: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.77      rillig   3351: </dl></dd>
1.299     rillig   3352: <dt><span class="chapter"><a href="#gnome">22. GNOME packaging and porting</a></span></dt>
                   3353: <dd><dl>
                   3354: <dt><span class="sect1"><a href="#meta-packages">22.1. Meta packages</a></span></dt>
                   3355: <dt><span class="sect1"><a href="#new-package">22.2. Packaging a GNOME application</a></span></dt>
                   3356: <dt><span class="sect1"><a href="#full-update">22.3. Updating GNOME to a newer version</a></span></dt>
                   3357: <dt><span class="sect1"><a href="#patching">22.4. Patching guidelines</a></span></dt>
                   3358: </dl></dd>
1.267     rillig   3359: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.77      rillig   3360: <dd><dl>
1.267     rillig   3361: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
                   3362: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
                   3363: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
                   3364: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
                   3365: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
                   3366: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
                   3367: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
                   3368: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
                   3369: </dl></dd>
                   3370: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
1.75      rillig   3371: </dl>
                   3372: </div>
1.77      rillig   3373: </div>
1.148     asau     3374: <div class="chapter">
1.77      rillig   3375: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   3376: <a name="help-devel"></a>Chapter 11. Getting help</h2></div></div></div>
                   3377: <p>
                   3378:        To get help when developing pkgsrc, the definitive source is this
                   3379:        document, the pkgsrc guide. If you don't find anything here,
                   3380:        there are alternatives:
                   3381: </p>
                   3382: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3383: <li class="listitem">
                   3384: <p>
                   3385:        The built-in pkgsrc help, which is available after bootstrapping
                   3386:        pkgsrc. Run <span class="command"><strong>bmake help topic=&#8230;</strong></span> to get
                   3387:        help for any topic, such as a variable name like
                   3388:        <code class="varname">BUILD_DEFS</code>, a make target like
                   3389:        <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
                   3390:        <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
1.322     leot     3391: <p>The available help topics are listed in <a class="xref" href="#help-topics" title="Appendix E. Help topics">Appendix E, <i>Help topics</i></a>.</p>
1.267     rillig   3392: </li>
                   3393: <li class="listitem"><p>
1.278     rillig   3394:        To see the value of a single variable, run <span class="command"><strong>bmake
                   3395:        show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
                   3396: </p></li>
                   3397: <li class="listitem"><p>
                   3398:        To see the values of the most common variables, run
                   3399:        <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
                   3400:        topic. To see the variables for a single topic, run
                   3401:        <span class="command"><strong>bmake
                   3402:        show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
                   3403:        <span class="command"><strong>bmake show-all-fetch</strong></span>.
                   3404: </p></li>
                   3405: <li class="listitem"><p>
1.267     rillig   3406:        The tech-pkg mailing list, to which
                   3407:        <a class="ulink" href="https://www.NetBSD.org/mailinglists/#tech-pkg" target="_top">you
                   3408:        can subscribe</a> and then <a class="ulink" href="mailto:tech-pkg@NetBSD.org" target="_top">ask your
                   3409:        questions</a>.</p></li>
                   3410: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
                   3411:        <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
                   3412:        or by using a specialized chat program such as
                   3413:        <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
                   3414:        Pick any user name and join the channel #pkgsrc.</p></li>
                   3415: </ul></div>
                   3416: </div>
                   3417: <div class="chapter">
                   3418: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   3419: <a name="components"></a>Chapter 12. Package components - files, directories and contents</h2></div></div></div>
1.91      rillig   3420: <div class="toc">
                   3421: <p><b>Table of Contents</b></p>
1.210     leot     3422: <dl class="toc">
1.299     rillig   3423: <dt><span class="sect1"><a href="#components.Makefile">12.1. <code class="filename">Makefile</code></a></span></dt>
                   3424: <dt><span class="sect1"><a href="#components.distinfo">12.2. <code class="filename">distinfo</code></a></span></dt>
                   3425: <dt><span class="sect1"><a href="#components.patches">12.3. <code class="filename">patches/*</code></a></span></dt>
                   3426: <dd><dl>
                   3427: <dt><span class="sect2"><a href="#components.patch.structure">12.3.1. Structure of a single patch file</a></span></dt>
                   3428: <dt><span class="sect2"><a href="#components.patches.caveats">12.3.2. Creating patch files</a></span></dt>
                   3429: <dt><span class="sect2"><a href="#components.patches.sources">12.3.3. Sources where the patch files come from</a></span></dt>
                   3430: <dt><span class="sect2"><a href="#components.patches.guidelines">12.3.4. Patching guidelines</a></span></dt>
                   3431: <dt><span class="sect2"><a href="#components.patches.feedback">12.3.5. Feedback to the author</a></span></dt>
                   3432: </dl></dd>
                   3433: <dt><span class="sect1"><a href="#other-mandatory-files">12.4. Other mandatory files</a></span></dt>
                   3434: <dt><span class="sect1"><a href="#components.optional">12.5. Optional files</a></span></dt>
                   3435: <dd><dl>
                   3436: <dt><span class="sect2"><a href="#components.optional.bin">12.5.1. Files affecting the binary package</a></span></dt>
                   3437: <dt><span class="sect2"><a href="#components.optional.build">12.5.2. Files affecting the build process</a></span></dt>
                   3438: <dt><span class="sect2"><a href="#components.optional.none">12.5.3. Files affecting nothing at all</a></span></dt>
1.91      rillig   3439: </dl></dd>
1.299     rillig   3440: <dt><span class="sect1"><a href="#work-dir">12.6. <code class="filename">work*</code></a></span></dt>
                   3441: <dt><span class="sect1"><a href="#files-dir">12.7. <code class="filename">files/*</code></a></span></dt>
1.91      rillig   3442: </dl>
                   3443: </div>
1.299     rillig   3444: <p>Whenever you're preparing a package, there are a number of
                   3445: files involved which are described in the following
                   3446: sections.</p>
                   3447: <div class="sect1">
                   3448: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   3449: <a name="components.Makefile"></a>12.1. <code class="filename">Makefile</code>
                   3450: </h2></div></div></div>
                   3451: <p>Building, installation and creation of a binary package are all
                   3452:   controlled by the package's <code class="filename">Makefile</code>.
                   3453:   The <code class="filename">Makefile</code> describes various things about
                   3454:   a package, for example from where to get it, how to configure,
                   3455:   build, and install it.</p>
                   3456: <p>A package <code class="filename">Makefile</code> contains several
                   3457:   sections that describe the package.</p>
                   3458: <p>In the first section there are the following variables, which
                   3459:   should appear exactly in the order given here.  The order and
                   3460:   grouping of the variables is mostly historical and has no further
                   3461:   meaning.</p>
                   3462: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3463: <li class="listitem"><p><code class="varname">DISTNAME</code> is the basename of the
                   3464:     distribution file to be downloaded from the package's
                   3465:     website.</p></li>
                   3466: <li class="listitem"><p><code class="varname">PKGNAME</code> is the name of the
                   3467:     package, as used by pkgsrc. You need to provide it if
                   3468:     <code class="varname">DISTNAME</code> (which is the default) is not a good
                   3469:     name for the package in pkgsrc or <code class="varname">DISTNAME</code> is not
                   3470:     provided (no distribution file is required).  Usually it is the pkgsrc
                   3471:     directory name together with the version number. It must match the
                   3472:     regular expression
                   3473:     <code class="varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>, that is, it
                   3474:     starts with a letter or digit, and contains only letters, digits,
1.319     nia      3475:     dashes, underscores, dots and plus signs.
                   3476:     New packages should have entirely lower-case names, with the exception
                   3477:     of some that must follow pre-existing conventions
                   3478:     (e.g. R packages begin with <code class="varname">R-</code>).
                   3479:     You can use the <code class="code">:tl</code> variable modifier to lower-case
                   3480:     the package name.</p></li>
1.299     rillig   3481: <li class="listitem">
                   3482: <p><code class="varname">CATEGORIES</code> is a list of categories
                   3483:     which the package fits in. You can choose any of the top-level
                   3484:     directories of pkgsrc for it.</p>
                   3485: <p>Currently the following values are available for
                   3486:     <code class="varname">CATEGORIES</code>. If more than
                   3487:     one is used, they need to be separated by spaces:</p>
1.77      rillig   3488: <pre class="programlisting">
1.299     rillig   3489: archivers     cross         geography     meta-pkgs     security
                   3490: audio         databases     graphics      misc          shells
                   3491: benchmarks    devel         ham           multimedia    sysutils
                   3492: biology       editors       inputmethod   net           textproc
                   3493: cad           emulators     lang          news          time
                   3494: chat          finance       mail          parallel      wm
                   3495: comms         fonts         math          pkgtools      www
                   3496: converters    games         mbone         print         x11
1.77      rillig   3497: </pre>
                   3498: </li>
1.299     rillig   3499: <li class="listitem"><p><code class="varname">MASTER_SITES</code>,
                   3500:     <code class="varname">DYNAMIC_MASTER_SITES</code>,
                   3501:     <code class="varname">DIST_SUBDIR</code>, <code class="varname">EXTRACT_SUFX</code>
                   3502:     and <code class="varname">DISTFILES</code> are discussed in detail in
                   3503:     <a class="xref" href="#build.fetch" title="13.5. The fetch phase">Section 13.5, &#8220;The <span class="emphasis"><em>fetch</em></span> phase&#8221;</a>.</p></li>
                   3504: </ul></div>
                   3505: <p>The second section contains information about separately
                   3506:   downloaded patches, if any.
                   3507:   </p>
                   3508: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3509: <li class="listitem"><p><code class="varname">PATCHFILES</code>:
                   3510:     Name(s) of additional files that contain distribution patches.
                   3511:     There is no default. pkgsrc will look for them at
                   3512:     <code class="varname">PATCH_SITES</code>.
                   3513:     They will automatically be uncompressed before patching if
                   3514:     the names end with <code class="filename">.gz</code> or
                   3515:     <code class="filename">.Z</code>.</p></li>
                   3516: <li class="listitem"><p><code class="varname">PATCH_SITES</code>:
                   3517:     Primary location(s) for distribution patch files (see
                   3518:     <code class="varname">PATCHFILES</code> above) if not found locally.</p></li>
                   3519: <li class="listitem"><p><code class="varname">PATCH_DIST_STRIP</code>:
1.322     leot     3520:     an argument to <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/patch.1"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> that sets the pathname strip count to
1.299     rillig   3521:     help find the correct files to patch. It defaults to
                   3522:     <span class="command"><strong>-p0</strong></span>.</p></li>
                   3523: </ul></div>
                   3524: <p>The third section contains the following variables.
                   3525:   </p>
                   3526: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3527: <li class="listitem"><p><code class="varname">MAINTAINER</code> is the email
                   3528:     address of the person who feels responsible for this package,
                   3529:     and who is most likely to look at problems or questions regarding
1.322     leot     3530:     this package which have been reported with <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/send-pr.1"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a>.
1.299     rillig   3531:     Other developers may contact the <code class="varname">MAINTAINER</code>
                   3532:     before making changes to the package, but are not required to
                   3533:     do so. When packaging a new program, set <code class="varname">MAINTAINER</code>
                   3534:     to yourself. If you really can't maintain the package for future
                   3535:     updates, set it to
                   3536:     <code class="email">&lt;<a class="email" href="mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>&gt;</code>.</p></li>
                   3537: <li class="listitem"><p><code class="varname">OWNER</code> should be used instead
                   3538:     of <code class="varname">MAINTAINER</code> when you do not want other
                   3539:     developers to update or change the package without contacting
                   3540:     you first. A package Makefile should contain one of
                   3541:     <code class="varname">MAINTAINER</code> or <code class="varname">OWNER</code>, but
                   3542:     not both.  </p></li>
                   3543: <li class="listitem"><p><code class="varname">HOMEPAGE</code> is a URL where users can
                   3544:     find more information about the package.</p></li>
                   3545: <li class="listitem"><p><code class="varname">COMMENT</code> is a one-line
                   3546:     description of the package (should not include the package
                   3547:     name).</p></li>
                   3548: <li class="listitem"><p><code class="varname">LICENSE</code> indicates the license(s)
                   3549:     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>
                   3550: </ul></div>
                   3551: <p>Other variables that affect the build:
                   3552:   </p>
                   3553: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
                   3554: <p><code class="varname">WRKSRC</code>: The directory where the
                   3555:       interesting distribution files of the package are found. The
                   3556:       default is <code class="filename">${WRKDIR}/${DISTNAME}</code>, which
                   3557:       works for most packages.</p>
                   3558: <p>If a package doesn't create a subdirectory for itself
                   3559:       (most GNU software does, for instance), but extracts itself in
                   3560:       the current directory, you should set
                   3561:       <code class="varname">WRKSRC=${WRKDIR}</code>.</p>
                   3562: <p>If a package doesn't create a subdirectory with the
                   3563:       name of <code class="varname">DISTNAME</code> but some different name,
                   3564:       set <code class="varname">WRKSRC</code> to point to the proper name in
                   3565:       <code class="filename">${WRKDIR}</code>, for example
                   3566:       <code class="varname">WRKSRC=${WRKDIR}/${DISTNAME}/unix</code>. See
1.322     leot     3567:       <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/tcl/index.html" target="_top"><code class="filename">lang/tcl</code></a> and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/tk/index.html" target="_top"><code class="filename">x11/tk</code></a> for other examples.</p>
1.299     rillig   3568: <p>The name of the working directory created by pkgsrc is
                   3569:       taken from the <code class="varname">WRKDIR_BASENAME</code>
                   3570:       variable. By default, its value is
                   3571:       <code class="filename">work</code>. If you want to use the same
                   3572:       pkgsrc tree for building different kinds of binary packages,
                   3573:       you can change the variable according to your needs. Two
                   3574:       other variables handle common cases of setting
                   3575:       <code class="varname">WRKDIR_BASENAME</code> individually. If
                   3576:       <code class="varname">OBJHOSTNAME</code> is defined in
                   3577:       <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the first component of
                   3578:       the host's name is attached to the directory name. If
                   3579:       <code class="varname">OBJMACHINE</code> is defined, the platform name
                   3580:       is attached, which might look like
                   3581:       <code class="filename">work.i386</code> or
                   3582:       <code class="filename">work.sparc</code>.</p>
                   3583: </li></ul></div>
                   3584: <p>Please pay attention to the following gotchas:</p>
                   3585: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3586: <li class="listitem"><p>Add <code class="varname">MANCOMPRESSED</code> if man pages are
                   3587:       installed in compressed form by the package.  For packages using
                   3588:       BSD-style makefiles which honor MANZ, there is
                   3589:       <code class="varname">MANCOMPRESSED_IF_MANZ</code>.</p></li>
                   3590: <li class="listitem"><p>Replace <code class="filename">/usr/local</code> with
                   3591:       <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span> in all files (see patches,
                   3592:       below).</p></li>
                   3593: <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>
                   3594: </ul></div>
                   3595: </div>
1.148     asau     3596: <div class="sect1">
1.91      rillig   3597: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   3598: <a name="components.distinfo"></a>12.2. <code class="filename">distinfo</code>
                   3599: </h2></div></div></div>
                   3600: <p>The <code class="filename">distinfo</code> file contains the message
                   3601:   digest, or checksum, of each distfile needed for the package. This
                   3602:   ensures that the distfiles retrieved from the Internet have not been
                   3603:   corrupted during transfer or altered by a malign force to introduce
                   3604:   a security hole. To provide maximum security, all distfiles are
                   3605:   protected using three different message digest algorithms (SHA1,
                   3606:   RMD160, SHA512), as well as the file size.</p>
                   3607: <p>The <code class="filename">distinfo</code> file also contains the
                   3608:   checksums for all the patches found in the
                   3609:   <code class="filename">patches</code> directory (see <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, &#8220;<code class="filename">patches/*</code>&#8221;</a>). These checksums ensure that patches
                   3610:   are only applied intentionally and that they don't accidentally change,
                   3611:   e.g. when merging different changes together. They also make sure that
                   3612:   new patches are actually added to CVS and old ones are removed.
                   3613:   Too see whether the patches and the <code class="filename">distinfo</code> file
                   3614:   match, run <span class="command"><strong>pkglint</strong></span> after changing the patches.</p>
                   3615: <p>To regenerate the <code class="filename">distinfo</code> file, use the
                   3616:   <span class="command"><strong>make distinfo</strong></span> command.</p>
                   3617: <p>Some packages have different sets of distfiles depending on
1.322     leot     3618:   the platform, for example <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/openjdk8/index.html" target="_top"><code class="filename">lang/openjdk8</code></a>. These are kept in the same
1.299     rillig   3619:   <code class="filename">distinfo</code> file and care should be taken when
                   3620:   upgrading such a package to ensure distfile information is not
                   3621:   lost.</p>
                   3622: </div>
                   3623: <div class="sect1">
                   3624: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   3625: <a name="components.patches"></a>12.3. <code class="filename">patches/*</code>
                   3626: </h2></div></div></div>
                   3627: <p>Some packages don't work out-of-the box on the various
                   3628:   platforms that are supported by pkgsrc. These packages need
                   3629:   to be patched to make them work. The patch files can be
                   3630:   found in the <code class="filename">patches/</code> directory.</p>
                   3631: <p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are
                   3632:   applied to the files in <code class="varname">WRKSRC</code> directory after
                   3633:   extracting them, in alphabetic order.</p>
1.148     asau     3634: <div class="sect2">
1.91      rillig   3635: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   3636: <a name="components.patch.structure"></a>12.3.1. Structure of a single patch file</h3></div></div></div>
                   3637: <p>The <code class="filename">patch-*</code> files should be in
                   3638:   <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid
                   3639:   problems. (To force patches to apply with fuzz you can set
                   3640:   <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch
                   3641:   should contain only changes for a single file, and no file should be
                   3642:   patched by more than one patch file. This helps to keep future
                   3643:   modifications simple.</p>
                   3644: <p>Each patch file is structured as follows: In the first line,
                   3645:   there is the RCS Id of the patch itself. The second line should be
                   3646:   empty for aesthetic reasons. After that, there should be a comment for
                   3647:   each change that the patch does. There are a number of standard
                   3648:   cases:</p>
                   3649: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3650: <li class="listitem"><p>Patches for commonly known vulnerabilities should
                   3651:   mention the vulnerability ID (CAN, CVE).</p></li>
                   3652: <li class="listitem"><p>Patches that change source code should mention the
                   3653:   platform and other environment (for example, the compiler) that the
                   3654:   patch is needed for.</p></li>
                   3655: </ul></div>
                   3656: <p>The patch should be commented so that any
                   3657:   developer who knows the code of the application can make some use of
                   3658:   the patch. Special care should be taken for the upstream developers,
                   3659:   since we generally want that they accept our patches, so we have less
                   3660:   work in the future.</p>
1.91      rillig   3661: </div>
1.148     asau     3662: <div class="sect2">
1.91      rillig   3663: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   3664: <a name="components.patches.caveats"></a>12.3.2. Creating patch files</h3></div></div></div>
                   3665: <p>One important thing to mention is to pay attention that no RCS
                   3666:   IDs get stored in the patch files, as these will cause problems when
                   3667:   later checked into the NetBSD CVS tree. Use the
1.322     leot     3668:   <span class="command"><strong>pkgdiff</strong></span> command from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/index.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package to avoid these
1.299     rillig   3669:   problems.</p>
                   3670: <p>For even more automation, we recommend using
                   3671:   <span class="command"><strong>mkpatches</strong></span> from the same package to make a
1.337     gutterid 3672:   whole set of patches. You just have to back up files before you
                   3673:   edit them to <code class="filename">filename.orig</code>, e.g., with
1.299     rillig   3674:   <span class="command"><strong>cp -p filename filename.orig</strong></span> or, easier, by
                   3675:   using <span class="command"><strong>pkgvi</strong></span> again from the same package. If
                   3676:   you upgrade a package this way, you can easily compare the new
                   3677:   set of patches with the previously existing one with
                   3678:   <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code>
                   3679:   are replaced by new files, so carefully check if you want to take all
                   3680:   the changes.</p>
                   3681: <p>When you have finished a package, remember to generate
                   3682:   the checksums for the patch files by using the <span class="command"><strong>make
                   3683:   makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="12.2. distinfo">Section 12.2, &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
                   3684: <p>When adding a patch that corrects a problem in the
                   3685:   distfile (rather than e.g. enforcing pkgsrc's view of where
                   3686:   man pages should go), send the patch as a bug report to the
                   3687:   maintainer.  This benefits non-pkgsrc users of the package,
                   3688:   and usually makes it possible to remove the patch in future
                   3689:   version.</p>
                   3690: <p>The file names of the patch files are usually of the form
                   3691:   <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>.
                   3692:   Many packages still use the previous convention
                   3693:   <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>,
                   3694:   but new patches should be of the form containing the filename.
1.322     leot     3695:   <span class="command"><strong>mkpatches</strong></span> included in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/index.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> takes care of the name
1.299     rillig   3696:   automatically.</p>
1.337     gutterid 3697: <p>When updating pre-existing patch files, if a file uses the old
                   3698:   <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>
                   3699:   convention, it's best not to change it to the new form, as that will
                   3700:   just cause churn that makes it harder to track changes to patching
                   3701:   over time. Similarly, if a patch now applies at different line offsets,
                   3702:   but still applies cleanly as-is, there's no need to update it, as that
                   3703:   also unnecessarily complicates the patch history.</p>
1.118     imil     3704: </div>
1.275     brook    3705: <div class="sect2">
                   3706: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   3707: <a name="components.patches.sources"></a>12.3.3. Sources where the patch files come from</h3></div></div></div>
                   3708: <p>If you want to share patches between multiple packages
                   3709:   in pkgsrc, e.g. because they use the same distfiles, set
                   3710:   <code class="varname">PATCHDIR</code> to the path where the patch files
                   3711:   can be found, e.g.:</p>
                   3712: <pre class="programlisting">
                   3713: PATCHDIR=       ../../editors/xemacs/patches
                   3714: </pre>
                   3715: <p>Patch files that are distributed by the author or other
                   3716:     maintainers can be listed in
                   3717:     <code class="varname">PATCHFILES</code>.</p>
                   3718: <p>If it is desired to store any patches that should not be
                   3719:     committed into pkgsrc, they can be kept outside the pkgsrc
                   3720:     tree in the <code class="filename">$LOCALPATCHES</code> directory. The
                   3721:     directory tree there is expected to have the same
                   3722:     <span class="quote">&#8220;<span class="quote">category/package</span>&#8221;</span> structure as pkgsrc, and
                   3723:     patches are expected to be stored inside these dirs (also
                   3724:     known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For
                   3725:     example, if you want to keep a private patch for
                   3726:     <code class="filename">pkgsrc/graphics/png</code>, keep it in
                   3727:     <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   3728:     files in the named directory are expected to be patch files,
                   3729:     and <span class="emphasis"><em>they are applied after pkgsrc patches are
                   3730:     applied</em></span>.</p>
1.275     brook    3731: </div>
                   3732: <div class="sect2">
                   3733: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   3734: <a name="components.patches.guidelines"></a>12.3.4. Patching guidelines</h3></div></div></div>
                   3735: <p>When fixing a portability issue in the code do not use
                   3736:       preprocessor magic to check for the current operating system nor
                   3737:       platform.  Doing so hurts portability to other platforms because
                   3738:       the OS-specific details are not abstracted appropriately.</p>
                   3739: <p>The general rule to follow is: instead of checking for the
                   3740:       operating system the application is being built on, check for the
                   3741:       specific <span class="emphasis"><em>features</em></span> you need.  For example,
                   3742:       instead of assuming that kqueue is available under NetBSD and
                   3743:       using the <code class="varname">__NetBSD__</code> macro to conditionalize
                   3744:       kqueue support, add a check that detects kqueue itself &mdash;
                   3745:       yes, this generally involves patching the
                   3746:       <span class="command"><strong>configure</strong></span> script.  There is absolutely nothing
                   3747:       that prevents some OSes from adopting interfaces from other OSes
                   3748:       (e.g. Linux implementing kqueue), something that the above checks
                   3749:       cannot take into account.</p>
                   3750: <p>Of course, checking for features generally involves more
                   3751:       work on the developer's side, but the resulting changes are
                   3752:       cleaner and there are chances they will work on many other
                   3753:       platforms.  Not to mention that there are higher chances of being
                   3754:       later integrated into the mainstream sources.  Remember:
                   3755:       <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p>
                   3756: <p>Some typical examples:</p>
                   3757: <div class="table">
                   3758: <a name="patch-examples"></a><p class="title"><b>Table 12.1. Patching examples</b></p>
                   3759: <div class="table-contents"><table class="table" summary="Patching examples" border="1">
                   3760: <colgroup>
                   3761: <col>
                   3762: <col>
                   3763: <col>
                   3764: </colgroup>
                   3765: <thead><tr>
                   3766: <th>Where</th>
                   3767: <th>Incorrect</th>
                   3768: <th>Correct</th>
                   3769: </tr></thead>
                   3770: <tbody>
                   3771: <tr>
                   3772: <td>configure script</td>
                   3773: <td>
1.275     brook    3774: <pre class="programlisting">
1.299     rillig   3775: case ${target_os} in
                   3776: netbsd*) have_kvm=yes ;;
                   3777: *)       have_kvm=no  ;;
                   3778: esac
1.275     brook    3779: </pre>
1.299     rillig   3780:              </td>
                   3781: <td>
1.275     brook    3782: <pre class="programlisting">
1.299     rillig   3783: AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)
1.275     brook    3784: </pre>
1.299     rillig   3785:              </td>
                   3786: </tr>
                   3787: <tr>
                   3788: <td>C source file</td>
                   3789: <td>
1.91      rillig   3790: <pre class="programlisting">
1.299     rillig   3791: #if defined(__NetBSD__)
                   3792: #  include &lt;sys/event.h&gt;
                   3793: #endif
1.91      rillig   3794: </pre>
1.299     rillig   3795:              </td>
                   3796: <td>
1.91      rillig   3797: <pre class="programlisting">
1.299     rillig   3798: #if defined(HAVE_SYS_EVENT_H)
                   3799: #  include &lt;sys/event.h&gt;
                   3800: #endif
1.91      rillig   3801: </pre>
1.299     rillig   3802:              </td>
                   3803: </tr>
                   3804: <tr>
                   3805: <td>C source file</td>
                   3806: <td>
1.91      rillig   3807: <pre class="programlisting">
1.299     rillig   3808: int
                   3809: monitor_file(...)
                   3810: {
                   3811: #if defined(__NetBSD__)
                   3812:         int fd = kqueue();
                   3813:         ...
                   3814: #else
                   3815:         ...
                   3816: #endif
                   3817: }
1.91      rillig   3818: </pre>
1.299     rillig   3819:              </td>
                   3820: <td>
1.91      rillig   3821: <pre class="programlisting">
1.299     rillig   3822: int
                   3823: monitor_file(...)
                   3824: {
                   3825: #if defined(HAVE_KQUEUE)
                   3826:         int fd = kqueue();
                   3827:         ...
                   3828: #else
                   3829:         ...
                   3830: #endif
                   3831: }
1.91      rillig   3832: </pre>
1.299     rillig   3833:              </td>
                   3834: </tr>
                   3835: </tbody>
                   3836: </table></div>
                   3837: </div>
                   3838: <br class="table-break">
                   3839: </div>
                   3840: <div class="sect2">
                   3841: <div class="titlepage"><div><div><h3 class="title">
                   3842: <a name="components.patches.feedback"></a>12.3.5. Feedback to the author</h3></div></div></div>
                   3843: <p>Always, always, <span class="strong"><strong>always</strong></span>
                   3844:       feed back any <span class="emphasis"><em>portability fixes</em></span> or
                   3845:       improvements you do to a package to the mainstream developers.
                   3846:       This is the only way to get their attention on portability issues
                   3847:       and to ensure that future versions can be built out-of-the box on
                   3848:       NetBSD.  Furthermore, any user that gets newer distfiles will get
                   3849:       the fixes straight from the packaged code.</p>
                   3850: <p>This generally involves cleaning up the patches
                   3851:       (because sometimes the patches that are
                   3852:       added to pkgsrc are quick hacks), filing bug reports in the
                   3853:       appropriate trackers for the projects and working with the
                   3854:       mainstream authors to accept your changes.  It is
                   3855:       <span class="emphasis"><em>extremely important</em></span> that you do it so that
                   3856:       the packages in pkgsrc are kept simple and thus further changes
                   3857:       can be done without much hassle.</p>
                   3858: <p>When you have done this, please add a URL to the upstream
                   3859:       bug report to the patch comment.</p>
                   3860: <p>Support the idea of free software!</p>
                   3861: </div>
1.91      rillig   3862: </div>
1.299     rillig   3863: <div class="sect1">
                   3864: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   3865: <a name="other-mandatory-files"></a>12.4. Other mandatory files</h2></div></div></div>
                   3866: <div class="variablelist"><dl class="variablelist">
                   3867: <dt><span class="term"><code class="filename">DESCR</code></span></dt>
                   3868: <dd><p>A multi-line description of the piece of software.  This should include
                   3869:          any credits where they are due.  Please bear in mind that others do not
                   3870:          share your sense of humour (or spelling idiosyncrasies), and that others
                   3871:          will read everything that you write here.</p></dd>
                   3872: <dt><span class="term"><code class="filename">PLIST</code></span></dt>
                   3873: <dd><p>This file governs the files that are installed on your
                   3874:          system: all the binaries, manual pages, etc. There are other
                   3875:          directives which may be entered in this file, to control the
                   3876:          creation and deletion of directories, and the location of
                   3877:          inserted files.  See <a class="xref" href="#plist" title="Chapter 19. PLIST issues">Chapter 19, <i>PLIST issues</i></a> for more
                   3878:          information.</p></dd>
                   3879: </dl></div>
                   3880: </div>
                   3881: <div class="sect1">
                   3882: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   3883: <a name="components.optional"></a>12.5. Optional files</h2></div></div></div>
                   3884: <div class="sect2">
                   3885: <div class="titlepage"><div><div><h3 class="title">
                   3886: <a name="components.optional.bin"></a>12.5.1. Files affecting the binary package</h3></div></div></div>
                   3887: <div class="variablelist"><dl class="variablelist">
                   3888: <dt><span class="term"><code class="filename">INSTALL</code></span></dt>
                   3889: <dd>
1.322     leot     3890: <p>This shell script is invoked twice by <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_add.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a>.
1.299     rillig   3891:            First time after package extraction and before files are
                   3892:            moved in place, the second time after the files to install
                   3893:            are moved in place. This can be used to do any custom
                   3894:            procedures not possible with @exec commands in
1.322     leot     3895:            <code class="filename">PLIST</code>. See <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_add.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> and
                   3896:            <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_create.1"><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="20.1. Files and directories outside the installation prefix">Section 20.1, &#8220;Files and directories outside the installation prefix&#8221;</a>.
1.299     rillig   3897:            Please note that you can modify variables in it easily by using
                   3898:            <code class="varname">FILES_SUBST</code> in the package's
                   3899:            <code class="filename">Makefile</code>:</p>
1.91      rillig   3900: <pre class="programlisting">
1.299     rillig   3901: FILES_SUBST+=  SOMEVAR="somevalue"
1.91      rillig   3902: </pre>
1.299     rillig   3903: <p>replaces "@SOMEVAR@" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in the
                   3904:            <code class="filename">INSTALL</code>.  By default, substitution is
                   3905:            performed for <code class="varname">PREFIX</code>,
                   3906:            <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
                   3907:            <code class="varname">VARBASE</code>, and a few others, type
                   3908:            <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a
                   3909:            complete list.</p>
                   3910: </dd>
                   3911: <dt><span class="term"><code class="filename">DEINSTALL</code></span></dt>
                   3912: <dd><p>This script is executed before and after any files are removed.  It is
                   3913:            this script's responsibility to clean up any additional messy details
                   3914:            around the package's installation, since all pkg_delete knows is how to
                   3915:            delete the files created in the original distribution.
1.322     leot     3916:            See <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_delete.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
                   3917:            and <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_create.1"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> for more information.
1.299     rillig   3918:            The same methods to replace variables can be used as for
                   3919:            the <code class="filename">INSTALL</code> file.</p></dd>
                   3920: <dt><span class="term"><code class="filename">MESSAGE</code></span></dt>
                   3921: <dd>
                   3922: <p>This file is displayed after installation of the package.
1.312     gdt      3923:            While this was used often in the past, it has two
                   3924:            problems: the display will be missed if many packages are
                   3925:            intalled at once, and the person installing the package
                   3926:            and the one using or configuring it may be different.  It
                   3927:            should therefore be used only in exceptional circumstances
                   3928:            where lasting negative consequences would result from
                   3929:            someone not reading it.</p>
                   3930: <p>MESSAGE should not be used for:</p>
                   3931: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   3932: <li class="listitem"><p>exhortations to read the documentation</p></li>
                   3933: <li class="listitem"><p>reminders to install rc.d files and set variables</p></li>
                   3934: <li class="listitem"><p>anything that should be explained in the
                   3935:              installation/configuration documentation that should
                   3936:              come with the package</p></li>
                   3937: </ul></div>
                   3938: <p>If the documentation provided by upstream needs
1.313     leot     3939:            enhancing, create e.g. files/README.pkgsrc and install it
                   3940:            in the package's documentation directory.
1.312     gdt      3941:            </p>
                   3942: <p>Note that MESSAGE is shown for all operating
                   3943:            systems and all init systems.  If a MESSAGE is necessary,
1.313     leot     3944:            it should be narrowed to only those operating systems and
1.312     gdt      3945:            init systems to which it applies.</p>
                   3946: <p>Note that you can modify variables in it easily by using
1.299     rillig   3947:            <code class="varname">MESSAGE_SUBST</code> in the package's
                   3948:            <code class="filename">Makefile</code>:</p>
1.91      rillig   3949: <pre class="programlisting">
1.299     rillig   3950: MESSAGE_SUBST+=  SOMEVAR="somevalue"
1.91      rillig   3951: </pre>
1.299     rillig   3952: <p>replaces "${SOMEVAR}" with <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span> in
                   3953:            <code class="filename">MESSAGE</code>.  By default, substitution is
                   3954:            performed for <code class="varname">PKGNAME</code>,
                   3955:            <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>,
                   3956:            <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
                   3957:            <code class="varname">PKG_SYSCONFDIR</code>,
                   3958:            <code class="varname">ROOT_GROUP</code>, and
                   3959:            <code class="varname">ROOT_USER</code>.</p>
                   3960: <p>You can display a different or additional files by
                   3961:            setting the <code class="varname">MESSAGE_SRC</code> variable.  Its
                   3962:            default is <code class="filename">MESSAGE</code>, if the file
                   3963:            exists.</p>
                   3964: </dd>
                   3965: <dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt>
                   3966: <dd>
                   3967: <p>This file is used by the alternatives framework.
                   3968:            It creates, configures, and destroys generic wrappers used to
                   3969:            run programs with similar interfaces.
                   3970:            See pkg_alternatives(8) from pkgtools/pkg_alternatives
                   3971:             for more information.</p>
                   3972: <p>Each line of the file contains two filenames, first
                   3973:            the wrapper and then the alternative provided by the package.
                   3974:            Both paths are relative to <code class="varname">PREFIX</code>.</p>
                   3975: </dd>
                   3976: </dl></div>
                   3977: </div>
                   3978: <div class="sect2">
                   3979: <div class="titlepage"><div><div><h3 class="title">
                   3980: <a name="components.optional.build"></a>12.5.2. Files affecting the build process</h3></div></div></div>
                   3981: <div class="variablelist"><dl class="variablelist">
                   3982: <dt><span class="term"><code class="filename">Makefile.common</code></span></dt>
                   3983: <dd><p>This file contains arbitrary things that could
                   3984:        also go into a <code class="filename">Makefile</code>, but its purpose is
                   3985:        to be used by more than one package. This file should only be
                   3986:        used when the packages that will use the file are known in
                   3987:        advance. For other purposes it is often better to write a
                   3988:        <code class="filename">*.mk</code> file and give it a good name that
                   3989:        describes what it does.</p></dd>
                   3990: <dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt>
                   3991: <dd><p>This file contains the dependency information
                   3992:        for the buildlink3 framework (see <a class="xref" href="#buildlink" title="Chapter 18. Buildlink methodology">Chapter 18, <i>Buildlink methodology</i></a>).</p></dd>
                   3993: <dt><span class="term"><code class="filename">hacks.mk</code></span></dt>
                   3994: <dd><p>This file contains workarounds for compiler bugs
                   3995:        and similar things. It is included automatically by the pkgsrc
                   3996:        infrastructure, so you don't need an extra
                   3997:        <code class="literal">.include</code> line for
                   3998:        it.</p></dd>
                   3999: <dt><span class="term"><code class="filename">options.mk</code></span></dt>
                   4000: <dd><p>This file contains the code for the
                   4001:        package-specific options (see <a class="xref" href="#options" title="Chapter 16. Options handling">Chapter 16, <i>Options handling</i></a>) that can be
                   4002:        selected by the user. If a package has only one or two options,
                   4003:        it is equally acceptable to put the code directly into the
                   4004:        <code class="filename">Makefile</code>.</p></dd>
                   4005: </dl></div>
                   4006: </div>
                   4007: <div class="sect2">
                   4008: <div class="titlepage"><div><div><h3 class="title">
                   4009: <a name="components.optional.none"></a>12.5.3. Files affecting nothing at all</h3></div></div></div>
                   4010: <div class="variablelist"><dl class="variablelist">
                   4011: <dt><span class="term"><code class="filename">README*</code></span></dt>
                   4012: <dd><p>These files do not take place in the creation of
                   4013:        a package and thus are purely informative to the package
                   4014:        developer.</p></dd>
                   4015: <dt><span class="term"><code class="filename">TODO</code></span></dt>
                   4016: <dd><p>This file contains things that need to be done
                   4017:        to make the package even
                   4018:        better.</p></dd>
                   4019: </dl></div>
                   4020: </div>
                   4021: </div>
                   4022: <div class="sect1">
                   4023: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   4024: <a name="work-dir"></a>12.6. <code class="filename">work*</code>
                   4025: </h2></div></div></div>
                   4026: <p>When you type <span class="command"><strong>make</strong></span>, the distribution files are
                   4027:     unpacked into the directory denoted by
                   4028:     <code class="varname">WRKDIR</code>. It can be removed by running
                   4029:     <span class="command"><strong>make clean</strong></span>. Besides the sources, this
                   4030:     directory is also used to keep various timestamp files.
                   4031:     The directory gets <span class="emphasis"><em>removed completely</em></span> on clean.
                   4032:     The default is <code class="filename">${.CURDIR}/work</code>
                   4033:     or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code>
                   4034:     if <code class="varname">OBJMACHINE</code> is set.</p>
1.91      rillig   4035: </div>
1.299     rillig   4036: <div class="sect1">
                   4037: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   4038: <a name="files-dir"></a>12.7. <code class="filename">files/*</code>
                   4039: </h2></div></div></div>
                   4040: <p>If you have any files that you wish to be placed in the package
                   4041:     prior to configuration or building, you can place these files here
                   4042:     and use a <span class="command"><strong>${CP}</strong></span> command in the
                   4043:     <span class="quote">&#8220;<span class="quote">post-extract</span>&#8221;</span> target to achieve this.</p>
                   4044: <p>If you want to share files in this way with other
                   4045:     packages, set the <code class="varname">FILESDIR</code> variable to point
                   4046:     to the other package's <code class="filename">files</code> directory,
                   4047:     e.g.:</p>
1.91      rillig   4048: <pre class="programlisting">
1.299     rillig   4049: FILESDIR=       ../../editors/xemacs/files
1.91      rillig   4050: </pre>
                   4051: </div>
                   4052: </div>
1.148     asau     4053: <div class="chapter">
1.75      rillig   4054: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   4055: <a name="build"></a>Chapter 13. The build process</h2></div></div></div>
1.75      rillig   4056: <div class="toc">
                   4057: <p><b>Table of Contents</b></p>
1.210     leot     4058: <dl class="toc">
1.299     rillig   4059: <dt><span class="sect1"><a href="#build.intro">13.1. Introduction</a></span></dt>
                   4060: <dt><span class="sect1"><a href="#build.prefix">13.2. Program location</a></span></dt>
                   4061: <dt><span class="sect1"><a href="#build.builddirs">13.3. Directories used during the build process</a></span></dt>
                   4062: <dt><span class="sect1"><a href="#build.running">13.4. Running a phase</a></span></dt>
                   4063: <dt><span class="sect1"><a href="#build.fetch">13.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   4064: <dd><dl>
                   4065: <dt><span class="sect2"><a href="#build.fetch.what">13.5.1. What to fetch and where to get it from</a></span></dt>
                   4066: <dt><span class="sect2"><a href="#build.fetch.how">13.5.2. How are the files fetched?</a></span></dt>
                   4067: </dl></dd>
                   4068: <dt><span class="sect1"><a href="#build.checksum">13.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
                   4069: <dt><span class="sect1"><a href="#build.extract">13.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
                   4070: <dt><span class="sect1"><a href="#build.patch">13.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
                   4071: <dt><span class="sect1"><a href="#build.tools">13.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
                   4072: <dt><span class="sect1"><a href="#build.wrapper">13.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
                   4073: <dt><span class="sect1"><a href="#build.configure">13.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   4074: <dt><span class="sect1"><a href="#build.build">13.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   4075: <dt><span class="sect1"><a href="#build.test">13.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
                   4076: <dt><span class="sect1"><a href="#build.install">13.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   4077: <dt><span class="sect1"><a href="#build.package">13.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
                   4078: <dt><span class="sect1"><a href="#build.clean">13.16. Cleaning up</a></span></dt>
                   4079: <dt><span class="sect1"><a href="#build.helpful-targets">13.17. Other helpful targets</a></span></dt>
1.75      rillig   4080: </dl>
                   4081: </div>
1.148     asau     4082: <div class="sect1">
1.75      rillig   4083: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4084: <a name="build.intro"></a>13.1. Introduction</h2></div></div></div>
                   4085: <p>This chapter gives a detailed description on how a package is
                   4086:     built. Building a package is separated into different
                   4087:     <span class="emphasis"><em>phases</em></span> (for example <code class="varname">fetch</code>,
                   4088:     <code class="varname">build</code>, <code class="varname">install</code>), all of which are
                   4089:     described in the following sections. Each phase is split into
                   4090:     so-called <span class="emphasis"><em>stages</em></span>, which take the name of the
                   4091:     containing phase, prefixed by one of <code class="varname">pre-</code>,
                   4092:     <code class="varname">do-</code> or <code class="varname">post-</code>. (Examples are
                   4093:     <code class="varname">pre-configure</code>, <code class="varname">post-build</code>.) Most
                   4094:     of the actual work is done in the <code class="varname">do-*</code> stages.</p>
                   4095: <p>Never override the regular targets (like
                   4096:     <code class="varname">fetch</code>), if you have to, override the
                   4097:     <code class="varname">do-*</code> ones instead.</p>
                   4098: <p>The basic steps for building a program are always the same.  First
                   4099:     the program's source (<span class="emphasis"><em>distfile</em></span>) must be brought to
                   4100:     the local system and then extracted. After any pkgsrc-specific patches
                   4101:     to compile properly are applied, the software can be configured, then
                   4102:     built (usually by compiling), and finally the generated binaries, etc.
                   4103:     can be put into place on the system.</p>
                   4104: <p>To get more details about what is happening at each step,
                   4105:     you can set the <code class="varname">PKG_VERBOSE</code> variable, or the
                   4106:     <code class="varname">PATCH_DEBUG</code> variable if you are just interested
                   4107:     in more details about the <span class="emphasis"><em>patch</em></span> step.</p>
                   4108: </div>
                   4109: <div class="sect1">
                   4110: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   4111: <a name="build.prefix"></a>13.2. Program location</h2></div></div></div>
                   4112: <p>Before outlining the process performed by the NetBSD package system in
                   4113:     the next section, here's a brief discussion on where programs are
                   4114:     installed, and which variables influence this.</p>
                   4115: <p>The automatic variable <code class="varname">PREFIX</code> indicates
                   4116:     where all files of the final program shall be installed. It is
                   4117:     usually set to <code class="varname">LOCALBASE</code>
                   4118:     (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code>
                   4119:     for pkgs in the <code class="filename">cross</code> category.  The value of
                   4120:     <code class="varname">PREFIX</code> needs to be put
                   4121:     into the various places in the program's source where paths to
                   4122:     these files are encoded.  See <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.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>
                   4123: <p>When choosing which of these variables to use,
                   4124:     follow the following rules:</p>
1.148     asau     4125: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.299     rillig   4126: <li class="listitem"><p><code class="varname">PREFIX</code> always points to the location
                   4127:        where the current pkg will be installed.  When referring to a
                   4128:        pkg's own installation path, use
                   4129:        <span class="quote">&#8220;<span class="quote">${PREFIX}</span>&#8221;</span>.</p></li>
1.338     nia      4130: <li class="listitem"><p><code class="varname">LOCALBASE</code> is where all pkgs
1.299     rillig   4131:        are installed.  If you need to construct a -I or -L argument
                   4132:        to the compiler to find includes and libraries installed by
1.338     nia      4133:        another pkg, use <span class="quote">&#8220;<span class="quote">${LOCALBASE}</span>&#8221;</span>. The name
1.299     rillig   4134:        <code class="varname">LOCALBASE</code> stems from FreeBSD, which
                   4135:        installed all packages in <code class="filename">/usr/local</code>. As
                   4136:        pkgsrc leaves <code class="filename">/usr/local</code> for the system
                   4137:        administrator, this variable is a misnomer.</p></li>
                   4138: <li class="listitem"><p><code class="varname">X11BASE</code> is where the actual X11
                   4139:        distribution (from xsrc, etc.) is installed. When looking for
                   4140:        <span class="emphasis"><em>standard</em></span> X11 includes (not those
                   4141:        installed by a package), use <span class="quote">&#8220;<span class="quote">${X11BASE}</span>&#8221;</span>.</p></li>
                   4142: <li class="listitem"><p>X11-based packages using imake must set
                   4143:        <code class="varname">USE_IMAKE</code> to be installed correctly under
                   4144:        <code class="varname">LOCALBASE</code>.</p></li>
                   4145: <li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should
1.322     leot     4146:        install files according to <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/hier.7"><span class="citerefentry"><span class="refentrytitle">hier</span>(7)</span></a>, with the exception that
1.299     rillig   4147:        manual pages go into <code class="filename">${PREFIX}/man</code>, not
                   4148:        <code class="filename">${PREFIX}/share/man</code>.</p></li>
                   4149: </ul></div>
                   4150: </div>
                   4151: <div class="sect1">
                   4152: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   4153: <a name="build.builddirs"></a>13.3. Directories used during the build process</h2></div></div></div>
                   4154: <p>When building a package, various directories are used to store
                   4155:     source files, temporary files, pkgsrc-internal files, and so on. These
                   4156:     directories are explained here.</p>
                   4157: <p>Some of the directory variables contain relative pathnames. There
                   4158:     are two common base directories for these relative directories:
                   4159:     <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are
                   4160:     pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories
                   4161:     inside the package itself.</p>
                   4162: <div class="variablelist"><dl class="variablelist">
                   4163: <dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt>
                   4164: <dd><p>This is an absolute pathname that points to the pkgsrc
                   4165:       root directory. Generally, you don't need
                   4166:       it.</p></dd>
                   4167: <dt><span class="term"><code class="varname">PKGDIR</code></span></dt>
                   4168: <dd><p>This is an absolute pathname that points to the
                   4169:       current package.</p></dd>
                   4170: <dt><span class="term"><code class="varname">PKGPATH</code></span></dt>
1.343     gutterid 4171: <dd>
                   4172: <p>This is a pathname relative to
                   4173:       <code class="varname">PKGSRCDIR</code> that points to the current package.
                   4174:       It is defined after including <code class="filename">bsd.prefs.mk</code>
                   4175:       and can be used in makefile fragments that are used by several
                   4176:       packages to distinguish between these packages. Other variables
                   4177:       that would serve the same purpose are <code class="varname">PKGBASE</code>
                   4178:       and <code class="varname">PKGNAME</code>, but these are only defined after
                   4179:       including <code class="filename">bsd.pkg.mk</code>, which is too
                   4180:       late.</p>
                   4181: <p>In <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the pkgsrc user can use
                   4182:       <code class="varname">PKGPATH</code> to tweak variables like
                   4183:       <code class="varname">MAKE_JOBS</code> and
                   4184:       <code class="varname">CFLAGS</code>.</p>
                   4185: </dd>
1.299     rillig   4186: <dt><span class="term"><code class="varname">WRKDIR</code></span></dt>
                   4187: <dd><p>This is an absolute pathname pointing to the directory
                   4188:       where all work takes place. The distfiles are extracted to this
                   4189:       directory. It also contains temporary directories and log files used by
                   4190:       the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or
                   4191:       the <span class="emphasis"><em>wrappers</em></span>.</p></dd>
                   4192: <dt><span class="term"><code class="varname">WRKSRC</code></span></dt>
                   4193: <dd><p>This is an absolute pathname pointing to the directory
                   4194:       where the distfiles are extracted. It is usually a direct subdirectory
                   4195:       of <code class="varname">WRKDIR</code>, and often it's the only directory entry
                   4196:       that isn't hidden. This variable may be changed by a package
                   4197:       <code class="filename">Makefile</code>.</p></dd>
                   4198: </dl></div>
                   4199: <p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either
                   4200:     the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults
                   4201:     to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the
                   4202:     <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory.
                   4203:     If users would like to have their pkgsrc trees behave in a
                   4204:     read-only manner, then the value of
                   4205:     <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to
                   4206:     <span class="emphasis"><em>no</em></span>.</p>
1.75      rillig   4207: </div>
1.148     asau     4208: <div class="sect1">
1.75      rillig   4209: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4210: <a name="build.running"></a>13.4. Running a phase</h2></div></div></div>
                   4211: <p>You can run a particular phase by typing <span class="command"><strong>make
1.343     gutterid 4212:     <em class="replaceable"><code>phase</code></em></strong></span>, where
                   4213:     <em class="replaceable"><code>phase</code></em> is the name of the phase. This will
                   4214:     automatically run all phases that are required for this phase. The
                   4215:     default phase is <code class="varname">build</code>, that is, when you run
                   4216:     <span class="command"><strong>make</strong></span> without parameters in a package directory,
1.299     rillig   4217:     the package will be built, but not installed.</p>
1.75      rillig   4218: </div>
1.148     asau     4219: <div class="sect1">
1.75      rillig   4220: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4221: <a name="build.fetch"></a>13.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
                   4222: <p>The first step in building a package is to fetch the
                   4223:     distribution files (distfiles) from the sites that are providing
                   4224:     them. This is the task of the <span class="emphasis"><em>fetch</em></span>
                   4225:     phase.</p>
1.148     asau     4226: <div class="sect2">
1.93      rillig   4227: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   4228: <a name="build.fetch.what"></a>13.5.1. What to fetch and where to get it from</h3></div></div></div>
                   4229: <p>In simple cases, <code class="varname">MASTER_SITES</code>
                   4230:       defines all URLs from where the distfile, whose name is
                   4231:       derived from the <code class="varname">DISTNAME</code> variable, is
                   4232:       fetched. The more complicated cases are described
                   4233:       below.</p>
                   4234: <p>The variable <code class="varname">DISTFILES</code> specifies
                   4235:       the list of distfiles that have to be fetched. Its value
                   4236:       defaults to <code class="literal">${DEFAULT_DISTFILES}</code> and
                   4237:       its value is <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>,
                   4238:       so that most packages don't need to define it at all.
                   4239:       <code class="varname">EXTRACT_SUFX</code> is
                   4240:       <code class="literal">.tar.gz</code> by default, but can be changed
                   4241:       freely. Note that if your package requires additional
                   4242:       distfiles to the default one, you cannot just append the
                   4243:       additional filenames using the <code class="literal">+=</code>
                   4244:       operator, but you have write for example:</p>
                   4245: <pre class="programlisting">
                   4246: DISTFILES=      ${DEFAULT_DISTFILES} additional-files.tar.gz
                   4247: </pre>
                   4248: <p>Each distfile is fetched from a list of sites, usually
                   4249:       <code class="varname">MASTER_SITES</code>. If the package has multiple
                   4250:       <code class="varname">DISTFILES</code> or multiple
                   4251:       <code class="varname">PATCHFILES</code> from different sites, you can
                   4252:       set
                   4253:       <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code>
                   4254:       to the list of URLs where the file
                   4255:       <code class="filename"><em class="replaceable"><code>distfile</code></em></code>
                   4256:       (including the suffix) can be found.</p>
                   4257: <pre class="programlisting">
                   4258: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   4259: DISTFILES+=     foo-file.tar.gz
                   4260: SITES.foo-file.tar.gz= \
                   4261: https://www.somewhere.com/somehow/ \
                   4262: https://www.somewhereelse.com/mirror/somehow/
                   4263: </pre>
                   4264: <p>When actually fetching the distfiles, each item from
                   4265:       <code class="varname">MASTER_SITES</code> or
                   4266:       <code class="varname">SITES.*</code> gets the name of each distfile
                   4267:       appended to it, without an intermediate slash. Therefore,
                   4268:       all site values have to end with a slash or other separator
                   4269:       character. This allows for example to set
                   4270:       <code class="varname">MASTER_SITES</code> to a URL of a CGI script
                   4271:       that gets the name of the distfile as a parameter. In this
                   4272:       case, the definition would look like:</p>
                   4273: <pre class="programlisting">
                   4274: MASTER_SITES=   https://www.example.com/download.cgi?file=
                   4275: </pre>
                   4276: <p> The exception to this rule are URLs starting with a dash.
                   4277:       In that case the URL is taken as is, fetched and the result
                   4278:       stored under the name of the distfile. You can use this style
                   4279:       for the case when the download URL style does not match the
                   4280:       above common case. For example, if permanent download URL is a
                   4281:       redirector to the real download URL, or the download file name
                   4282:       is offered by an HTTP Content-Disposition header. In the
                   4283:       following example, <code class="filename">foo-1.0.0.tar.gz</code> will be
                   4284:       created instead of the default
                   4285:       <code class="filename">v1.0.0.tar.gz</code>.</p>
                   4286: <pre class="programlisting">
                   4287: DISTNAME=       foo-1.0.0
                   4288: MASTER_SITES=   -https://www.example.com/archive/v1.0.0.tar.gz
                   4289: </pre>
                   4290: <p>There are some predefined values for
                   4291:       <code class="varname">MASTER_SITES</code>, which can be used in
                   4292:       packages.  The names of the variables should speak for
                   4293:       themselves.</p>
                   4294: <table border="0" summary="Simple list" class="simplelist">
                   4295: <tr>
                   4296: <td>MASTER_SITE_APACHE</td>
                   4297: <td>MASTER_SITE_BACKUP</td>
                   4298: </tr>
                   4299: <tr>
                   4300: <td>MASTER_SITE_CRATESIO</td>
                   4301: <td>MASTER_SITE_CYGWIN</td>
                   4302: </tr>
                   4303: <tr>
                   4304: <td>MASTER_SITE_DEBIAN</td>
                   4305: <td>MASTER_SITE_FREEBSD</td>
                   4306: </tr>
                   4307: <tr>
                   4308: <td>MASTER_SITE_FREEBSD_LOCAL</td>
                   4309: <td>MASTER_SITE_GENTOO</td>
                   4310: </tr>
                   4311: <tr>
                   4312: <td>MASTER_SITE_GITHUB</td>
1.340     gutterid 4313: <td>MASTER_SITE_GITLAB</td>
                   4314: </tr>
                   4315: <tr>
1.299     rillig   4316: <td>MASTER_SITE_GNOME</td>
1.340     gutterid 4317: <td>MASTER_SITE_GNU</td>
1.299     rillig   4318: </tr>
                   4319: <tr>
                   4320: <td>MASTER_SITE_GNUSTEP</td>
1.340     gutterid 4321: <td>MASTER_SITE_HASKELL_HACKAGE</td>
1.299     rillig   4322: </tr>
                   4323: <tr>
                   4324: <td>MASTER_SITE_IFARCHIVE</td>
1.340     gutterid 4325: <td>MASTER_SITE_KDE</td>
1.299     rillig   4326: </tr>
                   4327: <tr>
                   4328: <td>MASTER_SITE_MOZILLA</td>
1.340     gutterid 4329: <td>MASTER_SITE_MOZILLA_ALL</td>
1.299     rillig   4330: </tr>
                   4331: <tr>
                   4332: <td>MASTER_SITE_MYSQL</td>
1.340     gutterid 4333: <td>MASTER_SITE_NETLIB</td>
1.299     rillig   4334: </tr>
                   4335: <tr>
                   4336: <td>MASTER_SITE_OPENBSD</td>
1.340     gutterid 4337: <td>MASTER_SITE_OPENOFFICE</td>
1.299     rillig   4338: </tr>
                   4339: <tr>
                   4340: <td>MASTER_SITE_OSDN</td>
1.340     gutterid 4341: <td>MASTER_SITE_PERL_CPAN</td>
1.299     rillig   4342: </tr>
                   4343: <tr>
                   4344: <td>MASTER_SITE_PGSQL</td>
1.340     gutterid 4345: <td>MASTER_SITE_PYPI</td>
1.299     rillig   4346: </tr>
                   4347: <tr>
                   4348: <td>MASTER_SITE_RUBYGEMS</td>
1.340     gutterid 4349: <td>MASTER_SITE_R_CRAN</td>
1.299     rillig   4350: </tr>
                   4351: <tr>
                   4352: <td>MASTER_SITE_SOURCEFORGE</td>
1.340     gutterid 4353: <td>MASTER_SITE_SUNSITE</td>
1.299     rillig   4354: </tr>
1.85      jmmv     4355: <tr>
1.299     rillig   4356: <td>MASTER_SITE_SUSE</td>
1.340     gutterid 4357: <td>MASTER_SITE_TEX_CTAN</td>
1.85      jmmv     4358: </tr>
                   4359: <tr>
1.299     rillig   4360: <td>MASTER_SITE_XCONTRIB</td>
1.340     gutterid 4361: <td>MASTER_SITE_XEMACS</td>
1.85      jmmv     4362: </tr>
                   4363: <tr>
1.299     rillig   4364: <td>MASTER_SITE_XORG</td>
1.340     gutterid 4365: <td> </td>
1.299     rillig   4366: </tr>
                   4367: </table>
                   4368: <p>Some explanations for the less self-explaining ones:
                   4369:       <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites
                   4370:       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
                   4371:       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>
                   4372: <p>If you choose one of these predefined sites, you may
                   4373:       want to specify a subdirectory of that site. Since these
                   4374:       macros may expand to more than one actual site, you
                   4375:       <span class="emphasis"><em>must</em></span> use the following construct to
                   4376:       specify a subdirectory:</p>
1.100     rillig   4377: <pre class="programlisting">
1.299     rillig   4378: MASTER_SITES=   ${MASTER_SITE_GNU:=subdirectory/name/}
                   4379: MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.100     rillig   4380: </pre>
1.299     rillig   4381: <p>Note the trailing slash after the subdirectory
                   4382:       name.</p>
                   4383: </div>
                   4384: <div class="sect2">
                   4385: <div class="titlepage"><div><div><h3 class="title">
                   4386: <a name="build.fetch.how"></a>13.5.2. How are the files fetched?</h3></div></div></div>
                   4387: <p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that
                   4388:       all the distfiles exist in a local directory
                   4389:       (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc
                   4390:       user). If the files do not exist, they are fetched using
                   4391:       commands of the form</p>
1.100     rillig   4392: <pre class="programlisting">
1.299     rillig   4393: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   4394: </pre>
                   4395: <p>where <code class="literal">${site}</code> varies through
                   4396:       several possibilities in turn: first,
                   4397:       <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the
                   4398:       sites specified in either <code class="varname">SITES.file</code> if
                   4399:       defined, else <code class="varname">MASTER_SITES</code> or
                   4400:       <code class="varname">PATCH_SITES</code>, as applies, then finally the
                   4401:       value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of
                   4402:       all except the first and the last can be optionally sorted
                   4403:       by the user, via setting either
                   4404:       <code class="varname">MASTER_SORT_RANDOM</code>, and
                   4405:       <code class="varname">MASTER_SORT_AWK</code> or
                   4406:       <code class="varname">MASTER_SORT_REGEX</code>.</p>
                   4407: <p> The specific command and arguments used depend on the
                   4408:       <code class="varname">FETCH_USING</code> parameter. The example above is
                   4409:       for <code class="literal">FETCH_USING=custom</code>.</p>
                   4410: <p>The distfiles mirror run by the NetBSD Foundation uses the
                   4411:       <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the
                   4412:       distfiles, if they are freely distributable.  Packages setting
                   4413:       <code class="varname">NO_SRC_ON_FTP</code> (usually to
                   4414:       <span class="quote">&#8220;<span class="quote">${RESTRICTED}</span>&#8221;</span>) will not have their distfiles
                   4415:       mirrored.</p>
1.85      jmmv     4416: </div>
                   4417: </div>
1.299     rillig   4418: <div class="sect1">
                   4419: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   4420: <a name="build.checksum"></a>13.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div>
                   4421: <p>After the distfile(s) are fetched, their checksum is
                   4422:     generated and compared with the checksums stored in the
                   4423:     distinfo file. If the checksums don't match, the build is
                   4424:     aborted. This is to ensure the same distfile is used for
                   4425:     building, and that the distfile wasn't changed, e.g. by some
                   4426:     malign force, deliberately changed distfiles on the master
                   4427:     distribution site or network lossage.</p>
1.75      rillig   4428: </div>
1.148     asau     4429: <div class="sect1">
1.75      rillig   4430: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4431: <a name="build.extract"></a>13.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div>
                   4432: <p>When the distfiles are present on the local system, they
                   4433:     need to be extracted, as they usually come in the form of some
                   4434:     compressed archive format.</p>
                   4435: <p>By default, all <code class="varname">DISTFILES</code> are
                   4436:     extracted. If you only need some of them, you can set the
                   4437:     <code class="varname">EXTRACT_ONLY</code> variable to the list of those
                   4438:     files.</p>
                   4439: <p>Extracting the files is usually done by a little
                   4440:     program, <code class="filename">mk/extract/extract</code>, which
                   4441:     already knows how to extract various archive formats, so most
                   4442:     likely you will not need to change anything here. But if you
                   4443:     need, the following variables may help you:</p>
1.148     asau     4444: <div class="variablelist"><dl class="variablelist">
1.299     rillig   4445: <dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
                   4446: <dd><p>Use these variables to override the default
                   4447:       options for an extract command, which are defined in
                   4448:       <code class="filename">mk/extract/extract</code>.</p></dd>
                   4449: <dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt>
                   4450: <dd><p>This variable can be set to
                   4451:       <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code>
                   4452:       (which is the default value), <code class="literal">pax</code>, or an
                   4453:       absolute pathname pointing to the command with which tar
                   4454:       archives should be extracted.  It is preferred to choose bsdtar over gtar
                   4455:       if NetBSD's pax-as-tar is not good enough.</p></dd>
1.75      rillig   4456: </dl></div>
1.299     rillig   4457: <p>If the <code class="filename">extract</code> program doesn't
                   4458:     serve your needs, you can also override the
                   4459:     <code class="varname">EXTRACT_CMD</code> variable, which holds the
                   4460:     command used for extracting the files. This command is
                   4461:     executed in the <code class="filename">${WRKSRC}</code>
                   4462:     directory. During execution of this command, the shell
                   4463:     variable <code class="varname">extract_file</code> holds the absolute
                   4464:     pathname of the file that is going to be extracted.</p>
                   4465: <p>And if that still does not suffice, you can override the
                   4466:     <code class="varname">do-extract</code> target in the package
                   4467:     Makefile.</p>
1.75      rillig   4468: </div>
1.148     asau     4469: <div class="sect1">
1.75      rillig   4470: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4471: <a name="build.patch"></a>13.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
                   4472: <p>After extraction, all the patches named by the
                   4473:     <code class="varname">PATCHFILES</code>, those present in the patches
                   4474:     subdirectory of the package as well as in
                   4475:     $LOCALPATCHES/$PKGPATH (e.g.
                   4476:     <code class="filename">/usr/local/patches/graphics/png</code>) are
                   4477:     applied.  Patchfiles ending in <code class="filename">.Z</code> or
                   4478:     <code class="filename">.gz</code> are uncompressed before they are
                   4479:     applied, files ending in <code class="filename">.orig</code> or
                   4480:     <code class="filename">.rej</code> are ignored. Any special options to
1.322     leot     4481:     <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/patch.1"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> can be handed in
1.299     rillig   4482:     <code class="varname">PATCH_DIST_ARGS</code>.  See <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, &#8220;<code class="filename">patches/*</code>&#8221;</a> for more details.</p>
1.322     leot     4483: <p>By default <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/patch.1"><span class="citerefentry"><span class="refentrytitle">patch</span>(1)</span></a> is given special arguments to make it
1.299     rillig   4484:     fail if the expected text from the patch context is not found in the
                   4485:     patched file. If that happens, fix the patch file by comparing it
                   4486:     with the actual text in the file to be patched.</p>
1.78      rillig   4487: </div>
1.148     asau     4488: <div class="sect1">
1.75      rillig   4489: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4490: <a name="build.tools"></a>13.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
                   4491: <p>This is covered in <a class="xref" href="#tools" title="Chapter 17. Tools needed for building or running">Chapter 17, <i>Tools needed for building or running</i></a>.
                   4492:     </p>
1.75      rillig   4493: </div>
1.148     asau     4494: <div class="sect1">
1.75      rillig   4495: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4496: <a name="build.wrapper"></a>13.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div>
                   4497: <p>This phase creates wrapper programs for the compilers and
                   4498:     linkers. The following variables can be used to tweak the
                   4499:     wrappers.</p>
                   4500: <div class="variablelist"><dl class="variablelist">
                   4501: <dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt>
                   4502: <dd><p>The command used to print progress
                   4503:       messages. Does nothing by default. Set to
                   4504:       <code class="literal">${ECHO}</code> to see the progress
                   4505:       messages.</p></dd>
                   4506: <dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt>
                   4507: <dd><p>This variable can be set to
                   4508:       <code class="literal">yes</code> (default) or <code class="literal">no</code>,
                   4509:       depending on whether you want additional information in the
                   4510:       wrapper log file.</p></dd>
                   4511: <dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt>
                   4512: <dd><p>This variable can be set to
                   4513:       <code class="literal">yes</code> or <code class="literal">no</code>, depending
                   4514:       on whether the wrapper should use its cache, which will
                   4515:       improve the speed. The default value is
                   4516:       <code class="literal">yes</code>, but is forced to
                   4517:       <code class="literal">no</code> if the platform does not support
                   4518:       it.</p></dd>
                   4519: <dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt>
                   4520: <dd><p>A list of reordering commands. A reordering
                   4521:       command has the form
                   4522:       <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>.
                   4523:       It ensures that that
                   4524:       <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs
                   4525:       before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>.
                   4526:       </p></dd>
                   4527: </dl></div>
                   4528: </div>
                   4529: <div class="sect1">
                   4530: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   4531: <a name="build.configure"></a>13.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
                   4532: <p>Most pieces of software need information on the header
                   4533:     files, system calls, and library routines which are available
                   4534:     on the platform they run on. The process of determining this
                   4535:     information is known as configuration, and is usually
                   4536:     automated. In most cases, a script is supplied with the
                   4537:     distfiles, and its invocation results in generation of header
                   4538:     files, Makefiles, etc.</p>
                   4539: <p>If the package contains a configure script, this can be
                   4540:     invoked by setting <code class="varname">HAS_CONFIGURE</code> to
                   4541:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. If the configure script is a GNU autoconf
                   4542:     script, you should set <code class="varname">GNU_CONFIGURE</code> to
1.301     rillig   4543:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> instead.</p>
                   4544: <p>In the <code class="literal">do-configure</code> stage, a rough
                   4545:     equivalent of the following command is run. See
                   4546:     <code class="filename">mk/configure/configure.mk</code>, target
                   4547:     <code class="literal">do-configure-script</code> for the exact
                   4548:     definition.</p>
                   4549: <pre class="programlisting">
                   4550: .for dir in ${CONFIGURE_DIRS}
                   4551:         cd ${WRKSRC} &amp;&amp; cd ${dir} \
                   4552:         &amp;&amp; env ${CONFIGURE_ENV} \
                   4553:             ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.299     rillig   4554: .endfor
1.100     rillig   4555: </pre>
1.299     rillig   4556: <p><code class="varname">CONFIGURE_DIRS</code> (default:
                   4557:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to
                   4558:     <code class="varname">WRKSRC</code>. In each of these directories, the
                   4559:     configure script is run with the environment
                   4560:     <code class="varname">CONFIGURE_ENV</code> and arguments
                   4561:     <code class="varname">CONFIGURE_ARGS</code>. The variables
                   4562:     <code class="varname">CONFIGURE_ENV</code>,
                   4563:     <code class="varname">CONFIGURE_SCRIPT</code> (default:
                   4564:     <span class="quote">&#8220;<span class="quote">./configure</span>&#8221;</span>) and
                   4565:     <code class="varname">CONFIGURE_ARGS</code> may all be changed by the
                   4566:     package.</p>
                   4567: <p>If the program uses the Perl way of configuration (mainly Perl
                   4568:     modules, but not only), i.e. a file called
                   4569:     <code class="filename">Makefile.PL</code>, it should include
                   4570:     <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for
                   4571:     <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code>
                   4572:     variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p>
                   4573: <p>If the program uses an <code class="filename">Imakefile</code>
                   4574:     for configuration, the appropriate steps can be invoked by
                   4575:     setting <code class="varname">USE_IMAKE</code> to
                   4576:     <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>.
                   4577:     You can add variables to xmkmf's environment by adding them to the
                   4578:     <code class="varname">SCRIPTS_ENV</code> variable.</p>
                   4579: <p>If the program uses <code class="filename">cmake</code>
                   4580:     for configuration, the appropriate steps can be invoked by
                   4581:     setting <code class="varname">USE_CMAKE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.
                   4582:     You can add variables to cmake's environment by adding them to the
                   4583:     <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake
                   4584:     by adding them to the <code class="varname">CMAKE_ARGS</code> variable.
                   4585:     The top directory argument is given by the
                   4586:     <code class="varname">CMAKE_ARG_PATH</code> variable, that defaults to
                   4587:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> (relative to <code class="varname">CONFIGURE_DIRS</code>)</p>
                   4588: <p>If there is no configure step at all, set
                   4589:     <code class="varname">NO_CONFIGURE</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p>
1.75      rillig   4590: </div>
1.148     asau     4591: <div class="sect1">
1.75      rillig   4592: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4593: <a name="build.build"></a>13.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.301     rillig   4594: <p>For building a package, a rough equivalent of the following
                   4595:     code is executed; see <code class="filename">mk/build/build.mk</code>, target
                   4596:     <code class="literal">do-build</code> for the exact definition.</p>
1.97      rillig   4597: <pre class="programlisting">
1.301     rillig   4598: .for dir in ${BUILD_DIRS}
                   4599:         cd ${WRKSRC} &amp;&amp; cd ${dir} \
1.299     rillig   4600:         &amp;&amp; env ${MAKE_ENV} \
1.301     rillig   4601:             ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.299     rillig   4602:                 -f ${MAKE_FILE} \
                   4603:                 ${BUILD_TARGET}
                   4604: .endfor
1.97      rillig   4605: </pre>
1.299     rillig   4606: <p><code class="varname">BUILD_DIRS</code> (default:
                   4607:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span>) is a list of pathnames relative to
                   4608:     <code class="varname">WRKSRC</code>. In each of these directories,
                   4609:     <code class="varname">MAKE_PROGRAM</code> is run with the environment
                   4610:     <code class="varname">MAKE_ENV</code> and arguments
                   4611:     <code class="varname">BUILD_MAKE_FLAGS</code>. The variables
                   4612:     <code class="varname">MAKE_ENV</code>,
                   4613:     <code class="varname">BUILD_MAKE_FLAGS</code>,
                   4614:     <code class="varname">MAKE_FILE</code> and
                   4615:     <code class="varname">BUILD_TARGET</code> may all be changed by the
                   4616:     package.</p>
                   4617: <p>The default value of <code class="varname">MAKE_PROGRAM</code> is
                   4618:     <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> if <code class="varname">USE_TOOLS</code> contains
                   4619:     <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span>, <span class="quote">&#8220;<span class="quote">make</span>&#8221;</span> otherwise. The
                   4620:     default value of <code class="varname">MAKE_FILE</code> is
                   4621:     <span class="quote">&#8220;<span class="quote">Makefile</span>&#8221;</span>, and <code class="varname">BUILD_TARGET</code>
                   4622:     defaults to <span class="quote">&#8220;<span class="quote">all</span>&#8221;</span>.</p>
                   4623: <p>If there is no build step at all, set
                   4624:     <code class="varname">NO_BUILD</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.</p>
1.97      rillig   4625: </div>
1.148     asau     4626: <div class="sect1">
1.97      rillig   4627: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4628: <a name="build.test"></a>13.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div>
                   4629: <p>[TODO]</p>
1.75      rillig   4630: </div>
1.148     asau     4631: <div class="sect1">
1.75      rillig   4632: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4633: <a name="build.install"></a>13.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
                   4634: <p>Once the build stage has completed, the final step is to
                   4635:     install the software in public directories, so users can
                   4636:     access the programs and files.</p>
1.301     rillig   4637: <p>In the <span class="emphasis"><em>install</em></span> phase, a rough equivalent
                   4638:     of the following code is executed; see
                   4639:     <code class="filename">mk/install/install.mk</code>, target
                   4640:     <code class="literal">do-install</code> for the exact definition. Additionally,
                   4641:     before and after this code, several consistency checks are run
                   4642:     against the files-to-be-installed, see
                   4643:     <code class="filename">mk/check/*.mk</code> for details.</p>
                   4644: <pre class="programlisting">
                   4645: .for dir in ${INSTALL_DIRS}
                   4646:         cd ${WRKSRC} &amp;&amp; cd ${dir} \
                   4647:         &amp;&amp; env ${INSTALL_ENV} ${MAKE_ENV} \
                   4648:             ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
                   4649:                 -f ${MAKE_FILE} ${INSTALL_TARGET}
1.299     rillig   4650: .endfor
1.220     wiz      4651: </pre>
1.299     rillig   4652: <p>The variable's meanings are analogous to the ones in the
                   4653:     <span class="emphasis"><em>build</em></span> phase.
                   4654:     <code class="varname">INSTALL_DIRS</code> defaults to
                   4655:     <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code>
                   4656:     is <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> by default, plus
                   4657:     <span class="quote">&#8220;<span class="quote">install.man</span>&#8221;</span> if <code class="varname">USE_IMAKE</code> is
                   4658:     defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not
                   4659:     defined.</p>
                   4660: <p>In the <span class="emphasis"><em>install</em></span> phase, the following
                   4661:     variables are useful. They are all variations of the
1.322     leot     4662:     <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/install.1"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a> command that have the owner, group and
1.299     rillig   4663:     permissions preset. <code class="varname">INSTALL</code> is the plain
                   4664:     install command. The specialized variants, together with their
                   4665:     intended use, are:</p>
                   4666: <div class="variablelist"><dl class="variablelist">
                   4667: <dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt>
                   4668: <dd><p>directories that contain
                   4669:       binaries</p></dd>
                   4670: <dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt>
                   4671: <dd><p>directories that contain
                   4672:       scripts</p></dd>
                   4673: <dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt>
                   4674: <dd><p>directories that contain shared and static
                   4675:       libraries</p></dd>
                   4676: <dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt>
                   4677: <dd><p>directories that contain data
                   4678:       files</p></dd>
                   4679: <dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt>
                   4680: <dd><p>directories that contain man
                   4681:       pages</p></dd>
                   4682: <dt><span class="term"><code class="varname">INSTALL_GAME_DIR</code></span></dt>
                   4683: <dd><p>directories that contain data files for games
                   4684:       </p></dd>
                   4685: <dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt>
                   4686: <dd><p>binaries that can be stripped from debugging
                   4687:       symbols</p></dd>
                   4688: <dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt>
                   4689: <dd><p>binaries that cannot be
                   4690:       stripped</p></dd>
                   4691: <dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt>
                   4692: <dd><p>game
                   4693:       binaries</p></dd>
                   4694: <dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt>
                   4695: <dd><p>shared and static
                   4696:       libraries</p></dd>
                   4697: <dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt>
                   4698: <dd><p>data files</p></dd>
                   4699: <dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt>
                   4700: <dd><p>data files for
                   4701:       games</p></dd>
                   4702: <dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt>
                   4703: <dd><p>man pages</p></dd>
                   4704: </dl></div>
                   4705: <p>Some other variables are:</p>
                   4706: <div class="variablelist"><dl class="variablelist">
                   4707: <dt><span class="term"><code class="varname">INSTALL_UNSTRIPPED</code></span></dt>
1.322     leot     4708: <dd><p>If set to <code class="literal">yes</code>, do not run <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/strip.1"><span class="citerefentry"><span class="refentrytitle">strip</span>(1)</span></a>
1.299     rillig   4709:       when installing binaries. Any debugging sections and symbols present in
                   4710:       binaries will be preserved.
                   4711:       </p></dd>
                   4712: <dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt>
                   4713: <dd><p>A list of directories relative to
                   4714:       <code class="varname">PREFIX</code> that are created by pkgsrc at the
                   4715:       beginning of the <span class="emphasis"><em>install</em></span> phase.
                   4716:       The package is supposed to create all needed directories itself
                   4717:       before installing files to it and list all other directories here.
                   4718:       </p></dd>
                   4719: </dl></div>
                   4720: <p>In the rare cases that a package shouldn't install anything,
                   4721:     set <code class="varname">NO_INSTALL</code> to <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. This is
                   4722:     mostly relevant for packages in the <code class="filename">regress</code>
                   4723:     category.</p>
1.75      rillig   4724: </div>
1.148     asau     4725: <div class="sect1">
1.75      rillig   4726: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4727: <a name="build.package"></a>13.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div>
                   4728: <p>Once the install stage has completed, a binary package of
                   4729:     the installed files can be built.  These binary packages can be
                   4730:     used for quick installation without previous compilation, e.g. by
                   4731:     the <span class="command"><strong>make bin-install</strong></span> or by using
                   4732:     <span class="command"><strong>pkg_add</strong></span>.</p>
                   4733: <p>By default, the binary packages are created in
                   4734:     <code class="filename">${PACKAGES}/All</code> and symlinks are created in
                   4735:     <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>,
                   4736:     one for each category in the <code class="varname">CATEGORIES</code>
                   4737:     variable.  <code class="varname">PACKAGES</code> defaults to
                   4738:     <code class="filename">pkgsrc/packages</code>.</p>
1.75      rillig   4739: </div>
1.148     asau     4740: <div class="sect1">
1.75      rillig   4741: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4742: <a name="build.clean"></a>13.16. Cleaning up</h2></div></div></div>
                   4743: <p>Once you're finished with a package, you can clean the work
                   4744:     directory by running <span class="command"><strong>make clean</strong></span>.  If you want
                   4745:     to clean the work directories of all dependencies too, use
                   4746:     <span class="command"><strong>make clean-depends</strong></span>.</p>
1.75      rillig   4747: </div>
1.148     asau     4748: <div class="sect1">
1.75      rillig   4749: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   4750: <a name="build.helpful-targets"></a>13.17. Other helpful targets</h2></div></div></div>
1.148     asau     4751: <div class="variablelist"><dl class="variablelist">
1.299     rillig   4752: <dt><span class="term">pre/post-*</span></dt>
                   4753: <dd>
                   4754: <p>For any of the main targets described in the previous
                   4755:          section (configure, build, install, etc.), two auxiliary
                   4756:          targets exist with
                   4757:          <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
                   4758:          prefix for the main target's name.  These targets are
                   4759:          invoked before and after the main target is called,
                   4760:          allowing extra configuration or installation steps be
                   4761:          performed from a package's Makefile, for example, which
                   4762:          a program's configure script or install target
                   4763:          omitted.</p>
                   4764: <p>About 5% of the pkgsrc packages define their custom
                   4765:          post-extract target, another 5% define pre-configure, and 10%
                   4766:          define post-install. The other pre/post-* targets are defined
                   4767:          even less often.</p>
                   4768: </dd>
                   4769: <dt><span class="term">do-*</span></dt>
1.75      rillig   4770: <dd>
1.299     rillig   4771: <p>Should one of the main targets do the wrong thing,
                   4772:          and should there be no variable to fix this, you can
                   4773:          redefine it with the do-* target.  (Note that redefining
                   4774:          the target itself instead of the do-* target is a bad
                   4775:          idea, as the pre-* and post-* targets won't be called
                   4776:          anymore, etc.)</p>
                   4777: <p>About 15% of the pkgsrc packages override the default
                   4778:          do-install, the other do-* targets are overridden even less
                   4779:          often.</p>
1.75      rillig   4780: </dd>
1.299     rillig   4781: <dt><span class="term">reinstall</span></dt>
1.75      rillig   4782: <dd>
1.299     rillig   4783: <p>If you did a <span class="command"><strong>make install</strong></span> and
                   4784:          you noticed some file was not installed properly, you
                   4785:          can repeat the installation with this target, which will
                   4786:          ignore the <span class="quote">&#8220;<span class="quote">already installed</span>&#8221;</span> flag.</p>
                   4787: <p>This is the default value of
                   4788:          <code class="varname">DEPENDS_TARGET</code> except in the case of
                   4789:          <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make
                   4790:          package</strong></span>, where the defaults are
                   4791:          <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> and <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span>,
                   4792:          respectively.</p>
1.75      rillig   4793: </dd>
1.299     rillig   4794: <dt><span class="term">deinstall</span></dt>
                   4795: <dd>
1.322     leot     4796: <p>This target does a <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_delete.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> in the
1.299     rillig   4797:          current directory, effectively de-installing the
                   4798:          package. The following variables can be used to tune the
                   4799:          behaviour:</p>
                   4800: <div class="variablelist"><dl class="variablelist">
                   4801: <dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt>
1.322     leot     4802: <dd><p>Add a "-v" to the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_delete.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> command.</p></dd>
1.299     rillig   4803: <dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt>
                   4804: <dd><p>Remove all packages that require (depend on)
                   4805:                the given package.  This can be used to remove any
                   4806:                packages that may have been pulled in by a given
                   4807:                package, e.g. if <span class="command"><strong>make deinstall
                   4808:                DEINSTALLDEPENDS=1</strong></span> is done in
                   4809:                <code class="filename">pkgsrc/x11/kde</code>, this is
                   4810:                likely to remove whole KDE. Works by adding
1.322     leot     4811:                <span class="quote">&#8220;<span class="quote">-R</span>&#8221;</span> to the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_delete.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a>
1.299     rillig   4812:                command line.</p></dd>
                   4813: </dl></div>
                   4814: </dd>
                   4815: <dt><span class="term">bin-install</span></dt>
                   4816: <dd><p>Install a binary package from local disk and via FTP
                   4817:          from a list of sites (see the
                   4818:          <code class="varname">BINPKG_SITES</code> variable), and do a
                   4819:          <span class="command"><strong>make package</strong></span> if no binary package is
                   4820:          available anywhere.  The arguments given to
                   4821:          <span class="command"><strong>pkg_add</strong></span> can be set via
                   4822:          <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose
                   4823:          operation, etc.</p></dd>
                   4824: <dt><span class="term">install-clean</span></dt>
                   4825: <dd><p>This target removes the state files for the "install" and later
                   4826:          phases so that the "install" target may be re-invoked. This can be
                   4827:          used after editing the PLIST to install the package without
                   4828:          rebuilding it.</p></dd>
                   4829: <dt><span class="term">build-clean</span></dt>
                   4830: <dd><p>This target removes the state files for the "build" and later
                   4831:          phases so that the "build" target may be re-invoked.</p></dd>
                   4832: <dt><span class="term">update</span></dt>
                   4833: <dd>
                   4834: <p>This target causes the current package to be
                   4835:          updated to the latest version.  The package and all
                   4836:          depending packages first get de-installed, then current
                   4837:          versions of the corresponding packages get compiled and
                   4838:          installed.  This is similar to manually noting which
                   4839:          packages are currently installed, then performing a
                   4840:          series of <span class="command"><strong>make deinstall</strong></span> and
                   4841:          <span class="command"><strong>make install</strong></span> (or whatever
                   4842:          <code class="varname">UPDATE_TARGET</code> is set to) for these
                   4843:          packages.</p>
                   4844: <p>You can use the <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> target to
                   4845:          resume package updating in case a previous <span class="command"><strong>make
                   4846:          update</strong></span> was interrupted for some reason.
                   4847:          However, in this case, make sure you don't call
                   4848:          <span class="command"><strong>make clean</strong></span> or otherwise remove the
                   4849:          list of dependent packages in <code class="varname">WRKDIR</code>.
                   4850:          Otherwise, you lose the ability to automatically update
                   4851:          the current package along with the dependent packages
                   4852:          you have installed.</p>
                   4853: <p>Resuming an interrupted <span class="command"><strong>make
                   4854:          update</strong></span> will only work as long as the package
                   4855:          tree remains unchanged.  If the source code for one of
                   4856:          the packages to be updated has been changed, resuming
                   4857:          <span class="command"><strong>make update</strong></span> will most certainly
                   4858:          fail!</p>
                   4859: <p>The following variables can be used either on the
                   4860:          command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
                   4861:          alter the behaviour of <span class="command"><strong>make
                   4862:          update</strong></span>:</p>
                   4863: <div class="variablelist"><dl class="variablelist">
                   4864: <dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt>
                   4865: <dd><p>Install target to recursively use for the
                   4866:                updated package and the dependent packages.
                   4867:                Defaults to <code class="varname">DEPENDS_TARGET</code> if
                   4868:                set, <span class="quote">&#8220;<span class="quote">install</span>&#8221;</span> otherwise for
                   4869:                <span class="command"><strong>make update</strong></span>.  Other good
                   4870:                targets are <span class="quote">&#8220;<span class="quote">package</span>&#8221;</span> or
                   4871:                <span class="quote">&#8220;<span class="quote">bin-install</span>&#8221;</span>.  Do not set this to
                   4872:                <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> or you will get stuck in an
                   4873:                endless loop!</p></dd>
                   4874: <dt><span class="term"><code class="varname">NOCLEAN</code></span></dt>
                   4875: <dd><p>Don't clean up after updating.  Useful if
                   4876:                you want to leave the work sources of the updated
                   4877:                packages around for inspection or other purposes.
                   4878:                Be sure you eventually clean up the source tree
                   4879:                (see the <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target below)
                   4880:                or you may run into troubles with old source code
                   4881:                still lying around on your next
                   4882:                <span class="command"><strong>make</strong></span> or <span class="command"><strong>make
                   4883:                update</strong></span>.</p></dd>
                   4884: <dt><span class="term"><code class="varname">REINSTALL</code></span></dt>
                   4885: <dd><p>Deinstall each package before installing
                   4886:                (making <code class="varname">DEPENDS_TARGET</code>). This
                   4887:                may be necessary if the
                   4888:                <span class="quote">&#8220;<span class="quote">clean-update</span>&#8221;</span> target (see below) was
                   4889:                called after interrupting a running <span class="command"><strong>make
                   4890:                update</strong></span>.</p></dd>
                   4891: <dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt>
                   4892: <dd><p>Allows you to disable recursion and hardcode
                   4893:                the target for packages.  The default is
                   4894:                <span class="quote">&#8220;<span class="quote">update</span>&#8221;</span> for the update target,
                   4895:                facilitating a recursive update of prerequisite
                   4896:                packages.  Only set
                   4897:                <code class="varname">DEPENDS_TARGET</code> if you want to
                   4898:                disable recursive updates. Use
                   4899:                <code class="varname">UPDATE_TARGET</code> instead to just
                   4900:                set a specific target for each package to be
                   4901:                installed during <span class="command"><strong>make update</strong></span>
                   4902:                (see above).</p></dd>
                   4903: </dl></div>
                   4904: </dd>
                   4905: <dt><span class="term">clean-update</span></dt>
                   4906: <dd>
                   4907: <p>Clean the source tree for all packages that would
                   4908:          get updated if <span class="command"><strong>make update</strong></span> was called
                   4909:          from the current directory.  This target should not be
                   4910:          used if the current package (or any of its depending
                   4911:          packages) have already been de-installed (e.g., after
                   4912:          calling <span class="command"><strong>make update</strong></span>) or you may lose
                   4913:          some packages you intended to update. As a rule of
                   4914:          thumb: only use this target <span class="emphasis"><em>before</em></span>
                   4915:          the first time you run <span class="command"><strong>make update</strong></span>
                   4916:          and only if you have a dirty package tree (e.g., if you
                   4917:          used <code class="varname">NOCLEAN</code>).</p>
                   4918: <p>If you are unsure about whether your tree is
                   4919:          clean, you can either perform a <span class="command"><strong>make
                   4920:          clean</strong></span> at the top of the tree, or use the
                   4921:          following sequence of commands from the directory of the
                   4922:          package you want to update (<span class="emphasis"><em>before</em></span>
                   4923:          running <span class="command"><strong>make update</strong></span> for the first
                   4924:          time, otherwise you lose all the packages you wanted to
                   4925:          update!):</p>
                   4926: <pre class="screen">
                   4927: <code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong>
                   4928: <code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   4929: <code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong>
                   4930:          </pre>
                   4931: <p>The following variables can be used either on the
                   4932:          command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of
                   4933:          <span class="command"><strong>make clean-update</strong></span>:</p>
                   4934: <div class="variablelist"><dl class="variablelist">
                   4935: <dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt>
                   4936: <dd><p>After <span class="command"><strong>make clean</strong></span>, do not
                   4937:                reconstruct the list of directories to update for
                   4938:                this package.  Only use this if <span class="command"><strong>make
                   4939:                update</strong></span> successfully installed all
                   4940:                packages you wanted to update.  Normally, this is
                   4941:                done automatically on <span class="command"><strong>make
                   4942:                update</strong></span>, but may have been suppressed by
                   4943:                the <code class="varname">NOCLEAN</code> variable (see
                   4944:                above).</p></dd>
                   4945: </dl></div>
                   4946: </dd>
                   4947: <dt><span class="term">replace</span></dt>
                   4948: <dd>
                   4949: <p>Update the installation of the current package.  This
                   4950:          differs from update in that it does not replace dependent
1.322     leot     4951:          packages.  You will need to install <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_tarup/index.html" target="_top"><code class="filename">pkgtools/pkg_tarup</code></a> for this
1.299     rillig   4952:          target to work.</p>
                   4953: <p><span class="emphasis"><em>Be careful when using this
                   4954:          target!</em></span> There are no guarantees that dependent
                   4955:          packages will still work, in particular they will most
                   4956:          certainly break if you <span class="command"><strong>make replace</strong></span> a
                   4957:          library package whose shared library major version changed
                   4958:          between your installed version and the new one.  For this
                   4959:          reason, this target is not officially supported and only
                   4960:          recommended for advanced users.</p>
                   4961: </dd>
                   4962: <dt><span class="term">info</span></dt>
1.322     leot     4963: <dd><p>This target invokes <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_info.1"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a> for the current
1.299     rillig   4964:          package. You can use this to check which version of a
                   4965:          package is installed.</p></dd>
                   4966: <dt><span class="term">index</span></dt>
                   4967: <dd>
                   4968: <p>This is a top-level command, i.e. it should be used in
                   4969:          the <code class="filename">pkgsrc</code> directory.  It creates a
                   4970:          database of all packages in the local pkgsrc tree, including
                   4971:          dependencies, comment, maintainer, and some other useful
                   4972:          information.  Individual entries are created by running
                   4973:          <span class="command"><strong>make describe</strong></span> in the packages'
                   4974:          directories.  This index file is saved as
                   4975:          <code class="filename">pkgsrc/INDEX</code>.  It can be displayed in
                   4976:          verbose format by running <span class="command"><strong>make
                   4977:          print-index</strong></span>.  You can search in it with
                   4978:          <span class="command"><strong>make search
                   4979:          key=<em class="replaceable"><code>something</code></em></strong></span>.  You can
                   4980:          extract a list of all packages that depend on a particular
                   4981:          one by running <span class="command"><strong>make show-deps
                   4982:          PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p>
                   4983: <p>Running this command takes a very long time, some
                   4984:          hours even on fast machines!</p>
                   4985: </dd>
                   4986: <dt><span class="term">readme</span></dt>
                   4987: <dd>
                   4988: <p>This target generates a
1.314     nia      4989:          <code class="filename">index.html</code> file, which can be
1.322     leot     4990:          viewed using a browser such as <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/firefox/index.html" target="_top"><code class="filename">www/firefox</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/links/index.html" target="_top"><code class="filename">www/links</code></a>.  The generated files
1.299     rillig   4991:          contain references to any packages which are in the
                   4992:          <code class="varname">PACKAGES</code> directory on the local
                   4993:          host. The generated files can be made to refer to URLs
                   4994:          based on <code class="varname">FTP_PKG_URL_HOST</code> and
                   4995:          <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I
1.314     nia      4996:          wanted to generate <code class="filename">index.html</code>
1.299     rillig   4997:          files which pointed to binary packages on the local
                   4998:          machine, in the directory
                   4999:          <code class="filename">/usr/packages</code>, set
                   5000:          <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and
                   5001:          <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   5002:          <code class="varname">${PACKAGES}</code> directory and its
                   5003:          subdirectories will be searched for all the binary
                   5004:          packages.</p>
                   5005: <p>The target can be run at the toplevel or in category
                   5006:          directories, in which case it descends recursively.</p>
                   5007: </dd>
                   5008: <dt><span class="term">readme-all</span></dt>
                   5009: <dd><p>This is a top-level command, run it in
                   5010:          <code class="filename">pkgsrc</code>.  Use this target to create a
                   5011:          file <code class="filename">README-all.html</code> which contains a
                   5012:          list of all packages currently available in the NetBSD
                   5013:          Packages Collection, together with the category they belong
                   5014:          to and a short description. This file is compiled from the
1.314     nia      5015:          <code class="filename">pkgsrc/*/index.html</code> files, so be sure
1.299     rillig   5016:          to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make
                   5017:          readme</strong></span>.</p></dd>
                   5018: <dt><span class="term">cdrom-readme</span></dt>
                   5019: <dd><p>This is very much the same as the
                   5020:          <span class="quote">&#8220;<span class="quote">readme</span>&#8221;</span> target (see above), but is to be
                   5021:          used when generating a pkgsrc tree to be written to a
                   5022:          CD-ROM.  This target also produces
1.314     nia      5023:          <code class="filename">index.html</code> files, and can be made
1.299     rillig   5024:          to refer to URLs based on
                   5025:          <code class="varname">CDROM_PKG_URL_HOST</code> and
                   5026:          <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd>
                   5027: <dt><span class="term">show-distfiles</span></dt>
                   5028: <dd><p>This target shows which distfiles and patchfiles
                   5029:          are needed to build the package
                   5030:          (<code class="varname">ALLFILES</code>, which contains all
                   5031:          <code class="varname">DISTFILES</code> and
                   5032:          <code class="varname">PATCHFILES</code>, but not
                   5033:          <code class="filename">patches/*</code>).</p></dd>
                   5034: <dt><span class="term">show-downlevel</span></dt>
                   5035: <dd><p>This target shows nothing if the package is not
                   5036:          installed. If a version of this package is installed,
                   5037:          but is not the version provided in this version of
                   5038:          pkgsrc, then a warning message is displayed. This target
                   5039:          can be used to show which of your installed packages are
                   5040:          downlevel, and so the old versions can be deleted, and
                   5041:          the current ones added.</p></dd>
                   5042: <dt><span class="term">show-pkgsrc-dir</span></dt>
                   5043: <dd><p>This target shows the directory in the pkgsrc
                   5044:          hierarchy from which the package can be built and
                   5045:          installed. This may not be the same directory as the one
                   5046:          from which the package was installed. This target is
                   5047:          intended to be used by people who may wish to upgrade
                   5048:          many packages on a single host, and can be invoked from
                   5049:          the top-level pkgsrc Makefile by using the
                   5050:          <span class="quote">&#8220;<span class="quote">show-host-specific-pkgs</span>&#8221;</span> target.</p></dd>
                   5051: <dt><span class="term">show-installed-depends</span></dt>
                   5052: <dd><p>This target shows which installed packages match
                   5053:          the current package's <code class="varname">DEPENDS</code>. Useful
                   5054:          if out of date dependencies are causing build
                   5055:          problems.</p></dd>
                   5056: <dt><span class="term">print-build-depends-list</span></dt>
                   5057: <dd><p>This target shows the list of packages that the current package
                   5058:            depends on for building.</p></dd>
                   5059: <dt><span class="term">print-run-depends-list</span></dt>
                   5060: <dd><p>This target shows the list of packages that the current package
                   5061:            depends on for running.</p></dd>
                   5062: <dt><span class="term">check-shlibs</span></dt>
                   5063: <dd><p>After a package is installed, check all its
                   5064:          binaries and (on ELF platforms) shared libraries to see
                   5065:          if they find the shared libs they need.  Run by default
                   5066:          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>
                   5067: <dt><span class="term">print-PLIST</span></dt>
                   5068: <dd>
                   5069: <p>After a <span class="quote">&#8220;<span class="quote">make install</span>&#8221;</span> from a new or
                   5070:          upgraded pkg, this prints out an attempt to generate a
                   5071:          new <code class="filename">PLIST</code> from a <span class="command"><strong>find
                   5072:          -newer work/.extract_done</strong></span>.  An attempt is made
                   5073:          to care for shared libs etc., but it is
                   5074:          <span class="emphasis"><em>strongly</em></span> recommended to review the
                   5075:          result before putting it into
                   5076:          <code class="filename">PLIST</code>. On upgrades, it's useful to
                   5077:          diff the output of this command against an already
                   5078:          existing <code class="filename">PLIST</code> file.</p>
1.322     leot     5079: <p>If the package installs files via <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/tar.1"><span class="citerefentry"><span class="refentrytitle">tar</span>(1)</span></a> or
1.299     rillig   5080:          other methods that don't update file access times, be
                   5081:          sure to add these files manually to your
                   5082:          <code class="filename">PLIST</code>, as the <span class="quote">&#8220;<span class="quote">find
                   5083:          -newer</span>&#8221;</span> command used by this target won't catch
                   5084:          them!</p>
                   5085: <p>See <a class="xref" href="#print-PLIST" title="19.3. Tweaking output of make print-PLIST">Section 19.3, &#8220;Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>&#8221;</a> for more
                   5086:          information on this target.</p>
                   5087: </dd>
                   5088: </dl></div>
                   5089: </div>
                   5090: </div>
                   5091: <div class="chapter">
                   5092: <div class="titlepage"><div><div><h2 class="title">
                   5093: <a name="creating"></a>Chapter 14. Creating a new pkgsrc package from scratch</h2></div></div></div>
                   5094: <div class="toc">
                   5095: <p><b>Table of Contents</b></p>
                   5096: <dl class="toc">
                   5097: <dt><span class="sect1"><a href="#creating.common">14.1. Common types of packages</a></span></dt>
                   5098: <dd><dl>
1.334     nia      5099: <dt><span class="sect2"><a href="#creating.python-module">14.1.1. Python modules and programs</a></span></dt>
                   5100: <dt><span class="sect2"><a href="#creating.R-package">14.1.2. R packages</a></span></dt>
                   5101: <dt><span class="sect2"><a href="#creating.TeX-package">14.1.3. TeXlive packages</a></span></dt>
1.299     rillig   5102: </dl></dd>
                   5103: <dt><span class="sect1"><a href="#creating.examples">14.2. Examples</a></span></dt>
                   5104: <dd><dl><dt><span class="sect2"><a href="#creating.nvu">14.2.1. How the www/nvu package came into pkgsrc</a></span></dt></dl></dd>
                   5105: </dl>
                   5106: </div>
                   5107: <p>When you find a package that is not yet in pkgsrc, you
                   5108: most likely have a URL from where you can download the source
                   5109: code. Starting with this URL, creating a package involves only a
                   5110: few steps.</p>
                   5111: <div class="procedure"><ol class="procedure" type="1">
                   5112: <li class="step"><p>In your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, set <code class="code">PKG_DEVELOPER=yes</code> to
                   5113: enable the basic quality checks.</p></li>
                   5114: <li class="step">
1.322     leot     5115: <p>Install the package <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/pkg_developer/index.html" target="_top"><code class="filename">meta-pkgs/pkg_developer</code></a>, which among others will
1.299     rillig   5116: install the utilities <span class="command"><strong>url2pkg</strong></span>,
                   5117: <span class="command"><strong>pkglint</strong></span>, <span class="command"><strong>pkgvi</strong></span> and
                   5118: <span class="command"><strong>mkpatches</strong></span>:</p>
                   5119: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
                   5120: <code class="prompt">$</code> <strong class="userinput"><code>(cd meta-pkgs/pkg_developer &amp;&amp; bmake update)</code></strong></pre>
                   5121: </li>
                   5122: <li class="step">
                   5123: <p>Choose one of the top-level directories as the category in
                   5124: which you want to place your package. You can also create a directory of
1.334     nia      5125: your own (maybe called <code class="filename">local</code>). Change into that
                   5126: category directory:</p>
                   5127: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd <em class="replaceable"><code>category</code></em></code></strong></pre>
1.299     rillig   5128: </li>
                   5129: <li class="step">
1.334     nia      5130: <p>Run the program <span class="command"><strong>url2pkg</strong></span>, passing as
                   5131: argument the URL of the distribution file (in most cases a
                   5132: <code class="filename">.tar.gz</code> file). This will download the distribution
                   5133: file and create the necessary files of the package, based on what's in
                   5134: the distribution file:</p>
1.299     rillig   5135: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>url2pkg <em class="replaceable"><code>https://www.example.org/packages/package-1.0.tar.gz</code></em></code></strong></pre>
                   5136: </li>
                   5137: <li class="step">
                   5138: <p>Examine the extracted files to determine the dependencies of
                   5139: your package. Ideally, this is mentioned in some
                   5140: <code class="filename">README</code> file, but things may differ. For each of
                   5141: these dependencies, look where it exists in pkgsrc, and if there is a
                   5142: file called <code class="filename">buildlink3.mk</code> in that directory, add a
                   5143: line to your package <code class="filename">Makefile</code> which includes that
                   5144: file just before the last line. If the
                   5145: <code class="filename">buildlink3.mk</code> file does not exist, it must be
                   5146: created first. The <code class="filename">buildlink3.mk</code> file makes sure
                   5147: that the package's include files and libraries are provided.</p>
1.334     nia      5148: <p>If you just need binaries from a dependent package, add a
1.299     rillig   5149: <code class="varname">DEPENDS</code> line to the Makefile, which specifies the
                   5150: version of the dependency and where it can be found in pkgsrc. This line
                   5151: should be placed in the third paragraph. If the dependency is only
                   5152: needed for building the package, but not when using it, use
                   5153: <code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code>
                   5154: instead of <code class="varname">DEPENDS</code>.
                   5155: The difference between <code class="varname">TOOL_DEPENDS</code> and
                   5156: <code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling:
                   5157: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
1.334     nia      5158: packages, i.e. packages for the platform where the package is built;
1.299     rillig   5159: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
1.334     nia      5160: packages, i.e. packages for the platform for which the package
                   5161: is built. There is also <code class="varname">TEST_DEPENDS</code>, which
                   5162: specifies a dependency used only for testing the resulting package
                   5163: built, using the upstream project's included test suite, on the native
                   5164: platform.
1.299     rillig   5165: Your package may then look like this:</p>
                   5166: <pre class="programlisting">
                   5167: [...]
                   5168: 
                   5169: TOOL_DEPENDS+=  libxslt-[0-9]*:../../textproc/libxslt
                   5170: DEPENDS+=       screen-[0-9]*:../../misc/screen
                   5171: DEPENDS+=       screen&gt;=4.0:../../misc/screen
                   5172: 
                   5173: [...]
                   5174: 
                   5175: .include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
                   5176: .include "../../devel/glib2/buildlink3.mk"
                   5177: .include "../../mk/bsd.pkg.mk"
                   5178: </pre>
                   5179: </li>
                   5180: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
                   5181: to be done to make your package a <span class="quote">&#8220;<span class="quote">good</span>&#8221;</span> one. If you don't
                   5182: know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
                   5183: --explain</strong></span> or <span class="command"><strong>pkglint -e</strong></span>, which outputs
                   5184: additional explanations.</p></li>
                   5185: <li class="step"><p>In many cases the package is not yet ready to build. You can
                   5186: find instructions for the most common cases in the next section, <a class="xref" href="#creating.common" title="14.1. Common types of packages">Section 14.1, &#8220;Common types of packages&#8221;</a>. After you have followed the instructions
                   5187: over there, you can hopefully continue here.</p></li>
                   5188: <li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working
                   5189: directory from the extracted files. Besides these files, a lot of cache
1.334     nia      5190: files and other system information have been saved in the working
                   5191: directory, which may have become outdated after you edited the
1.299     rillig   5192: <code class="filename">Makefile</code>.</p></li>
                   5193: <li class="step">
                   5194: <p>Now, run <span class="command"><strong>bmake</strong></span> to build the package. For
                   5195: 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>
1.334     nia      5196: <p>If the extracted files from the package need to be fixed, run
                   5197: multiple rounds of these commands:</p>
                   5198: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>bmake</code></strong>
1.299     rillig   5199: <code class="prompt">$</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   5200: <code class="prompt">$</code> <strong class="userinput"><code>mkpatches</code></strong>
1.334     nia      5201: <code class="prompt">$</code> <strong class="userinput"><code>bmake mps</code></strong>
                   5202: <code class="prompt">$</code> <strong class="userinput"><code>bmake clean</code></strong></pre>
1.299     rillig   5203: </li>
                   5204: <li class="step"><p>When the package builds fine, the next step is to install
                   5205: the package. Run <span class="command"><strong>bmake install</strong></span> and hope that
                   5206: everything works.</p></li>
                   5207: <li class="step"><p>Up to now, the file <code class="filename">PLIST</code>, which
                   5208: contains a list of the files that are installed by the package, is
                   5209: nearly empty. Run <span class="command"><strong>bmake print-PLIST
                   5210: &gt;PLIST</strong></span> to generate a probably correct list. Check
                   5211: the file using your preferred text editor to see if the list of
                   5212: files looks plausible.</p></li>
                   5213: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> again to see if the generated
                   5214: <code class="filename">PLIST</code> contains garbage or not.</p></li>
                   5215: <li class="step"><p>When you ran <span class="command"><strong>bmake install</strong></span>, the package
                   5216: had been registered in the database of installed files, but with an
                   5217: empty list of files. To fix this, run <span class="command"><strong>bmake deinstall</strong></span>
                   5218: and <span class="command"><strong>bmake install</strong></span> again. Now the package is
                   5219: registered with the list of files from
                   5220: <code class="filename">PLIST</code>.</p></li>
                   5221: <li class="step"><p>Run <span class="command"><strong>bmake clean update</strong></span> to run everything
                   5222: from above again in a single step, making sure that the PLIST is correct
                   5223: and the whole package is created as intended.</p></li>
1.334     nia      5224: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see if there's anything
                   5225: left to do.</p></li>
1.299     rillig   5226: <li class="step"><p>Commit the package to pkgsrc-wip or main pkgsrc; see <a class="xref" href="#submit" title="Chapter 23. Submitting and Committing">Chapter 23, <i>Submitting and Committing</i></a>.</p></li>
                   5227: </ol></div>
                   5228: <div class="sect1">
                   5229: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   5230: <a name="creating.common"></a>14.1. Common types of packages</h2></div></div></div>
                   5231: <div class="sect2">
                   5232: <div class="titlepage"><div><div><h3 class="title">
1.334     nia      5233: <a name="creating.python-module"></a>14.1.1. Python modules and programs</h3></div></div></div>
1.299     rillig   5234: <p>Python modules and programs packages are easily created using a
                   5235: set of predefined variables.</p>
                   5236: <p>
                   5237: If some Python versions are not supported by the software, set the
                   5238: <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions
                   5239: that are not supported, e.g.
                   5240: </p>
                   5241: <pre class="programlisting">
                   5242: PYTHON_VERSIONS_INCOMPATIBLE=       27
                   5243: </pre>
                   5244: <p>
                   5245: If the packaged software is a Python module, include one of
1.330     wiz      5246: <code class="filename">../../lang/python/egg.mk</code> or
1.299     rillig   5247: <code class="filename">../../lang/python/extension.mk</code>.</p>
1.330     wiz      5248: <p>Most Python packages use setuptools (<span class="quote">&#8220;<span class="quote">eggs</span>&#8221;</span>).
1.299     rillig   5249: If the packaged software is using setuptools, you only need
                   5250: to include <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/egg.mk</code></span>&#8221;</span>.
1.330     wiz      5251: </p>
1.299     rillig   5252: <p>Either way, the package directory should be called
                   5253: <span class="quote">&#8220;<span class="quote">py-software</span>&#8221;</span> and <code class="varname">PKGNAME</code> should be set to
                   5254: <span class="quote">&#8220;<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>&#8221;</span>, e.g.
                   5255: </p>
                   5256: <pre class="programlisting">
                   5257: DISTNAME=   foopymodule-1.2.10
                   5258: PKGNAME=    ${PYPKGPREFIX}-${DISTNAME}
                   5259: </pre>
1.341     gutterid 5260: <p>
                   5261: For software in PyPi, the name should match what PyPi specifies for
                   5262: "pip install software".
                   5263: </p>
1.299     rillig   5264: <p>If it is an application, include
                   5265: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>&#8221;</span>.
                   5266: In order to correctly set the path to the Python interpreter, use the
                   5267: <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files
                   5268: (paths relative to <code class="varname">WRKSRC</code>) that must be corrected.
                   5269: For example:
                   5270: </p>
                   5271: <pre class="programlisting">
                   5272: REPLACE_PYTHON=   *.py
                   5273: </pre>
                   5274: <p>Some Python modules have separate distributions for Python-2.x
                   5275: and Python-3.x support. In pkgsrc this is handled by the
                   5276: <code class="filename">versioned_dependencies.mk</code> file. Set
                   5277: <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of
                   5278: packages that should be depended upon and include
                   5279: <span class="quote">&#8220;<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>&#8221;</span>,
                   5280: then the pkgsrc infrastructure will depend on the appropriate package
                   5281: version. For example:
                   5282: </p>
                   5283: <pre class="programlisting">
                   5284: PYTHON_VERSIONED_DEPENDENCIES=dialog
                   5285: </pre>
                   5286: <p>
                   5287: Look inside <code class="filename">versioned_dependencies.mk</code> for a list
                   5288: of supported packages.</p>
                   5289: </div>
                   5290: <div class="sect2">
                   5291: <div class="titlepage"><div><div><h3 class="title">
1.334     nia      5292: <a name="creating.R-package"></a>14.1.2. R packages</h3></div></div></div>
1.299     rillig   5293: <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>
                   5294: are handled automatically by <span class="command"><strong>R2pkg</strong></span>, which is
1.322     leot     5295: available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/R2pkg/index.html" target="_top"><code class="filename">pkgtools/R2pkg</code></a>.
1.299     rillig   5296: Individual packages (and optionally their dependencies) may be created
                   5297: and updated.  R packages generally follow the same form, and most of
                   5298: the relevant information needed is contained in a
                   5299: <code class="filename">DESCRIPTION</code> file as part of each R package on
                   5300: <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>.
                   5301: Consequently, <span class="command"><strong>R2pkg</strong></span> downloads that information and
                   5302: creates or updates a package in the canonical form.  The resulting
                   5303: package should be reviewed for correctness.</p>
                   5304: </div>
                   5305: <div class="sect2">
                   5306: <div class="titlepage"><div><div><h3 class="title">
1.334     nia      5307: <a name="creating.TeX-package"></a>14.1.3. TeXlive packages</h3></div></div></div>
1.299     rillig   5308: <p>TeXlive packages from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> are handled automatically by
1.322     leot     5309: <span class="command"><strong>texlive2pkg</strong></span>, which is available in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/texlive2pkg/index.html" target="_top"><code class="filename">pkgtools/texlive2pkg</code></a>.</p>
1.299     rillig   5310: <p>If the TeXlive package name is not known, it may be useful to
                   5311: search <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>.  A
                   5312: <span class="quote">&#8220;<span class="quote">Contained in</span>&#8221;</span> field on the package page typically
                   5313: 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
                   5314: archive</a>.</p>
                   5315: <p>If the TeXlive package name is known, download the files from
                   5316: the <a class="ulink" href="https://www.ctan.org/tex-archive/systems/texlive/tlnet/archive" target="_top">TeXlive
                   5317: archive</a>.  For package <code class="filename">foo</code>, you will need
                   5318: to download <code class="filename">foo.tar.xz</code>.  Most TeXlive packages
                   5319: also have associated documentation packages, so download
                   5320: <code class="filename">foo.doc.tar.xz</code> at the same time.  These files
                   5321: should be placed in the appropriate category directory, which is often
                   5322: but not always <code class="filename">print</code>.  Then run the following
                   5323: command in the category directory.</p>
                   5324: <pre class="programlisting">
                   5325: texlive2pkg foo.tar.xz foo.doc.tar.xz
                   5326: </pre>
                   5327: <p>This will create two packages, <code class="filename">tex-foo</code> and
                   5328: <code class="filename">tex-foo-doc</code>.  Be sure to check that both packages
                   5329: are correct.</p>
                   5330: <p>Finally, <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>
                   5331: currently does not include version information in package filenames
                   5332: and changes their contents periodically when updates occur.
                   5333: Consequently, pkgsrc avoids downloading distfiles directly from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> and instead relies on the
                   5334: pkgsrc archives.  For each new or updated TeXlive package, e.g., the
                   5335: main one and the corresponding documentation, upload the distfiles
                   5336: with the following command in each package directory.</p>
                   5337: <pre class="programlisting">
                   5338: make upload-distfiles
                   5339: </pre>
                   5340: </div>
                   5341: </div>
                   5342: <div class="sect1">
                   5343: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   5344: <a name="creating.examples"></a>14.2. Examples</h2></div></div></div>
                   5345: <div class="sect2">
                   5346: <div class="titlepage"><div><div><h3 class="title">
                   5347: <a name="creating.nvu"></a>14.2.1. How the www/nvu package came into pkgsrc</h3></div></div></div>
                   5348: <div class="sect3">
                   5349: <div class="titlepage"><div><div><h4 class="title">
                   5350: <a name="creating.nvu.init"></a>14.2.1.1. The initial package</h4></div></div></div>
                   5351: <p>Looking at the file <code class="filename">pkgsrc/doc/TODO</code>, I saw
                   5352: that the <span class="quote">&#8220;<span class="quote">nvu</span>&#8221;</span> package has not yet been imported into
                   5353: pkgsrc. As the description says it has to do with the web, the obvious
                   5354: choice for the category is <span class="quote">&#8220;<span class="quote">www</span>&#8221;</span>.</p>
                   5355: <pre class="programlisting">
                   5356: <code class="prompt">$</code> mkdir www/nvu
                   5357: <code class="prompt">$</code> cd www/nvu
                   5358: </pre>
                   5359: <p>The web site says that the sources are available as a tar file, so
                   5360: I fed that URL to the <span class="command"><strong>url2pkg</strong></span> program:</p>
                   5361: <pre class="programlisting">
                   5362: <code class="prompt">$</code> url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
                   5363: </pre>
                   5364: <p>My editor popped up, and I added a <code class="varname">PKGNAME</code> line
                   5365: below the <code class="varname">DISTNAME</code> line, as the package name should
                   5366: not have the word <span class="quote">&#8220;<span class="quote">sources</span>&#8221;</span> in it. I also filled in the
                   5367: <code class="varname">MAINTAINER</code>, <code class="varname">HOMEPAGE</code> and
                   5368: <code class="varname">COMMENT</code> fields. Then the package
                   5369: <code class="filename">Makefile</code> looked like that:</p>
                   5370: <pre class="programlisting">
                   5371: # $NetBSD $
                   5372: #
                   5373: 
                   5374: DISTNAME=       nvu-1.0-sources
                   5375: PKGNAME=        nvu-1.0
                   5376: CATEGORIES=     www
                   5377: MASTER_SITES=   http://cvs.nvu.com/download/
                   5378: EXTRACT_SUFX=   .tar.bz2
                   5379: 
                   5380: MAINTAINER=     rillig@NetBSD.org
                   5381: HOMEPAGE=       http://cvs.nvu.com/
                   5382: COMMENT=        Web Authoring System
                   5383: 
                   5384: # url2pkg-marker (please do not remove this line.)
                   5385: .include "../../mk/bsd.pkg.mk"
                   5386: </pre>
                   5387: <p>On the first line of output above, an artificial space has been added between NetBSD and $,
                   5388: this is a workaround to prevent CVS expanding to the filename of the
                   5389: guide.</p>
                   5390: <p>Then, I quit the editor and watched pkgsrc downloading a large
                   5391: source archive:</p>
                   5392: <pre class="programlisting">
                   5393: url2pkg&gt; Running "make makesum" ...
                   5394: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                   5395: =&gt; Fetching nvu-1.0-sources.tar.bz2
                   5396: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
                   5397: 100% |*************************************| 28992 KB  150.77 KB/s00:00 ETA
                   5398: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
                   5399: url2pkg&gt; Running "make extract" ...
                   5400: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                   5401: =&gt; Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
                   5402: =&gt; Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
                   5403: work.bacc -&gt; /tmp/roland/pkgsrc/www/nvu/work.bacc
                   5404: ===&gt; Installing dependencies for nvu-1.0
                   5405: ===&gt; Overriding tools for nvu-1.0
                   5406: ===&gt; Extracting for nvu-1.0
                   5407: url2pkg&gt; Adjusting the Makefile.
                   5408: 
                   5409: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
                   5410: 
                   5411: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
                   5412: </pre>
                   5413: </div>
                   5414: <div class="sect3">
                   5415: <div class="titlepage"><div><div><h4 class="title">
                   5416: <a name="creating.nvu.problems"></a>14.2.1.2. Fixing all kinds of problems to make the package work</h4></div></div></div>
                   5417: <p>Now that the package has been extracted, let's see what's inside
                   5418: it. The package has a <code class="filename">README.txt</code>, but that only
                   5419: says something about mozilla, so it's probably useless for seeing what
                   5420: dependencies this package has. But since there is a GNU configure script
                   5421: in the package, let's hope that it will complain about everything it
                   5422: needs.</p>
                   5423: <pre class="programlisting">
                   5424: <code class="prompt">$</code> bmake
                   5425: =&gt; Required installed package digest&gt;=20010302: digest-20060826 found
                   5426: =&gt; Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
                   5427: =&gt; Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
                   5428: ===&gt; Patching for nvu-1.0
                   5429: ===&gt; Creating toolchain wrappers for nvu-1.0
                   5430: ===&gt; Configuring for nvu-1.0
                   5431: [...]
                   5432: configure: error: Perl 5.004 or higher is required.
                   5433: [...]
                   5434: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
                   5435: [...]
                   5436: </pre>
                   5437: <p>That worked quite well. So I opened the package Makefile in my
                   5438: editor, and since it already has a <code class="varname">USE_TOOLS</code> line, I
                   5439: just appended <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to it. Since the dependencies of the
                   5440: package have changed now, and since a perl wrapper is automatically
                   5441: installed in the <span class="quote">&#8220;<span class="quote">tools</span>&#8221;</span> phase, I need to build the package
                   5442: from scratch.</p>
                   5443: <pre class="programlisting">
                   5444: <code class="prompt">$</code> bmake clean
                   5445: ===&gt; Cleaning for nvu-1.0
                   5446: <code class="prompt">$</code> bmake
                   5447: [...]
                   5448: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
                   5449: GNU Make.  You will not be able to build Mozilla without GNU Make.
                   5450: [...]
                   5451: </pre>
                   5452: <p>So I added <span class="quote">&#8220;<span class="quote">gmake</span>&#8221;</span> to the
                   5453: <code class="varname">USE_TOOLS</code> line and tried again (from scratch).</p>
                   5454: <pre class="programlisting">
                   5455: [...]
                   5456: checking for GTK - version &gt;= 1.2.0... no
                   5457: *** Could not run GTK test program, checking why...
                   5458: [...]
                   5459: </pre>
                   5460: <p>Now to the other dependencies. The first question is: Where is the
                   5461: GTK package hidden in pkgsrc?</p>
                   5462: <pre class="programlisting">
                   5463: <code class="prompt">$</code> echo ../../*/gtk*
                   5464: [many packages ...]
                   5465: <code class="prompt">$</code> echo ../../*/gtk
                   5466: ../../x11/gtk
                   5467: <code class="prompt">$</code> echo ../../*/gtk2
                   5468: ../../x11/gtk2
                   5469: <code class="prompt">$</code> echo ../../*/gtk2/bui*
                   5470: ../../x11/gtk2/buildlink3.mk
                   5471: </pre>
                   5472: <p>The first try was definitely too broad. The second one had exactly
                   5473: one result, which is very good. But there is one pitfall with GNOME
                   5474: packages. Before GNOME 2 had been released, there were already many
                   5475: GNOME 1 packages in pkgsrc. To be able to continue to use these
                   5476: packages, the GNOME 2 packages were imported as separate packages, and
                   5477: their names usually have a <span class="quote">&#8220;<span class="quote">2</span>&#8221;</span> appended. So I checked
                   5478: whether this was the case here, and indeed it was.</p>
                   5479: <p>Since the GTK2 package has a <code class="filename">buildlink3.mk</code>
                   5480: file, adding the dependency is very easy. I just inserted an
                   5481: <code class="literal">.include</code> line before the last line of the package
                   5482: <code class="filename">Makefile</code>, so that it now looks like this:</p>
                   5483: <pre class="programlisting">
                   5484: [...]
                   5485: .include "../../x11/gtk2/buildlink3.mk"
                   5486: .include "../../mk/bsd.pkg.mk
                   5487: </pre>
                   5488: <p>After another <span class="command"><strong>bmake clean &amp;&amp; bmake</strong></span>, the answer
                   5489: was:</p>
1.75      rillig   5490: <pre class="programlisting">
1.299     rillig   5491: [...]
                   5492: checking for gtk-config... /home/roland/pkg/bin/gtk-config
                   5493: checking for GTK - version &gt;= 1.2.0... no
                   5494: *** Could not run GTK test program, checking why...
                   5495: *** The test program failed to compile or link. See the file config.log for the
                   5496: *** exact error that occured. This usually means GTK was incorrectly installed
                   5497: *** or that you have moved GTK since it was installed. In the latter case, you
                   5498: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
                   5499: configure: error: Test for GTK failed.
                   5500: [...]
1.222     sevan    5501: </pre>
1.299     rillig   5502: <p>In this particular case, the assumption that <span class="quote">&#8220;<span class="quote">every package
                   5503: prefers GNOME 2</span>&#8221;</span> had been wrong. The first of the lines above
                   5504: told me that this package really wanted to have the GNOME 1 version of
                   5505: GTK. If the package had looked for GTK2, it would have looked for
                   5506: <span class="command"><strong>pkg-config</strong></span> instead of <span class="command"><strong>gtk-config</strong></span>.
                   5507: So I changed the <code class="literal">x11/gtk2</code> to
                   5508: <code class="literal">x11/gtk</code> in the package <code class="filename">Makefile</code>,
                   5509: and tried again.</p>
1.119     mishka   5510: <pre class="programlisting">
1.299     rillig   5511: [...]
                   5512: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\"  [...]
                   5513: In file included from xpidl.c:42:
                   5514: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
                   5515: In file included from xpidl.c:42:
                   5516: xpidl.h:132: error: parse error before "IDL_ns"
                   5517: [...]
1.222     sevan    5518: </pre>
1.299     rillig   5519: <p>The package still does not find all of its dependencies. Now the
                   5520: question is: Which package provides the
                   5521: <code class="filename">libIDL/IDL.h</code> header file?</p>
1.119     mishka   5522: <pre class="programlisting">
1.299     rillig   5523: <code class="prompt">$</code> echo ../../*/*idl*
                   5524: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
                   5525: <code class="prompt">$</code> echo ../../*/*IDL*
                   5526: ../../net/libIDL
1.222     sevan    5527: </pre>
1.299     rillig   5528: <p>Let's take the one from the second try. So I included the
                   5529: <code class="filename">../../net/libIDL/buildlink3.mk</code> file and tried
                   5530: again. But the error didn't change. After digging through some of the
                   5531: code, I concluded that the build process of the package was broken and
                   5532: couldn't have ever worked, but since the Mozilla source tree is quite
                   5533: large, I didn't want to fix it. So I added the following to the package
                   5534: <code class="filename">Makefile</code> and tried again:</p>
1.197     wiz      5535: <pre class="programlisting">
1.299     rillig   5536: CPPFLAGS+=              -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
                   5537: BUILDLINK_TRANSFORM+=   l:IDL:IDL-2
1.222     sevan    5538: </pre>
1.299     rillig   5539: <p>The latter line is needed because the package expects the library
                   5540: <code class="filename">libIDL.so</code>, but only
                   5541: <code class="filename">libIDL-2.so</code> is available. So I told the compiler
                   5542: wrapper to rewrite that on the fly.</p>
                   5543: <p>The next problem was related to a recent change of the FreeType
1.322     leot     5544: interface. I looked up in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/seamonkey/index.html" target="_top"><code class="filename">www/seamonkey</code></a>
1.299     rillig   5545: which patch files were relevant for this issue and copied them to the
                   5546: <code class="filename">patches</code> directory. Then I retried, fixed the
                   5547: patches so that they applied cleanly and retried again. This time,
                   5548: everything worked.</p>
1.197     wiz      5549: </div>
1.299     rillig   5550: <div class="sect3">
                   5551: <div class="titlepage"><div><div><h4 class="title">
                   5552: <a name="creating.nvu.inst"></a>14.2.1.3. Installing the package</h4></div></div></div>
1.87      wiz      5553: <pre class="programlisting">
1.299     rillig   5554: <code class="prompt">$</code> bmake CHECK_FILES=no install
                   5555: [...]
                   5556: <code class="prompt">$</code> bmake print-PLIST &gt;PLIST
                   5557: <code class="prompt">$</code> bmake deinstall
                   5558: <code class="prompt">$</code> bmake install
1.222     sevan    5559: </pre>
1.299     rillig   5560: </div>
                   5561: </div>
1.75      rillig   5562: </div>
                   5563: </div>
1.148     asau     5564: <div class="chapter">
1.75      rillig   5565: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   5566: <a name="makefile"></a>Chapter 15. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
1.75      rillig   5567: <div class="toc">
                   5568: <p><b>Table of Contents</b></p>
1.210     leot     5569: <dl class="toc">
1.299     rillig   5570: <dt><span class="sect1"><a href="#makefile.style">15.1. Caveats</a></span></dt>
                   5571: <dt><span class="sect1"><a href="#makefile.variables">15.2. <code class="filename">Makefile</code> variables</a></span></dt>
                   5572: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">15.2.1. Naming conventions</a></span></dt></dl></dd>
                   5573: <dt><span class="sect1"><a href="#makefile.code">15.3. Code snippets</a></span></dt>
                   5574: <dd><dl>
                   5575: <dt><span class="sect2"><a href="#adding-to-list">15.3.1. Adding things to a list</a></span></dt>
                   5576: <dt><span class="sect2"><a href="#echo-literal">15.3.2. Echoing a string exactly as-is</a></span></dt>
                   5577: <dt><span class="sect2"><a href="#cflags-gnu-configure">15.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</a></span></dt>
                   5578: <dt><span class="sect2"><a href="#empty-variables">15.3.4. Handling possibly empty variables</a></span></dt>
1.344     gutterid 5579: <dt><span class="sect2"><a href="#makefile.yesno">15.3.5. Testing yes/no variables in conditions</a></span></dt>
1.75      rillig   5580: </dl></dd>
                   5581: </dl>
                   5582: </div>
1.299     rillig   5583: <p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
                   5584:   each of which forms a well-defined part of the pkgsrc system. Using
1.322     leot     5585:   the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> system as a programming language for a big system
1.299     rillig   5586:   like pkgsrc requires some discipline to keep the code correct and
                   5587:   understandable.</p>
                   5588: <p>The basic ingredients for <code class="filename">Makefile</code>
                   5589:   programming are variables and shell
                   5590:   commands. Among these shell commands may even be more complex ones
1.322     leot     5591:   like <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/awk.1"><span class="citerefentry"><span class="refentrytitle">awk</span>(1)</span></a> programs. To make sure that every shell command runs
1.299     rillig   5592:   as intended it is necessary to quote all variables correctly when they
                   5593:   are used.</p>
                   5594: <p>This chapter describes some patterns that appear quite often in
                   5595:   <code class="filename">Makefile</code>s, including the pitfalls that come along
                   5596:   with them.</p>
1.148     asau     5597: <div class="sect1">
1.75      rillig   5598: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   5599: <a name="makefile.style"></a>15.1. Caveats</h2></div></div></div>
                   5600: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
                   5601: <p>When you are creating a file as a
                   5602:     target of a rule, always write the data to a temporary file first
                   5603:     and finally rename that file. Otherwise there might occur an error
                   5604:     in the middle of generating the file, and when the user runs
1.322     leot     5605:     <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> for the second time, the file exists and will not be
1.299     rillig   5606:     regenerated properly. Example:</p>
1.75      rillig   5607: <pre class="programlisting">
1.299     rillig   5608: wrong:
                   5609:         @echo "line 1" &gt; ${.TARGET}
                   5610:         @echo "line 2" &gt;&gt; ${.TARGET}
                   5611:         @false
                   5612: 
                   5613: correct:
                   5614:         @echo "line 1" &gt; ${.TARGET}.tmp
                   5615:         @echo "line 2" &gt;&gt; ${.TARGET}.tmp
                   5616:         @false
                   5617:         @mv ${.TARGET}.tmp ${.TARGET}
1.100     rillig   5618: </pre>
1.299     rillig   5619: <p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file
                   5620:     <code class="filename">wrong</code> will exist, although there was an error
                   5621:     message in the first run. On the other hand, running <span class="command"><strong>make
                   5622:     correct</strong></span> gives an error message twice, as expected.</p>
1.322     leot     5623: <p>You might remember that <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> sometimes removes
1.299     rillig   5624:     <code class="literal">${.TARGET}</code> in case of error, but this only
                   5625:     happens when it is interrupted, for example by pressing
                   5626:     <code class="literal">Ctrl+C</code>. This does <span class="emphasis"><em>not</em></span> happen
1.322     leot     5627:     when one of the commands fails (like <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/false.1"><span class="citerefentry"><span class="refentrytitle">false</span>(1)</span></a> above).</p>
1.299     rillig   5628: </li></ul></div>
                   5629: </div>
                   5630: <div class="sect1">
                   5631: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   5632: <a name="makefile.variables"></a>15.2. <code class="filename">Makefile</code> variables</h2></div></div></div>
                   5633: <p><code class="filename">Makefile</code> variables contain strings that
                   5634:     can be processed using the five operators <code class="code">=</code>,
                   5635:     <code class="code">+=</code>, <code class="code">?=</code>, <code class="code">:=</code> and
1.322     leot     5636:     <code class="code">!=</code>, which are described in the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man
1.299     rillig   5637:     page.</p>
                   5638: <p>When a variable's value is parsed from a
                   5639:     <code class="filename">Makefile</code>, the hash character <code class="code">#</code> and
                   5640:     the backslash character <code class="code">\</code> are handled specially. If a
                   5641:     backslash is the last character in a line, that backslash is removed
                   5642:     from the line and the line continues with the next line of the file.</p>
                   5643: <p>The <code class="code">#</code> character starts a comment that reaches
                   5644:     until the end of the line. To get an actual <code class="code">#</code> character,
                   5645:     such as in a URL, write <code class="code">\#</code> instead.</p>
                   5646: <p>The evaluation of variables either happens immediately or lazy.
                   5647:     It happens immediately when the variable occurs on the right-hand
                   5648:     side of the <code class="code">:=</code> or the <code class="code">!=</code> operator, in a
                   5649:     <code class="varname">.if</code> condition or a <code class="varname">.for</code> loop.
                   5650:     In the other cases, it is evaluated lazily.</p>
                   5651: <p>Some of the modifiers split the string into words and then
                   5652:     operate on the words, others operate on the string as a whole. When a
                   5653:     string is split into words, double quotes and single quotes are
1.322     leot     5654:     interpreted as delimiters, just like in <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/sh.1"><span class="citerefentry"><span class="refentrytitle">sh</span>(1)</span></a>.</p>
1.299     rillig   5655: <div class="sect2">
                   5656: <div class="titlepage"><div><div><h3 class="title">
                   5657: <a name="makefile.variables.names"></a>15.2.1. Naming conventions</h3></div></div></div>
                   5658: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   5659: <li class="listitem"><p>All variable names starting with an underscore
                   5660:        are reserved for use by the pkgsrc infrastructure. They shall
                   5661:        not be used by packages.</p></li>
                   5662: <li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use
                   5663:        lowercase variable names for the iteration
                   5664:        variables.</p></li>
                   5665: <li class="listitem"><p>All list variables should have a plural name,
                   5666:        such as <code class="varname">PKG_OPTIONS</code> or
                   5667:        <code class="varname">DISTFILES</code>.</p></li>
                   5668: </ul></div>
                   5669: </div>
                   5670: </div>
                   5671: <div class="sect1">
                   5672: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   5673: <a name="makefile.code"></a>15.3. Code snippets</h2></div></div></div>
                   5674: <div class="sect2">
                   5675: <div class="titlepage"><div><div><h3 class="title">
                   5676: <a name="adding-to-list"></a>15.3.1. Adding things to a list</h3></div></div></div>
                   5677: <p>When adding a string that possibly contains whitespace or quotes to
                   5678: a list (example 1), it must be quoted using the <code class="code">:Q</code>
                   5679: modifier.</p>
                   5680: <p>When adding another list to a list (example 2), it must not be
                   5681: quoted, since its elements are already quoted.</p>
1.75      rillig   5682: <pre class="programlisting">
1.299     rillig   5683: STRING=         foo * bar `date`
                   5684: LIST=           # empty
                   5685: ANOTHER_LIST=   a=b c=d
                   5686: 
                   5687: LIST+=          ${STRING:Q}       # 1
                   5688: LIST+=          ${ANOTHER_LIST}   # 2
1.100     rillig   5689: </pre>
1.299     rillig   5690: </div>
                   5691: <div class="sect2">
                   5692: <div class="titlepage"><div><div><h3 class="title">
                   5693: <a name="echo-literal"></a>15.3.2. Echoing a string exactly as-is</h3></div></div></div>
                   5694: <p>Echoing a string containing special characters needs special
                   5695: work.</p>
1.75      rillig   5696: <pre class="programlisting">
1.299     rillig   5697: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
                   5698: EXAMPLE_ENV=    string=${STRING:Q} x=multiple\ quoted\ words
                   5699: 
                   5700: all:
                   5701:         echo ${STRING}                  # 1
                   5702:         echo ${STRING:Q}                # 2
                   5703:         printf '%s\n' ${STRING:Q}''     # 3
                   5704:         env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"'   # 4
1.100     rillig   5705: </pre>
1.299     rillig   5706: <p>Example 1 leads to a syntax error in the shell, as the characters
                   5707: are just copied.</p>
                   5708: <p>Example 2 quotes the string so that the shell interprets it
                   5709: correctly. But the echo command may additionally interpret strings with a
                   5710: leading dash or those containing backslashes.</p>
1.322     leot     5711: <p>Example 3 can handle arbitrary strings, since <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/printf.1"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> only
1.299     rillig   5712: interprets the format string, but not the next argument. The trailing
                   5713: single quotes handle the case when the string is empty. In that case, the
                   5714: :Q modifier would result in an empty string too, which would then be
1.322     leot     5715: skipped by the shell. For <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/printf.1"><span class="citerefentry"><span class="refentrytitle">printf</span>(1)</span></a> this doesn't make a difference,
1.299     rillig   5716: but other programs may care.</p>
                   5717: <p>In example 4, the <code class="varname">EXAMPLE_ENV</code> does not
                   5718: need to be quoted because the quoting has already been done
                   5719: when adding elements to the list.</p>
1.75      rillig   5720: </div>
1.148     asau     5721: <div class="sect2">
1.75      rillig   5722: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   5723: <a name="cflags-gnu-configure"></a>15.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</h3></div></div></div>
                   5724: <p>When passing <code class="varname">CFLAGS</code> or similar variables to a
                   5725: GNU-style configure script (especially those that call other configure
                   5726: scripts), it must not have leading or trailing whitespace, since
                   5727: otherwise the configure script gets confused. To trim leading and
                   5728: trailing whitespace, use the <code class="code">:M</code> modifier, as in the
                   5729: following example:</p>
1.75      rillig   5730: <pre class="programlisting">
1.299     rillig   5731: CPPFLAGS=               # empty
                   5732: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX}\"
                   5733: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    5734: 
1.299     rillig   5735: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    5736: 
1.299     rillig   5737: all:
                   5738:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
                   5739:         echo x${CONFIGURE_ARGS:Q}x      # properly trimmed
                   5740: </pre>
                   5741: <p>In this example, <code class="varname">CPPFLAGS</code> has both leading and
                   5742: trailing whitespace because the <code class="code">+=</code> operator always adds a
                   5743: space.</p>
                   5744: </div>
                   5745: <div class="sect2">
                   5746: <div class="titlepage"><div><div><h3 class="title">
                   5747: <a name="empty-variables"></a>15.3.4. Handling possibly empty variables</h3></div></div></div>
                   5748: <p>When a possibly empty variable is used in a shell program, it may
                   5749: lead to a syntax error.</p>
                   5750: <pre class="programlisting">
                   5751: EGFILES=        # empty
1.87      wiz      5752: 
1.299     rillig   5753: install-examples:   # produces a syntax error in the shell
                   5754:         for egfile in ${EGFILES}; do            \
                   5755:                 echo "Installing $$egfile";     \
                   5756:         done
                   5757: </pre>
                   5758: <p>The shell only sees the text <code class="code">for egfile in ; do</code>, since
1.322     leot     5759: <code class="code">${EGFILES}</code> is replaced with an empty string by <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>.
1.299     rillig   5760: To fix this syntax error, use one of the snippets below.</p>
                   5761: <pre class="programlisting">
1.344     gutterid 5762: EGFILES=        # empty
1.87      wiz      5763: 
1.299     rillig   5764: install-examples:
                   5765:         for egfile in ${EGFILES} ""; do         \
                   5766:                 [ -n "$$egfile" ] || continue;  \
                   5767:                 echo "Installing $$egfile";     \
                   5768:         done
                   5769: </pre>
                   5770: <p>In this case, an empty string is appended to the iteration list (to
                   5771: prevent the syntax error) and filtered out later.</p>
                   5772: <pre class="programlisting">
                   5773: EGFILES=        # empty
1.87      wiz      5774: 
1.299     rillig   5775: install-examples:
                   5776: .for egfile in ${EGFILES}
                   5777:         echo "Installing ${egfile}"
                   5778: .endfor
1.100     rillig   5779: </pre>
1.299     rillig   5780: <p>If one of the filenames contains special characters, it should be
                   5781: enclosed in single or double quotes.</p>
                   5782: <p>To have a shell command test whether a make variable is empty, use
                   5783: the following code: <code class="code">${TEST} -z ${POSSIBLY_EMPTY:Q}""</code>.</p>
                   5784: </div>
1.344     gutterid 5785: <div class="sect2">
                   5786: <div class="titlepage"><div><div><h3 class="title">
                   5787: <a name="makefile.yesno"></a>15.3.5. Testing yes/no variables in conditions</h3></div></div></div>
                   5788: <p>When a variable can have the values <code class="literal">yes</code> or
                   5789: <code class="literal">no</code>, use the following pattern to test the variable:</p>
                   5790: <pre class="programlisting">
                   5791: .if ${VAR:U:tl} == "yes"
                   5792: # do something
                   5793: .endif
                   5794: </pre>
                   5795: <p>The <code class="literal">:U</code> modifier is only necessary if the variable
                   5796: can be undefined. If the variable is guaranteed to be defined, the
                   5797: <code class="literal">:U</code> can be omitted.</p>
                   5798: <p>The <code class="literal">:tl</code> modifier converts the variable value to
                   5799: lowercase, allowing for the values <code class="literal">yes</code>,
                   5800: <code class="literal">Yes</code>, <code class="literal">YES</code>.</p>
                   5801: </div>
1.299     rillig   5802: </div>
                   5803: </div>
                   5804: <div class="chapter">
                   5805: <div class="titlepage"><div><div><h2 class="title">
                   5806: <a name="options"></a>Chapter 16. Options handling</h2></div></div></div>
                   5807: <div class="toc">
                   5808: <p><b>Table of Contents</b></p>
                   5809: <dl class="toc">
                   5810: <dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
                   5811: <dt><span class="sect1"><a href="#converting-to-options">16.2. Converting packages to use <code class="filename">bsd.options.mk</code></a></span></dt>
                   5812: <dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
                   5813: <dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
                   5814: </dl>
1.75      rillig   5815: </div>
1.299     rillig   5816: <p>Many packages have the ability to be built to support different
                   5817: sets of features.  <code class="filename">bsd.options.mk</code> is a framework
                   5818: in pkgsrc that provides generic handling of those options that
                   5819: determine different ways in which the packages can be built.  It's
                   5820: possible for the user to specify exactly which sets of options will be
                   5821: built into a package or to allow a set of global default options
                   5822: apply.</p>
                   5823: <p>There are two broad classes of behaviors that one might want to
                   5824: control via options.  One is whether some particular feature is
                   5825: enabled in a program that will be built anyway, often by including or
                   5826: not including a dependency on some other package.  The other is
                   5827: whether or not an additional program will be built as part of the
                   5828: package.  Generally, it is better to make a split package for such
                   5829: additional programs instead of using options, because it enables
                   5830: binary packages to be built which can then be added separately.  For
                   5831: example, the foo package might have minimal dependencies (those
                   5832: packages without which foo doesn't make sense), and then the foo-gfoo
                   5833: package might include the GTK frontend program gfoo.  This is better
                   5834: than including a gtk option to foo that adds gfoo, because either that
                   5835: option is default, in which case binary users can't get foo without
                   5836: gfoo, or not default, in which case they can't get gfoo.  With split
                   5837: packages, they can install foo without having GTK, and later decide to
                   5838: install gfoo (pulling in GTK at that time).  This is an advantage to
                   5839: source users too, avoiding the need for rebuilds.</p>
                   5840: <p>Plugins with widely varying dependencies should usually be split
                   5841: instead of options.</p>
                   5842: <p>It is often more work to maintain split packages, especially if
                   5843: the upstream package does not support this.  The decision of split
                   5844: vs. option should be made based on the likelihood that users will want
                   5845: or object to the various pieces, the size of the dependencies that are
                   5846: included, and the amount of work.</p>
                   5847: <p>A further consideration is licensing.  Non-free parts, or parts
                   5848: that depend on non-free dependencies (especially plugins) should
                   5849: almost always be split if feasible.</p>
                   5850: <div class="sect1">
                   5851: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   5852: <a name="global-default-options"></a>16.1. Global default options</h2></div></div></div>
                   5853: <p>Global default options are listed in
                   5854: <code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options
                   5855: that should be built into every package if that option is supported.
                   5856: This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75      rillig   5857: </div>
1.148     asau     5858: <div class="sect1">
1.75      rillig   5859: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   5860: <a name="converting-to-options"></a>16.2. Converting packages to use <code class="filename">bsd.options.mk</code>
                   5861: </h2></div></div></div>
                   5862: <p>The following example shows how
                   5863: <code class="filename">bsd.options.mk</code> should be used
                   5864: by the hypothetical ``wibble'' package, either in the package
                   5865: <code class="filename">Makefile</code>, or in a file,
                   5866: e.g. <code class="filename">options.mk</code>, that is included by the
                   5867: main package <code class="filename">Makefile</code>.</p>
1.75      rillig   5868: <pre class="programlisting">
1.299     rillig   5869: PKG_OPTIONS_VAR=                PKG_OPTIONS.wibble
                   5870: PKG_SUPPORTED_OPTIONS=          wibble-foo ldap
                   5871: PKG_OPTIONS_OPTIONAL_GROUPS=    database
                   5872: PKG_OPTIONS_GROUP.database=     mysql pgsql
                   5873: PKG_SUGGESTED_OPTIONS=          wibble-foo
                   5874: PKG_OPTIONS_LEGACY_VARS+=       WIBBLE_USE_OPENLDAP:ldap
                   5875: PKG_OPTIONS_LEGACY_OPTS+=       foo:wibble-foo
                   5876: 
                   5877: .include "../../mk/bsd.prefs.mk"
                   5878: 
                   5879: # this package was previously named wibble2
                   5880: .if defined(PKG_OPTIONS.wibble2)
                   5881: PKG_LEGACY_OPTIONS+=            ${PKG_OPTIONS.wibble2}
                   5882: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
                   5883:         "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
                   5884: .endif
                   5885: 
                   5886: .include "../../mk/bsd.options.mk"
                   5887: 
                   5888: # Package-specific option-handling
1.100     rillig   5889: 
1.299     rillig   5890: ###
                   5891: ### FOO support
                   5892: ###
                   5893: .if !empty(PKG_OPTIONS:Mwibble-foo)
                   5894: CONFIGURE_ARGS+=    --enable-foo
                   5895: .endif
1.100     rillig   5896: 
1.299     rillig   5897: ###
                   5898: ### LDAP support
                   5899: ###
                   5900: .if !empty(PKG_OPTIONS:Mldap)
                   5901: .  include "../../databases/openldap-client/buildlink3.mk"
                   5902: CONFIGURE_ARGS+=    --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
                   5903: .endif
1.100     rillig   5904: 
1.299     rillig   5905: ###
                   5906: ### database support
                   5907: ###
                   5908: .if !empty(PKG_OPTIONS:Mmysql)
                   5909: .  include "../../mk/mysql.buildlink3.mk"
                   5910: .endif
                   5911: .if !empty(PKG_OPTIONS:Mpgsql)
                   5912: .  include "../../mk/pgsql.buildlink3.mk"
                   5913: .endif
                   5914: </pre>
                   5915: <p>The first section contains the information about which build
                   5916: options are supported by the package, and any default options settings
                   5917: if needed.</p>
                   5918: <div class="orderedlist"><ol class="orderedlist" type="1">
                   5919: <li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the
1.322     leot     5920: <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> variable that the user can set to override the default
1.299     rillig   5921: options.  It should be set to
                   5922: PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to
                   5923: PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined
                   5924: at the point where the options are processed.</p></li>
                   5925: <li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   5926: build options supported by the package.</p></li>
                   5927: <li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
                   5928: list of names of groups of mutually exclusive options.  The options in
                   5929: each group are listed in
                   5930: <code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>.
                   5931: The most specific setting of any option from the group takes
                   5932: precedence over all other options in the group.  Options from the
                   5933: groups will be automatically added to
                   5934: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li>
                   5935: <li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like
                   5936: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the
                   5937: packages will fail if no option from the group is
                   5938: selected.</p></li>
                   5939: <li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list
                   5940: of names of sets of options.  At least one option from each set must
                   5941: be selected.  The options in each set are listed in
                   5942: <code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>.
                   5943: Options from the sets will be automatically added to
                   5944: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.  Building the package will
                   5945: fail if no option from the set is selected.</p></li>
                   5946: <li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   5947: build options which are enabled by default.</p></li>
                   5948: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
                   5949: of
                   5950: <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>
                   5951: pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to
                   5952: their option counterparts.  Pairs should be added with
                   5953: <span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep the listing of global legacy variables.  A
                   5954: warning will be issued if the user uses a legacy
                   5955: variable.</p></li>
                   5956: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
                   5957: of
                   5958: <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>
                   5959: pairs that map options that have been renamed to their new
                   5960: counterparts.  Pairs should be added with <span class="quote">&#8220;<span class="quote">+=</span>&#8221;</span> to keep
                   5961: the listing of global legacy options.  A warning will be issued if
                   5962: the user uses a legacy option.</p></li>
                   5963: <li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of
                   5964: options implied by deprecated variables used.  This can be used for
                   5965: cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor
                   5966: <code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when
                   5967: <code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li>
                   5968: <li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
                   5969: a list of warnings about deprecated variables or options used, and
                   5970: what to use instead.</p></li>
                   5971: </ol></div>
                   5972: <p>A package should never modify
                   5973: <code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in
                   5974: <code class="varname">PKG_OPTIONS_VAR</code>.  These are strictly user-settable.
                   5975: To suggest a default set of options, use
                   5976: <code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p>
                   5977: <p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before
                   5978: including <code class="filename">bsd.options.mk</code>.  If none of
                   5979: <code class="varname">PKG_SUPPORTED_OPTIONS</code>,
                   5980: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
                   5981: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can
                   5982: happen with platform-specific options if none of them is supported on
                   5983: the current platform), <code class="varname">PKG_OPTIONS</code> is set to the
                   5984: empty list and the package is otherwise treated as not using the
                   5985: options framework.</p>
                   5986: <p>After the inclusion of <code class="filename">bsd.options.mk</code>, the
                   5987: variable <code class="varname">PKG_OPTIONS</code> contains the list of selected
                   5988: build options, properly filtered to remove unsupported and duplicate
                   5989: options.</p>
                   5990: <p>The remaining sections contain the logic that is specific to
                   5991: each option.  The correct way to check for an option is to check
                   5992: whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p>
                   5993: <pre class="programlisting">
                   5994: .if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>)
1.100     rillig   5995: </pre>
1.75      rillig   5996: </div>
1.299     rillig   5997: <div class="sect1">
                   5998: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   5999: <a name="option-names"></a>16.3. Option Names</h2></div></div></div>
                   6000: <p>Options that enable similar features in different packages (like
                   6001: optional support for a library) should use a common name in all
                   6002: packages that support it (like the name of the library).  If another
                   6003: package already has an option with the same meaning, use the same
                   6004: name.</p>
                   6005: <p>Options that enable features specific to one package, where it's
                   6006: unlikely that another (unrelated) package has the same (or a similar)
                   6007: optional feature, should use a name prefixed with
                   6008: <code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p>
                   6009: <p>If a group of related packages share an optional feature
                   6010: specific to that group, prefix it with the name of the
                   6011: <span class="quote">&#8220;<span class="quote">main</span>&#8221;</span> package
                   6012: (e. g. <code class="varname">djbware-errno-hack</code>).</p>
                   6013: <p>For new options, add a line to
                   6014: <code class="filename">mk/defaults/options.description</code>.  Lines have two
                   6015: fields, separated by tab.  The first field is the option name, the
                   6016: second its description.  The description should be a whole sentence
                   6017: (starting with an uppercase letter and ending with a period) that
                   6018: describes what enabling the option does.  E. g. <span class="quote">&#8220;<span class="quote">Enable ispell
                   6019: support.</span>&#8221;</span> The file is sorted by option names.</p>
                   6020: </div>
                   6021: <div class="sect1">
                   6022: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   6023: <a name="option-build"></a>16.4. Determining the options of dependencies</h2></div></div></div>
                   6024: <p>When writing <a class="link" href="#buildlink3.mk"><code class="filename">buildlink3.mk</code></a> files, it is often necessary to list
                   6025: different dependencies based on the options with which the package was
                   6026: built. For querying these options, the file
                   6027: <code class="filename">pkgsrc/mk/pkg-build-options.mk</code> should be used. A
                   6028: typical example looks like this:</p>
1.87      wiz      6029: <pre class="programlisting">
1.299     rillig   6030: pkgbase := libpurple
                   6031: .include "../../mk/pkg-build-options.mk"
                   6032: 
                   6033: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
                   6034: ...
                   6035: .endif
1.229     sevan    6036: </pre>
1.299     rillig   6037: <p>Including <code class="filename">pkg-build-options.mk</code> here will set
                   6038: the variable <code class="varname">PKG_BUILD_OPTIONS.libpurple</code> to the build
                   6039: options of the libpurple package, which can then be queried like
                   6040: <code class="varname">PKG_OPTIONS</code> in the <code class="filename">options.mk</code>
                   6041: file. See the file <code class="filename">pkg-build-options.mk</code> for more
                   6042: details.</p>
1.75      rillig   6043: </div>
                   6044: </div>
1.148     asau     6045: <div class="chapter">
1.75      rillig   6046: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   6047: <a name="tools"></a>Chapter 17. Tools needed for building or running</h2></div></div></div>
1.75      rillig   6048: <div class="toc">
                   6049: <p><b>Table of Contents</b></p>
1.210     leot     6050: <dl class="toc">
1.299     rillig   6051: <dt><span class="sect1"><a href="#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
                   6052: <dt><span class="sect1"><a href="#package-tools">17.2. Tools needed by packages</a></span></dt>
                   6053: <dt><span class="sect1"><a href="#platform-tools">17.3. Tools provided by platforms</a></span></dt>
1.75      rillig   6054: </dl>
                   6055: </div>
1.299     rillig   6056: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
                   6057: by pkgsrc and also for individual packages to define what commands
                   6058: are needed for building a package (like <code class="varname">TOOL_DEPENDS</code>)
                   6059: or for later run-time of an installed packaged (such as
                   6060: <code class="varname">DEPENDS</code>).
                   6061: If the native system provides an adequate tool, then in many cases, a pkgsrc
                   6062: package will not be used.</p>
                   6063: <p>When building a package, the replacement tools are
                   6064: made available in a directory (as symlinks or wrapper scripts)
                   6065: that is early in the executable search path. Just like the buildlink
                   6066: system, this helps with consistent builds.</p>
                   6067: <p>A tool may be needed to help build a specific package. For example,
                   6068: perl, GNU make (gmake) or yacc may be needed.</p>
                   6069: <p>Also a tool may be needed, for example, because the native system's supplied
                   6070: tool may be inefficient for building a package with pkgsrc.
                   6071: For example, a package may need GNU awk, bison (instead of
                   6072: yacc) or a better sed.</p>
                   6073: <p>The tools used by a package can be listed by running
                   6074: <span class="command"><strong>make show-tools</strong></span>.</p>
1.148     asau     6075: <div class="sect1">
1.75      rillig   6076: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6077: <a name="pkgsrc-tools"></a>17.1. Tools for pkgsrc builds</h2></div></div></div>
                   6078: <p>The default set of tools used by pkgsrc is defined in
                   6079: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
                   6080: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
                   6081: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
                   6082: These can be seen by running:
                   6083: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
                   6084: <p>If a package needs a specific program to build
                   6085: then the <code class="varname">USE_TOOLS</code> variable can be used
                   6086: to define the tools needed.</p>
1.75      rillig   6087: </div>
1.299     rillig   6088: <div class="sect1">
                   6089: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   6090: <a name="package-tools"></a>17.2. Tools needed by packages</h2></div></div></div>
                   6091: <p>In the following examples, the :run means that it is needed at
                   6092: run-time (and becomes a DEPENDS).
                   6093: The default is a build dependency which can be set with
                   6094: :build. (So in this example, it is the same as gmake:build
                   6095: and pkg-config:build.)</p>
1.75      rillig   6096: <pre class="programlisting">
1.299     rillig   6097: USE_TOOLS+=     gmake perl:run pkg-config
1.1       grant    6098: </pre>
1.299     rillig   6099: <p>When using the tools framework, a
                   6100: <code class="varname">TOOLS_PATH.foo</code> variable is defined
                   6101: which contains the full path to the appropriate tool. For example,
                   6102: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">&#8220;<span class="quote">/bin/bash</span>&#8221;</span>
                   6103: on Linux systems.</p>
                   6104: <p>If you always need a pkgsrc version of the
                   6105: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
                   6106: </p>
1.75      rillig   6107: </div>
1.299     rillig   6108: <div class="sect1">
                   6109: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   6110: <a name="platform-tools"></a>17.3. Tools provided by platforms</h2></div></div></div>
                   6111: <p>When improving or porting pkgsrc to a new platform, have a look
                   6112: at (or create) the corresponding platform specific make file fragment under
                   6113: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
                   6114: the name of the common tools. For example:</p>
1.75      rillig   6115: <pre class="programlisting">
1.299     rillig   6116: .if exists(/usr/bin/bzcat)
                   6117: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzcat
                   6118: .elif exists(/usr/bin/bzip2)
                   6119: TOOLS_PLATFORM.bzcat?=          /usr/bin/bzip2 -cd
                   6120: .endif
                   6121: 
                   6122: TOOLS_PLATFORM.true?=           true                    # shell builtin
1.1       grant    6123: </pre>
1.75      rillig   6124: </div>
                   6125: </div>
1.299     rillig   6126: <div class="chapter">
                   6127: <div class="titlepage"><div><div><h2 class="title">
                   6128: <a name="buildlink"></a>Chapter 18. Buildlink methodology</h2></div></div></div>
                   6129: <div class="toc">
                   6130: <p><b>Table of Contents</b></p>
                   6131: <dl class="toc">
                   6132: <dt><span class="sect1"><a href="#converting-to-buildlink3">18.1. Converting packages to use buildlink3</a></span></dt>
                   6133: <dt><span class="sect1"><a href="#creating-buildlink3.mk">18.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
                   6134: <dd><dl>
                   6135: <dt><span class="sect2"><a href="#anatomy-of-bl3">18.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
                   6136: <dt><span class="sect2"><a href="#updating-buildlink-depends">18.2.2. Updating
                   6137:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6138:       and
                   6139:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6140:       in <code class="filename">buildlink3.mk</code> files</a></span></dt>
                   6141: </dl></dd>
                   6142: <dt><span class="sect1"><a href="#writing-builtin.mk">18.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
                   6143: <dd><dl>
                   6144: <dt><span class="sect2"><a href="#anatomy-of-builtin.mk">18.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</a></span></dt>
                   6145: <dt><span class="sect2"><a href="#native-or-pkgsrc-preference">18.3.2. Global preferences for native or pkgsrc software</a></span></dt>
                   6146: </dl></dd>
                   6147: </dl>
1.75      rillig   6148: </div>
1.299     rillig   6149: <p>Buildlink is a framework in pkgsrc that controls what headers and libraries
                   6150:   are seen by a package's configure and build processes.  This is implemented
                   6151:   in a two step process:</p>
                   6152: <div class="orderedlist"><ol class="orderedlist" type="1">
                   6153: <li class="listitem"><p>Symlink headers and libraries for dependencies into
                   6154:       <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory
                   6155:       of <code class="varname">WRKDIR</code>.</p></li>
                   6156: <li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler
                   6157:       tools that translate <code class="option">-I${LOCALBASE}/include</code> and
                   6158:       <code class="option">-L${LOCALBASE}/lib</code> into references to
                   6159:       <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make
                   6160:       native compiler on some operating systems look like GCC, so that
                   6161:       packages that expect GCC won't require modifications to build with
                   6162:       those native compilers.</p></li>
                   6163: </ol></div>
                   6164: <p>This normalizes the environment in which a package is built so that the
                   6165:   package may be built consistently despite what other software may be
                   6166:   installed. Please note that the normal system header and library paths,
                   6167:   e.g. <code class="filename">/usr/include</code>,
                   6168:   <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is
                   6169:   designed to insulate the package build from non-system-supplied
                   6170:   software.</p>
1.148     asau     6171: <div class="sect1">
1.75      rillig   6172: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6173: <a name="converting-to-buildlink3"></a>18.1. Converting packages to use buildlink3</h2></div></div></div>
                   6174: <p>The process of converting packages to use the buildlink3
                   6175:     framework (<span class="quote">&#8220;<span class="quote">bl3ifying</span>&#8221;</span>) is fairly straightforward.
                   6176:     The things to keep in mind are:</p>
1.128     wiz      6177: <div class="orderedlist"><ol class="orderedlist" type="1">
1.299     rillig   6178: <li class="listitem"><p>Ensure that the build always calls the wrapper scripts
                   6179:        instead of the actual toolchain.  Some packages are tricky,
                   6180:        and the only way to know for sure is the check
                   6181:        <code class="filename">${WRKDIR}/.work.log</code> to see if the
                   6182:        wrappers are being invoked.</p></li>
                   6183: <li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within
                   6184:        the package Makefile, e.g. Java VMs, standalone shells,
                   6185:        etc., because the code to symlink files into
                   6186:        <code class="filename">${BUILDLINK_DIR}</code> looks for files
                   6187:        relative to <span class="quote">&#8220;<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>&#8221;</span>.
                   6188:        </p></li>
                   6189: <li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the
                   6190:        <code class="filename">buildlink3.mk</code> files that you list in a
                   6191:        package's Makefile are added as dependencies for that package.
                   6192:        </p></li>
                   6193: </ol></div>
                   6194: <p>If a dependency on a particular package is required for its libraries and
                   6195:     headers, then we replace:</p>
                   6196: <pre class="programlisting">
                   6197: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6198: </pre>
                   6199: <p>with</p>
                   6200: <pre class="programlisting">
                   6201: .include "../../category/foo/buildlink3.mk"
                   6202: </pre>
                   6203: <p>The buildlink3.mk files usually define the required dependencies.
                   6204:     If you need a newer version of the dependency when using buildlink3.mk
                   6205:     files, then you can define it in your Makefile; for example:</p>
1.75      rillig   6206: <pre class="programlisting">
1.299     rillig   6207: BUILDLINK_API_DEPENDS.foo+=   foo&gt;=1.1.0
                   6208: .include "../../category/foo/buildlink3.mk"
1.1       grant    6209: </pre>
1.299     rillig   6210: <p>There are several <code class="filename">buildlink3.mk</code>
                   6211:     files in <code class="filename">pkgsrc/mk</code>
                   6212:     that handle special package issues:</p>
                   6213: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6214: <li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either
                   6215:        the native or a pkgsrc Berkeley DB implementation based on
                   6216:        the values of <code class="varname">BDB_ACCEPTED</code> and
                   6217:        <code class="varname">BDB_DEFAULT</code>.</p></li>
                   6218: <li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system
                   6219:        comes with neither Curses nor NCurses, this will take care
1.322     leot     6220:        to install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/ncurses/index.html" target="_top"><code class="filename">devel/ncurses</code></a> package.</p></li>
1.299     rillig   6221: <li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value
                   6222:        of <code class="varname">KRB5_ACCEPTED</code> to choose between
                   6223:        adding a dependency on Heimdal or MIT-krb5 for packages that
                   6224:        require a Kerberos 5 implementation.</p></li>
                   6225: <li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a
                   6226:        system-provided Motif installation or adds a dependency on
1.322     leot     6227:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/lesstif/index.html" target="_top"><code class="filename">x11/lesstif</code></a> or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/motif/index.html" target="_top"><code class="filename">x11/motif</code></a>. The user can set
1.299     rillig   6228:        <code class="varname">MOTIF_TYPE</code> to <span class="quote">&#8220;<span class="quote">dt</span>&#8221;</span>,
                   6229:        <span class="quote">&#8220;<span class="quote">lesstif</span>&#8221;</span> or <span class="quote">&#8220;<span class="quote">motif</span>&#8221;</span>
                   6230:        to choose which Motif version will be used.</p></li>
                   6231: <li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a
                   6232:        system-provided GNU readline or editline (libedit) installation,
1.322     leot     6233:        or adds a dependency on <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/readline/index.html" target="_top"><code class="filename">devel/readline</code></a>,
                   6234:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/editline/index.html" target="_top"><code class="filename">devel/editline</code></a>. The user can set
1.299     rillig   6235:        <code class="varname">READLINE_DEFAULT</code> to choose readline implementation.
                   6236:        If your package really needs GNU readline library, its Makefile
                   6237:        should include <code class="filename">devel/readline/buildlink3.mk</code>
                   6238:        instead of <code class="filename">readline.buildlink3.mk</code>.</p></li>
                   6239: <li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several
                   6240:        variables that may be used by packages that use the
                   6241:        Open Sound System (OSS) API.</p></li>
                   6242: <li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept
                   6243:        any of the Postgres versions in the variable
                   6244:        <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to
                   6245:        the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See
                   6246:        the file for more information.</p></li>
                   6247: <li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of
                   6248:        <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds
1.322     leot     6249:        a dependency on <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pth/index.html" target="_top"><code class="filename">devel/pth</code></a> as needed.</p></li>
1.299     rillig   6250: <li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of
                   6251:        <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets
                   6252:        library.</p></li>
                   6253: </ul></div>
                   6254: <p>The comments in those <code class="filename">buildlink3.mk</code>
                   6255:     files provide a more complete
                   6256:     description of how to use them properly.</p>
1.75      rillig   6257: </div>
1.148     asau     6258: <div class="sect1">
1.75      rillig   6259: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6260: <a name="creating-buildlink3.mk"></a>18.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div>
                   6261: <a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is
                   6262:     included by Makefiles to indicate the need to compile and link
                   6263:     against header files and libraries provided by the package.  A
                   6264:     <code class="filename">buildlink3.mk</code> file should always provide
                   6265:     enough information to add the correct type of dependency
                   6266:     relationship and include any other
                   6267:     <code class="filename">buildlink3.mk</code> files that it needs to find
                   6268:     headers and libraries that it needs in turn.</p>
                   6269: <p>To generate an initial <code class="filename">buildlink3.mk</code>
1.322     leot     6270:     file for further editing, Rene Hexel's <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/createbuildlink/index.html" target="_top"><code class="filename">pkgtools/createbuildlink</code></a>
1.299     rillig   6271:     package is highly recommended.  For most packages, the following
                   6272:     command will generate a good starting point for
                   6273:     <code class="filename">buildlink3.mk</code> files:</p>
                   6274: <pre class="screen">
                   6275: <code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em>
                   6276: <code class="prompt">%</code> createbuildlink &gt;buildlink3.mk</code></strong>
                   6277:     </pre>
1.148     asau     6278: <div class="sect2">
1.75      rillig   6279: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   6280: <a name="anatomy-of-bl3"></a>18.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div>
                   6281: <p>The following real-life example
                   6282:       <code class="filename">buildlink3.mk</code> is taken
                   6283:       from <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.75      rillig   6284: <pre class="programlisting">
1.299     rillig   6285: BUILDLINK_TREE+=        tiff
                   6286: 
                   6287: .if !defined(TIFF_BUILDLINK3_MK)
                   6288: TIFF_BUILDLINK3_MK:=
                   6289: 
                   6290: BUILDLINK_API_DEPENDS.tiff+=    tiff&gt;=3.6.1
                   6291: BUILDLINK_ABI_DEPENDS.tiff+=    tiff&gt;=3.7.2nb1
                   6292: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6293: 
                   6294: .include "../../devel/zlib/buildlink3.mk"
                   6295: .include "../../graphics/jpeg/buildlink3.mk"
                   6296: .endif # TIFF_BUILDLINK3_MK
                   6297: 
                   6298: BUILDLINK_TREE+=        -tiff
1.1       grant    6299: </pre>
1.299     rillig   6300: <p>The header and footer manipulate
                   6301:       <code class="varname">BUILDLINK_TREE</code>, which is common across all
                   6302:       <code class="filename">buildlink3.mk</code> files and is used to track
                   6303:       the dependency tree.</p>
                   6304: <p>The main section is protected from multiple inclusion
                   6305:       and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is
                   6306:       added.  Several important variables are set in the section:</p>
                   6307: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6308: <li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300     wiz      6309:          is the dependency version recorded in the installed
1.299     rillig   6310:          package; this should always be set using
                   6311:          <span class="command"><strong>+=</strong></span> to ensure that
                   6312:          we're appending to any pre-existing list of values.  This
1.300     wiz      6313:          variable should be set to the last version of the
1.299     rillig   6314:          package that had an backwards-incompatible API change.
                   6315:          </p></li>
                   6316: <li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code>
                   6317:          is the location of the <em class="replaceable"><code>pkg</code></em>
                   6318:          pkgsrc directory.</p></li>
                   6319: <li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
                   6320:          (not shown above) controls whether we use
                   6321:          <code class="varname">BUILD_DEPENDS</code> or
                   6322:          <code class="varname">DEPENDS</code> to add the dependency on
                   6323:          <em class="replaceable"><code>pkg</code></em>.  The build dependency is
                   6324:          selected by setting
                   6325:          <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
                   6326:          to <span class="quote">&#8220;<span class="quote">build</span>&#8221;</span>.  By default, the full dependency is
                   6327:          used.</p></li>
                   6328: <li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code>
                   6329:            and
                   6330:            <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
                   6331:            (not shown above) are lists of subdirectories of
                   6332:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
                   6333:            to add to the header and library search paths.  These
                   6334:            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>
                   6335:          respectively.</p></li>
                   6336: <li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code>
                   6337:            (not shown above) is the list of preprocessor flags to add
                   6338:            to <code class="varname">CPPFLAGS</code>, which are passed on to the
                   6339:            configure and build phases.  The <span class="quote">&#8220;<span class="quote">-I</span>&#8221;</span> option
                   6340:            should be avoided and instead be handled using
                   6341:            <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as
                   6342:          above.</p></li>
                   6343: </ul></div>
                   6344: <p>The following variables are all optionally defined within
                   6345:       this second section (protected against multiple inclusion) and
                   6346:       control which package files are symlinked into
                   6347:       <code class="filename">${BUILDLINK_DIR}</code> and how their names are
                   6348:       transformed during the symlinking:</p>
                   6349: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6350: <li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>
                   6351:            (not shown above) is a shell glob pattern relative to
                   6352:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
                   6353:            to be symlinked into
                   6354:            <code class="filename">${BUILDLINK_DIR}</code>,
                   6355:          e.g. <code class="filename">include/*.h</code>.</p></li>
                   6356: <li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code>
                   6357:            (not shown above) is a shell pipeline that
                   6358:            outputs to stdout a list of files relative to
                   6359:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>.
                   6360:            The resulting files are to be symlinked
                   6361:            into <code class="filename">${BUILDLINK_DIR}</code>.  By default,
                   6362:            this takes the <code class="filename">+CONTENTS</code> of a
                   6363:            <em class="replaceable"><code>pkg</code></em> and filters it through
                   6364:            <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li>
                   6365: <li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
                   6366:            (not shown above) is a filter command that filters
                   6367:            <code class="filename">+CONTENTS</code> input into a list of files
                   6368:            relative to
                   6369:            <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
                   6370:            on stdout.  By default,
                   6371:            <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
                   6372:            outputs the contents of the <code class="filename">include</code>
                   6373:            and <code class="filename">lib</code> directories in the package
                   6374:            <code class="filename">+CONTENTS</code>.</p></li>
                   6375: <li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code>
                   6376:            (not shown above) is a list of sed arguments used to
                   6377:            transform the name of the source filename into a
                   6378:            destination filename, e.g. <span class="command"><strong>-e
                   6379:            "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li>
                   6380: </ul></div>
                   6381: <p>This section can additionally include any
                   6382:       <code class="filename">buildlink3.mk</code> needed for
                   6383:       <em class="replaceable"><code>pkg</code></em>'s library dependencies.
                   6384:       Including these <code class="filename">buildlink3.mk</code> files
                   6385:       means that the headers and libraries for these
                   6386:       dependencies are also symlinked into
                   6387:       <code class="filename">${BUILDLINK_DIR}</code>
                   6388:       whenever the <em class="replaceable"><code>pkg</code></em>
                   6389:       <code class="filename">buildlink3.mk</code>
                   6390:       file is included. Dependencies are only added for directly
                   6391:       include <code class="filename">buildlink3.mk</code> files.</p>
                   6392: <p>When providing a <code class="filename">buildlink3.mk</code> and
                   6393:       including other <code class="filename">buildlink3.mk</code> files in it,
                   6394:       please only add necessary ones, i.e., those whose libraries or
                   6395:       header files are automatically exposed when the package is
                   6396:       use.</p>
                   6397: <p>In particular, if only an executable
                   6398:       (<code class="filename">bin/foo</code>) is linked against a library, that
                   6399:       library does not need to be propagated in the
                   6400:       <code class="filename">buildlink3.mk</code> file.</p>
                   6401: <p>The following steps should help you decide if a
                   6402:       <code class="filename">buildlink3.mk</code> file needs to be included:
                   6403:       </p>
                   6404: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6405: <li class="listitem"><p>Look at the installed header files: What
                   6406:        headers do they include? The packages providing these files
                   6407:        must be buildlinked.</p></li>
                   6408: <li class="listitem"><p>Run <code class="filename">ldd</code> on all installed
                   6409:        libraries and look against what other libraries they link.
                   6410:        Some of the packages providing these probably need to be
                   6411:        buildlinked; however, it's not automatic, since e.g. GTK on
                   6412:        some systems pulls in the X libraries, so they will show up in
                   6413:        the <code class="filename">ldd</code> output, while on others (like OS
                   6414:        X) it won't. <code class="filename">ldd</code> output can thus only be
                   6415:        used as a hint.</p></li>
                   6416: </ul></div>
                   6417: <p>
                   6418:       </p>
                   6419: </div>
1.148     asau     6420: <div class="sect2">
1.75      rillig   6421: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   6422: <a name="updating-buildlink-depends"></a>18.2.2. Updating
                   6423:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6424:       and
                   6425:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6426:       in <code class="filename">buildlink3.mk</code> files</h3></div></div></div>
1.300     wiz      6427: <p>Both variables set lower bounds for a version of this package.
                   6428:       The two variables differ in that one describes source
1.299     rillig   6429:       compatibility (API) and the other binary compatibility (ABI).
                   6430:       The difference is that a change in the API breaks compilation of
                   6431:       programs while changes in the ABI stop compiled programs from
                   6432:       running.</p>
1.300     wiz      6433: <p>The
                   6434:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6435:       variable in a <code class="filename">buildlink3.mk</code> should be
                   6436:       changed very rarely.  (One possible scenario: If all packages
                   6437:       using this package need a higher version than defined in the
                   6438:       <code class="filename">buildlink3.mk</code>,
1.299     rillig   6439:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300     wiz      6440:       could be updated to that higher version.)</p>
                   6441: <p>On the other hand, changes to
1.299     rillig   6442:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300     wiz      6443:       are more common.  The variable will need to be updated every
                   6444:       time the major version of one of its shared libraries is changed,
                   6445:       or any other change where a binary built against the previous
                   6446:       version of the package will not run against the new version any
                   6447:       longer.</p>
                   6448: <p>In such a case, the package's
1.299     rillig   6449:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300     wiz      6450:       must be increased to require the new package version.  Then the
                   6451:       <code class="varname">PKGREVISION</code> of all packages
                   6452:       <em class="replaceable"><code>foo</code></em> that depend on this package need
                   6453:       to be increased, and if they have
                   6454:       <code class="filename">buildlink3.mk</code> files,
                   6455:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>foo</code></em></code>
                   6456:       in their <code class="filename">buildlink3.mk</code> files must be
                   6457:       increased to the new version as well. This is required so that a
                   6458:       package will pull in the versions of the packages that use the
                   6459:       new ABI and that the packages' <code class="varname">PKGREVISION</code>s
                   6460:       uniquely identify the packages built against the new ABI. The
1.322     leot     6461:       <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/revbump/index.html" target="_top"><code class="filename">pkgtools/revbump</code></a> package can
1.300     wiz      6462:       help with these updates.</p>
                   6463: <p>See <a class="xref" href="#dependencies" title="21.1.5. Handling dependencies">Section 21.1.5, &#8220;Handling dependencies&#8221;</a> for more information
                   6464:       about dependencies on other packages, including the
                   6465:       <code class="varname">BUILDLINK_API_DEPENDS</code> definitions.</p>
1.299     rillig   6466: <p>Please take careful consideration before adjusting
                   6467:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6468:       or
                   6469:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300     wiz      6470:       in a <code class="filename">buildlink3.mk</code> file as we don't want to
                   6471:       cause unneeded package deletions and rebuilds.  In many cases,
                   6472:       new versions of packages work just fine with older
                   6473:       dependencies.</p>
1.326     gutterid 6474: <p>Also, it is not needed to set
1.299     rillig   6475:       <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   6476:       when it is identical to
1.326     gutterid 6477:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.</p>
                   6478: <p>Note there is also the distinction that users are able to disable
                   6479:       enforcement of ABI dependencies using the <code class="varname">USE_ABI_DEPENDS</code>
                   6480:       variable, but there is no equivalent option for API dependencies.</p>
1.75      rillig   6481: </div>
                   6482: </div>
1.148     asau     6483: <div class="sect1">
1.75      rillig   6484: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6485: <a name="writing-builtin.mk"></a>18.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div>
                   6486: <p>Some packages in pkgsrc install headers and libraries that
                   6487:       coincide with headers and libraries present in the base system.
                   6488:       Aside from a <code class="filename">buildlink3.mk</code> file, these
                   6489:       packages should also include a <code class="filename">builtin.mk</code>
                   6490:       file that includes the necessary checks to decide whether using
                   6491:       the built-in software or the pkgsrc software is
                   6492:     appropriate.</p>
                   6493: <p>The only requirements of a builtin.mk file for
                   6494:     <em class="replaceable"><code>pkg</code></em> are:</p>
                   6495: <div class="orderedlist"><ol class="orderedlist" type="1">
                   6496: <li class="listitem"><p>It should set
                   6497:        <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6498:        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>
                   6499:        after it is included.</p></li>
                   6500: <li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any
                   6501:        <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6502:        which is already set before the
                   6503:        <code class="filename">builtin.mk</code> file is included.</p></li>
                   6504: <li class="listitem"><p>It should be written to allow multiple inclusion.  This
                   6505:        is <span class="emphasis"><em>very</em></span> important and takes careful
                   6506:        attention to <code class="filename">Makefile</code> coding.</p></li>
                   6507: </ol></div>
                   6508: <div class="sect2">
                   6509: <div class="titlepage"><div><div><h3 class="title">
                   6510: <a name="anatomy-of-builtin.mk"></a>18.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</h3></div></div></div>
                   6511: <p>The following is the recommended template for builtin.mk
                   6512:       files:</p>
1.75      rillig   6513: <pre class="programlisting">
1.299     rillig   6514: .if !defined(IS_BUILTIN.foo)
                   6515: #
                   6516: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6517: # genuinely exists in the system or not.
                   6518: #
                   6519: IS_BUILTIN.foo?=        no
1.100     rillig   6520: 
1.299     rillig   6521: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6522: # version can be determined.
                   6523: #
                   6524: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6525: BUILTIN_PKG.foo?=       foo-1.0
                   6526: .  endif
                   6527: .endif  # IS_BUILTIN.foo
1.100     rillig   6528: 
1.299     rillig   6529: .if !defined(USE_BUILTIN.foo)
                   6530: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6531: .  if defined(BUILTIN_PKG.foo)
                   6532: .    for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
                   6533: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6534: USE_BUILTIN.foo!=                                                       \
                   6535:         ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}            \
                   6536:         &amp;&amp; ${ECHO} "yes" || ${ECHO} "no"
                   6537: .      endif
                   6538: .    endfor
                   6539: .  endif
                   6540: .endif  # USE_BUILTIN.foo
1.100     rillig   6541: 
1.299     rillig   6542: CHECK_BUILTIN.foo?=     no
                   6543: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6544: #
                   6545: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6546: # "yes" or "no".
                   6547: #
                   6548: .endif  # CHECK_BUILTIN.foo
1.75      rillig   6549: </pre>
1.299     rillig   6550: <p>The first section sets
                   6551:       <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6552:       depending on if <em class="replaceable"><code>pkg</code></em> really exists
                   6553:       in the base system.  This should not be a base system software
                   6554:       with similar functionality to <em class="replaceable"><code>pkg</code></em>;
                   6555:       it should only be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> if the actual package is
                   6556:       included as part of the base system.  This variable is only
                   6557:       used internally within the <code class="filename">builtin.mk</code>
                   6558:       file.</p>
                   6559: <p>The second section sets
                   6560:       <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
                   6561:       to the version of <em class="replaceable"><code>pkg</code></em> in the base
                   6562:       system if it exists (if
                   6563:       <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6564:       is <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>).  This variable is only used internally
                   6565:       within the <code class="filename">builtin.mk</code> file.</p>
                   6566: <p>The third section sets
                   6567:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6568:       and is <span class="emphasis"><em>required</em></span> in all
                   6569:       <code class="filename">builtin.mk</code> files.  The code in this
                   6570:       section must make the determination whether the built-in
                   6571:       software is adequate to satisfy the dependencies listed in
                   6572:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
                   6573:       This is typically done by comparing
                   6574:       <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
                   6575:       against each of the dependencies in
                   6576:       <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
                   6577:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6578:       <span class="emphasis"><em>must</em></span> be set to the correct value by the
                   6579:       end of the <code class="filename">builtin.mk</code> file.  Note that
                   6580:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6581:       may be <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span> even if
                   6582:       <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6583:       is <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span> because we may make the determination
                   6584:       that the built-in version of the software is similar enough to
                   6585:       be used as a replacement.</p>
                   6586: <p>The last section is guarded by
                   6587:       <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>,
                   6588:       and includes code that uses the value of
                   6589:       <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
                   6590:       set in the previous section.  This typically includes, e.g.,
                   6591:       adding additional dependency restrictions and listing additional
                   6592:       files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via
                   6593:       <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p>
                   6594: </div>
                   6595: <div class="sect2">
                   6596: <div class="titlepage"><div><div><h3 class="title">
                   6597: <a name="native-or-pkgsrc-preference"></a>18.3.2. Global preferences for native or pkgsrc software</h3></div></div></div>
                   6598: <p>When building packages, it's possible to choose whether to set
                   6599:        a global preference for using either the built-in (native)
                   6600:        version or the pkgsrc version of software to satisfy a
                   6601:        dependency.  This is controlled by setting
                   6602:        <code class="varname">PREFER_PKGSRC</code> and
                   6603:        <code class="varname">PREFER_NATIVE</code>.  These variables take values
                   6604:        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
                   6605:        packages.  <code class="varname">PREFER_PKGSRC</code> tells pkgsrc to
                   6606:        use the pkgsrc versions of software, while
                   6607:        <code class="varname">PREFER_NATIVE</code> tells pkgsrc to use the
                   6608:        built-in versions.  Preferences are determined by the most
                   6609:        specific instance of the package in either
                   6610:        <code class="varname">PREFER_PKGSRC</code> or
                   6611:        <code class="varname">PREFER_NATIVE</code>.  If a package is specified
                   6612:        in neither or in both variables, then
                   6613:        <code class="varname">PREFER_PKGSRC</code> has precedence over
                   6614:        <code class="varname">PREFER_NATIVE</code>.  For example, to require
                   6615:        using pkgsrc versions of software for all but the most basic
                   6616:       bits on a NetBSD system, you can set:</p>
1.75      rillig   6617: <pre class="programlisting">
1.299     rillig   6618: PREFER_PKGSRC=  yes
                   6619: PREFER_NATIVE=  getopt skey tcp_wrappers
                   6620: </pre>
                   6621: <p>A package <span class="emphasis"><em>must</em></span> have a
                   6622:       <code class="filename">builtin.mk</code>
                   6623:       file to be listed in <code class="varname">PREFER_NATIVE</code>,
                   6624:       otherwise it is simply ignored in that list.</p>
1.305     bacon    6625: <p><code class="varname">PREFER_PKGSRC</code> and
                   6626:       <code class="varname">PREFER_NATIVE</code> should be set during bootstrap
                   6627:       to ensure that the bootstrap process does not use inapropriate
                   6628:       native tools as dependencies for core packages.
                   6629: 
                   6630: </p>
                   6631: <pre class="screen">
                   6632: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap --prefer-pkgsrc yes --prefer-native openssl</code></strong>
                   6633: </pre>
                   6634: <p>
                   6635: 
1.299     rillig   6636:       Switching between settings globally at a later date can introduce
                   6637:       complications with dependency resolution. This is caused by packages
1.305     bacon    6638:       built with the opposite preference being installed alongside each
                   6639:       other.  Hence, any changes to these variables after bootstrap will
                   6640:       necessitate rebuilding all packages depending on one whose preference
                   6641:       has been changed.  This is not trivial and should be avoided.</p>
                   6642: <p>When using pkgsrc on Linux systems, there is high risk of
                   6643:       "leakage", where programs installed by pkgsrc may inadvertently use a
                   6644:       command or library not installed by pkgsrc, e.g. those installed by
                   6645:       yum or apt.  Such foreign dependencies may be installed, removed, or
                   6646:       upgraded to a version incompatible with the pkgsrc package at any
                   6647:       time, causing pkgsrc packages to subsequently malfunction.  Pkgsrc
                   6648:       cannot prevent this, as it has no control over other package managers.
                   6649:       Another potential problem is that under Redhat Enterprise and related
                   6650:       Linux systems, yum packages are only patched and never upgraded, so
                   6651:       eventually they may become too outdated for use by pkgsrc.  Even
                   6652:       intentionally using foreign dependencies, not considered leakage, can
                   6653:       lead to these problems, so it is generally discouraged.  In order to
                   6654:       minimize such problems, PREFER_PKGSRC defaults to "yes" on Linux systems.
                   6655:       This ensures that pkgsrc is aware of any changes to dependency packages
                   6656:       and can rebuild or upgrade the entire dependency tree as needed.  This
                   6657:       default can be overridden by setting --prefer-pkgsrc to "no" or a list of
                   6658:       packages, or by setting --prefer-native to "yes".</p>
1.75      rillig   6659: </div>
1.107     rillig   6660: </div>
1.75      rillig   6661: </div>
1.148     asau     6662: <div class="chapter">
1.75      rillig   6663: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   6664: <a name="plist"></a>Chapter 19. PLIST issues</h2></div></div></div>
1.75      rillig   6665: <div class="toc">
                   6666: <p><b>Table of Contents</b></p>
1.210     leot     6667: <dl class="toc">
1.299     rillig   6668: <dt><span class="sect1"><a href="#rcs-id">19.1. RCS ID</a></span></dt>
                   6669: <dt><span class="sect1"><a href="#automatic-plist-generation">19.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
                   6670: <dt><span class="sect1"><a href="#print-PLIST">19.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span></a></span></dt>
                   6671: <dt><span class="sect1"><a href="#plist.misc">19.4. Variable substitution in PLIST</a></span></dt>
                   6672: <dt><span class="sect1"><a href="#manpage-compression">19.5. Man page compression</a></span></dt>
                   6673: <dt><span class="sect1"><a href="#using-PLIST_SRC">19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
                   6674: <dt><span class="sect1"><a href="#platform-specific-plist">19.7. Platform-specific and differing PLISTs</a></span></dt>
                   6675: <dt><span class="sect1"><a href="#build-plist">19.8. Build-specific PLISTs</a></span></dt>
                   6676: <dt><span class="sect1"><a href="#faq.common-dirs">19.9. Sharing directories between packages</a></span></dt>
1.75      rillig   6677: </dl>
                   6678: </div>
1.299     rillig   6679: <p>The <code class="filename">PLIST</code> file contains a package's
                   6680:   <span class="quote">&#8220;<span class="quote">packing list</span>&#8221;</span>, i.e. a list of files that belong to
                   6681:   the package (relative to the <code class="filename">${PREFIX}</code>
                   6682:   directory it's been installed in) plus some additional statements
1.322     leot     6683:   - see the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_create.1"><span class="citerefentry"><span class="refentrytitle">pkg_create</span>(1)</span></a> man page for a full list.
1.299     rillig   6684:   This chapter addresses some issues that need attention when
                   6685:   dealing with the <code class="filename">PLIST</code> file (or files, see
                   6686:   below!).</p>
1.148     asau     6687: <div class="sect1">
1.75      rillig   6688: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6689: <a name="rcs-id"></a>19.1. RCS ID</h2></div></div></div>
                   6690: <p>Be sure to add a RCS ID line as the first thing in any
                   6691:     <code class="filename">PLIST</code> file you write:</p>
                   6692: <pre class="programlisting">
                   6693: @comment $NetBSD $
                   6694: </pre>
                   6695: <p>An artificial space has been added between NetBSD and $, this is a
                   6696: workaround here to prevent CVS expanding to the filename of the guide. When
                   6697: adding the RCS ID the space should be omitted.</p>
1.75      rillig   6698: </div>
1.148     asau     6699: <div class="sect1">
1.75      rillig   6700: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6701: <a name="automatic-plist-generation"></a>19.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div>
                   6702: <p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command
                   6703:     to output a PLIST that matches any new files since the package
                   6704:     was extracted.  See <a class="xref" href="#build.helpful-targets" title="13.17. Other helpful targets">Section 13.17, &#8220;Other helpful targets&#8221;</a> for
                   6705:     more information on this target.</p>
1.75      rillig   6706: </div>
1.148     asau     6707: <div class="sect1">
1.75      rillig   6708: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6709: <a name="print-PLIST"></a>19.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>
                   6710: </h2></div></div></div>
                   6711: <p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set
                   6712:     of AWK patterns and actions that are used to filter the output of
                   6713:     print-PLIST.  You can <span class="emphasis"><em>append</em></span> any chunk of AWK
                   6714:     scripting you like to it, but be careful with quoting.</p>
                   6715: <p>For example, to get all files inside the
                   6716:     <code class="filename">libdata/foo</code> directory removed from the
                   6717:     resulting PLIST:</p>
1.88      wiz      6718: <pre class="programlisting">
1.299     rillig   6719: PRINT_PLIST_AWK+=       /^libdata\/foo/ { next; }
1.100     rillig   6720: </pre>
1.300     wiz      6721: <p>The <code class="varname">PRINT_PLIST_AWK</code> transformations are
                   6722:     evaluated after the file list and directory list are sorted.
                   6723:     <code class="varname">EARLY_PRINT_PLIST_AWK</code> is like
                   6724:     <code class="varname">PRINT_PLIST_AWK</code> except it operates before the file
                   6725:     list and directory list are sorted.</p>
1.299     rillig   6726: </div>
                   6727: <div class="sect1">
                   6728: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   6729: <a name="plist.misc"></a>19.4. Variable substitution in PLIST</h2></div></div></div>
                   6730: <p>A number of variables are substituted automatically in
                   6731:     PLISTs when a package is installed on a system. This includes the
                   6732:     following variables:</p>
                   6733: <div class="variablelist"><dl class="variablelist">
                   6734: <dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt>
                   6735: <dd>
                   6736: <p>Some packages like emacs and perl embed information
                   6737:          about which architecture they were built on into the
                   6738:          pathnames where they install their files. To handle this
                   6739:          case, PLIST will be preprocessed before actually used, and
                   6740:          the symbol
                   6741:          <span class="quote">&#8220;<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>&#8221;</span> will be
                   6742:          replaced by what <span class="command"><strong>uname -p</strong></span> gives. The
                   6743:          same is done if the string
                   6744:          <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   6745:          PLIST somewhere - use this on packages that have GNU
                   6746:          autoconf-created configure scripts.</p>
                   6747: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   6748: <h3 class="title">Legacy note</h3>
                   6749: <p>There used to be a symbol
                   6750:            <span class="quote">&#8220;<span class="quote"><code class="varname">$ARCH</code></span>&#8221;</span> that
                   6751:            was replaced by the output of <span class="command"><strong>uname
                   6752:            -m</strong></span>, but that's no longer supported and has
                   6753:            been removed.</p>
                   6754: </div>
                   6755: </dd>
                   6756: <dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt>
                   6757: <dd>
                   6758: <p>Some packages want to embed the OS name and version
                   6759:          into some paths.  To do this, use these variables in the
                   6760:          <code class="filename">PLIST</code>:
                   6761:          </p>
                   6762: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6763: <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>
                   6764: <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>
                   6765: <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>
                   6766: </ul></div>
                   6767: </dd>
                   6768: </dl></div>
                   6769: <p>For a list of values which are replaced by
                   6770:     default, the output of <span class="command"><strong>make help topic=PLIST_SUBST</strong></span> as
                   6771: well as searching the <code class="filename">pkgsrc/mk</code> directory with <span class="command"><strong>grep</strong></span> for
                   6772: <code class="varname">PLIST_SUBST</code> should help.</p>
                   6773: <p>If you want to change other variables not listed above, you
                   6774:     can add variables and their expansions to this variable in the
                   6775:     following way, similar to <code class="varname">MESSAGE_SUBST</code> (see <a class="xref" href="#components.optional" title="12.5. Optional files">Section 12.5, &#8220;Optional files&#8221;</a>):</p>
1.81      rillig   6776: <pre class="programlisting">
1.299     rillig   6777: PLIST_SUBST+=   SOMEVAR="somevalue"
1.100     rillig   6778: </pre>
1.299     rillig   6779: <p>This replaces all occurrences of <span class="quote">&#8220;<span class="quote">${SOMEVAR}</span>&#8221;</span>
                   6780:     in the <code class="filename">PLIST</code> with
                   6781:     <span class="quote">&#8220;<span class="quote">somevalue</span>&#8221;</span>.</p>
                   6782: <p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify
                   6783:     the common case of conditionally including some
                   6784:     <code class="filename">PLIST</code> entries. It can be done by adding
                   6785:     <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and
                   6786:     setting the corresponding <code class="varname">PLIST.foo</code> variable
                   6787:     to <code class="literal">yes</code> if the entry should be included.
                   6788:     This will substitute <span class="quote">&#8220;<span class="quote"><code class="varname">${PLIST.foo}</code></span>&#8221;</span>
                   6789:     in the <code class="filename">PLIST</code> with either
                   6790:     <span class="quote">&#8220;<span class="quote"><code class="literal">""</code></span>&#8221;</span> or
                   6791:     <span class="quote">&#8220;<span class="quote"><code class="literal">"@comment "</code></span>&#8221;</span>.
                   6792:     For example, in <code class="filename">Makefile</code>:</p>
1.174     asau     6793: <pre class="programlisting">
1.299     rillig   6794: PLIST_VARS+=    foo
                   6795: .if <em class="replaceable"><code>condition</code></em>
                   6796: PLIST.foo=      yes
                   6797: .else
1.174     asau     6798: </pre>
1.299     rillig   6799: <p>And then in <code class="filename">PLIST</code>:</p>
1.81      rillig   6800: <pre class="programlisting">
1.299     rillig   6801: @comment $NetBSD $
                   6802: bin/bar
                   6803: man/man1/bar.1
                   6804: ${PLIST.foo}bin/foo
                   6805: ${PLIST.foo}man/man1/foo.1
                   6806: ${PLIST.foo}share/bar/foo.data
1.100     rillig   6807: </pre>
1.299     rillig   6808: <p>An artificial space has been added between NetBSD and $, this is a
                   6809: workaround here to prevent CVS expanding to the filename of the guide. When
1.309     gutterid 6810: adding the RCS ID the space should be omitted.</p>
1.81      rillig   6811: </div>
1.299     rillig   6812: <div class="sect1">
                   6813: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   6814: <a name="manpage-compression"></a>19.5. Man page compression</h2></div></div></div>
                   6815: <p>Man pages should be installed in compressed form if
                   6816:     <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>),
                   6817:     and uncompressed otherwise. To handle this in the
                   6818:     <code class="filename">PLIST</code> file, the suffix <span class="quote">&#8220;<span class="quote">.gz</span>&#8221;</span> is
                   6819:     appended/removed automatically for man pages according to
                   6820:     <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set
                   6821:     or not, see above for details. This modification of the
                   6822:     <code class="filename">PLIST</code> file is done on a copy of it, not
                   6823:     <code class="filename">PLIST</code> itself.</p>
1.75      rillig   6824: </div>
1.148     asau     6825: <div class="sect1">
1.75      rillig   6826: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6827: <a name="using-PLIST_SRC"></a>19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code>
                   6828: </h2></div></div></div>
                   6829: <p>To use one or more files as source for the <code class="filename">PLIST</code> used
                   6830:     in generating the binary package, set the variable
                   6831:     <code class="varname">PLIST_SRC</code> to the names of that file(s).
1.322     leot     6832:     The files are later concatenated using <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/cat.1"><span class="citerefentry"><span class="refentrytitle">cat</span>(1)</span></a>, and the order of things is
1.299     rillig   6833:     important. The default for <code class="varname">PLIST_SRC</code> is
                   6834:     <code class="filename">${PKGDIR}/PLIST</code>.</p>
1.75      rillig   6835: </div>
1.148     asau     6836: <div class="sect1">
1.75      rillig   6837: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6838: <a name="platform-specific-plist"></a>19.7. Platform-specific and differing PLISTs</h2></div></div></div>
                   6839: <p>Some packages decide to install a different set of files based on
                   6840:     the operating system being used. These differences can be
                   6841:     automatically handled by using the following files:</p>
                   6842: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6843: <li class="listitem"><p><code class="filename">PLIST.common</code></p></li>
                   6844: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li>
                   6845: <li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li>
                   6846: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li>
                   6847: <li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li>
                   6848: </ul></div>
1.75      rillig   6849: </div>
1.148     asau     6850: <div class="sect1">
1.75      rillig   6851: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6852: <a name="build-plist"></a>19.8. Build-specific PLISTs</h2></div></div></div>
                   6853: <p>Some packages decide to generate hard-to-guess file names
                   6854:     during installation that are hard to wire down.</p>
                   6855: <p>In such cases, you can set the
                   6856:     <code class="varname">GENERATE_PLIST</code> variable to shell code
                   6857:     terminated (with a semicolon) that will output PLIST entries which
                   6858:     will be appended to the PLIST</p>
                   6859: <p>You can find one example in editors/xemacs:</p>
                   6860: <pre class="programlisting">
                   6861: GENERATE_PLIST+=        ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
                   6862: </pre>
                   6863: <p>which will append something like
                   6864:     <code class="filename">bin/xemacs-21.4.23-54e8ea71.dmp</code> to the
                   6865:     <code class="filename">PLIST</code>.
                   6866:     </p>
1.75      rillig   6867: </div>
1.148     asau     6868: <div class="sect1">
1.75      rillig   6869: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6870: <a name="faq.common-dirs"></a>19.9. Sharing directories between packages</h2></div></div></div>
                   6871: <p>A <span class="quote">&#8220;<span class="quote">shared directory</span>&#8221;</span> is a directory where
                   6872:     multiple (and unrelated) packages install files.  These
                   6873:     directories were problematic because you had to add special
                   6874:     tricks in the PLIST to conditionally remove them, or have some
                   6875:     centralized package handle them.</p>
                   6876: <p>In pkgsrc, it is now easy: Each package should create
                   6877:     directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span>
                   6878:     will remove any directories left empty after uninstalling a
                   6879:     package.</p>
                   6880: <p>If a package needs an empty directory to work, create
                   6881:     the directory during installation as usual, and also add an
                   6882:     entry to the PLIST:
                   6883: 
                   6884: </p>
                   6885: <pre class="programlisting">
                   6886: @pkgdir path/to/empty/directory
                   6887: </pre>
                   6888: <p>
                   6889: 
                   6890:     or take a look at <code class="varname">MAKE_DIRS</code> and
                   6891:     <code class="varname">OWN_DIRS</code>.
1.88      wiz      6892:     </p>
1.75      rillig   6893: </div>
1.299     rillig   6894: </div>
                   6895: <div class="chapter">
                   6896: <div class="titlepage"><div><div><h2 class="title">
                   6897: <a name="pkginstall"></a>Chapter 20. The pkginstall framework</h2></div></div></div>
                   6898: <div class="toc">
                   6899: <p><b>Table of Contents</b></p>
                   6900: <dl class="toc">
                   6901: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">20.1. Files and directories outside the installation prefix</a></span></dt>
                   6902: <dd><dl>
                   6903: <dt><span class="sect2"><a href="#dirs-outside-prefix">20.1.1. Directory manipulation</a></span></dt>
                   6904: <dt><span class="sect2"><a href="#files-outside-prefix">20.1.2. File manipulation</a></span></dt>
                   6905: </dl></dd>
                   6906: <dt><span class="sect1"><a href="#conf-files">20.2. Configuration files</a></span></dt>
                   6907: <dd><dl>
                   6908: <dt><span class="sect2"><a href="#conf-files-sysconfdir">20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
                   6909: <dt><span class="sect2"><a href="#conf-files-configure">20.2.2. Telling the software where configuration files are</a></span></dt>
                   6910: <dt><span class="sect2"><a href="#conf-files-patching">20.2.3. Patching installations</a></span></dt>
                   6911: <dt><span class="sect2"><a href="#conf-files-disable">20.2.4. Disabling handling of configuration files</a></span></dt>
                   6912: </dl></dd>
                   6913: <dt><span class="sect1"><a href="#rcd-scripts">20.3. System startup scripts</a></span></dt>
                   6914: <dd><dl><dt><span class="sect2"><a href="#rcd-scripts-disable">20.3.1. Disabling handling of system startup scripts</a></span></dt></dl></dd>
                   6915: <dt><span class="sect1"><a href="#users-and-groups">20.4. System users and groups</a></span></dt>
                   6916: <dt><span class="sect1"><a href="#shells">20.5. System shells</a></span></dt>
                   6917: <dd><dl><dt><span class="sect2"><a href="#shells-disable">20.5.1. Disabling shell registration</a></span></dt></dl></dd>
                   6918: <dt><span class="sect1"><a href="#fonts">20.6. Fonts</a></span></dt>
                   6919: <dd><dl><dt><span class="sect2"><a href="#fonts-disable">20.6.1. Disabling automatic update of the fonts databases</a></span></dt></dl></dd>
                   6920: </dl>
                   6921: </div>
                   6922: <p>This chapter describes the framework known as
                   6923: <code class="literal">pkginstall</code>, whose key features are:</p>
                   6924: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6925: <li class="listitem"><p>Generic installation and manipulation of directories and files
                   6926:     outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li>
                   6927: <li class="listitem"><p>Automatic handling of configuration files during installation,
                   6928:     provided that packages are correctly designed.</p></li>
                   6929: <li class="listitem"><p>Generation and installation of system startup scripts.</p></li>
                   6930: <li class="listitem"><p>Registration of system users and groups.</p></li>
                   6931: <li class="listitem"><p>Registration of system shells.</p></li>
                   6932: <li class="listitem"><p>Automatic updating of fonts databases.</p></li>
                   6933: </ul></div>
                   6934: <p>The following sections inspect each of the above points in detail.</p>
                   6935: <p>You may be thinking that many of the things described here could be
                   6936: easily done with simple code in the package's post-installation target
                   6937: (<code class="literal">post-install</code>).  <span class="emphasis"><em>This is incorrect</em></span>,
                   6938: as the code in them is only executed when building from source.  Machines
                   6939: using binary packages could not benefit from it at all (as the code itself
                   6940: could be unavailable).  Therefore, the only way to achieve any of the items
                   6941: described above is by means of the installation scripts, which are
                   6942: automatically generated by pkginstall.</p>
1.148     asau     6943: <div class="sect1">
1.75      rillig   6944: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   6945: <a name="files-and-dirs-outside-prefix"></a>20.1. Files and directories outside the installation prefix</h2></div></div></div>
                   6946: <p>As you already know, the <code class="filename">PLIST</code> file holds a list
                   6947: of files and directories that belong to a package.  The names used in it
                   6948: are relative to the installation prefix (<code class="filename">${PREFIX}</code>),
                   6949: which means that it cannot register files outside this directory (absolute
                   6950: path names are not allowed).  Despite this restriction, some packages need
                   6951: to install files outside this location; e.g., under
                   6952: <code class="filename">${VARBASE}</code> or
                   6953: <code class="filename">${PKG_SYSCONFDIR}</code>.  The only way to achieve this
                   6954: is to create such files during installation time by using
                   6955: installation scripts.</p>
                   6956: <p>The generic installation scripts are shell scripts that can
                   6957: contain arbitrary code.  The list of scripts to execute is taken from
                   6958: the <code class="varname">INSTALL_FILE</code> variable, which defaults to
                   6959: <code class="filename">INSTALL</code>.  A similar variable exists for package
                   6960: removal (<code class="varname">DEINSTALL_FILE</code>, whose default is
                   6961: <code class="filename">DEINSTALL</code>).  These scripts can run arbitrary
                   6962: commands, so they have the potential to create and manage files
                   6963: anywhere in the file system.</p>
                   6964: <p>Using these general installation files is not recommended, but
                   6965: may be needed in some special cases.  One reason for avoiding them is
                   6966: that the user has to trust the packager that there is no unwanted or
                   6967: simply erroneous code included in the installation script. Also,
                   6968: previously there were many similar scripts for the same functionality,
                   6969: and fixing a common error involved finding and changing all of
                   6970: them.</p>
                   6971: <p>The pkginstall framework offers another, standardized way.  It
                   6972: provides generic scripts to abstract the manipulation of such files
                   6973: and directories based on variables set in the package's
                   6974: <code class="filename">Makefile</code>.  The rest of this section describes
                   6975: these variables.</p>
                   6976: <div class="sect2">
                   6977: <div class="titlepage"><div><div><h3 class="title">
                   6978: <a name="dirs-outside-prefix"></a>20.1.1. Directory manipulation</h3></div></div></div>
                   6979: <p>The following variables can be set to request the creation of
                   6980: directories anywhere in the file system:</p>
                   6981: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   6982: <li class="listitem">
                   6983: <p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code>
                   6984:     contain a list of directories that should be created and should attempt
                   6985:     to be destroyed by the installation scripts.  The difference between
                   6986:     the two is that the latter prompts the administrator to remove any
                   6987:     directories that may be left after deinstallation (because they were
                   6988:     not empty), while the former does not.  Example:</p>
                   6989: <pre class="programlisting">
                   6990: MAKE_DIRS+=             ${VARBASE}/foo/private
                   6991: </pre>
                   6992: </li>
                   6993: <li class="listitem">
                   6994: <p><code class="varname">MAKE_DIRS_PERMS</code> and
                   6995:     <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing
                   6996:     which directories should be created and should attempt to be destroyed
                   6997:     by the installation scripts.  Each tuple holds the following values,
                   6998:     separated by spaces: the directory name, its owner, its group and its
                   6999:     numerical mode.  For example:</p>
                   7000: <pre class="programlisting">
                   7001: MAKE_DIRS_PERMS+=       ${VARBASE}/foo/private \
                   7002:                         ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
                   7003: </pre>
                   7004: <p>The difference between the two is exactly the same as their
                   7005:     non-<code class="varname">PERMS</code> counterparts.</p>
                   7006: </li>
                   7007: </ul></div>
1.75      rillig   7008: </div>
1.299     rillig   7009: <div class="sect2">
                   7010: <div class="titlepage"><div><div><h3 class="title">
                   7011: <a name="files-outside-prefix"></a>20.1.2. File manipulation</h3></div></div></div>
                   7012: <p>Creating non-empty files outside the installation prefix is tricky
                   7013: because the <code class="filename">PLIST</code> forces all files to be inside it.
                   7014: To overcome this problem, the only solution is to extract the file in the
                   7015: known place (i.e., inside the installation prefix) and copy it to the
                   7016: appropriate location during installation (done by the installation scripts
                   7017: generated by pkginstall).  We will call the former the <span class="emphasis"><em>master
                   7018: file</em></span> in the following paragraphs, which describe the variables
                   7019: that can be used to automatically and consistently handle files outside the
                   7020: installation prefix:</p>
                   7021: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   7022: <li class="listitem">
                   7023: <p><code class="varname">CONF_FILES</code> and
                   7024:     <code class="varname">REQD_FILES</code> are pairs of master and target files.
                   7025:     During installation time, the master file is copied to the target one
                   7026:     if and only if the latter does not exist.  Upon deinstallation, the
                   7027:     target file is removed provided that it was not modified by the
                   7028:     installation.</p>
                   7029: <p>The difference between the two is that the latter prompts the
                   7030:     administrator to remove any files that may be left after
                   7031:     deinstallation (because they were not empty), while the former does
                   7032:     not.</p>
                   7033: </li>
                   7034: <li class="listitem">
                   7035: <p><code class="varname">CONF_FILES_PERMS</code> and
                   7036:     <code class="varname">REQD_FILES_PERMS</code> contain tuples describing master
                   7037:     files as well as their target locations.  For each of them, it also
                   7038:     specifies their owner, their group and their numeric permissions, in
                   7039:     this order.  For example:</p>
1.88      wiz      7040: <pre class="programlisting">
1.299     rillig   7041: REQD_FILES_PERMS+=      ${PREFIX}/share/somefile ${VARBASE}/somefile \
                   7042:                         ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.100     rillig   7043: </pre>
1.299     rillig   7044: <p>The difference between the two is exactly the same as their
                   7045:     non-<code class="varname">PERMS</code> counterparts.</p>
                   7046: </li>
                   7047: </ul></div>
                   7048: </div>
1.75      rillig   7049: </div>
1.148     asau     7050: <div class="sect1">
1.75      rillig   7051: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   7052: <a name="conf-files"></a>20.2. Configuration files</h2></div></div></div>
                   7053: <p>Configuration files are special in the sense that they are installed
                   7054: in their own specific directory, <code class="varname">PKG_SYSCONFDIR</code>, and
                   7055: need special treatment during installation (most of which is automated by
                   7056: pkginstall).  The main concept you must bear in mind is that files marked
                   7057: as configuration files are automatically copied to the right place (somewhere
                   7058: inside <code class="varname">PKG_SYSCONFDIR</code>) during installation <span class="emphasis"><em>if
                   7059: and only if</em></span> they didn't exist before.  Similarly, they will not
                   7060: be removed if they have local modifications.  This ensures that
                   7061: administrators never lose any custom changes they may have made.</p>
                   7062: <div class="sect2">
                   7063: <div class="titlepage"><div><div><h3 class="title">
                   7064: <a name="conf-files-sysconfdir"></a>20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</h3></div></div></div>
                   7065: <p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable
                   7066: specifies where configuration files shall be installed.  Its contents are
                   7067: set based upon the following variables:</p>
                   7068: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   7069: <li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root
                   7070:     directory.  Defaults to <code class="filename">${PREFIX}/etc</code> although it may
                   7071:     be overridden by the user to point to his preferred location (e.g.,
                   7072:     <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.).
                   7073:     Packages must not use it directly.</p></li>
                   7074: <li class="listitem">
                   7075: <p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of
                   7076:     <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files
                   7077:     for the package being built shall be installed.  The definition of this
                   7078:     variable only makes sense in the package's
                   7079:     <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p>
                   7080: <p>As an example, consider the Apache package,
1.322     leot     7081:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/www/apache24/index.html" target="_top"><code class="filename">www/apache24</code></a>, which places its
1.299     rillig   7082:     configuration files under the
                   7083:     <code class="filename">httpd/</code> subdirectory of
                   7084:     <code class="varname">PKG_SYSCONFBASE</code>.  This should be set in the package
                   7085:     Makefile.</p>
                   7086: </li>
                   7087: <li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the
                   7088:     variable that holds this package's configuration directory (if
                   7089:     different from <code class="varname">PKG_SYSCONFBASE</code>).  It defaults to
                   7090:     <code class="varname">PKGBASE</code>'s value, and is always prefixed with
                   7091:     <code class="literal">PKG_SYSCONFDIR</code>.</p></li>
                   7092: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the
                   7093:     directory where the configuration files for the package identified by
                   7094:     <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li>
                   7095: </ul></div>
                   7096: <p>Based on the above variables, pkginstall determines the value of
                   7097: <code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span>
                   7098: variable that can be used within a package to refer to its configuration
                   7099: directory.  The algorithm used to set its value is basically the
                   7100: following:</p>
                   7101: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7102: <li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set,
                   7103:     its value is used.</p></li>
                   7104: <li class="listitem"><p>If the previous variable is not defined but
                   7105:     <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's
                   7106:     <code class="filename">Makefile</code>, the resulting value is
                   7107:     <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li>
                   7108: <li class="listitem"><p>Otherwise, it is set to
                   7109:     <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li>
                   7110: </ol></div>
                   7111: <p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is
                   7112: automatically added to <code class="filename">OWN_DIRS</code>.  See <a class="xref" href="#dirs-outside-prefix" title="20.1.1. Directory manipulation">Section 20.1.1, &#8220;Directory manipulation&#8221;</a> what this means.  This does not apply to
                   7113: subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>, they still have to
                   7114: be created with OWN_DIRS or MAKE_DIRS.</p>
                   7115: </div>
                   7116: <div class="sect2">
                   7117: <div class="titlepage"><div><div><h3 class="title">
                   7118: <a name="conf-files-configure"></a>20.2.2. Telling the software where configuration files are</h3></div></div></div>
                   7119: <p>Given that pkgsrc (and users!) expect configuration files to be in a
                   7120: known place, you need to teach each package where it shall install its
                   7121: files.  In some cases you will have to patch the package Makefiles to
                   7122: achieve it.  If you are lucky, though, it may be as easy as passing an
                   7123: extra flag to the configuration script; this is the case of GNU Autoconf-
                   7124: generated files:</p>
1.75      rillig   7125: <pre class="programlisting">
1.299     rillig   7126: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.100     rillig   7127: </pre>
1.299     rillig   7128: <p>Note that this specifies where the package has to <span class="emphasis"><em>look
                   7129: for</em></span> its configuration files, not where they will be originally
                   7130: installed (although the difference is never explicit,
                   7131: unfortunately).</p>
1.75      rillig   7132: </div>
1.299     rillig   7133: <div class="sect2">
                   7134: <div class="titlepage"><div><div><h3 class="title">
                   7135: <a name="conf-files-patching"></a>20.2.3. Patching installations</h3></div></div></div>
                   7136: <p>As said before, pkginstall automatically handles configuration files.
                   7137: This means that <span class="strong"><strong>the packages themselves must not
                   7138: touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code>
                   7139: directly</strong></span>.  Bad news is that many software installation scripts
                   7140: will, out of the box, mess with the contents of that directory.  So what is
                   7141: the correct procedure to fix this issue?</p>
                   7142: <p>You must teach the package (usually by manually patching it) to
                   7143: install any configuration files under the examples hierarchy,
                   7144: <code class="filename">share/examples/${PKGBASE}/</code>.  This way, the
                   7145: <code class="filename">PLIST</code> registers them and the administrator always
                   7146: has the original copies available.</p>
                   7147: <p>Once the required configuration files are in place (i.e., under the
                   7148: examples hierarchy), the pkginstall framework can use them as master copies
                   7149: during the package installation to update what is in
                   7150: <code class="filename">${PKG_SYSCONFDIR}</code>.  To achieve this, the variables
                   7151: <code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are
                   7152: used.  Check out <a class="xref" href="#files-outside-prefix" title="20.1.2. File manipulation">Section 20.1.2, &#8220;File manipulation&#8221;</a> for information
                   7153: about their syntax and their purpose.  Here is an example, taken from the
1.322     leot     7154: <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/mail/mutt/index.html" target="_top"><code class="filename">mail/mutt</code></a> package:</p>
1.88      wiz      7155: <pre class="programlisting">
1.299     rillig   7156: EGDIR=        ${PREFIX}/share/doc/mutt/samples
                   7157: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
1.100     rillig   7158: </pre>
1.299     rillig   7159: <p>Note that the <code class="varname">EGDIR</code> variable is specific to that
                   7160: package and has no meaning outside it.</p>
1.75      rillig   7161: </div>
1.299     rillig   7162: <div class="sect2">
                   7163: <div class="titlepage"><div><div><h3 class="title">
                   7164: <a name="conf-files-disable"></a>20.2.4. Disabling handling of configuration files</h3></div></div></div>
                   7165: <p>The automatic copying of config files can be toggled by setting the
                   7166: environment variable <code class="varname">PKG_CONFIG</code> prior to package
                   7167: installation.</p>
1.88      wiz      7168: </div>
1.75      rillig   7169: </div>
1.148     asau     7170: <div class="sect1">
1.75      rillig   7171: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   7172: <a name="rcd-scripts"></a>20.3. System startup scripts</h2></div></div></div>
                   7173: <p>System startup scripts are special files because they must be
                   7174: installed in a place known by the underlying OS, usually outside the
                   7175: installation prefix.  Therefore, the same rules described in <a class="xref" href="#files-and-dirs-outside-prefix" title="20.1. Files and directories outside the installation prefix">Section 20.1, &#8220;Files and directories outside the installation prefix&#8221;</a> apply, and the same solutions
                   7176: can be used.  However, pkginstall provides a special mechanism to handle
                   7177: these files.</p>
                   7178: <p>In order to provide system startup scripts, the package has
                   7179: to:</p>
                   7180: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7181: <li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with
                   7182:     the <code class="literal">.sh</code> suffix appended.  Considering the
1.338     nia      7183:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/cups-base/index.html" target="_top"><code class="filename">print/cups-base</code></a> package as an example, it
                   7184:     has a <code class="filename">cupsd.sh</code> in its files directory.</p></li>
1.299     rillig   7185: <li class="listitem">
                   7186: <p>Tell pkginstall to handle it, appending the name of the script,
                   7187:     without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable.
                   7188:     Continuing the previous example:</p>
                   7189: <pre class="programlisting">
                   7190: RCD_SCRIPTS+=   cupsd
                   7191: </pre>
                   7192: </li>
                   7193: </ol></div>
                   7194: <p>Once this is done, pkginstall will do the following steps for each
                   7195: script in an automated fashion:</p>
                   7196: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7197: <li class="listitem"><p>Process the file found in the files directory applying all the
                   7198:     substitutions described in the <code class="filename">FILES_SUBST</code>
                   7199:     variable.</p></li>
                   7200: <li class="listitem"><p>Copy the script from the files directory to the examples
                   7201:     hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>.  Note
                   7202:     that this master file must be explicitly registered in the
                   7203:     <code class="filename">PLIST</code>.</p></li>
                   7204: <li class="listitem"><p>Add code to the installation scripts to copy the startup script
                   7205:     from the examples hierarchy into the system-wide startup scripts
                   7206:     directory.</p></li>
                   7207: </ol></div>
                   7208: <div class="sect2">
                   7209: <div class="titlepage"><div><div><h3 class="title">
                   7210: <a name="rcd-scripts-disable"></a>20.3.1. Disabling handling of system startup scripts</h3></div></div></div>
                   7211: <p>The automatic copying of config files can be toggled by setting the
                   7212: environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package
                   7213: installation.  Note that the scripts will be always copied inside the
                   7214: examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no
                   7215: matter what the value of this variable is.</p>
1.75      rillig   7216: </div>
                   7217: </div>
1.299     rillig   7218: <div class="sect1">
                   7219: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   7220: <a name="users-and-groups"></a>20.4. System users and groups</h2></div></div></div>
                   7221: <p>If a package needs to create special users and/or groups during
                   7222: installation, it can do so by using the pkginstall framework.</p>
                   7223: <p>Users can be created by adding entries to the
                   7224: <code class="varname">PKG_USERS</code> variable.  Each entry has the following
                   7225: syntax:</p>
                   7226: <pre class="programlisting">
                   7227: user:group
                   7228: </pre>
                   7229: <p>Further specification of user details may be done by setting
                   7230: per-user variables.
                   7231: <code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the
                   7232: numeric UID for the user.
                   7233: <code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the
                   7234: user's description or comment.
                   7235: <code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the
                   7236: user's home directory, and defaults to
                   7237: <code class="filename">/nonexistent</code> if not specified.
                   7238: <code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the
                   7239: user's shell, and defaults to <code class="filename">/sbin/nologin</code> if
                   7240: not specified.</p>
                   7241: <p>Similarly, groups can be created by adding entries to the
                   7242: <code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p>
                   7243: <pre class="programlisting">
                   7244: group
                   7245: </pre>
                   7246: <p>The numeric GID of the group may be set by defining
                   7247: <code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p>
                   7248: <p>If a package needs to create the users and groups at an earlier
                   7249: stage, then it can set <code class="varname">USERGROUP_PHASE</code> to either
                   7250: <code class="literal">configure</code>,<code class="literal">build</code>, or
                   7251: <code class="literal">pre-install</code> to indicate the phase before which the
                   7252: users and groups are created. In this case, the numeric UIDs and GIDs
                   7253: of the created users and groups are automatically hardcoded into the
                   7254: final installation scripts.</p>
1.75      rillig   7255: </div>
1.148     asau     7256: <div class="sect1">
1.75      rillig   7257: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   7258: <a name="shells"></a>20.5. System shells</h2></div></div></div>
                   7259: <p>Packages that install system shells should register them in the shell
                   7260: database, <code class="filename">/etc/shells</code>, to make things easier to the
                   7261: administrator.  This must be done from the installation scripts to keep
                   7262: binary packages working on any system.  pkginstall provides an easy way to
                   7263: accomplish this task.</p>
                   7264: <p>When a package provides a shell interpreter, it has to set the
                   7265: <code class="varname">PKG_SHELL</code> variable to its absolute file name.  This will
                   7266: add some hooks to the installation scripts to handle it.  Consider the
1.322     leot     7267: following example, taken from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/zsh/index.html" target="_top"><code class="filename">shells/zsh</code></a>:</p>
1.299     rillig   7268: <pre class="programlisting">
                   7269: PKG_SHELL=      ${PREFIX}/bin/zsh
                   7270: </pre>
                   7271: <div class="sect2">
                   7272: <div class="titlepage"><div><div><h3 class="title">
                   7273: <a name="shells-disable"></a>20.5.1. Disabling shell registration</h3></div></div></div>
                   7274: <p>The automatic registration of shell interpreters can be disabled by
                   7275: the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code>
                   7276: environment variable to <code class="literal">NO</code>.</p>
                   7277: </div>
1.75      rillig   7278: </div>
1.148     asau     7279: <div class="sect1">
1.75      rillig   7280: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   7281: <a name="fonts"></a>20.6. Fonts</h2></div></div></div>
                   7282: <p>Packages that install X11 fonts should update the database files
                   7283: that index the fonts within each fonts directory.  This can easily be
                   7284: accomplished within the pkginstall framework.</p>
                   7285: <p>When a package installs X11 fonts, it must list the directories in
                   7286: which fonts are installed in the
                   7287: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables,
                   7288: where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">&#8220;<span class="quote">ttf</span>&#8221;</span>,
                   7289: <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
                   7290: installation scripts to run the appropriate commands to update the fonts
                   7291: database files within each of those directories.  For convenience, if the
                   7292: directory path is relative, it is taken to be relative to the package's
1.322     leot     7293: installation prefix.  Consider the following example, taken from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/fonts/dbz-ttf/index.html" target="_top"><code class="filename">fonts/dbz-ttf</code></a>:</p>
1.75      rillig   7294: <pre class="programlisting">
1.299     rillig   7295: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.75      rillig   7296: </pre>
1.299     rillig   7297: <div class="sect2">
                   7298: <div class="titlepage"><div><div><h3 class="title">
                   7299: <a name="fonts-disable"></a>20.6.1. Disabling automatic update of the fonts databases</h3></div></div></div>
                   7300: <p>The automatic update of fonts databases can be disabled by
                   7301: the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code>
                   7302: environment variable to <code class="literal">NO</code>.</p>
1.75      rillig   7303: </div>
                   7304: </div>
                   7305: </div>
1.148     asau     7306: <div class="chapter">
1.75      rillig   7307: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   7308: <a name="fixes"></a>Chapter 21. Making your package work</h2></div></div></div>
1.75      rillig   7309: <div class="toc">
                   7310: <p><b>Table of Contents</b></p>
1.210     leot     7311: <dl class="toc">
1.267     rillig   7312: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
1.75      rillig   7313: <dd><dl>
1.267     rillig   7314: <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>
                   7315: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
                   7316: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
                   7317: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
                   7318: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
                   7319: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
                   7320: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
                   7321: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
                   7322: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
                   7323: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
                   7324: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
                   7325: </dl></dd>
                   7326: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
                   7327: <dd><dl>
                   7328: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
                   7329: <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>
                   7330: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
                   7331: </dl></dd>
                   7332: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
                   7333: <dd><dl>
                   7334: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
                   7335: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
                   7336: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
1.338     nia      7337: <dt><span class="sect2"><a href="#meson">21.3.4. Meson / ninja</a></span></dt>
1.267     rillig   7338: </dl></dd>
                   7339: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
                   7340: <dd><dl>
                   7341: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
                   7342: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
1.320     wiz      7343: <dt><span class="sect2"><a href="#go-programming-language">21.4.3. Go</a></span></dt>
1.338     nia      7344: <dt><span class="sect2"><a href="#rust-programming-language">21.4.4. Rust</a></span></dt>
                   7345: <dt><span class="sect2"><a href="#perl-scripts">21.4.5. Packages containing Perl scripts</a></span></dt>
                   7346: <dt><span class="sect2"><a href="#shell-scripts">21.4.6. Packages containing shell scripts</a></span></dt>
                   7347: <dt><span class="sect2"><a href="#other-programming-languages">21.4.7. Other programming languages</a></span></dt>
1.267     rillig   7348: </dl></dd>
                   7349: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
                   7350: <dd><dl>
                   7351: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
                   7352: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.287     rillig   7353: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
                   7354: <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>
                   7355: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.267     rillig   7356: </dl></dd>
                   7357: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
                   7358: <dd><dl>
                   7359: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
                   7360: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
                   7361: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
                   7362: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
                   7363: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
1.318     nia      7364: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing Perl modules</a></span></dt>
1.267     rillig   7365: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
                   7366: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
1.318     nia      7367: <dt><span class="sect2"><a href="#x11-fonts">21.6.9. Packages installing X11 fonts</a></span></dt>
                   7368: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.10. Packages installing SGML or XML data</a></span></dt>
                   7369: <dt><span class="sect2"><a href="#mime-database">21.6.11. Packages installing extensions to the MIME database</a></span></dt>
                   7370: <dt><span class="sect2"><a href="#intltool">21.6.12. Packages using intltool</a></span></dt>
                   7371: <dt><span class="sect2"><a href="#startup-scripts">21.6.13. Packages installing startup scripts</a></span></dt>
                   7372: <dt><span class="sect2"><a href="#tex-packages">21.6.14. Packages installing TeX modules</a></span></dt>
                   7373: <dt><span class="sect2"><a href="#emulation-packages">21.6.15. Packages supporting running binaries in
1.87      wiz      7374:     emulation</a></span></dt>
1.318     nia      7375: <dt><span class="sect2"><a href="#hicolor-theme">21.6.16. Packages installing hicolor icons</a></span></dt>
                   7376: <dt><span class="sect2"><a href="#desktop-files">21.6.17. Packages installing desktop files</a></span></dt>
1.75      rillig   7377: </dl></dd>
1.267     rillig   7378: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.75      rillig   7379: </dl>
                   7380: </div>
1.148     asau     7381: <div class="sect1">
1.75      rillig   7382: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   7383: <a name="general-operation"></a>21.1. General operation</h2></div></div></div>
1.78      rillig   7384: <p>One appealing feature of pkgsrc is that it runs on many
1.218     rillig   7385:   different platforms. As a result, it is important to ensure,
                   7386:   where possible, that packages in pkgsrc are portable. This
                   7387:   chapter mentions some particular details you should pay
                   7388:   attention to while working on pkgsrc.</p>
1.148     asau     7389: <div class="sect2">
1.78      rillig   7390: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7391: <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.93      rillig   7392: </h3></div></div></div>
1.78      rillig   7393: <p>The pkgsrc user can configure pkgsrc by overriding several
1.87      wiz      7394:     variables in the file pointed to by <code class="varname">MAKECONF</code>,
1.110     hubertf  7395:     which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
1.87      wiz      7396:     want to use those variables in the preprocessor directives of
1.322     leot     7397:     <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> (for example <code class="literal">.if</code> or
1.87      wiz      7398:     <code class="literal">.for</code>), you need to include the file
                   7399:     <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
                   7400:     loads the user preferences.</p>
1.78      rillig   7401: <p>But note that some variables may not be completely defined
1.219     rillig   7402:     after <code class="filename">../../mk/bsd.prefs.mk</code> has been
                   7403:     included, as they may contain references to variables that are
                   7404:     not yet defined. In shell commands (the lines in
                   7405:     <code class="filename">Makefile</code> that are indented with a tab) this
                   7406:     is no problem, since variables are only expanded when they are
                   7407:     used. But in the preprocessor directives mentioned above and in
                   7408:     dependency lines (of the form <code class="literal">target:
                   7409:     dependencies</code>) the variables are expanded at load
                   7410:     time.</p>
1.148     asau     7411: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.78      rillig   7412: <h3 class="title">Note</h3>
1.218     rillig   7413: <p>To check whether a variable can be used at load time,
                   7414:     run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p>
1.78      rillig   7415: </div>
                   7416: </div>
1.148     asau     7417: <div class="sect2">
1.78      rillig   7418: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7419: <a name="user-interaction"></a>21.1.2. User interaction</h3></div></div></div>
1.88      wiz      7420: <p>Occasionally, packages require interaction from the user,
                   7421:     and this can be in a number of ways:</p>
1.148     asau     7422: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      7423: <li class="listitem"><p>When fetching the distfiles, some packages require user
1.87      wiz      7424:        interaction such as entering username/password or accepting a
                   7425:        license on a web page.</p></li>
1.128     wiz      7426: <li class="listitem"><p>When extracting the distfiles, some packages may ask for
1.88      wiz      7427:        passwords.</p></li>
1.128     wiz      7428: <li class="listitem"><p>help to configure the package before it is built</p></li>
                   7429: <li class="listitem"><p>help during the build process</p></li>
                   7430: <li class="listitem"><p>help during the installation of a package</p></li>
1.78      rillig   7431: </ul></div>
1.218     rillig   7432: <p>A package can set the <code class="varname">INTERACTIVE_STAGE</code>
                   7433:     variable to define which stages need interaction. This should be
                   7434:     done in the package's <code class="filename">Makefile</code>, e.g.:</p>
1.75      rillig   7435: <pre class="programlisting">
1.100     rillig   7436: INTERACTIVE_STAGE=      configure install
1.222     sevan    7437: </pre>
1.88      wiz      7438: <p>The user can then decide to skip this package by setting the
1.218     rillig   7439:     <code class="varname">BATCH</code> variable. Packages that require interaction
                   7440:     are also excluded from bulk builds.</p>
1.75      rillig   7441: </div>
1.148     asau     7442: <div class="sect2">
1.75      rillig   7443: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7444: <a name="handling-licenses"></a>21.1.3. Handling licenses</h3></div></div></div>
1.222     sevan    7445: <p>Authors of software can choose the licence under which software
                   7446:     can be copied.  The Free Software Foundation has declared some
                   7447:     licenses "Free", and the Open Source Initiative has a definition of
                   7448:     "Open Source".</p>
                   7449: <p>By default, pkgsrc allows packages with Free or Open Source
                   7450:     licenses to be built.  To allow packages with other licenses to be
                   7451:     built as well, the pkgsrc user needs to add these licenses to the
                   7452:     <code class="varname">ACCEPTABLE_LICENSES</code> variable in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.  Note
                   7453:     that this variable only affects which packages may be
                   7454:     <span class="emphasis"><em>built</em></span>, while the license terms often also
                   7455:     restrict the actual use of the package and its redistribution.</p>
1.98      wiz      7456: <p>One might want to only install packages with a BSD license,
1.218     rillig   7457:     or the GPL, and not the other.  The free licenses are added to the
1.222     sevan    7458:     default <code class="varname">ACCEPTABLE_LICENSES</code> variable.  The pkgsrc
1.121     jnemeth  7459:     user can override the default by setting the
                   7460:     <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead
1.222     sevan    7461:     of "+=".  The licenses accepted by default are defined in the
                   7462:     <code class="varname">DEFAULT_ACCEPTABLE_LICENSES</code> variable in the file
                   7463:     <code class="filename">pkgsrc/mk/license.mk</code>.</p>
1.78      rillig   7464: <p>The license tag mechanism is intended to address
1.87      wiz      7465:     copyright-related issues surrounding building, installing and
                   7466:     using a package, and not to address redistribution issues (see
                   7467:     <code class="varname">RESTRICTED</code> and
1.222     sevan    7468:     <code class="varname">NO_SRC_ON_FTP</code>, etc.).
1.121     jnemeth  7469:     Packages with redistribution restrictions should set these
                   7470:     tags.</p>
1.98      wiz      7471: <p>Denoting that a package may be copied according to a
                   7472:     particular license is done by placing the license in
1.87      wiz      7473:     <code class="filename">pkgsrc/licenses</code> and setting the
                   7474:     <code class="varname">LICENSE</code> variable to a string identifying the
1.322     leot     7475:     license, e.g. in <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/xv/index.html" target="_top"><code class="filename">graphics/xv</code></a>:</p>
1.87      wiz      7476: <pre class="programlisting">
1.100     rillig   7477: LICENSE=        xv-license
1.222     sevan    7478: </pre>
1.87      wiz      7479: <p>When trying to build, the user will get a notice that the
1.98      wiz      7480:     package is covered by a license which has not been placed in the
                   7481:     <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p>
1.87      wiz      7482: <pre class="programlisting">
1.100     rillig   7483: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
                   7484: ===&gt; xv-3.10anb9 has an unacceptable license: xv-license.
                   7485: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   7486: ===&gt;     To indicate acceptance, add this line to your /etc/mk.conf:
                   7487: ===&gt;     ACCEPTABLE_LICENSES+=xv-license
                   7488: *** Error code 1
1.222     sevan    7489: </pre>
1.110     hubertf  7490: <p>The license can be viewed with <span class="command"><strong>make
1.98      wiz      7491:     show-license</strong></span>, and if the user so chooses, the line
1.110     hubertf  7492:     printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.98      wiz      7493:     convey to pkgsrc that it should not in the future fail because of
                   7494:     that license:</p>
1.78      rillig   7495: <pre class="programlisting">
1.100     rillig   7496: ACCEPTABLE_LICENSES+=xv-license
1.222     sevan    7497: </pre>
                   7498: <p>The use of <code class="varname">LICENSE=shareware</code>,
                   7499:     <code class="varname">LICENSE=no-commercial-use</code>, and similar language
                   7500:     is deprecated because it does not crisply refer to a particular
                   7501:     license text.  Another problem with such usage is that it does not
                   7502:     enable a user to tell pkgsrc to proceed for a single package
                   7503:     without also telling pkgsrc to proceed for all packages with that
                   7504:     tag.</p>
                   7505: <div class="sect3">
                   7506: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   7507: <a name="new-license"></a>21.1.3.1. Adding a package with a new license</h4></div></div></div>
1.154     rodent   7508: <p>When adding a package with a new license, the following steps
                   7509:     are required:</p>
                   7510: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7511: <li class="listitem">
1.284     rillig   7512: <p>Check whether the license qualifies as Free or Open Source by
                   7513:     referencing <a class="ulink" href="https://www.gnu.org/licenses/license-list.en.html" target="_top">Various
                   7514:     Licenses and Comments about Them</a> and <a class="ulink" href="https://opensource.org/licenses/alphabetical" target="_top">Licenses by Name |
1.222     sevan    7515:     Open Source Initiative</a>.  If this is the case, the filename in
                   7516:     <code class="filename">pkgsrc/licenses/</code> does not need the
                   7517:     <code class="filename">-license</code> suffix, and the license name should be
                   7518:     added to:</p>
1.154     rodent   7519: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.284     rillig   7520: <li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in
                   7521:     <code class="filename">pkgsrc/mk/license.mk</code></p></li>
                   7522: <li class="listitem"><p>default_acceptable_licenses in
                   7523:     <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li>
1.154     rodent   7524: </ul></div>
                   7525: </li>
1.284     rillig   7526: <li class="listitem"><p>The license text should be added to
                   7527:     <code class="filename">pkgsrc/licenses</code> for displaying.  A list of known
                   7528:     licenses can be seen in this directory.</p></li>
1.154     rodent   7529: </ol></div>
1.222     sevan    7530: </div>
                   7531: <div class="sect3">
                   7532: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   7533: <a name="change-license"></a>21.1.3.2. Change to the license</h4></div></div></div>
1.98      wiz      7534: <p>When the license changes (in a way other than formatting),
1.222     sevan    7535:     make sure that the new license has a different name (e.g.,
1.98      wiz      7536:     append the version number if it exists, or the date).  Just
                   7537:     because a user told pkgsrc to build programs under a previous
                   7538:     version of a license does not mean that pkgsrc should build
1.99      rillig   7539:     programs under the new licenses.  The higher-level point is that
1.98      wiz      7540:     pkgsrc does not evaluate licenses for reasonableness; the only
                   7541:     test is a mechanistic test of whether a particular text has been
1.222     sevan    7542:     approved by either of two bodies (FSF or OSI).</p>
                   7543: </div>
1.75      rillig   7544: </div>
1.148     asau     7545: <div class="sect2">
1.75      rillig   7546: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7547: <a name="restricted-packages"></a>21.1.4. Restricted packages</h3></div></div></div>
1.75      rillig   7548: <p>Some licenses restrict how software may be re-distributed.
1.222     sevan    7549:     By declaring the restrictions, package tools can
1.98      wiz      7550:     automatically refrain from e.g. placing binary packages on FTP
                   7551:     sites.</p>
1.222     sevan    7552: <p>There are four possible restrictions, which are
1.98      wiz      7553:     the cross product of sources (distfiles) and binaries not being
                   7554:     placed on FTP sites and CD-ROMs.  Because this is rarely the exact
                   7555:     language in any license, and because non-Free licenses tend to be
                   7556:     different from each other, pkgsrc adopts a definition of FTP and
1.222     sevan    7557:     CD-ROM.
                   7558: 
                   7559:     "FTP" means making the source or binary file available over the
                   7560:     Internet at no charge.
                   7561: 
                   7562:     "CD-ROM" means making the source or binary available on some kind of
                   7563:     media, together with other source and binary packages, which is sold
                   7564:     for a distribution charge.
1.98      wiz      7565:     </p>
                   7566: <p>In order to encode these restrictions, the package system
1.87      wiz      7567:     defines five make variables that can be set to note these
                   7568:     restrictions:</p>
1.148     asau     7569: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      7570: <li class="listitem">
1.75      rillig   7571: <p><code class="varname">RESTRICTED</code></p>
                   7572: <p>This variable should be set whenever a restriction
1.87      wiz      7573:        exists (regardless of its kind).  Set this variable to a
1.98      wiz      7574:        string containing the reason for the restriction.  It should
                   7575:        be understood that those wanting to understand the restriction
                   7576:        will have to read the license, and perhaps seek advice of
                   7577:        counsel.</p>
1.75      rillig   7578: </li>
1.128     wiz      7579: <li class="listitem">
1.75      rillig   7580: <p><code class="varname">NO_BIN_ON_CDROM</code></p>
1.98      wiz      7581: <p>Binaries may not be placed on CD-ROM containing other
                   7582:        binary packages, for which a distribution charge may be made.
                   7583:        In this case, set this variable to
                   7584:        <code class="varname">${RESTRICTED}</code>.</p>
1.75      rillig   7585: </li>
1.128     wiz      7586: <li class="listitem">
1.75      rillig   7587: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.98      wiz      7588: <p>Binaries may not made available on the Internet without
                   7589:        charge.  In this case, set this variable to
                   7590:        <code class="varname">${RESTRICTED}</code>.  If this variable is set,
                   7591:        binary packages will not be included on ftp.NetBSD.org.</p>
1.75      rillig   7592: </li>
1.128     wiz      7593: <li class="listitem">
1.75      rillig   7594: <p><code class="varname">NO_SRC_ON_CDROM</code></p>
1.98      wiz      7595: <p>Distfiles may not be placed on CD-ROM, together with
                   7596:        other distfiles, for which a fee may be charged.  In this
                   7597:        case, set this variable to <code class="varname">${RESTRICTED}</code>.
                   7598:        </p>
1.75      rillig   7599: </li>
1.128     wiz      7600: <li class="listitem">
1.75      rillig   7601: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.98      wiz      7602: <p>Distfiles may not made available via FTP at no charge.
                   7603:        In this case, set this variable to
                   7604:        <code class="varname">${RESTRICTED}</code>.  If this variable is set,
                   7605:        the distfile(s) will not be mirrored on ftp.NetBSD.org.</p>
1.75      rillig   7606: </li>
                   7607: </ul></div>
1.222     sevan    7608: <p>Please note that packages will be removed from pkgsrc when the
                   7609:     distfiles are not distributable and cannot be obtained for a period
                   7610:     of one full quarter branch. Packages with manual/interactive fetch
                   7611:     must have a maintainer and it is his/her responsibility to ensure
                   7612:     this.</p>
1.75      rillig   7613: </div>
1.148     asau     7614: <div class="sect2">
1.75      rillig   7615: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7616: <a name="dependencies"></a>21.1.5. Handling dependencies</h3></div></div></div>
1.290     gutterid 7617: <p>Your package may depend on some other package being present,
                   7618:     and there are various ways of expressing this dependency.
                   7619:     pkgsrc supports the <code class="varname">DEPENDS</code>,
                   7620:     <code class="varname">BUILD_DEPENDS</code>,
                   7621:     <code class="varname">TOOL_DEPENDS</code>, and
                   7622:     <code class="varname">TEST_DEPENDS</code> definitions, the
1.88      wiz      7623:     <code class="varname">USE_TOOLS</code> definition, as well as dependencies
                   7624:     via <code class="filename">buildlink3.mk</code>, which is the preferred way
                   7625:     to handle dependencies, and which uses the variables named above.
1.299     rillig   7626:     See <a class="xref" href="#buildlink" title="Chapter 18. Buildlink methodology">Chapter 18, <i>Buildlink methodology</i></a> for more information.</p>
1.290     gutterid 7627: <p>The basic difference is that the <code class="varname">DEPENDS</code>
                   7628:     definition registers that pre-requisite in the binary package so it
                   7629:     will be pulled in when the binary package is later installed, whilst
                   7630:     the <code class="varname">BUILD_DEPENDS</code>, <code class="varname">TOOL_DEPENDS</code>,
                   7631:     and <code class="varname">TEST_DEPENDS</code> definitions do not, marking a
                   7632:     dependency that is only needed for building or testing the resulting
1.299     rillig   7633:     package. See also <a class="xref" href="#creating" title="Chapter 14. Creating a new pkgsrc package from scratch">Chapter 14, <i>Creating a new pkgsrc package from scratch</i></a> for more information.</p>
1.75      rillig   7634: <p>This means that if you only need a package present whilst
1.290     gutterid 7635:     you are building or testing, it should be noted as a
                   7636:     <code class="varname">TOOL_DEPENDS</code>,
                   7637:     <code class="varname">BUILD_DEPENDS</code>, or
                   7638:     <code class="varname">TEST_DEPENDS</code>.  When cross-compiling,
1.269     leot     7639:     <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
                   7640:     packages, i.e. packages for the architecture where the package
                   7641:     is built;
                   7642:     <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
1.290     gutterid 7643:     packages, i.e., packages for the architecture for which the package
1.269     leot     7644:     is built.</p>
1.290     gutterid 7645: <p>The format for a <code class="varname">DEPENDS</code>,
                   7646:     <code class="varname">BUILD_DEPENDS</code>, <code class="varname">TOOL_DEPENDS</code>,
                   7647:     and <code class="varname">TEST_DEPENDS</code> definition is:</p>
1.75      rillig   7648: <pre class="programlisting">
1.100     rillig   7649: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
1.222     sevan    7650: </pre>
1.128     wiz      7651: <p>Please note that the <span class="quote">&#8220;<span class="quote">pre-req-package-name</span>&#8221;</span>
1.87      wiz      7652:     may include any of the wildcard version numbers recognized by
1.322     leot     7653:     <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_info.1"><span class="citerefentry"><span class="refentrytitle">pkg_info</span>(1)</span></a>.</p>
1.128     wiz      7654: <div class="orderedlist"><ol class="orderedlist" type="1">
                   7655: <li class="listitem">
1.75      rillig   7656: <p>If your package needs another package's binaries or
1.160     wiz      7657:        libraries to build and run, and if that package has a
1.87      wiz      7658:        <code class="filename">buildlink3.mk</code> file available, use it:</p>
1.75      rillig   7659: <pre class="programlisting">
1.100     rillig   7660: .include "../../graphics/jpeg/buildlink3.mk"
1.222     sevan    7661: </pre>
1.75      rillig   7662: </li>
1.128     wiz      7663: <li class="listitem">
1.160     wiz      7664: <p>If your package needs another package's binaries or
                   7665:        libraries only for building, and if that package has a
                   7666:        <code class="filename">buildlink3.mk</code> file available, use it:</p>
                   7667: <pre class="programlisting">
                   7668: .include "../../graphics/jpeg/buildlink3.mk"
1.222     sevan    7669: </pre>
1.160     wiz      7670: <p>but set
                   7671:        <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code>
                   7672:        to make it a build dependency only. This case is rather
                   7673:        rare.</p>
                   7674: </li>
                   7675: <li class="listitem">
1.132     spz      7676: <p>If your package needs binaries from another package to build,
1.269     leot     7677:        use the <code class="varname">TOOL_DEPENDS</code> definition:</p>
1.75      rillig   7678: <pre class="programlisting">
1.269     leot     7679: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.222     sevan    7680: </pre>
1.75      rillig   7681: </li>
1.269     leot     7682: <li class="listitem"><p>If your package needs static libraries to link against, header
                   7683:        files to include, etc. from another package to build,
                   7684:        use the <code class="varname">BUILD_DEPENDS</code> definition.</p></li>
1.132     spz      7685: <li class="listitem"><p>If your package needs a library with which to link and
                   7686:        there is no <code class="filename">buildlink3.mk</code> file
                   7687:        available, create one. Using
                   7688:        <code class="varname">DEPENDS</code> won't be sufficient because the
                   7689:        include files and libraries will be hidden from the compiler.</p></li>
1.128     wiz      7690: <li class="listitem">
1.132     spz      7691: <p>If your package needs some executable to be able to run
                   7692:        correctly and if there's no
                   7693:        <code class="filename">buildlink3.mk</code> file, this is specified
                   7694:        using the <code class="varname">DEPENDS</code> variable. The
1.322     leot     7695:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/lyx/index.html" target="_top"><code class="filename">print/lyx</code></a> package needs to
1.242     wiz      7696:        be able to execute the latex binary from the tex-latex-bin package
1.132     spz      7697:        when it runs, and that is specified:</p>
1.75      rillig   7698: <pre class="programlisting">
1.242     wiz      7699: DEPENDS+=        tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.222     sevan    7700: </pre>
1.132     spz      7701: </li>
1.290     gutterid 7702: <li class="listitem"><p>If your package includes a test suite that has extra
                   7703:         dependencies only required for this purpose (frequently this
                   7704:         can be run as a <span class="quote">&#8220;<span class="quote">make test</span>&#8221;</span> target), use the
                   7705:         <code class="varname">TEST_DEPENDS</code> variable.</p></li>
1.132     spz      7706: <li class="listitem">
                   7707: <p>You can use wildcards in package dependencies. Note that
                   7708:        such wildcard dependencies are retained when creating binary
                   7709:        packages. The dependency is checked when installing the binary
                   7710:        package and any package which matches the pattern will be
                   7711:        used. Wildcard dependencies should be used with care.</p>
1.128     wiz      7712: <p>The <span class="quote">&#8220;<span class="quote">-[0-9]*</span>&#8221;</span> should be used instead of
                   7713:        <span class="quote">&#8220;<span class="quote">-*</span>&#8221;</span> to avoid potentially ambiguous matches
                   7714:        such as <span class="quote">&#8220;<span class="quote">tk-postgresql</span>&#8221;</span> matching a
                   7715:        <span class="quote">&#8220;<span class="quote">tk-*</span>&#8221;</span> <code class="varname">DEPENDS</code>.</p>
1.75      rillig   7716: <p>Wildcards can also be used to specify that a package
1.87      wiz      7717:        will only build against a certain minimum version of a
                   7718:        pre-requisite:</p>
1.75      rillig   7719: <pre class="programlisting">
1.132     spz      7720: DEPENDS+=       ImageMagick&gt;=6.0:../../graphics/ImageMagick
1.222     sevan    7721: </pre>
1.132     spz      7722: <p>This means that the package will build using version 6.0
                   7723:        of ImageMagick or newer. Such a dependency may be warranted
                   7724:        if, for example, the command line options of an executable
                   7725:        have changed.</p>
                   7726: <p>If you need to depend on minimum versions of libraries,
1.298     wiz      7727:        set
                   7728:        <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
                   7729:        to the appropriate pattern before including its
                   7730:        <code class="filename">buildlink3.mk</code> file, e.g.</p>
                   7731: <pre class="programlisting">
                   7732: BUILDLINK_API_DEPENDS.jpeg+=    jpeg&gt;=9.0
                   7733: .include "../../graphics/jpeg/buildlink3.mk"
                   7734: </pre>
1.75      rillig   7735: <p>For security fixes, please update the package
1.267     rillig   7736:        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.87      wiz      7737:        information.</p>
1.75      rillig   7738: </li>
                   7739: </ol></div>
                   7740: <p>If your package needs files from another package to build,
1.87      wiz      7741:     add the relevant distribution files to
                   7742:     <code class="varname">DISTFILES</code>, so they will be extracted
1.322     leot     7743:     automatically. See the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/print/ghostscript/index.html" target="_top"><code class="filename">print/ghostscript</code></a> package for an example.
1.87      wiz      7744:     (It relies on the jpeg sources being present in source form
                   7745:     during the build.)</p>
1.75      rillig   7746: </div>
1.148     asau     7747: <div class="sect2">
1.75      rillig   7748: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7749: <a name="conflicts"></a>21.1.6. Handling conflicts with other packages</h3></div></div></div>
1.341     gutterid 7750: <p>Your package may conflict with other packages users might
                   7751:     already have installed on their system, e.g., if your package
1.88      wiz      7752:     installs the same set of files as another package in the pkgsrc
1.342     wiz      7753:     tree.</p>
1.322     leot     7754: <p>For example, <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/libXaw3d/index.html" target="_top"><code class="filename">x11/libXaw3d</code></a>
                   7755:     and <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/x11/Xaw-Xpm/index.html" target="_top"><code class="filename">x11/Xaw-Xpm</code></a>
1.255     leot     7756:     install the same shared library, thus you set in
                   7757:     <code class="filename">pkgsrc/x11/libXaw3d/Makefile</code>:</p>
                   7758: <pre class="programlisting">
                   7759: CONFLICTS=      Xaw-Xpm-[0-9]*
                   7760:     </pre>
                   7761: <p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
                   7762: <pre class="programlisting">
                   7763: CONFLICTS=      libXaw3d-[0-9]*
                   7764:     </pre>
1.322     leot     7765: <p><a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_add.1"><span class="citerefentry"><span class="refentrytitle">pkg_add</span>(1)</span></a> is able to detect attempts to install packages
1.255     leot     7766:     that conflict with existing packages and abort. However, in many
                   7767:     situations this is too late in the process. Binary package managers
                   7768:     will not know about the conflict until they attempt to install the
                   7769:     package after already downloading it and all its dependencies.
                   7770:     Users may also waste time building a package and its dependencies
                   7771:     only to find out at the end that it conflicts with another package
                   7772:     they have installed.</p>
                   7773: <p>To avoid these issues <code class="varname">CONFLICTS</code> entries
                   7774:     should be added in all cases where it is known that packages conflict
                   7775:     with each other.  These <code class="varname">CONFLICTS</code> entries are
1.322     leot     7776:     exported in <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_summary.5"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> files and consumed by binary package
1.255     leot     7777:     managers to inform users that packages cannot be installed onto
                   7778:     the target system.</p>
1.75      rillig   7779: </div>
1.148     asau     7780: <div class="sect2">
1.75      rillig   7781: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7782: <a name="not-building-packages"></a>21.1.7. Packages that cannot or should not be built</h3></div></div></div>
1.75      rillig   7783: <p>There are several reasons why a package might be
1.88      wiz      7784:     instructed to not build under certain circumstances.  If the
1.87      wiz      7785:     package builds and runs on most platforms, the exceptions
1.193     dholland 7786:     should be noted with <code class="varname">BROKEN_ON_PLATFORM</code>.  If
                   7787:     the package builds and runs on a small handful of platforms,
                   7788:     set <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> instead.
                   7789:     Both <code class="varname">BROKEN_ON_PLATFORM</code> and
                   7790:     <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> are OS triples
                   7791:     (OS-version-platform) that can use glob-style
                   7792:     wildcards.</p>
                   7793: <p>If a package is not appropriate for some platforms (as
1.225     maya     7794:     opposed to merely broken), a different set of variables should be
1.193     dholland 7795:     used as this affects failure reporting and statistics.
                   7796:     If the package is appropriate for most platforms, the exceptions
1.87      wiz      7797:     should be noted with <code class="varname">NOT_FOR_PLATFORM</code>.  If
1.193     dholland 7798:     the package is appropriate for only a small handful of platforms
                   7799:     (often exactly one), set <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.87      wiz      7800:     Both <code class="varname">ONLY_FOR_PLATFORM</code> and
                   7801:     <code class="varname">NOT_FOR_PLATFORM</code> are OS triples
                   7802:     (OS-version-platform) that can use glob-style
                   7803:     wildcards.</p>
1.88      wiz      7804: <p>Some packages are tightly bound to a specific version of an
1.322     leot     7805:     operating system, e.g. LKMs or <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/lsof/index.html" target="_top"><code class="filename">sysutils/lsof</code></a>.  Such binary packages are not
1.88      wiz      7806:     backwards compatible with other versions of the OS, and should be
                   7807:     uploaded to a version specific directory on the FTP server.  Mark
                   7808:     these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to
1.128     wiz      7809:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>.  This variable is not currently used by any of
1.88      wiz      7810:     the package system internals, but may be used in the
                   7811:     future.</p>
1.75      rillig   7812: <p>If the package should be skipped (for example, because it
1.87      wiz      7813:     provides functionality already provided by the system), set
1.88      wiz      7814:     <code class="varname">PKG_SKIP_REASON</code> to a descriptive message.  If
                   7815:     the package should fail because some preconditions are not met,
                   7816:     set <code class="varname">PKG_FAIL_REASON</code> to a descriptive
1.87      wiz      7817:     message.</p>
1.75      rillig   7818: </div>
1.148     asau     7819: <div class="sect2">
1.75      rillig   7820: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7821: <a name="undeletable-packages"></a>21.1.8. Packages which should not be deleted, once installed</h3></div></div></div>
1.75      rillig   7822: <p>To ensure that a package may not be deleted, once it has been
1.87      wiz      7823:     installed, the <code class="varname">PKG_PRESERVE</code> definition should
                   7824:     be set in the package Makefile. This will be carried into any
                   7825:     binary package that is made from this pkgsrc entry. A
1.128     wiz      7826:     <span class="quote">&#8220;<span class="quote">preserved</span>&#8221;</span> package will
1.322     leot     7827:     not be deleted using <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_delete.1"><span class="citerefentry"><span class="refentrytitle">pkg_delete</span>(1)</span></a> unless the
1.128     wiz      7828:     <span class="quote">&#8220;<span class="quote">-f</span>&#8221;</span> option is used.</p>
1.75      rillig   7829: </div>
1.148     asau     7830: <div class="sect2">
1.75      rillig   7831: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7832: <a name="security-handling"></a>21.1.9. Handling packages with security problems</h3></div></div></div>
1.75      rillig   7833: <p>When a vulnerability is found, this should be noted in
1.320     wiz      7834:     <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>.
                   7835:     Entries in that file consist of three parts:</p>
                   7836: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   7837: <li class="listitem"><p>package version pattern</p></li>
                   7838: <li class="listitem"><p>type of vulnerability (please cut'n'paste an existing one where possible)</p></li>
                   7839: <li class="listitem"><p>URL providing additional information about the issue</p></li>
                   7840: </ul></div>
                   7841: <p>For the package version pattern please always use `&lt;' to
                   7842:     mark an upper bound (not `&lt;='!). This will avoid possible
                   7843:     problems due unrelated <code class="varname">PKGREVISION</code> bumps not
                   7844:     related to security fixes. Lower bounds can be added too, using
                   7845:     '&gt;' or '&gt;='. For example,
1.321     wiz      7846:     <span class="quote">&#8220;<span class="quote"><code class="literal">foo&gt;=1&lt;1.2</code></span>&#8221;</span> would mark
1.320     wiz      7847:     versions 1.0 (included) to 1.2 (excluded) of
                   7848:     <span class="quote">&#8220;<span class="quote"><code class="literal">foo</code></span>&#8221;</span> as affected by the security
                   7849:     issue.</p>
                   7850: <p>Entries should always be added at the bottom of the file.</p>
                   7851: <p>When fixing packages, please modify the upper bound of the
                   7852:     corresponding entry. To continue the previous example, if a fix
                   7853:     was backported to version 1.1nb2, change the previous pattern to
1.321     wiz      7854:     <span class="quote">&#8220;<span class="quote"><code class="literal">foo&gt;=1&lt;1.1nb2</code></span>&#8221;</span>.</p>
1.320     wiz      7855: <p>To locally test a package version pattern against a
                   7856:     <code class="varname">PKGNAME</code> you can use the <span class="command"><strong>pkg_admin
                   7857:     pmatch</strong></span> command.</p>
                   7858: <p>The URL should be as permanent as possible and provide as
                   7859:     much information about the issue as possible.  CVE entries are
                   7860:     preferred.</p>
                   7861: <p>After committing that file, ask pkgsrc-security@NetBSD.org to
1.138     wiz      7862:     update the file on ftp.NetBSD.org.</p>
1.75      rillig   7863: <p>After fixing the vulnerability by a patch, its
1.138     wiz      7864:     <code class="varname">PKGREVISION</code> should be increased (this is of
                   7865:     course not necessary if the problem is fixed by using a newer
                   7866:     release of the software), and the pattern in the
                   7867:     pkg-vulnerabilities file must be updated.</p>
1.75      rillig   7868: <p>Also, if the fix should be applied to the stable pkgsrc
1.87      wiz      7869:     branch, be sure to submit a pullup request!</p>
1.75      rillig   7870: <p>Binary packages already on ftp.NetBSD.org will be handled
1.87      wiz      7871:     semi-automatically by a weekly cron job.</p>
1.320     wiz      7872: <p>In case a security issue is disputed, please contact
                   7873:     pkgsrc-security@NetBSD.org.</p>
1.75      rillig   7874: </div>
1.148     asau     7875: <div class="sect2">
1.75      rillig   7876: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7877: <a name="bumping-pkgrevision"></a>21.1.10. How to handle incrementing versions when fixing an existing package</h3></div></div></div>
1.75      rillig   7878: <p>When making fixes to an existing package it can be useful
1.87      wiz      7879:     to change the version number in <code class="varname">PKGNAME</code>. To
                   7880:     avoid conflicting with future versions by the original author, a
1.128     wiz      7881:     <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.87      wiz      7882:     on package versions by setting <code class="varname">PKGREVISION=1</code>
1.128     wiz      7883:     (2, ...). The <span class="quote">&#8220;<span class="quote">nb</span>&#8221;</span> is treated like a
                   7884:     <span class="quote">&#8220;<span class="quote">.</span>&#8221;</span> by the package tools. e.g.</p>
1.87      wiz      7885: <pre class="programlisting">
1.100     rillig   7886: DISTNAME=       foo-17.42
                   7887: PKGREVISION=    9
1.222     sevan    7888: </pre>
1.75      rillig   7889: <p>will result in a <code class="varname">PKGNAME</code> of
1.128     wiz      7890:     <span class="quote">&#8220;<span class="quote">foo-17.42nb9</span>&#8221;</span>. If you want to use the original
                   7891:     value of <code class="varname">PKGNAME</code> without the <span class="quote">&#8220;<span class="quote">nbX</span>&#8221;</span>
1.87      wiz      7892:     suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use
                   7893:     <code class="varname">PKGNAME_NOREV</code>.</p>
1.75      rillig   7894: <p>When a new release of the package is released, the
1.87      wiz      7895:     <code class="varname">PKGREVISION</code> should be removed, e.g. on a new
                   7896:     minor release of the above package, things should be like:</p>
1.75      rillig   7897: <pre class="programlisting">
1.100     rillig   7898: DISTNAME=       foo-17.43
1.222     sevan    7899: </pre>
1.87      wiz      7900: <p><code class="varname">PKGREVISION</code> should be incremented for any
                   7901:     non-trivial change in the resulting binary package.  Without a
                   7902:     <code class="varname">PKGREVISION</code> bump, someone with the previous
                   7903:     version installed has no way of knowing that their package is out
                   7904:     of date.  Thus, changes without increasing
                   7905:     <code class="varname">PKGREVISION</code> are essentially labeled "this is so
                   7906:     trivial that no reasonable person would want to upgrade", and this
                   7907:     is the rough test for when increasing
                   7908:     <code class="varname">PKGREVISION</code> is appropriate.  Examples of
                   7909:     changes that do not merit increasing
                   7910:     <code class="varname">PKGREVISION</code> are:</p>
1.148     asau     7911: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      7912: <li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>,
1.284     rillig   7913:       <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>, or
                   7914:       comments in Makefile.</p></li>
                   7915: <li class="listitem"><p>Changing build variables if the resulting binary
                   7916:       package is the same.</p></li>
                   7917: <li class="listitem"><p>Changing
                   7918:       <code class="filename">DESCR</code>.</p></li>
                   7919: <li class="listitem"><p>Adding <code class="varname">PKG_OPTIONS</code> if the
                   7920:       default options don't change.</p></li>
1.100     rillig   7921: </ul></div>
1.87      wiz      7922: <p>Examples of changes that do merit an increase to
                   7923:     <code class="varname">PKGREVISION</code> include:</p>
1.148     asau     7924: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.284     rillig   7925: <li class="listitem"><p>Security fixes</p></li>
                   7926: <li class="listitem"><p>Changes or additions to a patch
                   7927:       file</p></li>
                   7928: <li class="listitem"><p>Changes to the
                   7929:       <code class="filename">PLIST</code></p></li>
                   7930: <li class="listitem"><p>A dependency is changed or
                   7931:       renamed.</p></li>
1.100     rillig   7932: </ul></div>
1.78      rillig   7933: <p>PKGREVISION must also be incremented when dependencies have ABI
                   7934:     changes.</p>
1.75      rillig   7935: </div>
1.148     asau     7936: <div class="sect2">
1.79      rillig   7937: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   7938: <a name="fixes.subst"></a>21.1.11. Substituting variable text in the package files (the SUBST framework)</h3></div></div></div>
1.295     rillig   7939: <p>When you want to replace the same text in multiple files, or
                   7940: multiple times in the same file, it is cumbersome to maintain a patch
                   7941: file for this. This is where the SUBST framework steps in. It provides an
                   7942: easy-to-use interface for replacing text in files. It just needs the
                   7943: following information:</p>
                   7944: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   7945: <li class="listitem"><p>In which phase of the package build cycle should the
                   7946: replacement happen?</p></li>
                   7947: <li class="listitem"><p>In which files should the replacement
1.287     rillig   7948: happen?</p></li>
1.295     rillig   7949: <li class="listitem"><p>Which text should be replaced with
                   7950: what?</p></li>
1.287     rillig   7951: </ul></div>
                   7952: <p>This information is encoded in a block of <code class="varname">SUBST</code>
1.295     rillig   7953: variables. A minimal example is:</p>
                   7954: <pre class="programlisting">
                   7955: SUBST_CLASSES+=         paths
                   7956: SUBST_STAGE.paths=      pre-configure
                   7957: SUBST_FILES.paths=      src/*.c
                   7958: SUBST_SED.paths=        -e 's,/usr/local,${PREFIX},g'
                   7959: </pre>
                   7960: <p>Translated into English, it means: In the pre-configure stage (that
                   7961: is, after applying the patches from the patches/ directory and before
                   7962: running the configure script and the portability check), replace the text
                   7963: <code class="literal">/usr/local</code> with the content of the variable
                   7964: <code class="varname">PREFIX</code>.</p>
                   7965: <p>Each SUBST block starts by appending an identifier to
                   7966: <code class="varname">SUBST_CLASSES</code> (note the <code class="literal">+=</code>). This
                   7967: identifier can be chosen freely by the package. If there should ever be
                   7968: duplicate identifiers, the pkgsrc infrastructure will catch this and fail
                   7969: early, so don't worry about name collisions.</p>
                   7970: <p>Except for <code class="varname">SUBST_CLASSES</code>, all variables in a
                   7971: SUBST block are parameterized using this identifier. In the remainder of
                   7972: this section, these parameterized variables are written as
                   7973: <code class="varname">SUBST_STAGE.*</code>.</p>
                   7974: <pre class="programlisting">
                   7975: SUBST_CLASSES+=         paths
                   7976: SUBST_STAGE.paths=      pre-configure
                   7977: SUBST_MESSAGE.paths=    Fixing absolute paths.
                   7978: SUBST_FILES.paths=      src/*.c
                   7979: SUBST_FILES.paths+=     scripts/*.sh
                   7980: SUBST_SED.paths=        -e 's,"/usr/local,"${PREFIX},g'
                   7981: SUBST_SED.paths+=       -e 's,"/var/log,"${VARBASE}/log,g'
                   7982: SUBST_VARS.paths=       LOCALBASE PREFIX PKGVERSION
                   7983: </pre>
                   7984: <p>To get a complete picture about the SUBST substitutions, run
                   7985: <span class="command"><strong>bmake show-all-subst</strong></span>. If something doesn't work as
                   7986: expected, run pkglint on the package, which detects several typical
                   7987: mistakes surrounding the SUBST blocks. For any questions that might
                   7988: remain after this, have a look at
                   7989: <code class="filename">mk/subst.mk</code>.</p>
                   7990: <div class="sect3">
                   7991: <div class="titlepage"><div><div><h4 class="title">
                   7992: <a name="fixes.subst.when"></a>21.1.11.1. Choosing the time where the substitutions happen</h4></div></div></div>
                   7993: <p>The <code class="varname">SUBST_STAGE.*</code> is one of
                   7994: {pre,do,post}-{extract,patch,configure,build,test,install}. Of these,
                   7995: <code class="literal">pre-configure</code> is used most often, by far. The most
                   7996: popular stages are, in chronological order:</p>
                   7997: <div class="variablelist"><dl class="variablelist">
                   7998: <dt><span class="term"><code class="literal">post-extract</code></span></dt>
                   7999: <dd>
                   8000: <p>The substitutions are applied immediately after the
                   8001: distfiles are extracted. Running <span class="command"><strong>bmake extract</strong></span> on the
                   8002: package will leave no traces of the original files.</p>
                   8003: <p>When the substitution applies to files for which there is also a
                   8004: patch in the <code class="filename">patches/</code> directory, this means that the
                   8005: patches will be computed based on the result of the substitution. When
                   8006: these patches are sent to the upstream maintainer later, to be fixed in
                   8007: the upstream package, these patches may no longer match what the upstream
                   8008: author is used to. Because of this, <code class="literal">pre-configure</code> is
                   8009: often a better choice.</p>
                   8010: </dd>
                   8011: <dt><span class="term"><code class="literal">pre-configure</code></span></dt>
                   8012: <dd>
                   8013: <p>The substitutions are applied after the patches from the
                   8014: <code class="filename">patches/</code> directory. This makes it possible to run
                   8015: <span class="command"><strong>bmake patch</strong></span> on the package, after which the patches
1.322     leot     8016: can be edited using the tools pkgvi and mkpatches from the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkgdiff/index.html" target="_top"><code class="filename">pkgtools/pkgdiff</code></a> package.</p>
1.295     rillig   8017: <p>When updating the patches, it is helpful to explicitly separate the
                   8018: <span class="command"><strong>bmake patch</strong></span> from the <span class="command"><strong>bmake
                   8019: configure</strong></span>, and to only edit the patches between these commands.
                   8020: Otherwise the substitutions from the SUBST block will end up in the patch
                   8021: file. When this happens in really obvious ways, pkglint will complain
                   8022: about patches that contain a hard-coded <code class="literal">/usr/pkg</code>
                   8023: instead of the correct and intended <code class="literal">@PREFIX@</code>, but it
                   8024: can only detect these really obvious
                   8025: cases.</p>
                   8026: </dd>
                   8027: <dt><span class="term"><code class="literal">do-configure</code></span></dt>
                   8028: <dd><p>This stage should only be used if the package defines a
                   8029: <code class="literal">pre-configure</code> action itself, and the substitution must
                   8030: happen after that. Typical examples are packages that use the
                   8031: <code class="literal">pre-configure</code> stage to regenerate the GNU configure
                   8032: script from
                   8033: <code class="filename">configure.ac</code>.</p></dd>
                   8034: <dt><span class="term"><code class="literal">post-configure</code></span></dt>
                   8035: <dd><p>This stage is used to fix up any mistakes by the
                   8036: configure stage.</p></dd>
                   8037: <dt><span class="term"><code class="literal">pre-build</code></span></dt>
                   8038: <dd><p>This stage should only be used for substitutions that are
                   8039: clearly related to building the package, not for fixing the
                   8040: configuration. Substitutions for pathnames (such as replacing
                   8041: <code class="filename">/usr/local</code> with <code class="literal">${PREFIX}</code>) or
                   8042: user names (such as replacing <code class="literal">@MY_USER@</code> with the
                   8043: actual username) belong in pre-configure or post-configure
                   8044: instead.</p></dd>
                   8045: <dt><span class="term"><code class="literal">post-build</code></span></dt>
                   8046: <dd>
                   8047: <p>Just as with pre-build, this stage should only be used
                   8048: for substitutions that are clearly related to building the package, not
                   8049: for fixing the configuration. Substitutions for pathnames (such as
                   8050: replacing <code class="filename">/usr/local</code> with
                   8051: <code class="literal">${PREFIX}</code>) or user names (such as replacing
                   8052: <code class="literal">@MY_USER@</code> with the actual username) belong in
                   8053: pre-configure or post-configure instead.</p>
                   8054: <p>A typical use is to update pkg-config files to include the rpath
                   8055: compiler options.</p>
                   8056: </dd>
                   8057: <dt><span class="term"><code class="literal">pre-install</code></span></dt>
                   8058: <dd><p>In general, the install phase should be as simple as
                   8059: possible. As with the pre-build and post-build stages, it should not be
                   8060: used to fix pathnames or user names, these belong in pre-configure
                   8061: instead. There are only few legitimate use cases for applying
                   8062: substitutions in this stage.</p></dd>
                   8063: </dl></div>
                   8064: </div>
                   8065: <div class="sect3">
                   8066: <div class="titlepage"><div><div><h4 class="title">
1.296     rillig   8067: <a name="fixes.subst.where"></a>21.1.11.2. Choosing the files where the substitutions happen</h4></div></div></div>
1.295     rillig   8068: <p>The <code class="varname">SUBST_FILES.*</code> variable contains a list of
                   8069: filename patterns. These patterns are relative to
                   8070: <code class="varname">WRKSRC</code> since that is where most substitutions happen.
                   8071: A typical example is:</p>
                   8072: <pre class="programlisting">
                   8073: SUBST_FILES.path=       Makefile */Makefile */*/Makefile *.[ch]
                   8074: </pre>
                   8075: <p>The above patterns, especially the last, are quite broad. The SUBST
                   8076: implementation checks that each filename pattern that is mentioned here
                   8077: has an effect. For example, if none of the
                   8078: <code class="filename">*/*/Makefile</code> files contains the patterns to be found
                   8079: and substituted, that filename pattern is redundant and should be left
1.296     rillig   8080: out. By default, the SUBST framework will complain with an error message.
                   8081: If the text to be substituted occurs in some of the files from a single
                   8082: pattern, but not in all of them, that is totally ok, and the SUBST
1.295     rillig   8083: framework will only print an INFO message for those files.</p>
                   8084: <p>If there is a good reason for having redundant filename patterns,
1.296     rillig   8085: set <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
1.295     rillig   8086: <p>Another popular way of choosing the files for the substitutions is
                   8087: via a shell command, like this:</p>
                   8088: <pre class="programlisting">
1.296     rillig   8089: C_FILES_CMD=            cd ${WRKSRC} &amp;&amp; ${FIND} . -name '*.c'
1.295     rillig   8090: SUBST_FILES.path=       ${C_FILES_CMD:sh}
                   8091: </pre>
                   8092: <p>The variable name <code class="varname">C_FILES_CMD</code> in this example is
                   8093: freely chosen and independent of the SUBST framework.</p>
                   8094: <p>In this variant, the <code class="varname">SUBST_FILES.*</code> variable
                   8095: lists each file individually. Thereby chances are higher that there are
                   8096: filename patterns in which no substitution happens. Since the SUBST
                   8097: framework cannot know whether the filename patterns in
                   8098: <code class="varname">SUBST_FILES.*</code> have been explicitly listed in the
                   8099: Makefile (where any redundant filename pattern would be suspicious) or
                   8100: been generated by a shell command (in which redundant filename patterns
                   8101: are more likely and to be expected), it will complain about these
                   8102: redundant filename patterns. Therefore, SUBST blocks that use a shell
                   8103: command to generate the list of filename patterns often need to set
                   8104: <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
                   8105: </div>
                   8106: <div class="sect3">
                   8107: <div class="titlepage"><div><div><h4 class="title">
                   8108: <a name="fixes.subst.what"></a>21.1.11.3. Choosing what to substitute</h4></div></div></div>
                   8109: <p>In most cases, the substitutions are given using one or more
1.322     leot     8110: <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/sed.1"><span class="citerefentry"><span class="refentrytitle">sed</span>(1)</span></a> commands, like this:</p>
1.295     rillig   8111: <pre class="programlisting">
                   8112: SUBST_SED.path=         -e 's|/usr/local|${PREFIX}|g'
                   8113: </pre>
                   8114: <p>Each of the sed commands needs to be preceded by the
                   8115: <code class="literal">-e</code> option and should be specified on a line of its
                   8116: own, to avoid hiding short sed commands at the end of a line.</p>
                   8117: <p>Since the sed commands often contain shell metacharacters as the
                   8118: separator (the <code class="literal">|</code> in the above example), it is common
                   8119: to enclose them in single quotes.</p>
                   8120: <p>A common substitution is to replace placeholders of the form
                   8121: <code class="literal">@VARNAME@</code> with their pkgsrc counterpart variable
                   8122: <code class="literal">${VARNAME}</code>. A typical example is:</p>
                   8123: <pre class="programlisting">
                   8124: SUBST_VARS.path=        PREFIX
                   8125: </pre>
                   8126: <p>This type of substitutions is typically done by the GNU configure
1.296     rillig   8127: scripts during the do-configure stage, but in some cases these need to be
                   8128: overridden. The same pattern is also used when a package defines patches
                   8129: that replace previously hard-coded paths like
                   8130: <code class="literal">/usr/local</code> with a <code class="literal">@PREFIX@</code>
                   8131: placeholder first, which then gets substituted by the actual
                   8132: <code class="literal">${PREFIX}</code> in the pre-configure stage. In many of these
                   8133: cases, it works equally well to just use the SUBST framework to directly
                   8134: replace <code class="literal">/usr/local</code> with <code class="literal">${PREFIX}</code>,
                   8135: thereby omitting the intermediate patch file.</p>
1.295     rillig   8136: <p>If the above is not flexible enough, it is possible to not use sed
                   8137: at all for the substitution but to specify an entirely different command,
                   8138: like this:</p>
1.87      wiz      8139: <pre class="programlisting">
1.295     rillig   8140: SUBST_FILTER_CMD.path=  LC_ALL=C ${TR} -d '\r'
                   8141: </pre>
                   8142: <p>This is used for the few remaining packages in which the
                   8143: distributed files use Windows-style line endings that need to be
                   8144: converted to UNIX-style line endings.</p>
                   8145: </div>
                   8146: <div class="sect3">
                   8147: <div class="titlepage"><div><div><h4 class="title">
                   8148: <a name="fixes.subst.other"></a>21.1.11.4. Other SUBST variables</h4></div></div></div>
                   8149: <p>When a SUBST block is applied during a package build, a message is
                   8150: logged. The default message is fine for most purposes but can be
                   8151: overridden by setting <code class="literal">SUBST_MESSAGE.*</code> to an individual
                   8152: message.</p>
                   8153: </div>
1.79      rillig   8154: </div>
1.75      rillig   8155: </div>
1.148     asau     8156: <div class="sect1">
1.75      rillig   8157: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   8158: <a name="fixes.fetch"></a>21.2. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.148     asau     8159: <div class="sect2">
1.75      rillig   8160: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8161: <a name="no-plain-download"></a>21.2.1. Packages whose distfiles aren't available for plain downloading</h3></div></div></div>
1.75      rillig   8162: <p>If you need to download from a dynamic URL you can set
1.110     hubertf  8163:     <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make
1.87      wiz      8164:     fetch</strong></span> will call <code class="filename">files/getsite.sh</code>
                   8165:     with the name of each file to download as an argument, expecting
                   8166:     it to output the URL of the directory from which to download
1.322     leot     8167:     it. <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/graphics/ns-cult3d/index.html" target="_top"><code class="filename">graphics/ns-cult3d</code></a> is an
1.87      wiz      8168:     example of this usage.</p>
1.75      rillig   8169: <p>If the download can't be automated, because the user must
1.87      wiz      8170:     submit personal information to apply for a password, or must pay
                   8171:     for the source, or whatever, you can set
                   8172:     <code class="varname">FETCH_MESSAGE</code> to a list of lines that are
                   8173:     displayed to the user before aborting the build. Example:</p>
                   8174: <pre class="programlisting">
1.100     rillig   8175: FETCH_MESSAGE=  "Please download the files"
                   8176: FETCH_MESSAGE+= "    "${DISTFILES:Q}
                   8177: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
1.222     sevan    8178: </pre>
1.75      rillig   8179: </div>
1.148     asau     8180: <div class="sect2">
1.75      rillig   8181: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8182: <a name="modified-distfiles-same-name"></a>21.2.2. How to handle modified distfiles with the 'old' name</h3></div></div></div>
1.75      rillig   8183: <p>Sometimes authors of a software package make some
1.87      wiz      8184:     modifications after the software was released, and they put up a
                   8185:     new distfile without changing the package's version number. If a
                   8186:     package is already in pkgsrc at that time, the checksum will
                   8187:     no longer match. The contents of the new distfile should be
                   8188:     compared against the old one before changing anything, to make
                   8189:     sure the distfile was really updated on purpose, and that
                   8190:     no trojan horse or so crept in.
1.97      rillig   8191:     Please mention that the distfiles were compared and what was found
1.159     rodent   8192:     in your commit message.</p>
1.220     wiz      8193: <p>Then, the correct way to work around this is to set
                   8194:     <code class="varname">DIST_SUBDIR</code> to a unique directory name, usually
                   8195:     based on <code class="varname">PKGNAME_NOREV</code> (but take care with
                   8196:     python or ruby packages, where <code class="varname">PKGNAME</code> includes
                   8197:     a variable prefix). All <code class="varname">DISTFILES</code> and
1.93      rillig   8198:     <code class="varname">PATCHFILES</code> for this package will be put in that
1.267     rillig   8199:     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.87      wiz      8200:     happens more often, <code class="varname">PKGNAME</code> can be used (thus
1.220     wiz      8201:     including the <code class="filename">nbX</code> suffix) or a date stamp can
                   8202:     be appended, like
                   8203:     <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p>
1.284     rillig   8204: <p><code class="varname">DIST_SUBDIR</code> is also used when a distfile's
                   8205:     name does not contain a version and the distfile is apt to change. In
                   8206:     cases where the likelihood of this is very small,
                   8207:     <code class="varname">DIST_SUBDIR</code> might not be required. Additionally,
                   8208:     <code class="varname">DIST_SUBDIR</code> must not be removed unless the
                   8209:     distfile name changes, even if a package is being moved or
                   8210:     renamed.</p>
1.159     rodent   8211: <p>Do not forget regenerating the <code class="filename">distinfo</code> file
1.87      wiz      8212:     after that, since it contains the <code class="varname">DIST_SUBDIR</code>
                   8213:     path in the filenames.
1.159     rodent   8214:     Also, increase the PKGREVISION if the installed package is different.
1.87      wiz      8215:     Furthermore, a mail to the package's authors seems appropriate
                   8216:     telling them that changing distfiles after releases without
                   8217:     changing the file names is not good practice.</p>
1.75      rillig   8218: </div>
1.199     tnn      8219: <div class="sect2">
                   8220: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8221: <a name="build.fetch.github"></a>21.2.3. Packages hosted on github.com</h3></div></div></div>
1.284     rillig   8222: <p>Helper methods exist for packages hosted on github.com which
                   8223:     will often have distfile names that clash with other packages, for
                   8224:     example <code class="filename">1.0.tar.gz</code>. Use one of the three recipes
                   8225:     from below:</p>
1.199     tnn      8226: <div class="sect3">
                   8227: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   8228: <a name="build.fetch.github.tag"></a>21.2.3.1. Fetch based on a tagged release</h4></div></div></div>
1.284     rillig   8229: <p>If your distfile URL looks similar to
1.303     bacon    8230:       <code class="literal">https://github.com/username/example/archive/v1.0.zip</code>,
1.284     rillig   8231:       then you are packaging a tagged release.</p>
1.199     tnn      8232: <pre class="programlisting">
1.303     bacon    8233: DISTNAME=       example-1.0
1.200     tnn      8234: MASTER_SITES=   ${MASTER_SITE_GITHUB:=username/}
1.303     bacon    8235: #GITHUB_PROJECT= example    # can be omitted if same as DISTNAME
1.200     tnn      8236: GITHUB_TAG=     v${PKGVERSION_NOREV}
1.199     tnn      8237: EXTRACT_SUFX=   .zip
                   8238: </pre>
1.345     gutterid 8239: <p>Here, DISTNAME combined with use of GITHUB_TAG leads the
                   8240:     file fetching infrastructure to save the resulting file locally as
                   8241:     <code class="literal">example-1.0.zip</code>.</p>
1.199     tnn      8242: </div>
                   8243: <div class="sect3">
                   8244: <div class="titlepage"><div><div><h4 class="title">
1.303     bacon    8245: <a name="build.fetch.github.commit.prerelease"></a>21.2.3.2. Fetch based on a specific commit before the first release</h4></div></div></div>
                   8246: <p>If your distfile looks similar to
                   8247:       <code class="literal">https://github.com/username/example/archive/988881adc9fc3655077dc2d4d757d480b5ea0e11</code> and is from a commit before the first
                   8248:       release, then set the package version to 0.0.0.N, where N is the number
                   8249:       of commits to the repository, and set GITHUB_TAG to the commit hash.
                   8250:       This will (almost) ensure that the first tagged release will have a
                   8251:       version greater than this one so that package upgrades will function
                   8252:       properly.</p>
                   8253: <pre class="programlisting">
                   8254: DISTNAME=       example-0.0.0.347
                   8255: MASTER_SITES=   ${MASTER_SITE_GITHUB:=username/}
                   8256: #GITHUB_PROJECT= example    # can be omitted if same as DISTNAME
                   8257: GITHUB_TAG=     988881adc9fc3655077dc2d4d757d480b5ea0e11
                   8258: </pre>
                   8259: </div>
                   8260: <div class="sect3">
                   8261: <div class="titlepage"><div><div><h4 class="title">
                   8262: <a name="build.fetch.github.commit.postrelease"></a>21.2.3.3. Fetch based on a specific commit after a release</h4></div></div></div>
                   8263: <p>If your distfile looks similar to
                   8264:       <code class="literal">https://github.com/username/example/archive/988881adc9fc3655077dc2d4d757d480b5ea0e11</code> and is from a commit after a release,
                   8265:       then include the last release version and the commit count since that
                   8266:       release in the package version and set GITHUB_TAG to the commit hash.
                   8267:       The latest release and commit count are shown in the output of
                   8268:       "git describe --tags":
                   8269:       </p>
                   8270: <pre class="screen">
                   8271: # git clone https://github.com/username/example
                   8272: # cd example
                   8273: # git describe --tags
                   8274: 1.2.3-5-g988881a
                   8275: </pre>
1.199     tnn      8276: <pre class="programlisting">
1.303     bacon    8277: DISTNAME=       example-1.2.3.5
                   8278: MASTER_SITES=   ${MASTER_SITE_GITHUB:=username/}
                   8279: #GITHUB_PROJECT= example    # can be omitted if same as DISTNAME
1.200     tnn      8280: GITHUB_TAG=     988881adc9fc3655077dc2d4d757d480b5ea0e11
1.222     sevan    8281: </pre>
1.199     tnn      8282: </div>
                   8283: <div class="sect3">
                   8284: <div class="titlepage"><div><div><h4 class="title">
1.303     bacon    8285: <a name="build.fetch.github.release"></a>21.2.3.4. Fetch based on release</h4></div></div></div>
1.284     rillig   8286: <p>If your distfile URL looks similar to
1.303     bacon    8287:       <code class="literal">https://github.com/username/example/releases/download/rel-1.6/offensive-1.6.zip</code>,
1.284     rillig   8288:       then you are packaging a release.</p>
1.199     tnn      8289: <pre class="programlisting">
                   8290: DISTNAME=       offensive-1.6
1.200     tnn      8291: PKGNAME=        ${DISTNAME:S/offensive/proper/}
                   8292: MASTER_SITES=   ${MASTER_SITE_GITHUB:=username/}
1.303     bacon    8293: GITHUB_PROJECT= example
1.200     tnn      8294: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
                   8295: EXTRACT_SUFX=   .zip
1.222     sevan    8296: </pre>
1.199     tnn      8297: </div>
                   8298: </div>
1.75      rillig   8299: </div>
1.148     asau     8300: <div class="sect1">
1.75      rillig   8301: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   8302: <a name="fixes.configure"></a>21.3. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.148     asau     8303: <div class="sect2">
1.75      rillig   8304: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8305: <a name="fixes.libtool"></a>21.3.1. Shared libraries - libtool</h3></div></div></div>
1.75      rillig   8306: <p>pkgsrc supports many different machines, with different
1.87      wiz      8307:     object formats like a.out and ELF, and varying abilities to do
                   8308:     shared library and dynamic loading at all. To accompany this,
                   8309:     varying commands and options have to be passed to the
                   8310:     compiler, linker, etc. to get the Right Thing, which can be
                   8311:     pretty annoying especially if you don't have all the machines
                   8312:     at your hand to test things.  The
1.322     leot     8313:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/libtool/index.html" target="_top"><code class="filename">devel/libtool</code></a> pkg
1.128     wiz      8314:     can help here, as it just <span class="quote">&#8220;<span class="quote">knows</span>&#8221;</span> how to build
1.87      wiz      8315:     both static and dynamic libraries from a set of source files,
                   8316:     thus being platform-independent.</p>
                   8317: <p>Here's how to use libtool in a package in seven simple
                   8318:     steps:</p>
1.128     wiz      8319: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8320: <li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package
1.87      wiz      8321:        Makefile.</p></li>
1.128     wiz      8322: <li class="listitem"><p>For library objects, use <span class="quote">&#8220;<span class="quote">${LIBTOOL} --mode=compile
                   8323:        ${CC}</span>&#8221;</span> in place of <span class="quote">&#8220;<span class="quote">${CC}</span>&#8221;</span>. You could even
1.87      wiz      8324:        add it to the definition of <code class="varname">CC</code>, if only
                   8325:        libraries are being built in a given Makefile. This one command
                   8326:        will build both PIC and non-PIC library objects, so you need not
                   8327:        have separate shared and non-shared library rules.</p></li>
1.128     wiz      8328: <li class="listitem">
1.75      rillig   8329: <p>For the linking of the library, remove any
1.128     wiz      8330:        <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
                   8331:        -Bshareable</span>&#8221;</span> commands, and instead use:</p>
1.75      rillig   8332: <pre class="programlisting">
1.100     rillig   8333: ${LIBTOOL} --mode=link \
                   8334:     ${CC} -o ${.TARGET:.a=.la} \
                   8335:         ${OBJS:.o=.lo} \
                   8336:         -rpath ${PREFIX}/lib \
                   8337:         -version-info major:minor
1.222     sevan    8338: </pre>
1.75      rillig   8339: <p>Note that the library is changed to have a
1.87      wiz      8340:        <code class="filename">.la</code> extension, and the objects are
                   8341:        changed to have a <code class="filename">.lo</code>
                   8342:        extension. Change <code class="varname">OBJS</code> as
                   8343:        necessary. This automatically creates all of the
                   8344:        <code class="filename">.a</code>,
                   8345:        <code class="filename">.so.major.minor</code>, and ELF symlinks (if
                   8346:        necessary) in the build directory. Be sure to include
1.128     wiz      8347:        <span class="quote">&#8220;<span class="quote">-version-info</span>&#8221;</span>, especially when major and
1.87      wiz      8348:        minor are zero, as libtool will otherwise strip off the
                   8349:        shared library version.</p>
1.75      rillig   8350: <p>From the libtool manual:</p>
                   8351: <pre class="programlisting">
1.100     rillig   8352: So, libtool library versions are described by three integers:
1.69      rillig   8353: 
1.100     rillig   8354: CURRENT
                   8355: The most recent interface number that this library implements.
1.69      rillig   8356: 
1.100     rillig   8357: REVISION
                   8358: The implementation number of the CURRENT interface.
1.69      rillig   8359: 
1.100     rillig   8360: AGE
                   8361: The difference between the newest and oldest interfaces that
                   8362: this library implements.  In other words, the library implements
                   8363: all the interface numbers in the range from number `CURRENT -
                   8364: AGE' to `CURRENT'.
1.1       grant    8365: 
1.100     rillig   8366: If two libraries have identical CURRENT and AGE numbers, then the
                   8367: dynamic linker chooses the library with the greater REVISION number.
1.222     sevan    8368: </pre>
1.128     wiz      8369: <p>The <span class="quote">&#8220;<span class="quote">-release</span>&#8221;</span> option will produce
1.87      wiz      8370:        different results for a.out and ELF (excluding symlinks)
                   8371:        in only one case. An ELF library of the form
1.128     wiz      8372:        <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.87      wiz      8373:        will have a symlink of
1.128     wiz      8374:        <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.87      wiz      8375:        on an a.out platform. This is handled
                   8376:        automatically.</p>
1.128     wiz      8377: <p>The <span class="quote">&#8220;<span class="quote">-rpath argument</span>&#8221;</span> is the install
1.87      wiz      8378:        directory of the library being built.</p>
1.76      rillig   8379: <p>In the <code class="filename">PLIST</code>, include only the
1.87      wiz      8380:        <code class="filename">.la</code> file, the other files will be
                   8381:        added automatically.</p>
1.75      rillig   8382: </li>
1.128     wiz      8383: <li class="listitem">
1.76      rillig   8384: <p>When linking shared object (<code class="filename">.so</code>)
1.322     leot     8385:        files, i.e. files that are loaded via <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/dlopen.3"><span class="citerefentry"><span class="refentrytitle">dlopen</span>(3)</span></a>, NOT
1.128     wiz      8386:        shared libraries, use <span class="quote">&#8220;<span class="quote">-module
                   8387:        -avoid-version</span>&#8221;</span> to prevent them getting version
1.87      wiz      8388:        tacked on.</p>
1.76      rillig   8389: <p>The <code class="filename">PLIST</code> file gets the
1.87      wiz      8390:        <code class="filename">foo.so</code> entry.</p>
1.75      rillig   8391: </li>
1.128     wiz      8392: <li class="listitem">
1.75      rillig   8393: <p>When linking programs that depend on these libraries
1.87      wiz      8394:        <span class="emphasis"><em>before</em></span> they are installed, preface
1.322     leot     8395:        the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/cc.1"><span class="citerefentry"><span class="refentrytitle">cc</span>(1)</span></a> or <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/ld.1"><span class="citerefentry"><span class="refentrytitle">ld</span>(1)</span></a> line with <span class="quote">&#8220;<span class="quote">${LIBTOOL}
1.128     wiz      8396:        --mode=link</span>&#8221;</span>, and it will find the correct
1.87      wiz      8397:        libraries (static or shared), but please be aware that
                   8398:        libtool will not allow you to specify a relative path in
1.128     wiz      8399:        -L (such as <span class="quote">&#8220;<span class="quote">-L../somelib</span>&#8221;</span>), because it
1.87      wiz      8400:        expects you to change that argument to be the
                   8401:        <code class="filename">.la</code> file. e.g.</p>
1.75      rillig   8402: <pre class="programlisting">
1.100     rillig   8403: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.222     sevan    8404: </pre>
1.75      rillig   8405: <p>should be changed to:</p>
                   8406: <pre class="programlisting">
1.100     rillig   8407: ${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em>
1.222     sevan    8408: </pre>
1.75      rillig   8409: <p>and it will do the right thing with the libraries.</p>
                   8410: </li>
1.128     wiz      8411: <li class="listitem">
1.322     leot     8412: <p>When installing libraries, preface the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/install.1"><span class="citerefentry"><span class="refentrytitle">install</span>(1)</span></a>
                   8413:        or <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/cp.1"><span class="citerefentry"><span class="refentrytitle">cp</span>(1)</span></a> command with <span class="quote">&#8220;<span class="quote">${LIBTOOL}
1.128     wiz      8414:        --mode=install</span>&#8221;</span>, and change the library name to
1.87      wiz      8415:        <code class="filename">.la</code>. e.g.</p>
1.75      rillig   8416: <pre class="programlisting">
1.126     jakllsch 8417: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.222     sevan    8418: </pre>
1.76      rillig   8419: <p>This will install the static <code class="filename">.a</code>,
1.87      wiz      8420:        shared library, any needed symlinks, and run
1.322     leot     8421:        <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/ldconfig.8"><span class="citerefentry"><span class="refentrytitle">ldconfig</span>(8)</span></a>.</p>
1.75      rillig   8422: </li>
1.128     wiz      8423: <li class="listitem"><p>In your <code class="filename">PLIST</code>, include only
1.87      wiz      8424:        the <code class="filename">.la</code>
                   8425:        file (this is a change from previous behaviour).</p></li>
1.75      rillig   8426: </ol></div>
                   8427: </div>
1.148     asau     8428: <div class="sect2">
1.75      rillig   8429: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8430: <a name="using-libtool"></a>21.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div>
1.75      rillig   8431: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to the
1.87      wiz      8432:     package Makefile. This will override the package's own libtool
                   8433:     in most cases.  For older libtool using packages,  libtool is
                   8434:     made by ltconfig script during the do-configure step; you can
1.110     hubertf  8435:     check the libtool script location by doing <span class="command"><strong>make
1.87      wiz      8436:     configure; find work*/ -name libtool</strong></span>.</p>
1.75      rillig   8437: <p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool
1.87      wiz      8438:     scripts, relative to <code class="varname">WRKSRC</code>, to override.  By
1.128     wiz      8439:     default, it is set to <span class="quote">&#8220;<span class="quote">libtool */libtool
                   8440:     */*/libtool</span>&#8221;</span>.  If this does not match the location of the
1.87      wiz      8441:     package's libtool script(s), set it as appropriate.</p>
1.76      rillig   8442: <p>If you do not need <code class="filename">*.a</code> static
1.87      wiz      8443:     libraries built and installed, then use
                   8444:     <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.75      rillig   8445: <p>If your package makes use of the platform-independent library
1.87      wiz      8446:     for loading dynamic shared objects, that comes with libtool
                   8447:     (libltdl), you should include devel/libltdl/buildlink3.mk.</p>
                   8448: <p>Some packages use libtool incorrectly so that the package
                   8449:     may not work or build in some circumstances. Some of the more
                   8450:     common errors are:</p>
1.148     asau     8451: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      8452: <li class="listitem">
1.75      rillig   8453: <p>The inclusion of a shared object (-module) as a dependent library in an
1.87      wiz      8454:        executable or library. This in itself isn't a problem if one of two things
                   8455:        has been done:</p>
1.128     wiz      8456: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8457: <li class="listitem"><p>The shared object is named correctly, i.e.
1.87      wiz      8458:            <code class="filename">libfoo.la</code>, not
                   8459:            <code class="filename">foo.la</code></p></li>
1.128     wiz      8460: <li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li>
1.75      rillig   8461: </ol></div>
                   8462: </li>
1.128     wiz      8463: <li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines.
1.87      wiz      8464:        The function lt_dlinit() should be called and the macro
                   8465:        <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in
                   8466:        executables.</p></li>
1.75      rillig   8467: </ul></div>
                   8468: </div>
1.148     asau     8469: <div class="sect2">
1.75      rillig   8470: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8471: <a name="autoconf-automake"></a>21.3.3. GNU Autoconf/Automake</h3></div></div></div>
1.75      rillig   8472: <p>If a package needs GNU autoconf or automake to be executed
1.338     nia      8473:     to regenerate the
                   8474:     <code class="filename">configure</code>
                   8475:     script and <code class="filename">Makefile.in</code> makefile
                   8476:     templates from <code class="filename">configure.ac</code> and
                   8477:     <code class="filename">Makefile.am</code>,
                   8478:     then they should be executed in a pre-configure target:</p>
1.75      rillig   8479: <pre class="programlisting">
1.338     nia      8480: USE_TOOLS+=    autoconf automake autoreconf
                   8481: GNU_CONFIGURE= yes
1.100     rillig   8482: ...
1.1       grant    8483: 
1.100     rillig   8484: pre-configure:
1.338     nia      8485:         set -e; cd ${WRKSRC} &amp;&amp; autoreconf -fi
1.100     rillig   8486: ...
1.222     sevan    8487: </pre>
1.338     nia      8488: <p>Packages which use GNU Automake will sometimes
                   8489:     require GNU Make (<code class="literal">gmake</code> in
                   8490:     <code class="varname">USE_TOOLS</code>),
                   8491:     but not always.  Note that autoreconf
                   8492:     only needs to be executed if <code class="filename">configure.ac</code>
                   8493:     or Makefiles are modified, or <code class="filename">configure</code>
                   8494:     is not present.</p>
1.75      rillig   8495: <p>There are times when the configure process makes
1.87      wiz      8496:     additional changes to the generated files, which then causes
                   8497:     the build process to try to re-execute the automake sequence.
                   8498:     This is prevented by touching various files in the configure
                   8499:     stage. If this causes problems with your package you can set
                   8500:     <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package
                   8501:     Makefile.</p>
1.75      rillig   8502: </div>
1.338     nia      8503: <div class="sect2">
                   8504: <div class="titlepage"><div><div><h3 class="title">
                   8505: <a name="meson"></a>21.3.4. Meson / ninja</h3></div></div></div>
                   8506: <p>Packages using Meson to configure need to include:
                   8507: 
                   8508: </p>
                   8509: <pre class="programlisting">
                   8510: .include "../../devel/meson/build.mk"
                   8511: </pre>
                   8512: <p>In nearly all cases (any program with dependencies),
                   8513:     pkg-config needs to be added to
                   8514:     <code class="varname">USE_TOOLS</code>.  If the package installs
                   8515:     translation files for non-English languages, also
                   8516:     add msgfmt and xgettext:
                   8517: 
                   8518: </p>
                   8519: <pre class="programlisting">
                   8520: USE_TOOLS+=    pkg-config msgfmt xgettext
                   8521: </pre>
                   8522: <p>If any options need to be passed to Meson, use
                   8523:     <code class="varname">MESON_ARGS</code> instead of
                   8524:     <code class="varname">CONFIGURE_ARGS</code>:
                   8525: 
                   8526: </p>
                   8527: <pre class="programlisting">
                   8528: MESON_ARGS+=   -Dx11=false
                   8529: </pre>
                   8530: </div>
1.75      rillig   8531: </div>
1.148     asau     8532: <div class="sect1">
1.75      rillig   8533: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   8534: <a name="programming-languages"></a>21.4. Programming languages</h2></div></div></div>
1.148     asau     8535: <div class="sect2">
1.87      wiz      8536: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8537: <a name="basic-programming-languages"></a>21.4.1. C, C++, and Fortran</h3></div></div></div>
1.338     nia      8538: <p>Compilers for the C and C++ languages comes with
1.87      wiz      8539:     the NetBSD base system.  By default, pkgsrc assumes that a package
                   8540:     is written in C and will hide all other compilers (via the wrapper
1.299     rillig   8541:     framework, see <a class="xref" href="#buildlink" title="Chapter 18. Buildlink methodology">Chapter 18, <i>Buildlink methodology</i></a>).</p>
1.87      wiz      8542: <p>To declare which language's compiler a package needs, set
                   8543:     the <code class="varname">USE_LANGUAGES</code> variable. Allowed values
1.327     wiz      8544:     currently are:
                   8545:     </p>
                   8546: <pre class="programlisting">
                   8547:        c99, c++, c++03, gnu++03, c++0x, gnu++0x, c++11, gnu++11,
                   8548:        c++14, gnu++14, c++17, gnu++17, c++20, gnu++20, fortran,
                   8549:        fortran77, java, objc, obj-c++, and ada.
                   8550:     </pre>
                   8551: <p>
                   8552:     (and any combination).  The default is
1.128     wiz      8553:     <span class="quote">&#8220;<span class="quote">c</span>&#8221;</span>.  Packages using GNU configure scripts, even if
1.87      wiz      8554:     written in C++, usually need a C compiler for the configure
                   8555:     phase.</p>
1.338     nia      8556: <p>To express a general requirement on a specific C or C++
                   8557:     version, normally only <code class="varname">GCC_REQD</code> needs to be set.
                   8558:     For example, GCC 7 includes support for C++17, so if the package uses
                   8559:     C++17 it should specify:
                   8560: 
                   8561:     </p>
                   8562: <pre class="programlisting">
                   8563:        GCC_REQD+=      7
                   8564:     </pre>
                   8565: <p>Language variants like <code class="literal">c++11</code> for
                   8566:     <code class="varname">USE_LANGUAGES</code> should only be specified
                   8567:     if the package does not explicitly set <code class="literal">-std=...</code>
                   8568:     when compiling (i.e. the package assumes the compiler defaults to
                   8569:     C++11 or some other standard).  This is usually a bug in the
                   8570:     upstream build system.</p>
                   8571: <p>GCC version 5 includes support for C++14, while GCC 4.7 includes
                   8572:     more-or-less complete support for C++11.  For more information, consult
                   8573:     <a class="ulink" href="https://gcc.gnu.org/projects/cxx-status.html" target="_top">GCC's own documentation on programming language support.</a></p>
1.87      wiz      8574: </div>
1.148     asau     8575: <div class="sect2">
1.87      wiz      8576: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8577: <a name="java-programming-language"></a>21.4.2. Java</h3></div></div></div>
1.87      wiz      8578: <p>If a program is written in Java, use the Java framework in
                   8579:     pkgsrc.  The package must include
                   8580:     <code class="filename">../../mk/java-vm.mk</code>.  This Makefile fragment
                   8581:     provides the following variables:</p>
1.148     asau     8582: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      8583: <li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build
1.87      wiz      8584:       dependency on the JDK is added.  If
1.128     wiz      8585:       <code class="varname">USE_JAVA</code> is set to <span class="quote">&#8220;<span class="quote">run</span>&#8221;</span>, then
1.87      wiz      8586:       there is only a runtime dependency on the JDK.  The default is
1.128     wiz      8587:       <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, which also adds a build dependency on the
1.87      wiz      8588:       JDK.</p></li>
1.128     wiz      8589: <li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that
1.87      wiz      8590:       a package needs a Java2 implementation.  The supported values
1.128     wiz      8591:       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
                   8592:       <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
                   8593:       implementation, <span class="quote">&#8220;<span class="quote">1.4</span>&#8221;</span> insists on versions 1.4 or
                   8594:       above, and <span class="quote">&#8220;<span class="quote">1.5</span>&#8221;</span> only accepts versions 1.5 or
1.87      wiz      8595:       above. This variable is not set by default.</p></li>
1.130     wiz      8596: <li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is
                   8597:       automatically set to the runtime location of the used Java
                   8598:       implementation dependency. It may be used to set
                   8599:       <code class="varname">JAVA_HOME</code> to a good value if the program
                   8600:       needs this variable to be defined.
                   8601:       </p></li>
1.87      wiz      8602: </ul></div>
                   8603: </div>
1.148     asau     8604: <div class="sect2">
1.87      wiz      8605: <div class="titlepage"><div><div><h3 class="title">
1.320     wiz      8606: <a name="go-programming-language"></a>21.4.3. Go</h3></div></div></div>
                   8607: <p>If a program is written in Go and has any dependencies on
                   8608:     other Go modules, have the package include
                   8609:     <code class="filename">../../lang/go/go-module.mk</code>.</p>
                   8610: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8611: <li class="listitem"><p>Generate a list of those dependencies with
                   8612:       <span class="command"><strong>make clean &amp;&amp; make patch &amp;&amp; make show-go-modules &gt;
                   8613:       go-modules.mk</strong></span>.</p></li>
1.338     nia      8614: <li class="listitem"><p>Prepend
                   8615:       <code class="literal">.include "go-modules.mk"</code> to any other
                   8616:       <code class="literal">.include</code>s.</p></li>
                   8617: <li class="listitem"><p>Incorporate these modules in
                   8618:       <code class="filename">distinfo</code> with <span class="command"><strong>make
                   8619:       makesum</strong></span>.</p></li>
                   8620: </ol></div>
                   8621: </div>
                   8622: <div class="sect2">
                   8623: <div class="titlepage"><div><div><h3 class="title">
                   8624: <a name="rust-programming-language"></a>21.4.4. Rust</h3></div></div></div>
                   8625: <p>If a program is written in Rust and uses Cargo to build,
                   8626:     have the package include
                   8627:     <code class="filename">../../lang/rust/cargo.mk</code>.</p>
                   8628: <div class="orderedlist"><ol class="orderedlist" type="1">
                   8629: <li class="listitem"><p>Generate a list of those dependencies with
                   8630:       <span class="command"><strong>make CARGO_ARGS="build --release" build &amp;&amp;
                   8631:       make print-cargo-depends &gt; cargo-depends.mk</strong></span>.</p></li>
                   8632: <li class="listitem"><p>Prepend
                   8633:       <code class="literal">.include "cargo-depends.mk"</code> to any other
                   8634:       <code class="literal">.include</code>s.</p></li>
1.320     wiz      8635: <li class="listitem"><p>Incorporate these modules in
                   8636:       <code class="filename">distinfo</code> with <span class="command"><strong>make
                   8637:       makesum</strong></span>.</p></li>
                   8638: </ol></div>
                   8639: </div>
                   8640: <div class="sect2">
                   8641: <div class="titlepage"><div><div><h3 class="title">
1.338     nia      8642: <a name="perl-scripts"></a>21.4.5. Packages containing Perl scripts</h3></div></div></div>
1.318     nia      8643: <p>If your package contains interpreted Perl scripts, add
1.128     wiz      8644:     <span class="quote">&#8220;<span class="quote">perl</span>&#8221;</span> to the <code class="varname">USE_TOOLS</code> variable
1.87      wiz      8645:     and set <code class="varname">REPLACE_PERL</code> to ensure that the proper
                   8646:     interpreter path is set. <code class="varname">REPLACE_PERL</code> should
                   8647:     contain a list of scripts, relative to <code class="varname">WRKSRC</code>,
1.183     wiz      8648:     that you want adjusted. Every occurrence of
                   8649:     <code class="filename">*/bin/perl</code> in a she-bang line will be
1.325     gutterid 8650:     replaced with the full path to the Perl executable.</p>
                   8651: <p>If a particular version of Perl is needed, set the
1.87      wiz      8652:     <code class="varname">PERL5_REQD</code> variable to the version number.  The
1.128     wiz      8653:     default is <span class="quote">&#8220;<span class="quote">5.0</span>&#8221;</span>.</p>
1.318     nia      8654: <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.325     gutterid 8655:     about handling Perl modules.</p>
                   8656: <p>There is also the <code class="varname">REPLACE_PERL6</code> variable
                   8657:     for the language now known as Raku.</p>
1.87      wiz      8658: </div>
1.148     asau     8659: <div class="sect2">
1.87      wiz      8660: <div class="titlepage"><div><div><h3 class="title">
1.338     nia      8661: <a name="shell-scripts"></a>21.4.6. Packages containing shell scripts</h3></div></div></div>
1.147     wiz      8662: <p><code class="varname">REPLACE_SH</code>,
                   8663:     <code class="varname">REPLACE_BASH</code>, <code class="varname">REPLACE_CSH</code>,
                   8664:     and <code class="varname">REPLACE_KSH</code> can be used to replace shell
1.340     gutterid 8665:     she-bangs in files. Please use the appropriate one, preferring
                   8666:     <code class="varname">REPLACE_SH</code> when this shell is sufficient.
1.183     wiz      8667:     Each should contain a list of scripts, relative to
                   8668:     <code class="varname">WRKSRC</code>, that you want adjusted. Every
                   8669:     occurrence of the matching shell in a she-bang line will be
                   8670:     replaced with the full path to the shell executable.
1.147     wiz      8671:     When using <code class="varname">REPLACE_BASH</code>, don't forget to add
                   8672:     <code class="filename">bash</code> to <code class="varname">USE_TOOLS</code>.</p>
                   8673: </div>
1.148     asau     8674: <div class="sect2">
1.147     wiz      8675: <div class="titlepage"><div><div><h3 class="title">
1.338     nia      8676: <a name="other-programming-languages"></a>21.4.7. Other programming languages</h3></div></div></div>
1.325     gutterid 8677: <p>There are further similar REPLACE variables available, e.g.,
                   8678:     <code class="varname">REPLACE_AWK</code> for packages containing awk scripts,
                   8679:     and <code class="varname">REPLACE_R</code> for R. These two, like the others
1.326     gutterid 8680:     noted above, have their actions defined centrally in
1.325     gutterid 8681:     <code class="filename">mk/configure/replace-interpreter.mk</code>. Other
1.326     gutterid 8682:     languages define the actions of these variables within their own
                   8683:     dedicated part of the tree, e.g., <code class="varname">REPLACE_PHP</code> is
                   8684:     actioned in <code class="filename">lang/php/phpversion.mk</code>, and
                   8685:     <code class="varname">REPLACE_PYTHON</code> is actioned in
1.325     gutterid 8686:     <code class="filename">lang/python/application.mk</code>. For other languages,
                   8687:     consult the mk files found within their specific directories (the
1.331     gutterid 8688:     naming convention varies), or check the list found in
                   8689:     <a class="xref" href="#help-topics" title="Appendix E. Help topics">Appendix E, <i>Help topics</i></a>.</p>
1.325     gutterid 8690: <p>Currently, special handling for other languages varies
1.87      wiz      8691:     in pkgsrc.  If a compiler package provides a
                   8692:     <code class="filename">buildlink3.mk</code> file, include that, otherwise
                   8693:     just add a (build) dependency on the appropriate compiler
                   8694:     package.</p>
                   8695: </div>
                   8696: </div>
1.148     asau     8697: <div class="sect1">
1.87      wiz      8698: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   8699: <a name="fixes.build"></a>21.5. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.77      rillig   8700: <p>The most common failures when building a package are that
                   8701:        some platforms do not provide certain header files, functions or
                   8702:        libraries, or they provide the functions in a library that the
                   8703:        original package author didn't know. To work around this, you
                   8704:        can rewrite the source code in most cases so that it does not
                   8705:        use the missing functions or provides a replacement function.</p>
1.148     asau     8706: <div class="sect2">
1.77      rillig   8707: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8708: <a name="fixes.build.cpp"></a>21.5.1. Compiling C and C++ code conditionally</h3></div></div></div>
1.77      rillig   8709: <p>If a package already comes with a GNU configure script, the
                   8710:        preferred way to fix the build failure is to change the
                   8711:        configure script, not the code. In the other cases, you can
                   8712:        utilize the C preprocessor, which defines certain macros
                   8713:        depending on the operating system and hardware architecture it
                   8714:        compiles for. These macros can be queried using for example
                   8715:        <code class="varname">#if defined(__i386)</code>. Almost every operating
                   8716:        system, hardware architecture and compiler has its own macro.
                   8717:        For example, if the macros <code class="varname">__GNUC__</code>,
                   8718:        <code class="varname">__i386__</code> and <code class="varname">__NetBSD__</code>
                   8719:        are all defined, you know that you are using NetBSD on an i386
                   8720:        compatible CPU, and your compiler is GCC.</p>
                   8721: <p>The list of the following macros for hardware and
                   8722:        operating system depends on the compiler that is used. For
                   8723:        example, if you want to conditionally compile code on Solaris,
                   8724:        don't use <code class="varname">__sun__</code>, as the SunPro compiler
                   8725:        does not define it. Use <code class="varname">__sun</code> instead.</p>
1.148     asau     8726: <div class="sect3">
1.75      rillig   8727: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   8728: <a name="fixes.build.cpp.os"></a>21.5.1.1. C preprocessor macros to identify the operating system</h4></div></div></div>
1.338     nia      8729: <p>To distinguish between specific NetBSD versions,
                   8730:         you should use the following code.</p>
                   8731: <pre class="programlisting">
                   8732: #ifdef __NetBSD__
                   8733: #include &lt;sys/param.h&gt;
                   8734: #if __NetBSD_Prereq__(9,99,17)
                   8735: /* use a newer feature */
                   8736: #else
                   8737: /* older code */
                   8738: #endif
                   8739: #endif
                   8740: 
                   8741: #ifndef _WIN32
                   8742: /* Unix-like specific code */
                   8743: #endif
                   8744: </pre>
1.75      rillig   8745: <p>To distinguish between 4.4 BSD-derived systems and the
                   8746:         rest of the world, you should use the following code.</p>
                   8747: <pre class="programlisting">
1.100     rillig   8748: #include &lt;sys/param.h&gt;
                   8749: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   8750: /* BSD-specific code goes here */
                   8751: #else
                   8752: /* non-BSD-specific code goes here */
                   8753: #endif
1.75      rillig   8754: </pre>
1.338     nia      8755: <p>You can also test for the following macros:</p>
1.75      rillig   8756: <pre class="programlisting">
1.151     obache   8757: Cygwin      __CYGWIN__
                   8758: DragonFly   __DragonFly__
1.100     rillig   8759: FreeBSD     __FreeBSD__
1.151     obache   8760: Haiku       __HAIKU__
1.100     rillig   8761: Interix     __INTERIX
                   8762: IRIX        __sgi (TODO: get a definite source for this)
1.338     nia      8763: Linux       __linux
1.193     dholland 8764: Mac OS X    __APPLE__
1.151     obache   8765: MirBSD      __MirBSD__ (__OpenBSD__ is also defined)
                   8766: Minix3      __minix
1.100     rillig   8767: NetBSD      __NetBSD__
                   8768: OpenBSD     __OpenBSD__
                   8769: Solaris     sun, __sun
1.75      rillig   8770: </pre>
                   8771: </div>
1.148     asau     8772: <div class="sect3">
1.75      rillig   8773: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   8774: <a name="fixes.build.cpp.arch"></a>21.5.1.2. C preprocessor macros to identify the hardware architecture</h4></div></div></div>
1.75      rillig   8775: <pre class="programlisting">
1.100     rillig   8776: i386        i386, __i386, __i386__
1.338     nia      8777: x86-64      __amd64__, __x86_64__
                   8778: ARM         __arm__
1.100     rillig   8779: MIPS        __mips
                   8780: SPARC       sparc, __sparc
1.338     nia      8781: PowerPC     __powerpc
1.75      rillig   8782: </pre>
                   8783: </div>
1.148     asau     8784: <div class="sect3">
1.75      rillig   8785: <div class="titlepage"><div><div><h4 class="title">
1.267     rillig   8786: <a name="fixes.build.cpp.compiler"></a>21.5.1.3. C preprocessor macros to identify the compiler</h4></div></div></div>
1.75      rillig   8787: <pre class="programlisting">
1.100     rillig   8788: GCC         __GNUC__ (major version), __GNUC_MINOR__
                   8789: MIPSpro     _COMPILER_VERSION (0x741 for MIPSpro 7.41)
                   8790: SunPro      __SUNPRO_C (0x570 for Sun C 5.7)
                   8791: SunPro C++  __SUNPRO_CC (0x580 for Sun C++ 5.8)
1.75      rillig   8792: </pre>
                   8793: </div>
                   8794: </div>
1.148     asau     8795: <div class="sect2">
1.78      rillig   8796: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   8797: <a name="compiler-bugs"></a>21.5.2. How to handle compiler bugs</h3></div></div></div>
1.78      rillig   8798: <p>Some source files trigger bugs in the compiler, based on
1.87      wiz      8799:         combinations of compiler version and architecture and almost
                   8800:         always relation to optimisation being enabled.  Common symptoms
                   8801:         are gcc internal errors or never finishing compiling a
1.78      rillig   8802:        file.</p>
                   8803: <p>Typically, a workaround involves testing the
                   8804:         <code class="varname">MACHINE_ARCH</code> and compiler version, disabling
                   8805:         optimisation for that combination of file,
1.198     tnn      8806:        <code class="varname">MACHINE_ARCH</code> and compiler.</p>
                   8807: <p>This used to be a big problem in the past, but is rarely
                   8808:        needed now as compiler technology has matured. If you still need
                   8809:        to add a compiler specific workaround, please do so in the file
                   8810:        <code class="filename">hacks.mk</code> and describe the symptom and
                   8811:        compiler version as detailed as possible.</p>
1.78      rillig   8812: </div>
1.148     asau     8813: <div class="sect2">
1.78      rillig   8814: <div class="titlepage"><div><div><h3 class="title">
1.287     rillig   8815: <a name="fixes.build.header"></a>21.5.3. No such file or directory</h3></div></div></div>
                   8816: <p>Compilation sometimes fails with an error message like this:</p>
                   8817: <pre class="programlisting">
                   8818: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
                   8819:     fatal error: pango/pango.h: No such file or directory
                   8820: </pre>
                   8821: <p>The proper way to fix this problem depends on the type of the
                   8822: header, which is described in the following sections.</p>
                   8823: <div class="sect3">
                   8824: <div class="titlepage"><div><div><h4 class="title">
                   8825: <a name="fixes.build.header.bl3"></a>21.5.3.1. Headers from other packages</h4></div></div></div>
                   8826: <p>If the header name looks like it comes from a different package,
                   8827: that other package should be included via the buildlink3
                   8828: framework.</p>
                   8829: <p>First, look whether the header is somewhere in the buildlink3
                   8830: directory below <code class="varname">WRKDIR</code>. In the above case of
                   8831: the missing Pango header:</p>
                   8832: <pre class="programlisting">
                   8833: <code class="prompt">$</code> find work/.buildlink/ -print | grep -F pango/pango.h
                   8834: </pre>
                   8835: <p>In the case of Pango, the output is:</p>
                   8836: <pre class="programlisting">
                   8837: work/.buildlink/include/pango-1.0/pango/pango.h
                   8838: </pre>
                   8839: <p>If the <code class="filename">pango/pango.h</code> file were placed directly
                   8840: in the <code class="filename">.buildlink</code> directory, it would have been
                   8841: found automatically. There is an extra <code class="filename">pango-1.0</code>
                   8842: path component though, which means that the compiler command line must
                   8843: contain an option of the form
                   8844: <code class="literal">-I${BUILDLINK3_PREFIX.pango}/include/pango-1.0</code>. In
                   8845: most cases this option is generated by the configure script, which can be examined using:</p>
                   8846: <pre class="programlisting">
                   8847: <code class="prompt">$</code> $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
                   8848: -I/usr/pkg/include/pango-1.0
                   8849: -I/usr/pkg/include/pango-1.0
                   8850: -I/usr/pkg/include/pango-1.0
                   8851: -I/usr/pkg/include/pango-1.0
                   8852: -I/usr/pkg/include/pango-1.0
                   8853: </pre>
                   8854: <p>This looks good. These options are transformed by the buildlink
                   8855: wrapper to refer to the correct path inside
                   8856: <code class="filename">work/.buildlink</code>.</p>
                   8857: <p>Since the compilation fails though, examine the compiler command
                   8858: lines in <code class="filename">work/.work.log</code> to see whether the
                   8859: <code class="literal">-I</code> option is included in the particular command
                   8860: line.</p>
                   8861: <p>To further analyze the situation, run <span class="command"><strong>bmake
                   8862: build-env</strong></span>, which sets up an interactive, realistic environment
                   8863: including all the pkgsrc wrapper commands and environment variables. From
                   8864: there, try to compile some simple example programs that use the
                   8865: header.</p>
                   8866: </div>
                   8867: <div class="sect3">
                   8868: <div class="titlepage"><div><div><h4 class="title">
                   8869: <a name="fixes.build.header.gen"></a>21.5.3.2. Headers generated during the build</h4></div></div></div>
                   8870: <p>If the name of the header seems to come from the package itself,
                   8871: and if the build is run with parallel jobs, the package may have some
                   8872: undeclared dependencies between the <code class="filename">.c</code> and the
                   8873: <code class="filename">.h</code> files, and a C file is compiled before its
                   8874: required header is generated.</p>
                   8875: <p>To see whether the build runs with parallel jobs, run
                   8876: <span class="command"><strong>bmake show-all-build | grep JOBS</strong></span>. Its output looks
                   8877: like this:</p>
                   8878: <pre class="programlisting">
                   8879:   usr   MAKE_JOBS=              7
                   8880:   pkg   MAKE_JOBS_SAFE          # undefined
                   8881:   def   _MAKE_JOBS_N=           7
                   8882: </pre>
                   8883: <p>In this case the pkgsrc user has asked pkgsrc to build packages
                   8884: with 7 jobs in parallel (<code class="varname">MAKE_JOBS</code>). The
                   8885: package could have disabled parallel builds by setting
                   8886: <code class="varname">MAKE_JOBS_SAFE</code> to <code class="literal">no</code>, but
                   8887: in this case it hasn't.</p>
                   8888: <p>To see whether the build failure is caused by parallel builds,
                   8889: first save the exact error message and a bit of context, maybe you need
                   8890: it later for reporting a bug. Next, run:</p>
                   8891: <pre class="programlisting">
                   8892: MAKE_JOBS_SAFE=no bmake clean build
                   8893: </pre>
                   8894: <p>If that succeeds, <a class="ulink" href="https://www.NetBSD.org/cgi-bin/sendpr.cgi?gndb=netbsd" target="_top">file a bug
                   8895: report</a> against the pkgsrc package, including the exact error
                   8896: message and the contents of your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file.</p>
                   8897: </div>
1.288     rillig   8898: <div class="sect3">
                   8899: <div class="titlepage"><div><div><h4 class="title">
                   8900: <a name="fixes.build.header.symlink"></a>21.5.3.3. Symlinks</h4></div></div></div>
                   8901: <p>Pkgsrc does not work reliably if any of
                   8902: <code class="varname">LOCALBASE</code>, <code class="varname">VARBASE</code> or
                   8903: <code class="varname">WRKDIR</code> contains a symlink. Since 2019Q2, the pkgsrc
                   8904: bootstrap program prevents installing pkgsrc in symlink-based
                   8905: directories. Existing pkgsrc installations are not checked for symlinks
                   8906: though.</p>
                   8907: <p>The "No such file or directory" error messages are a typical
                   8908: symptom of symlinks, and it's quite difficult to find out that this is
                   8909: the actual cause.</p>
                   8910: </div>
                   8911: <div class="sect3">
                   8912: <div class="titlepage"><div><div><h4 class="title">
                   8913: <a name="fixes.build.header.stale"></a>21.5.3.4. Stale working directories</h4></div></div></div>
                   8914: <p>When building a hierarchy of packages, it may happen that one
                   8915: package is built and then pkgsrc is updated. This situation can provoke
                   8916: various hard to diagnose build errors. To clean up the situation:</p>
                   8917: <pre class="programlisting">
1.338     nia      8918: <code class="prompt">$</code> (cd ../../ &amp;&amp; cat mk/bsd.pkg.mk &gt;/dev/null &amp;&amp; rm -rf */*/work)
1.288     rillig   8919: </pre>
1.338     nia      8920: <p>(The only purpose of the <code class="filename">bsd.pkg.mk</code> is to
                   8921: prevent running this command in the wrong directory.)</p>
1.288     rillig   8922: <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
                   8923: that directory as well.</p>
                   8924: </div>
                   8925: <div class="sect3">
                   8926: <div class="titlepage"><div><div><h4 class="title">
                   8927: <a name="fixes.build.header.misc"></a>21.5.3.5. Other possible reasons</h4></div></div></div>
                   8928: <p>On platforms other than BSD, third-party packages are installed in
                   8929: <code class="filename">/usr/include</code>, together with the base system. This
                   8930: means that pkgsrc cannot distinguish between headers provided by the base
                   8931: system (which it needs) and headers from third-party packages (which are
                   8932: often included in pkgsrc as well). This can lead to subtle version
                   8933: mismatches.</p>
                   8934: <p>In pkgsrc installations that have been active for several years, it
                   8935: may happen that some files are manually deleted. To exclude this unlikely
                   8936: reason, run <span class="command"><strong>pkg_admin check</strong></span>.</p>
                   8937: <p>It may help to run <span class="command"><strong>pkg_admin rebuild-tree</strong></span> to
                   8938: check/fix dependencies.</p>
                   8939: <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>
                   8940: for contact information. Be prepared to describe what you have tried so
                   8941: far and what any error messages were.</p>
                   8942: </div>
1.287     rillig   8943: </div>
                   8944: <div class="sect2">
                   8945: <div class="titlepage"><div><div><h3 class="title">
                   8946: <a name="undefined-reference"></a>21.5.4. Undefined reference to <span class="quote">&#8220;<span class="quote">...</span>&#8221;</span>
1.128     wiz      8947: </h3></div></div></div>
1.92      rillig   8948: <p>This error message often means that a package did not
1.78      rillig   8949:        link to a shared library it needs. The following functions are
                   8950:        known to cause this error message over and over.</p>
                   8951: <div class="informaltable">
1.216     tnn      8952: <a name="undefined-reference-functions"></a><table class="informaltable" border="1">
1.78      rillig   8953: <colgroup>
                   8954: <col>
                   8955: <col>
                   8956: <col>
                   8957: </colgroup>
                   8958: <thead><tr>
                   8959: <th>Function</th>
                   8960: <th>Library</th>
                   8961: <th>Affected platforms</th>
                   8962: </tr></thead>
                   8963: <tbody>
                   8964: <tr>
                   8965: <td>accept, bind, connect</td>
                   8966: <td>-lsocket</td>
                   8967: <td>Solaris</td>
                   8968: </tr>
                   8969: <tr>
                   8970: <td>crypt</td>
                   8971: <td>-lcrypt</td>
                   8972: <td>DragonFly, NetBSD</td>
                   8973: </tr>
                   8974: <tr>
                   8975: <td>dlopen, dlsym</td>
                   8976: <td>-ldl</td>
                   8977: <td>Linux</td>
                   8978: </tr>
                   8979: <tr>
                   8980: <td>gethost*</td>
                   8981: <td>-lnsl</td>
                   8982: <td>Solaris</td>
                   8983: </tr>
                   8984: <tr>
                   8985: <td>inet_aton</td>
                   8986: <td>-lresolv</td>
                   8987: <td>Solaris</td>
                   8988: </tr>
                   8989: <tr>
                   8990: <td>nanosleep, sem_*, timer_*</td>
                   8991: <td>-lrt</td>
                   8992: <td>Solaris</td>
                   8993: </tr>
                   8994: <tr>
                   8995: <td>openpty</td>
                   8996: <td>-lutil</td>
                   8997: <td>Linux</td>
                   8998: </tr>
                   8999: </tbody>
                   9000: </table>
                   9001: </div>
1.338     nia      9002: <p>To fix these linker errors, it is often sufficient to add
1.87      wiz      9003:     <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+=
                   9004:     -l<em class="replaceable"><code>foo</code></em></code> to the package
1.338     nia      9005:     <code class="filename">Makefile</code> and then run <span class="command"><strong>bmake clean;
1.87      wiz      9006:     bmake</strong></span>.</p>
1.148     asau     9007: <div class="sect3">
1.92      rillig   9008: <div class="titlepage"><div><div><h4 class="title">
1.338     nia      9009: <a name="undefined-reference-sunpro"></a>21.5.4.1. The SunPro compiler and inline functions</h4></div></div></div>
1.92      rillig   9010: <p>When you are using the SunPro compiler, there is another
                   9011: possibility. That compiler cannot handle the following code:</p>
                   9012: <pre class="programlisting">
1.100     rillig   9013: extern int extern_func(int);
1.93      rillig   9014: 
1.100     rillig   9015: static inline int
                   9016: inline_func(int x)
                   9017: {
1.92      rillig   9018:         return extern_func(x);
1.100     rillig   9019: }
1.93      rillig   9020: 
1.100     rillig   9021: int main(void)
                   9022: {
1.92      rillig   9023:         return 0;
1.100     rillig   9024: }
1.92      rillig   9025: </pre>
                   9026: <p>It generates the code for <code class="function">inline_func</code> even if
                   9027: that function is never used. This code then refers to
                   9028: <code class="function">extern_func</code>, which can usually not be resolved. To
                   9029: solve this problem you can try to tell the package to disable inlining
                   9030: of functions.</p>
                   9031: </div>
1.343     gutterid 9032: <div class="sect3">
                   9033: <div class="titlepage"><div><div><h4 class="title">
                   9034: <a name="undefined-reference-atomic"></a>21.5.4.2. Missing atomic functions</h4></div></div></div>
                   9035: <p>When building for older machine architectures (e.g., i386, PowerPC),
                   9036:   builds may fail because the package expects modern 64-bit atomic functions
                   9037:   which the underlying hardware either doesn't support, or will only support
                   9038:   with specific compiler flags. This is generally handled via inclusion of
                   9039:   mk/atomic64.mk.</p>
                   9040: </div>
1.87      wiz      9041: </div>
1.148     asau     9042: <div class="sect2">
1.87      wiz      9043: <div class="titlepage"><div><div><h3 class="title">
1.287     rillig   9044: <a name="out-of-memory"></a>21.5.5. Running out of memory</h3></div></div></div>
1.87      wiz      9045: <p>Sometimes packages fail to build because the compiler runs
                   9046:     into an operating system specific soft limit.  With the
                   9047:     <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told
1.338     nia      9048:     to unlimit the resources.  The allowed values are any combination of
                   9049:     <span class="quote">&#8220;<span class="quote">cputime</span>&#8221;</span>,
                   9050:     <span class="quote">&#8220;<span class="quote">datasize</span>&#8221;</span>,
                   9051:     <span class="quote">&#8220;<span class="quote">memorysize</span>&#8221;</span>,
                   9052:     <span class="quote">&#8220;<span class="quote">stacksize</span>&#8221;</span> and
                   9053:     <span class="quote">&#8220;<span class="quote">virtualsize</span>&#8221;</span>.
1.87      wiz      9054:     Setting this variable is similar to running the shell builtin
1.110     hubertf  9055:     <span class="command"><strong>ulimit</strong></span> command to raise the maximum data
1.87      wiz      9056:     segment size or maximum stack size of a process, respectively, to
                   9057:     their hard limits.</p>
1.78      rillig   9058: </div>
1.75      rillig   9059: </div>
1.148     asau     9060: <div class="sect1">
1.75      rillig   9061: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9062: <a name="fixes.install"></a>21.6. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.148     asau     9063: <div class="sect2">
1.75      rillig   9064: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9065: <a name="install-scripts"></a>21.6.1. Creating needed directories</h3></div></div></div>
1.110     hubertf  9066: <p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied
1.87      wiz      9067:     with some operating systems cannot create more than one
                   9068:     directory at a time. As such, you should call
                   9069:     <code class="literal">${INSTALL_*_DIR}</code> like this:</p>
                   9070: <pre class="programlisting">
1.100     rillig   9071: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   9072: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.222     sevan    9073: </pre>
1.338     nia      9074: <p>Instead of running the <span class="command"><strong>install</strong></span> commands
                   9075:     directly, you can also append <span class="quote">&#8220;<span class="quote"><code class="literal">dir1
                   9076:     dir2</code></span>&#8221;</span> to the <code class="varname">INSTALLATION_DIRS</code>
                   9077:     variable, which will automatically do the right thing.</p>
1.75      rillig   9078: </div>
1.148     asau     9079: <div class="sect2">
1.75      rillig   9080: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9081: <a name="where-to-install-documentation"></a>21.6.2. Where to install documentation</h3></div></div></div>
1.83      wiz      9082: <p>In general, documentation should be installed into
1.87      wiz      9083:     <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.338     nia      9084:     <code class="filename">${PREFIX}/share/doc/${PKGNAME_NOREV}</code> (the latter
1.87      wiz      9085:     includes the version number of the package).</p>
1.84      wiz      9086: <p>Many modern packages using GNU autoconf allow to set the
1.87      wiz      9087:     directory where HTML documentation is installed with the
1.338     nia      9088:     <span class="quote">&#8220;<span class="quote">--with-html-dir</span>&#8221;</span> option. Sometimes using this flag is
                   9089:     needed because otherwise the documentation ends up in
                   9090:     <code class="filename">${PREFIX}/share/doc/html</code> or other places. In
                   9091:     pkgsrc, the HTML documentation should go into the package-specific
                   9092:     directory, just like any other documentation.</p>
1.87      wiz      9093: <p>An exception to the above is that library API documentation
1.322     leot     9094:     generated with the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/textproc/gtk-doc/index.html" target="_top"><code class="filename">textproc/gtk-doc</code></a> tools, for use by special
1.87      wiz      9095:     browsers (devhelp) should be left at their default location, which
                   9096:     is <code class="filename">${PREFIX}/share/gtk-doc</code>.  Such
                   9097:     documentation can be recognized from files ending in
                   9098:     <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>.
                   9099:     (It is also acceptable to install such files in
                   9100:     <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
                   9101:     <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the
                   9102:     <code class="filename">.devhelp*</code> file must be directly in that
                   9103:     directory then, no additional subdirectory level is allowed in
                   9104:     this case. This is usually achieved by using
1.128     wiz      9105:     <span class="quote">&#8220;<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>&#8221;</span>.
1.87      wiz      9106:     <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred
                   9107:     though.)</p>
1.75      rillig   9108: </div>
1.148     asau     9109: <div class="sect2">
1.75      rillig   9110: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9111: <a name="installing-score-files"></a>21.6.3. Installing highscore files</h3></div></div></div>
1.75      rillig   9112: <p>Certain packages, most of them in the games category, install
1.87      wiz      9113:     a score file that allows all users on the system to record their
                   9114:     highscores.  In order for this to work, the binaries need to be
                   9115:     installed setgid and the score files owned by the appropriate
1.142     wiz      9116:     group and/or owner (traditionally the "games" user/group).  Set
                   9117:     <code class="varname">USE_GAMESGROUP</code> to yes to support this. The
1.87      wiz      9118:     following variables, documented in more detail in
                   9119:     <code class="filename">mk/defaults/mk.conf</code>, control this
1.142     wiz      9120:     behaviour: <code class="varname">GAMEDATAMODE</code>,
                   9121:     <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>,
1.210     leot     9122:     <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.
                   9123:     Other useful variables are: <code class="varname">GAMEDIR_PERMS</code>,
                   9124:     <code class="varname">GAMEDATA_PERMS</code> and
                   9125:     <code class="varname">SETGID_GAMES_PERMS</code>.</p>
                   9126: <p>An example that illustrates some of the variables described above is
                   9127:     <code class="filename">games/moon-buggy</code>. <code class="varname">OWN_DIRS_PERMS</code> is
                   9128:     used to properly set directory permissions of the directory where the
                   9129:     scorefile is saved, <code class="varname">REQD_FILES_PERMS</code> is used to create a
                   9130:     dummy scorefile (<code class="filename">mbscore</code>) with the proper permissions
                   9131:     and <code class="varname">SPECIAL_PERMS</code> is used to install setgid the game
                   9132:     binary:</p>
                   9133: <pre class="programlisting">
1.223     rillig   9134: USE_GAMESGROUP=         yes
1.210     leot     9135: 
1.223     rillig   9136: BUILD_DEFS+=            VARBASE
1.210     leot     9137: 
1.223     rillig   9138: OWN_DIRS_PERMS+=        ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
                   9139: REQD_FILES_PERMS+=      /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
                   9140: SPECIAL_PERMS+=         ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
1.222     sevan    9141: </pre>
1.210     leot     9142: <p>Various <code class="varname">INSTALL_*</code> variables are also available:
                   9143:     <code class="varname">INSTALL_GAME</code> to install setgid game binaries,
                   9144:     <code class="varname">INSTALL_GAME_DIR</code> to install game directories that are
                   9145:     needed to be accessed by setgid games and
                   9146:     <code class="varname">INSTALL_GAME_DATA</code> to install scorefiles.</p>
1.114     jmcneill 9147: <p>A package should therefore never hard code file ownership or
1.210     leot     9148:     access permissions but rely on <code class="varname">*_PERMS</code> as described above
                   9149:     or alternatively on <code class="varname">INSTALL_GAME</code>,
                   9150:     <code class="varname">INSTALL_GAME_DATA</code> and
                   9151:     <code class="varname">INSTALL_GAME_DIR</code> to set these correctly.</p>
1.75      rillig   9152: </div>
1.148     asau     9153: <div class="sect2">
1.75      rillig   9154: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9155: <a name="destdir-support"></a>21.6.4. Adding DESTDIR support to packages</h3></div></div></div>
1.114     jmcneill 9156: <p><code class="varname">DESTDIR</code> support means that a package
                   9157:     installs into a staging directory, not the final location of the
                   9158:     files. Then a binary package is created which can be used for
                   9159:     installation as usual. There are two ways: Either the package must
1.128     wiz      9160:     install as root (<span class="quote">&#8220;<span class="quote">destdir</span>&#8221;</span>) or the package can
                   9161:     install as non-root user (<span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span>).</p>
1.148     asau     9162: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      9163: <li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be
1.224     leot     9164:       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>.
                   9165:       By default <code class="varname">PKG_DESTDIR_SUPPORT</code>
1.145     wiz      9166:       is set to <span class="quote">&#8220;<span class="quote">user-destdir</span>&#8221;</span> to help catching more
                   9167:       potential packaging problems. If bsd.prefs.mk is included in the Makefile,
1.114     jmcneill 9168:       <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before
                   9169:       the inclusion.</p></li>
1.128     wiz      9170: <li class="listitem"><p>All installation operations have to be prefixed with
1.103     wiz      9171:       <code class="filename">${DESTDIR}</code>.</p></li>
1.128     wiz      9172: <li class="listitem"><p>automake gets this DESTDIR mostly right
1.103     wiz      9173:       automatically. Many manual rules and pre/post-install often are
                   9174:       incorrect; fix them.</p></li>
1.128     wiz      9175: <li class="listitem"><p>If files are installed with special owner/group
1.118     imil     9176:       use <code class="varname">SPECIAL_PERMS</code>.</p></li>
1.128     wiz      9177: <li class="listitem"><p>In general, packages should support
1.103     wiz      9178:       <code class="varname">UNPRIVILEGED</code> to be able to use
                   9179:       DESTDIR.</p></li>
                   9180: </ul></div>
                   9181: </div>
1.148     asau     9182: <div class="sect2">
1.103     wiz      9183: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9184: <a name="hardcoded-paths"></a>21.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div>
1.87      wiz      9185: <p>Your package may also contain scripts with hardcoded paths to
1.318     nia      9186:       other interpreters besides (or as well as) Perl.  To correct the
1.87      wiz      9187:       full pathname to the script interpreter, you need to set the
                   9188:       following definitions in your <code class="filename">Makefile</code> (we
1.110     hubertf  9189:     shall use <span class="command"><strong>tclsh</strong></span> in this example):</p>
1.87      wiz      9190: <pre class="programlisting">
1.100     rillig   9191: REPLACE_INTERPRETER+=   tcl
                   9192: REPLACE.tcl.old=        .*/bin/tclsh
                   9193: REPLACE.tcl.new=        ${PREFIX}/bin/tclsh
                   9194: REPLACE_FILES.tcl=      # list of tcl scripts which need to be fixed,
                   9195: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.222     sevan    9196: </pre>
1.75      rillig   9197: </div>
1.148     asau     9198: <div class="sect2">
1.75      rillig   9199: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9200: <a name="perl-modules"></a>21.6.6. Packages installing Perl modules</h3></div></div></div>
1.75      rillig   9201: <p>Makefiles of packages providing perl5 modules should include
1.87      wiz      9202:     the Makefile fragment
                   9203:     <code class="filename">../../lang/perl5/module.mk</code>.  It provides a
1.110     hubertf  9204:     <span class="command"><strong>do-configure</strong></span> target for the standard perl
1.87      wiz      9205:     configuration for such modules as well as various hooks to tune
                   9206:     this configuration.  See comments in this file for
                   9207:     details.</p>
1.75      rillig   9208: <p>Perl5 modules will install into different places depending
1.87      wiz      9209:     on the version of perl used during the build process.  To
                   9210:     address this, pkgsrc will append lines to the
                   9211:     <code class="filename">PLIST</code> corresponding to the files listed in
                   9212:     the installed <code class="filename">.packlist</code> file generated by
                   9213:     most perl5 modules.  This is invoked by defining
                   9214:     <code class="varname">PERL5_PACKLIST</code> to a space-separated list of
1.153     wiz      9215:     packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code>
                   9216:     (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default),
                   9217:     e.g.:</p>
1.75      rillig   9218: <pre class="programlisting">
1.153     wiz      9219: PERL5_PACKLIST= auto/Pg/.packlist
1.222     sevan    9220: </pre>
1.153     wiz      9221: <p>The perl5 config variables
                   9222:     <code class="varname">installarchlib</code>,
                   9223:     <code class="varname">installscript</code>,
                   9224:     <code class="varname">installvendorbin</code>,
                   9225:     <code class="varname">installvendorscript</code>,
                   9226:     <code class="varname">installvendorarch</code>,
                   9227:     <code class="varname">installvendorlib</code>,
                   9228:     <code class="varname">installvendorman1dir</code>, and
                   9229:     <code class="varname">installvendorman3dir</code> represent those
                   9230:     locations in which components of perl5 modules may be installed,
                   9231:     provided as variable with uppercase and prefixed with
                   9232:     <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code>
                   9233:     and may be used by perl5 packages that don't have a packlist.
                   9234:     These variables are also substituted for in the
                   9235:     <code class="filename">PLIST</code> as uppercase prefixed with
                   9236:     <code class="varname">PERL5_SUB_</code>.</p>
1.75      rillig   9237: </div>
1.148     asau     9238: <div class="sect2">
1.75      rillig   9239: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9240: <a name="faq.info-files"></a>21.6.7. Packages installing info files</h3></div></div></div>
1.75      rillig   9241: <p>Some packages install info files or use the
1.128     wiz      9242:     <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.87      wiz      9243:     commands.  <code class="varname">INFO_FILES</code> should be defined in
                   9244:     the package Makefile so that <code class="filename">INSTALL</code> and
                   9245:     <code class="filename">DEINSTALL</code> scripts will be generated to
                   9246:     handle registration of the info files in the Info directory
1.128     wiz      9247:     file. The <span class="quote">&#8220;<span class="quote">install-info</span>&#8221;</span> command used for the info
1.87      wiz      9248:     files registration is either provided by the system, or by a
                   9249:     special purpose package automatically added as dependency if
                   9250:     needed.</p>
1.75      rillig   9251: <p><code class="varname">PKGINFODIR</code> is the directory under
1.87      wiz      9252:     <code class="filename">${PREFIX}</code> where info files are primarily
                   9253:     located. <code class="varname">PKGINFODIR</code> defaults to
1.128     wiz      9254:     <span class="quote">&#8220;<span class="quote">info</span>&#8221;</span> and can be overridden by the user.</p>
1.75      rillig   9255: <p>The info files for the package should be listed in the
1.87      wiz      9256:     package <code class="filename">PLIST</code>; however any split info files
                   9257:     need not be listed.</p>
1.128     wiz      9258: <p>A package which needs the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command
                   9259:     at build time must add <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> to
1.87      wiz      9260:     <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum
1.128     wiz      9261:     version of the <span class="quote">&#8220;<span class="quote">makeinfo</span>&#8221;</span> command is needed it
1.87      wiz      9262:     should be noted with the <code class="varname">TEXINFO_REQD</code>
                   9263:     variable in the package <code class="filename">Makefile</code>. By
                   9264:     default, a minimum version of 3.12 is required. If the system
1.110     hubertf  9265:     does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it
1.87      wiz      9266:     does not match the required minimum, a build dependency on the
1.322     leot     9267:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/gtexinfo/index.html" target="_top"><code class="filename">devel/gtexinfo</code></a> package will
1.87      wiz      9268:     be added automatically.</p>
1.75      rillig   9269: <p>The build and installation process of the software provided
1.87      wiz      9270:     by the package should not use the
1.110     hubertf  9271:     <span class="command"><strong>install-info</strong></span> command as the registration of
1.87      wiz      9272:     info files is the task of the package
                   9273:     <code class="filename">INSTALL</code> script, and it must use the
1.110     hubertf  9274:     appropriate <span class="command"><strong>makeinfo</strong></span> command.</p>
1.75      rillig   9275: <p>To achieve this goal, the pkgsrc infrastructure creates
1.110     hubertf  9276:     overriding scripts for the <span class="command"><strong>install-info</strong></span> and
                   9277:     <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early
1.87      wiz      9278:     in <code class="varname">PATH</code>.</p>
1.110     hubertf  9279: <p>The script overriding <span class="command"><strong>install-info</strong></span> has
1.87      wiz      9280:     no effect except the logging of a message. The script overriding
1.110     hubertf  9281:     <span class="command"><strong>makeinfo</strong></span> logs a message and according to the
1.87      wiz      9282:     value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate
1.110     hubertf  9283:     <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p>
1.75      rillig   9284: </div>
1.148     asau     9285: <div class="sect2">
1.75      rillig   9286: <div class="titlepage"><div><div><h3 class="title">
1.267     rillig   9287: <a name="manpages"></a>21.6.8. Packages installing man pages</h3></div></div></div>
1.81      rillig   9288: <p>All packages that install manual pages should install them
1.87      wiz      9289:     into the same directory, so that there is one common place to look
                   9290:     for them. In pkgsrc, this place is
                   9291:     <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression
                   9292:     should be used in packages. The default for
                   9293:     <code class="varname">PKGMANDIR</code> is
1.128     wiz      9294:     <span class="quote">&#8220;<span class="quote"><code class="filename">man</code></span>&#8221;</span>. Another often-used value
                   9295:     is <span class="quote">&#8220;<span class="quote"><code class="filename">share/man</code></span>&#8221;</span>.</p>
1.148     asau     9296: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75      rillig   9297: <h3 class="title">Note</h3>
1.87      wiz      9298: <p>The support for a custom <code class="varname">PKGMANDIR</code>
                   9299:     is far from complete.</p>
1.75      rillig   9300: </div>
1.81      rillig   9301: <p>The <code class="filename">PLIST</code> files can just use
1.87      wiz      9302:     <code class="filename">man/</code> as the top level directory for the man
                   9303:     page file entries, and the pkgsrc framework will convert as
                   9304:     needed. In all other places, the correct
                   9305:     <code class="varname">PKGMANDIR</code> must be used.</p>
                   9306: <p>Packages that are
                   9307:     configured with <code class="varname">GNU_CONFIGURE</code> set as
1.128     wiz      9308:     <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>, by default will use the
1.87      wiz      9309:     <code class="filename">./configure</code>
                   9310:     --mandir switch to set where the man pages should be installed.
                   9311:     The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults
                   9312:     to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p>
                   9313: <p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not
                   9314:     use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code>
1.128     wiz      9315:     to <span class="quote">&#8220;<span class="quote">no</span>&#8221;</span>.
1.87      wiz      9316:     Or if the <code class="filename">./configure</code> script uses
                   9317:     a non-standard use of --mandir, you can set
                   9318:     <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
1.299     rillig   9319: <p>See <a class="xref" href="#manpage-compression" title="19.5. Man page compression">Section 19.5, &#8220;Man page compression&#8221;</a> for
1.87      wiz      9320:     information on installation of compressed manual pages.</p>
1.75      rillig   9321: </div>
1.148     asau     9322: <div class="sect2">
1.75      rillig   9323: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9324: <a name="x11-fonts"></a>21.6.9. Packages installing X11 fonts</h3></div></div></div>
1.75      rillig   9325: <p>If a package installs font files, you will need to rebuild
1.87      wiz      9326:     the fonts database in the directory where they get installed at
                   9327:     installation and deinstallation time.  This can be automatically
                   9328:     done by using the pkginstall framework.</p>
1.75      rillig   9329: <p>You can list the directories where fonts are installed in the
1.87      wiz      9330:     <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code>
                   9331:     variables, where <em class="replaceable"><code>type</code></em> can be one of
1.128     wiz      9332:     <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.87      wiz      9333:     Also make sure that the database file
                   9334:     <code class="filename">fonts.dir</code> is not listed in the PLIST.</p>
1.75      rillig   9335: <p>Note that you should not create new directories for fonts;
1.87      wiz      9336:     instead use the standard ones to avoid that the user needs to
                   9337:     manually configure his X server to find them.</p>
1.75      rillig   9338: </div>
1.148     asau     9339: <div class="sect2">
1.75      rillig   9340: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9341: <a name="sgml-xml-data"></a>21.6.10. Packages installing SGML or XML data</h3></div></div></div>
1.75      rillig   9342: <p>If a package installs SGML or XML data files that need to be
1.87      wiz      9343:     registered in system-wide catalogs (like DTDs, sub-catalogs,
                   9344:     etc.), you need to take some extra steps:</p>
1.128     wiz      9345: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9346: <li class="listitem"><p>Include
1.87      wiz      9347:        <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in
                   9348:        your <code class="filename">Makefile</code>, which takes care of
                   9349:        registering those files in system-wide catalogs at
                   9350:        installation and deinstallation time.</p></li>
1.128     wiz      9351: <li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of
1.87      wiz      9352:        any SGML catalogs installed by the package.</p></li>
1.128     wiz      9353: <li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of
1.87      wiz      9354:        any XML catalogs installed by the package.</p></li>
1.128     wiz      9355: <li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries
1.87      wiz      9356:        to be added to the SGML catalog.  These come in groups of
                   9357:        three strings; see xmlcatmgr(1) for more information
                   9358:        (specifically, arguments recognized by the 'add' action).
                   9359:        Note that you will normally not use this variable.</p></li>
1.128     wiz      9360: <li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries
1.87      wiz      9361:        to be added to the XML catalog.  These come in groups of three
                   9362:        strings; see xmlcatmgr(1) for more information (specifically,
                   9363:        arguments recognized by the 'add' action).  Note that you will
                   9364:        normally not use this variable.</p></li>
1.75      rillig   9365: </ol></div>
                   9366: </div>
1.148     asau     9367: <div class="sect2">
1.75      rillig   9368: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9369: <a name="mime-database"></a>21.6.11. Packages installing extensions to the MIME database</h3></div></div></div>
1.75      rillig   9370: <p>If a package provides extensions to the MIME database by
1.87      wiz      9371:     installing <code class="filename">.xml</code> files inside
                   9372:     <code class="filename">${PREFIX}/share/mime/packages</code>, you
                   9373:     need to take some extra steps to ensure that the database is kept
                   9374:     consistent with respect to these new files:</p>
1.128     wiz      9375: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9376: <li class="listitem"><p>Include
1.87      wiz      9377:        <code class="filename">../../databases/shared-mime-info/mimedb.mk</code>
                   9378:        (avoid using the <code class="filename">buildlink3.mk</code> file from
                   9379:        this same directory, which is reserved for inclusion from
                   9380:        other <code class="filename">buildlink3.mk</code> files).  It takes
                   9381:        care of rebuilding the MIME database at installation and
                   9382:        deinstallation time, and disallows any access to it directly
                   9383:        from the package.</p></li>
1.128     wiz      9384: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.87      wiz      9385:        <code class="filename">share/mime</code> directory,
                   9386:        <span class="emphasis"><em>except</em></span> for files saved under
                   9387:        <code class="filename">share/mime/packages</code>.  The former are
                   9388:        handled automatically by
                   9389:        the update-mime-database program, but the latter are
                   9390:        package-dependent and must be removed by the package that
                   9391:        installed them in the first place.</p></li>
1.128     wiz      9392: <li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories
1.87      wiz      9393:        from the PLIST.  They will be handled by the shared-mime-info
                   9394:        package.</p></li>
1.75      rillig   9395: </ol></div>
                   9396: </div>
1.148     asau     9397: <div class="sect2">
1.75      rillig   9398: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9399: <a name="intltool"></a>21.6.12. Packages using intltool</h3></div></div></div>
1.93      rillig   9400: <p>If a package uses intltool during its build, add
                   9401:     <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>,
1.87      wiz      9402:     which forces it to use the intltool package provided by pkgsrc,
                   9403:     instead of the one bundled with the distribution file.</p>
1.75      rillig   9404: <p>This tracks intltool's build-time dependencies and uses the
1.87      wiz      9405:     latest available version; this way, the package benefits of any
                   9406:     bug fixes that may have appeared since it was released.</p>
1.75      rillig   9407: </div>
1.148     asau     9408: <div class="sect2">
1.75      rillig   9409: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9410: <a name="startup-scripts"></a>21.6.13. Packages installing startup scripts</h3></div></div></div>
1.75      rillig   9411: <p>If a package contains a rc.d script, it won't be copied into
1.87      wiz      9412:     the startup directory by default, but you can enable it, by adding
                   9413:     the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in
1.110     hubertf  9414:     <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts
1.87      wiz      9415:     into <code class="filename">/etc/rc.d</code> when a package is installed, and
                   9416:     it will automatically remove the scripts when the package is
                   9417:     deinstalled.</p>
1.75      rillig   9418: </div>
1.148     asau     9419: <div class="sect2">
1.75      rillig   9420: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9421: <a name="tex-packages"></a>21.6.14. Packages installing TeX modules</h3></div></div></div>
1.75      rillig   9422: <p>If a package installs TeX packages into the texmf tree,
1.87      wiz      9423:     the <code class="filename">ls-R</code> database of the tree needs to be
                   9424:     updated.</p>
1.148     asau     9425: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75      rillig   9426: <h3 class="title">Note</h3>
1.125     wiz      9427: <p>Except the main TeX packages such as kpathsea,
1.87      wiz      9428:     packages should install files
1.125     wiz      9429:     into <code class="filename">${PREFIX}/share/texmf-dist</code>,
                   9430:     not <code class="filename">${PREFIX}/share/texmf</code>.</p>
1.75      rillig   9431: </div>
1.128     wiz      9432: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9433: <li class="listitem"><p>Include
1.125     wiz      9434:       <code class="filename">../../print/kpathsea/texmf.mk</code>.  This
1.87      wiz      9435:       takes care of rebuilding the <code class="filename">ls-R</code>
                   9436:       database at installation and deinstallation time.</p></li>
1.128     wiz      9437: <li class="listitem">
1.75      rillig   9438: <p>If your package installs files into a texmf
1.87      wiz      9439:       tree other than the one
1.125     wiz      9440:       at <code class="filename">${PREFIX}/share/texmf-dist</code>,
                   9441:       set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf
1.87      wiz      9442:       trees that need database update.</p>
1.75      rillig   9443: <p>If your package also installs font map files that need
1.110     hubertf  9444:       to be registered using <span class="command"><strong>updmap</strong></span>,
1.136     dholland 9445:       include <code class="filename">../../print/tex-tetex/map.mk</code> and
1.125     wiz      9446:       set <code class="varname">TEX_MAP_FILES</code> and/or
                   9447:       <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all
1.110     hubertf  9448:       such font map files.  Then <span class="command"><strong>updmap</strong></span> will
1.87      wiz      9449:       be run automatically at installation/deinstallation to
                   9450:       enable/disable font map files for TeX output
                   9451:       drivers.</p>
1.75      rillig   9452: </li>
1.128     wiz      9453: <li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code>
1.87      wiz      9454:       databases are included in <code class="filename">PLIST</code>, as
1.136     dholland 9455:       they will be removed only by the kpathsea package.</p></li>
1.75      rillig   9456: </ol></div>
                   9457: </div>
1.148     asau     9458: <div class="sect2">
1.85      jmmv     9459: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9460: <a name="emulation-packages"></a>21.6.15. Packages supporting running binaries in
1.87      wiz      9461:     emulation</h3></div></div></div>
                   9462: <p>There are some packages that provide libraries and
                   9463:     executables for running binaries from a one operating system
                   9464:     on a different one (if the latter supports it).  One example
                   9465:     is running Linux binaries on NetBSD.</p>
1.322     leot     9466: <p>The <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/rpm2pkg/index.html" target="_top"><code class="filename">pkgtools/rpm2pkg</code></a>
1.87      wiz      9467:     helps in extracting and packaging Linux rpm packages.</p>
                   9468: <p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to
1.110     hubertf  9469:     avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests
1.87      wiz      9470:     if all libraries for each installed executable can be found by
                   9471:     the dynamic linker.  Since the standard dynamic linker is run,
                   9472:     this fails for emulation packages, because the libraries used
                   9473:     by the emulation are not in the standard directories.</p>
                   9474: </div>
1.299     rillig   9475: <div class="sect2">
                   9476: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9477: <a name="hicolor-theme"></a>21.6.16. Packages installing hicolor icons</h3></div></div></div>
1.299     rillig   9478: <p>If a package installs images under the
                   9479:     <code class="filename">share/icons/hicolor</code> and/or updates the
                   9480:     <code class="filename">share/icons/hicolor/icon-theme.cache</code>
                   9481:     database, you need to take some extra steps to make sure that the
                   9482:     shared theme directory is handled appropriately and that the cache
                   9483:     database is rebuilt:</p>
                   9484: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9485: <li class="listitem"><p>Include
                   9486:        <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li>
                   9487: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the
                   9488:        entry that refers to the theme cache.</p></li>
                   9489: <li class="listitem"><p>Ensure that the PLIST does not remove the shared icon
                   9490:          directories from the <code class="filename">share/icons/hicolor</code>
                   9491:          hierarchy because they will be handled automatically.</p></li>
                   9492: </ol></div>
                   9493: <p>The best way to verify that the PLIST is correct with
                   9494:       respect to the last two points is to regenerate it using
                   9495:       <span class="command"><strong>make print-PLIST</strong></span>.</p>
                   9496: </div>
                   9497: <div class="sect2">
                   9498: <div class="titlepage"><div><div><h3 class="title">
1.318     nia      9499: <a name="desktop-files"></a>21.6.17. Packages installing desktop files</h3></div></div></div>
1.299     rillig   9500: <p>If a package installs <code class="filename">.desktop</code> files
                   9501:       under <code class="filename">share/applications</code> and these include
                   9502:       MIME information (MimeType key), you need to take extra steps to
                   9503:       ensure that they are registered into the MIME database:</p>
                   9504: <div class="orderedlist"><ol class="orderedlist" type="1">
                   9505: <li class="listitem"><p>Include
                   9506:          <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li>
                   9507: <li class="listitem"><p>Check the PLIST and remove the entry that refers to the
                   9508:          <code class="filename">share/applications/mimeinfo.cache</code> file.
                   9509:          It will be handled automatically.</p></li>
                   9510: </ol></div>
                   9511: <p>The best way to verify that the PLIST is correct with
                   9512:       respect to the last point is to regenerate it using <span class="command"><strong>make
                   9513:       print-PLIST</strong></span>.</p>
                   9514: </div>
                   9515: </div>
                   9516: <div class="sect1">
                   9517: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   9518: <a name="punting"></a>21.7. Marking packages as having problems</h2></div></div></div>
                   9519: <p>In some cases one does not have the time to solve a problem
                   9520:   immediately. In this case, one can plainly mark a package as broken.  For
                   9521:   this, one just sets the variable <code class="varname">BROKEN</code> to the
                   9522:   reason why the package is broken (similar to the
                   9523:   <code class="varname">PKG_FAIL_REASON</code> variable).  A user trying to build
                   9524:   the package will immediately be shown this message, and the build
                   9525:   will not be even tried.</p>
                   9526: <p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular
                   9527:   intervals.</p>
                   9528: </div>
                   9529: </div>
                   9530: <div class="chapter">
                   9531: <div class="titlepage"><div><div><h2 class="title">
                   9532: <a name="gnome"></a>Chapter 22. GNOME packaging and porting</h2></div></div></div>
                   9533: <div class="toc">
                   9534: <p><b>Table of Contents</b></p>
                   9535: <dl class="toc">
                   9536: <dt><span class="sect1"><a href="#meta-packages">22.1. Meta packages</a></span></dt>
                   9537: <dt><span class="sect1"><a href="#new-package">22.2. Packaging a GNOME application</a></span></dt>
                   9538: <dt><span class="sect1"><a href="#full-update">22.3. Updating GNOME to a newer version</a></span></dt>
                   9539: <dt><span class="sect1"><a href="#patching">22.4. Patching guidelines</a></span></dt>
                   9540: </dl>
                   9541: </div>
                   9542: <p>Quoting <a class="ulink" href="https://www.gnome.org/" target="_top">GNOME's web
                   9543: site</a>:</p>
                   9544: <div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop
                   9545:   environment, an intuitive and attractive desktop for users, and the
                   9546:   GNOME development platform, an extensive framework for building
                   9547:   applications that integrate into the rest of the desktop.</p></blockquote></div>
                   9548: <p>pkgsrc provides a seamless way to automatically build and install
                   9549: a complete GNOME environment <span class="emphasis"><em>under many different
                   9550: platforms</em></span>.  We can say with confidence that pkgsrc is one of
                   9551: the most advanced build and packaging systems for GNOME due to its
                   9552: included technologies buildlink3, the wrappers and tools framework and
                   9553: automatic configuration file management.  Lots of efforts are put into
                   9554: achieving a completely clean deinstallation of installed software
                   9555: components.</p>
                   9556: <p>Given that pkgsrc is <a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system,
                   9557: the above also means that great efforts are put into making GNOME work
1.316     cirnatda 9558: under this operating system.</p>
1.299     rillig   9559: <p>This chapter is aimed at pkgsrc developers and other people
                   9560: interested in helping our GNOME porting and packaging efforts.  It
                   9561: provides instructions on how to manage the existing packages and some
                   9562: important information regarding their internals.</p>
                   9563: <div class="sect1">
                   9564: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   9565: <a name="meta-packages"></a>22.1. Meta packages</h2></div></div></div>
                   9566: <p>pkgsrc includes three GNOME-related meta packages:</p>
                   9567: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322     leot     9568: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/index.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>: Provides
1.299     rillig   9569:     the core GNOME desktop environment.  It only includes the necessary
                   9570:     bits to get it to boot correctly, although it may lack important
                   9571:     functionality for daily operation.  The idea behind this package is
                   9572:     to let end users build their own configurations on top of this one,
                   9573:     first installing this meta package to achieve a functional setup and
                   9574:     then adding individual applications.</p></li>
1.322     leot     9575: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome/index.html" target="_top"><code class="filename">meta-pkgs/gnome</code></a>: Provides a
1.299     rillig   9576:     complete installation of the GNOME platform and desktop as defined
                   9577:     by the GNOME project; this is based on the components distributed in
                   9578:     the <code class="filename">platform/x.y/x.y.z/sources</code> and
                   9579:     <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the
                   9580:     official FTP server.  Developer-only tools found in those
                   9581:     directories are not installed unless required by some other
                   9582:     component to work properly.  Similarly, packages from the bindings
                   9583:     set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled
                   9584:     in unless required as a dependency for an end-user component.  This
1.322     leot     9585:     package "extends" <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-base/index.html" target="_top"><code class="filename">meta-pkgs/gnome-base</code></a>.</p></li>
                   9586: <li class="listitem"><p><a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/index.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a>:
1.299     rillig   9587:     Installs all the tools required to build a GNOME component when
                   9588:     fetched from the CVS repository.  These are required to let the
                   9589:     <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li>
                   9590: </ul></div>
                   9591: <p>In all these packages, the <code class="varname">DEPENDS</code> lines are
                   9592: sorted in a way that eases updates: a package may depend on other
                   9593: packages listed before it but not on any listed after it.  It is very
                   9594: important to keep this order to ease updates so... <span class="emphasis"><em>do not
                   9595: change it to alphabetical sorting!</em></span></p>
                   9596: </div>
                   9597: <div class="sect1">
                   9598: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   9599: <a name="new-package"></a>22.2. Packaging a GNOME application</h2></div></div></div>
                   9600: <p>Almost all GNOME applications are written in C and use a common
                   9601: set of tools as their build system.  Things get different with the new
                   9602: bindings to other languages (such as Python), but the following will
                   9603: give you a general idea on the minimum required tools:</p>
                   9604: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   9605: <li class="listitem">
                   9606: <p>Almost all GNOME applications use the GNU Autotools as their
                   9607:     build system.  As a general rule you will need to tell this to your
                   9608:     package:</p>
                   9609: <pre class="programlisting">
1.338     nia      9610: GNU_CONFIGURE=  yes
                   9611: USE_LIBTOOL=    yes
                   9612: USE_TOOLS+=     gmake
1.299     rillig   9613: </pre>
                   9614: </li>
                   9615: <li class="listitem">
                   9616: <p>If the package uses pkg-config to detect dependencies, add this
                   9617:     tool to the list of required utilities:</p>
                   9618: <pre class="programlisting">
1.338     nia      9619: USE_TOOLS+=     pkg-config
1.299     rillig   9620: </pre>
1.322     leot     9621: <p>Also use <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/verifypc/index.html" target="_top"><code class="filename">pkgtools/verifypc</code></a> at
1.299     rillig   9622:     the end of the build process to ensure that you did not miss to
                   9623:     specify any dependency in your package and that the version
                   9624:     requirements are all correct.</p>
                   9625: </li>
                   9626: <li class="listitem"><p>If the package uses intltool, be sure to add
                   9627:     <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>
                   9628:     to handle dependencies and to force the package to use the latest
                   9629:     available version.</p></li>
                   9630: <li class="listitem">
                   9631: <p>If the package uses gtk-doc (a documentation generation
                   9632:     utility), do <span class="emphasis"><em>not</em></span> add a dependency on it.  The
                   9633:     tool is rather big and the distfile should come with pregenerated
                   9634:     documentation anyway; if it does not, it is a bug that you ought to
                   9635:     report.  For such packages you should disable gtk-doc (unless it is
                   9636:     the default):</p>
                   9637: <pre class="programlisting">
1.338     nia      9638: CONFIGURE_ARGS+=        --disable-gtk-doc
1.299     rillig   9639: </pre>
                   9640: <p>The default location of installed HTML files
                   9641:     (<code class="filename">share/gtk-doc/&lt;package-name&gt;</code>) is correct
                   9642:     and should not be changed unless the package insists on installing
                   9643:     them somewhere else.  Otherwise programs as
                   9644:     <span class="command"><strong>devhelp</strong></span> will not be able to open them.  You can
                   9645:     do that with an entry similar to:</p>
                   9646: <pre class="programlisting">
1.338     nia      9647: CONFIGURE_ARGS+=        --with-html-dir=${PREFIX}/share/gtk-doc/...
1.299     rillig   9648: </pre>
                   9649: </li>
                   9650: </ul></div>
                   9651: <p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and
                   9652: files under the installation prefix to maintain databases.  In this
                   9653: context, shared means that those exact same directories and files are
                   9654: used among several different packages, leading to conflicts in the
                   9655: <code class="filename">PLIST</code>.  pkgsrc currently includes functionality to
                   9656: handle the most common cases, so you have to forget about using
                   9657: <code class="literal">@unexec ${RMDIR}</code> lines in your file lists and
                   9658: omitting shared files from them.  If you find yourself doing those,
                   9659: <span class="emphasis"><em>your package is most likely incorrect</em></span>.</p>
                   9660: <p>The following table lists the common situations that result in
                   9661: using shared directories or files.  For each of them, the appropriate
                   9662: solution is given.  After applying the solution be sure to
                   9663: <span class="emphasis"><em>regenerate the package's file list</em></span> with
                   9664: <span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p>
                   9665: <div class="table">
                   9666: <a name="plist-handling"></a><p class="title"><b>Table 22.1. PLIST handling for GNOME packages</b></p>
                   9667: <div class="table-contents"><table class="table" summary="PLIST handling for GNOME packages" border="1">
                   9668: <colgroup>
                   9669: <col>
                   9670: <col>
                   9671: </colgroup>
                   9672: <thead><tr>
                   9673: <th>If the package...</th>
                   9674: <th>Then...</th>
                   9675: </tr></thead>
                   9676: <tbody>
                   9677: <tr>
                   9678: <td>Installs icons under the
                   9679:         <code class="filename">share/icons/hicolor</code> hierarchy or updates
                   9680:         <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td>
1.318     nia      9681: <td>See <a class="xref" href="#hicolor-theme" title="21.6.16. Packages installing hicolor icons">Section 21.6.16, &#8220;Packages installing hicolor icons&#8221;</a>.</td>
1.299     rillig   9682: </tr>
                   9683: <tr>
                   9684: <td>Installs files under
                   9685:         <code class="filename">share/mime/packages</code>.</td>
1.318     nia      9686: <td>See <a class="xref" href="#mime-database" title="21.6.11. Packages installing extensions to the MIME database">Section 21.6.11, &#8220;Packages installing extensions to the MIME database&#8221;</a>.</td>
1.299     rillig   9687: </tr>
                   9688: <tr>
                   9689: <td>Installs <code class="filename">.desktop</code> files under
                   9690:         <code class="filename">share/applications</code> and these include MIME
                   9691:         information.</td>
1.318     nia      9692: <td>See <a class="xref" href="#desktop-files" title="21.6.17. Packages installing desktop files">Section 21.6.17, &#8220;Packages installing desktop files&#8221;</a>.</td>
1.299     rillig   9693: </tr>
                   9694: </tbody>
                   9695: </table></div>
1.75      rillig   9696: </div>
1.299     rillig   9697: <br class="table-break">
1.75      rillig   9698: </div>
1.148     asau     9699: <div class="sect1">
1.87      wiz      9700: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   9701: <a name="full-update"></a>22.3. Updating GNOME to a newer version</h2></div></div></div>
                   9702: <p>When seeing GNOME as a whole, there are two kinds of
                   9703: updates:</p>
                   9704: <div class="variablelist"><dl class="variablelist">
                   9705: <dt><span class="term">Major update</span></dt>
                   9706: <dd>
                   9707: <p>Given that there is still a very long way for GNOME 3 (if it
                   9708:       ever appears), we consider a major update one that goes from a
                   9709:       <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one,
                   9710:       where <code class="literal">Y</code> is even and greater than
                   9711:       <code class="literal">X</code>.  These are hard to achieve because they
                   9712:       introduce lots of changes in the components' code and almost all
                   9713:       GNOME distfiles are updated to newer versions.  Some of them can
                   9714:       even break API and ABI compatibility with the previous major
                   9715:       version series.  As a result, the update needs to be done all at
                   9716:       once to minimize breakage.</p>
                   9717: <p>A major update typically consists of around 80 package
                   9718:       updates and the addition of some new ones.</p>
                   9719: </dd>
                   9720: <dt><span class="term">Minor update</span></dt>
                   9721: <dd>
                   9722: <p>We consider a minor update one that goes from a
                   9723:       <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code>
                   9724:       one where <code class="literal">Y</code> is greater than
                   9725:       <code class="literal">X</code>.  These are easy to achieve because they do
                   9726:       not update all GNOME components, can be done in an incremental way
                   9727:       and do not break API nor ABI compatibility.</p>
                   9728: <p>A minor update typically consists of around 50 package
                   9729:       updates, although the numbers here may vary a lot.</p>
                   9730: </dd>
                   9731: </dl></div>
                   9732: <p>In order to update the GNOME components in pkgsrc to a new stable
                   9733: release (either major or minor), the following steps should be
                   9734: followed:</p>
                   9735: <div class="orderedlist"><ol class="orderedlist" type="1">
1.128     wiz      9736: <li class="listitem">
1.299     rillig   9737: <p>Get a list of all the tarballs that form the new release by
                   9738:     using the following commands.  These will leave the full list of the
                   9739:     components' distfiles into the <code class="filename">list.txt</code>
                   9740:     file:</p>
                   9741: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
                   9742:     ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
                   9743:     awk '{ print $9 }' &gt;list.txt</code></strong>
                   9744: <code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
                   9745:     ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
                   9746:     awk '{ print $9 }' &gt;&gt;list.txt</code></strong></pre>
1.75      rillig   9747: </li>
1.299     rillig   9748: <li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and
                   9749:     bump their version to the release you are updating them to.  The
                   9750:     three meta packages should be always consistent with versioning.
                   9751:     Obviously remove any <code class="varname">PKGREVISION</code>s that might be
                   9752:     in them.</p></li>
1.128     wiz      9753: <li class="listitem">
1.299     rillig   9754: <p>For each meta package, update all its
                   9755:     <code class="varname">DEPENDS</code> lines to match the latest versions as
                   9756:     shown by the above commands.  Do <span class="emphasis"><em>not</em></span> list any
                   9757:     newer version (even if found in the FTP) because the meta packages
                   9758:     are supposed to list the exact versions that form a specific GNOME
                   9759:     release.  Exceptions are permitted here if a newer version solves a
                   9760:     serious issue in the overall desktop experience; these typically
                   9761:     come in the form of a revision bump in pkgsrc, not in newer versions
                   9762:     from the developers.</p>
                   9763: <p>Packages not listed in the <code class="filename">list.txt</code> file
                   9764:     should be updated to the latest version available (if found in
                   9765:     pkgsrc).  This is the case, for example, of the dependencies on the
1.322     leot     9766:     GNU Autotools in the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/gnome-devel/index.html" target="_top"><code class="filename">meta-pkgs/gnome-devel</code></a> meta package.</p>
1.75      rillig   9767: </li>
1.128     wiz      9768: <li class="listitem">
1.299     rillig   9769: <p>Generate a patch from the modified meta packages and extract the
                   9770:     list of "new" lines.  This will provide you an outline on what
                   9771:     packages need to be updated in pkgsrc and in what order:</p>
                   9772: <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>
1.75      rillig   9773: </li>
1.299     rillig   9774: <li class="listitem"><p>For major desktop updates it is recommended to zap all your
                   9775:     installed packages and start over from scratch at this point.</p></li>
                   9776: <li class="listitem"><p>Now comes the longest step by far: iterate over the contents
                   9777:     of <code class="filename">todo.txt</code> and update the packages listed in
                   9778:     it in order.  For major desktop updates none of these should be
                   9779:     committed until the entire set is completed because there are chances
                   9780:     of breaking not-yet-updated packages.</p></li>
                   9781: <li class="listitem"><p>Once the packages are up to date and working, commit them to
                   9782:     the tree one by one with appropriate log messages.  At the end,
                   9783:     commit the three meta package updates and all the corresponding
                   9784:     changes to the <code class="filename">doc/CHANGES-&lt;YEAR&gt;</code> and
                   9785:     <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>
                   9786: </ol></div>
                   9787: </div>
                   9788: <div class="sect1">
                   9789: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   9790: <a name="patching"></a>22.4. Patching guidelines</h2></div></div></div>
                   9791: <p>GNOME is a very big component in pkgsrc which approaches 100
                   9792: packages.  Please, it is very important that you always, always,
                   9793: <span class="strong"><strong>always</strong></span> feed back any portability
                   9794: fixes you do to a GNOME package to the mainstream developers (see <a class="xref" href="#components.patches.feedback" title="12.3.5. Feedback to the author">Section 12.3.5, &#8220;Feedback to the author&#8221;</a>).  This is the only way to get
                   9795: their attention on portability issues and to ensure that future versions
                   9796: can be built out-of-the box on NetBSD.  The less custom patches in
                   9797: pkgsrc, the easier further updates are.  Those developers in charge of
                   9798: issuing major GNOME updates will be grateful if you do that.</p>
1.315     cirnatda 9799: <p>The most common places to report bugs are the <a class="ulink" href="https://gitlab.gnome.org/GNOME" target="_top">GNOME's GitLab</a> and the <a class="ulink" href="https://gitlab.freedesktop.org/explore/groups" target="_top">freedesktop.org's
                   9800: GitLab</a>.  Not all components use these to track bugs, but most
1.299     rillig   9801: of them do.  Do not be short on your reports: always provide detailed
                   9802: explanations of the current failure, how it can be improved to achieve
1.315     cirnatda 9803: maximum portability and, if at all possible, provide a patch against the
                   9804: main Git branch.  The more verbose you are, the higher chances of your
                   9805: patch being accepted.</p>
1.299     rillig   9806: <p>Also, please avoid using preprocessor magic to fix portability
                   9807: issues.  While the FreeBSD GNOME people are doing a great job in porting
                   9808: GNOME to their operating system, the official GNOME sources are now
                   9809: plagued by conditionals that check for <code class="varname">__FreeBSD__</code>
                   9810: and similar macros.  This hurts portability.  Please see our patching
                   9811: guidelines (<a class="xref" href="#components.patches.guidelines" title="12.3.4. Patching guidelines">Section 12.3.4, &#8220;Patching guidelines&#8221;</a>) for more
                   9812: details.</p>
                   9813: </div>
1.75      rillig   9814: </div>
1.148     asau     9815: <div class="chapter">
1.75      rillig   9816: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   9817: <a name="submit"></a>Chapter 23. Submitting and Committing</h2></div></div></div>
1.75      rillig   9818: <div class="toc">
                   9819: <p><b>Table of Contents</b></p>
1.210     leot     9820: <dl class="toc">
1.267     rillig   9821: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
                   9822: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
                   9823: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
                   9824: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
                   9825: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
                   9826: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
                   9827: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
                   9828: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
1.75      rillig   9829: </dl>
                   9830: </div>
1.148     asau     9831: <div class="sect1">
1.75      rillig   9832: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9833: <a name="submitting-binary-packages"></a>23.1. Submitting binary packages</h2></div></div></div>
1.75      rillig   9834: <p>Our policy is that we accept binaries only from pkgsrc
                   9835:        developers to guarantee that the packages don't contain any
                   9836:        trojan horses etc. This is not to annoy anyone but rather to
                   9837:        protect our users! You're still free to put up your home-made
                   9838:        binary packages and tell the world where to get them. NetBSD
                   9839:        developers doing bulk builds and wanting to upload them please
1.267     rillig   9840:        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.174     asau     9841: builds)</i></a>.</p>
1.75      rillig   9842: </div>
1.148     asau     9843: <div class="sect1">
1.75      rillig   9844: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9845: <a name="submitting-your-package"></a>23.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div>
1.333     nia      9846: <p>Firstly, you can import new packages into
                   9847:        pkgsrc-wip (<span class="quote">&#8220;<span class="quote">pkgsrc work-in-progress</span>&#8221;</span>); see the
                   9848:        homepage at <a class="ulink" href="https://pkgsrc.org/wip/" target="_top">https://pkgsrc.org/wip/</a>
                   9849:        for details.</p>
                   9850: <p>Next, check that your package is complete, compiles and
1.299     rillig   9851:        runs well; see <a class="xref" href="#creating" title="Chapter 14. Creating a new pkgsrc package from scratch">Chapter 14, <i>Creating a new pkgsrc package from scratch</i></a> and the rest of this
1.333     nia      9852:        document. Run the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/index.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>
                   9853:        tool and fix any errors that appear.</p>
                   9854: <p>Finally, send a report to the pkgsrc bug tracking system,
1.322     leot     9855:        either with the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/send-pr.1"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> command, or if you don't have
1.87      wiz      9856:        that, go to the web page
1.289     leot     9857:        <a class="ulink" href="https://www.NetBSD.org/support/send-pr.html" target="_top">https://www.NetBSD.org/support/send-pr.html</a>,
1.124     snj      9858:        which contains some instructions and a link to a form where you
                   9859:        can submit packages.  The
1.322     leot     9860:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/gtk-send-pr/index.html" target="_top"><code class="filename">sysutils/gtk-send-pr</code></a> package is
1.124     snj      9861:        also available as a substitute for either of the above two tools.
                   9862:        </p>
1.87      wiz      9863: <p>In the form of the problem report, the category should be
1.128     wiz      9864:        <span class="quote">&#8220;<span class="quote">pkg</span>&#8221;</span>, the synopsis should include the package name
1.87      wiz      9865:        and version number, and the description field should contain a
                   9866:        short description of your package (contents of the COMMENT
1.333     nia      9867:        variable or DESCR file are OK).</p>
1.75      rillig   9868: </div>
1.148     asau     9869: <div class="sect1">
1.75      rillig   9870: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9871: <a name="general-notes-for-changes"></a>23.3. General notes when adding, updating, or removing packages</h2></div></div></div>
1.75      rillig   9872: <p>Please note all package additions, updates, moves, and
1.93      rillig   9873:        removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very
1.75      rillig   9874:        important to keep this file up to date and conforming to the
                   9875:        existing format, because it will be used by scripts to
1.289     leot     9876:        automatically update pages on <a class="ulink" href="https://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other
1.75      rillig   9877:        sites. Additionally, check the
1.76      rillig   9878:        <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry
1.75      rillig   9879:        for the package you updated or removed, in case it was mentioned
                   9880:        there.</p>
                   9881: <p>When the <code class="varname">PKGREVISION</code> of a package is
                   9882:        bumped, the change should appear in
1.93      rillig   9883:        <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security
1.75      rillig   9884:        related or otherwise relevant. Mass bumps that result from a
                   9885:        dependency being updated should not be mentioned. In all other
                   9886:        cases it's the developer's decision.</p>
                   9887: <p>There is a make target that helps in creating proper
1.110     hubertf  9888:   <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries:  <span class="command"><strong>make
1.75      rillig   9889:   changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code>
                   9890:   and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general
1.93      rillig   9891:   usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code>
1.75      rillig   9892:   file is up-to-date (to avoid having to resolve conflicts later-on)
1.110     hubertf  9893:   and then to <span class="command"><strong>cd</strong></span> to the package directory.  For
                   9894:   package updates, <span class="command"><strong>make changes-entry</strong></span> is enough.
1.75      rillig   9895:   For new packages, or package moves or removals, set the
                   9896:   <code class="varname">CTYPE</code> variable on the command line to "Added",
                   9897:   "Moved", or "Removed".  You can set <code class="varname">NETBSD_LOGIN_NAME</code>
1.110     hubertf  9898:   in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is
1.125     wiz      9899:   not the same as your NetBSD login name. The target also automatically
                   9900:   removes possibly existing entries for the package in the
                   9901:   <code class="filename">TODO</code> file. Don't forget to commit
1.174     asau     9902:   the changes, e.g. by using <span class="command"><strong>make commit-changes-entry</strong></span>!
1.126     jakllsch 9903:   If you are not using a checkout directly from cvs.NetBSD.org, but e.g.
1.125     wiz      9904:   a local copy of the repository, you can set USE_NETBSD_REPO=yes. This
                   9905:   makes the cvs commands use the main repository.
                   9906:   </p>
1.75      rillig   9907: </div>
1.148     asau     9908: <div class="sect1">
1.75      rillig   9909: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9910: <a name="commit-messages"></a>23.4. Commit Messages</h2></div></div></div>
1.243     wiz      9911: <p>For several years, there have been mirrors of pkgsrc in
                   9912:   fossil, git, and hg. Standard practise when using these tools is to
                   9913:   make the first line of a commit message function as a summary that
                   9914:   can be read without the rest, such as is commonly done with "git log
                   9915:   --oneline". For this reason, we have the following guidelines for
                   9916:   pkgsrc commit messages:</p>
                   9917: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   9918: <li class="listitem"><p>Start the commit message with a line that explains the
1.244     wiz      9919:     big picture in 65 characters or less. When a commit is for one
1.243     wiz      9920:     package, include the name of the package. For updates, include the
                   9921:     version to which it is updated.</p></li>
                   9922: <li class="listitem"><p>Leave the next line empty.</p></li>
                   9923: <li class="listitem"><p>Then come the details for the commit (changes in that
                   9924:     package, reason for a change) and any relevant PRs. Wrap this
                   9925:     section.</p></li>
                   9926: </ul></div>
                   9927: <p>Here is an example:
                   9928:   </p>
                   9929: <pre class="programlisting">
                   9930:   libxslt: update to 1.0.30
                   9931: 
                   9932:   Changes since 1.0.29:
                   9933:   ...
                   9934:   </pre>
                   9935: <p>
                   9936:   </p>
                   9937: <p>Here is another example:
                   9938:   </p>
                   9939: <pre class="programlisting">
                   9940:   mk/bsd.pkg.mk: enable SSP by default on NetBSD
                   9941: 
                   9942:   (rationale)
                   9943:   </pre>
                   9944: <p>
                   9945:   </p>
                   9946: <p>Commit messages are final: no <span class="quote">&#8220;<span class="quote">cvs admin</span>&#8221;</span> is
                   9947:   allowed on the pkgsrc repository to change commit messages.</p>
                   9948: </div>
                   9949: <div class="sect1">
                   9950: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9951: <a name="committing-importing"></a>23.5. Committing: Adding a package to CVS</h2></div></div></div>
1.87      wiz      9952: <p>This section is only of interest for pkgsrc developers with write
1.140     wiz      9953:   access to the pkgsrc repository.</p>
                   9954: <p>When the package is finished, <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span> the files.
                   9955: Start by adding the directory and then files in the directory. Don't
                   9956: forget to add the new package to the category's
                   9957: <code class="filename">Makefile</code>. Make sure you don't forget any files;
                   9958: you can check by running <span class="quote">&#8220;<span class="quote">cvs status</span>&#8221;</span>. An example:</p>
                   9959: <pre class="programlisting">
                   9960: <code class="prompt">$</code> cd .../pkgsrc/category
                   9961: <code class="prompt">$</code> cvs add pkgname
                   9962: <code class="prompt">$</code> cd pkgname
                   9963: <code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
                   9964: <code class="prompt">$</code> cvs add patches/p*
                   9965: <code class="prompt">$</code> cvs status | less
1.141     wiz      9966: <code class="prompt">$</code> cvs commit
1.140     wiz      9967: <code class="prompt">$</code> cd ..
                   9968: <code class="prompt">$</code> vi Makefile # add SUBDIRS+=pkgname line
1.141     wiz      9969: <code class="prompt">$</code> cvs commit Makefile
1.174     asau     9970: <code class="prompt">$</code> cd pkgname
1.182     jnemeth  9971: <code class="prompt">$</code> make CTYPE=Added commit-changes-entry
1.140     wiz      9972: </pre>
1.87      wiz      9973: <p>The commit message of the initial import should include part of the
1.76      rillig   9974:   <code class="filename">DESCR</code> file, so people reading the mailing lists know
1.87      wiz      9975:   what the package is/does.</p>
1.140     wiz      9976: <p>Also mention the new package in
                   9977: <code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p>
                   9978: <p>Previously, <span class="quote">&#8220;<span class="quote">cvs import</span>&#8221;</span> was suggested, but it was
                   9979: much easier to get wrong than <span class="quote">&#8220;<span class="quote">cvs add</span>&#8221;</span>.</p>
1.75      rillig   9980: </div>
1.148     asau     9981: <div class="sect1">
1.75      rillig   9982: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   9983: <a name="updating-package"></a>23.6. Updating a package to a newer version</h2></div></div></div>
1.87      wiz      9984: <p>Please always put a concise, appropriate and relevant summary of the
1.75      rillig   9985:   changes between old and new versions into the commit log when updating
1.87      wiz      9986:   a package. There are various reasons for this:</p>
1.148     asau     9987: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      9988: <li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely
1.87      wiz      9989:   or its information may be overwritten by newer information.</p></li>
1.128     wiz      9990: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.87      wiz      9991:   repository is very useful for people who use either cvs or anoncvs.</p></li>
1.128     wiz      9992: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.75      rillig   9993:   repository is very useful for people who read the pkgsrc-changes mailing
                   9994:   list, so that they can make tactical decisions about when to upgrade
1.87      wiz      9995:   the package.</p></li>
1.75      rillig   9996: </ul></div>
1.87      wiz      9997: <p>Please also recognize that, just because a new version of a package
1.75      rillig   9998:   has been released, it should not automatically be upgraded in the CVS
                   9999:   repository.  We prefer to be conservative in the packages that are
                   10000:   included in pkgsrc - development or beta packages are not really the
                   10001:   best thing for most places in which pkgsrc is used. Please use your
                   10002:   judgement about what should go into pkgsrc, and bear in mind that
1.87      wiz      10003:   stability is to be preferred above new and possibly untested features.</p>
1.75      rillig   10004: </div>
1.148     asau     10005: <div class="sect1">
1.75      rillig   10006: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   10007: <a name="renaming-package"></a>23.7. Renaming a package in pkgsrc</h2></div></div></div>
1.122     reed     10008: <p>Renaming packages is not recommended.</p>
1.290     gutterid 10009: <p>When renaming packages, be sure to fix any references to the old name
1.122     reed     10010:   in other Makefiles, options, buildlink files, etc.</p>
1.282     leot     10011: <p>
1.290     gutterid 10012:   Also, when renaming a package, please add
1.282     leot     10013:   the package name and version pattern(s) of the previous package
                   10014:   to <code class="varname">SUPERSEDES</code>.
1.122     reed     10015:   This may be repeated for multiple renames.
                   10016:   The new package would be an exact replacement.
1.282     leot     10017:   Example:
1.122     reed     10018: </p>
1.282     leot     10019: <pre class="programlisting">
                   10020: SUPERSEDES+=    p5-IO-Compress-Zlib&lt;2.017
                   10021: SUPERSEDES+=    optcomp-[0-9]*
                   10022: </pre>
1.128     wiz      10023: <p>Note that <span class="quote">&#8220;<span class="quote">successor</span>&#8221;</span> in the
1.122     reed     10024:   CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily
                   10025:   mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may
                   10026:   not be an exact replacement but is a suggestion for the replaced
                   10027:   functionality.</p>
                   10028: </div>
1.148     asau     10029: <div class="sect1">
1.122     reed     10030: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267     rillig   10031: <a name="moving-package"></a>23.8. Moving a package in pkgsrc</h2></div></div></div>
1.122     reed     10032: <p>It is preferred that packages are not renamed or moved, but if needed
                   10033:   please follow these steps.
                   10034: </p>
1.128     wiz      10035: <div class="orderedlist"><ol class="orderedlist" type="1">
                   10036: <li class="listitem"><p>Make a copy of the directory somewhere else.</p></li>
                   10037: <li class="listitem">
1.75      rillig   10038: <p>Remove all CVS dirs.</p>
1.87      wiz      10039: <p>Alternatively to the first two steps you can also do:</p>
1.75      rillig   10040: <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>
1.87      wiz      10041: <p>and use that for further work.</p>
1.75      rillig   10042: </li>
1.128     wiz      10043: <li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any
                   10044: <code class="varname">DEPENDS</code> paths that just did <span class="quote">&#8220;<span class="quote">../package</span>&#8221;</span>
                   10045: instead of <span class="quote">&#8220;<span class="quote">../../category/package</span>&#8221;</span>.</p></li>
                   10046: <li class="listitem"><p>In the modified package's Makefile, consider setting
1.122     reed     10047: <code class="varname">PREV_PKGPATH</code> to the previous category/package
                   10048: pathname.  The <code class="varname">PREV_PKGPATH</code> can be used by tools
                   10049: for doing an update using pkgsrc building; for example, it can
1.322     leot     10050: search the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/pkg_summary.5"><span class="citerefentry"><span class="refentrytitle">pkg_summary</span>(5)</span></a> database for <code class="varname">PREV_PKGPATH</code>
1.122     reed     10051: (if no <code class="varname">SUPERSEDES</code>) and then use the corresponding
                   10052: new <code class="varname">PKGPATH</code> for that moved package.  Note that
                   10053: it may have multiple matches, so the tool should also check on the
                   10054: <code class="varname">PKGBASE</code> too.  The <code class="varname">PREV_PKGPATH</code>
                   10055: probably has no value unless <code class="varname">SUPERSEDES</code> is not
                   10056: set, i.e.  <code class="varname">PKGBASE</code> stays the same.  </p></li>
1.128     wiz      10057: <li class="listitem"><p><span class="command"><strong>cvs import</strong></span> the modified package in the new
1.75      rillig   10058: place.</p></li>
1.128     wiz      10059: <li class="listitem">
1.75      rillig   10060: <p>Check if any package depends on it:
                   10061: </p>
                   10062: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
                   10063: <code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre>
                   10064: </li>
1.128     wiz      10065: <li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li>
                   10066: <li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li>
                   10067: <li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li>
                   10068: <li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li>
                   10069: <li class="listitem">
1.75      rillig   10070: <p>Commit the changed and removed files:</p>
                   10071: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong></pre>
1.87      wiz      10072: <p>(and any packages from step 5, of course).</p>
1.75      rillig   10073: </li>
                   10074: </ol></div>
                   10075: </div>
                   10076: </div>
1.148     asau     10077: <div class="chapter">
1.75      rillig   10078: <div class="titlepage"><div><div><h2 class="title">
1.267     rillig   10079: <a name="devfaq"></a>Chapter 24. Frequently Asked Questions</h2></div></div></div>
1.75      rillig   10080: <p>This section contains the answers to questions that may
                   10081:        arise when you are writing a package. If you don't find your
                   10082:        question answered here, first have a look in the other chapters,
                   10083:        and if you still don't have the answer, ask on the
                   10084:        <code class="literal">pkgsrc-users</code> mailing list.</p>
1.148     asau     10085: <div class="qandaset">
1.289     leot     10086: <a name="devfaq.qandaset"></a><dl>
1.267     rillig   10087: <dt>24.1. <a href="#devfaq.makeflags">What is the difference between
1.75      rillig   10088:        MAKEFLAGS, .MAKEFLAGS and
                   10089:        MAKE_FLAGS?</a>
                   10090: </dt>
1.267     rillig   10091: <dt>24.2. <a href="#devfaq.make">What is the difference between
1.75      rillig   10092:        MAKE, GMAKE and
                   10093:        MAKE_PROGRAM?</a>
                   10094: </dt>
1.267     rillig   10095: <dt>24.3. <a href="#devfaq.cc">What is the difference between
1.75      rillig   10096:        CC, PKG_CC and
                   10097:        PKGSRC_COMPILER?</a>
                   10098: </dt>
1.338     nia      10099: <dt>24.4. <a href="#devfaq.bl3prefix">Why does make show-var
1.75      rillig   10100:        VARNAME=BUILDLINK_PREFIX.foo
                   10101:        say it's empty?</a>
                   10102: </dt>
1.338     nia      10103: <dt>24.5. <a href="#devfaq.master_sites">What does
1.78      rillig   10104:        ${MASTER_SITE_SOURCEFORGE:=package/} mean? I
                   10105:        don't understand the := inside
                   10106:        it.</a>
                   10107: </dt>
1.338     nia      10108: <dt>24.6. <a href="#devfaq.mailinglists">Which mailing lists are there for package
1.78      rillig   10109:        developers?</a>
                   10110: </dt>
1.338     nia      10111: <dt>24.7. <a href="#devfaq.documentation">Where is the pkgsrc
1.80      rillig   10112:        documentation?</a>
                   10113: </dt>
1.338     nia      10114: <dt>24.8. <a href="#devfaq.too-much-time">I have a little time to kill.
1.289     leot     10115: What shall I do?</a>
1.92      rillig   10116: </dt>
1.75      rillig   10117: </dl>
1.148     asau     10118: <table border="0" style="width: 100%;">
                   10119: <colgroup>
1.75      rillig   10120: <col align="left" width="1%">
1.128     wiz      10121: <col>
1.148     asau     10122: </colgroup>
1.75      rillig   10123: <tbody>
1.148     asau     10124: <tr class="question">
1.75      rillig   10125: <td align="left" valign="top">
1.289     leot     10126: <a name="devfaq.makeflags"></a><a name="devfaq.makeflags.q"></a><p><b>24.1.</b></p>
1.75      rillig   10127: </td>
                   10128: <td align="left" valign="top"><p>What is the difference between
                   10129:        <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
                   10130:        <code class="varname">MAKE_FLAGS</code>?</p></td>
                   10131: </tr>
                   10132: <tr class="answer">
1.91      rillig   10133: <td align="left" valign="top"></td>
1.338     nia      10134: <td align="left" valign="top">
                   10135: <p><code class="varname">MAKEFLAGS</code> are the flags passed
                   10136:        to the pkgsrc-internal invocations of <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a>.</p>
                   10137: <p><code class="varname">MAKE_FLAGS</code> are the flags that are
                   10138:        passed to the <code class="varname">MAKE_PROGRAM</code> when building the
                   10139:        package.</p>
                   10140: <p><code class="varname">.MAKEFLAGS</code> is an internal variable of
                   10141:        <span class="command"><strong>bmake</strong></span> and should not be used by
                   10142:        packages.</p>
                   10143: </td>
1.75      rillig   10144: </tr>
1.148     asau     10145: <tr class="question">
1.75      rillig   10146: <td align="left" valign="top">
1.289     leot     10147: <a name="devfaq.make"></a><a name="devfaq.make.q"></a><p><b>24.2.</b></p>
1.75      rillig   10148: </td>
                   10149: <td align="left" valign="top"><p>What is the difference between
                   10150:        <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
                   10151:        <code class="varname">MAKE_PROGRAM</code>?</p></td>
                   10152: </tr>
                   10153: <tr class="answer">
1.91      rillig   10154: <td align="left" valign="top"></td>
1.338     nia      10155: <td align="left" valign="top">
                   10156: <p><code class="varname">MAKE</code> is the path to the
1.322     leot     10157:        <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> program that is used in the pkgsrc
1.338     nia      10158:        infrastructure.</p>
                   10159: <p><code class="varname">GMAKE</code> is the path to GNU Make, but you
                   10160:        need to say <code class="varname">USE_TOOLS+=gmake</code> to use
                   10161:        that.</p>
                   10162: <p><code class="varname">MAKE_PROGRAM</code> is the path to the Make
                   10163:        program that is used for building the package.</p>
                   10164: </td>
1.75      rillig   10165: </tr>
1.148     asau     10166: <tr class="question">
1.75      rillig   10167: <td align="left" valign="top">
1.289     leot     10168: <a name="devfaq.cc"></a><a name="devfaq.cc.q"></a><p><b>24.3.</b></p>
1.75      rillig   10169: </td>
                   10170: <td align="left" valign="top"><p>What is the difference between
                   10171:        <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
                   10172:        <code class="varname">PKGSRC_COMPILER</code>?</p></td>
                   10173: </tr>
                   10174: <tr class="answer">
1.91      rillig   10175: <td align="left" valign="top"></td>
1.75      rillig   10176: <td align="left" valign="top">
1.338     nia      10177: <p><code class="varname">CC</code> is the path to the real C
                   10178:        compiler, which can be configured by the pkgsrc user.</p>
                   10179: <p><code class="varname">PKG_CC</code> is the path to the compiler
                   10180:        wrapper.</p>
                   10181: <p><code class="varname">PKGSRC_COMPILER</code> is
                   10182:        <span class="emphasis"><em>not</em></span> a path to a compiler, but the type of
                   10183:        compiler that should be used. See
                   10184:        <code class="filename">mk/compiler.mk</code> for more information about
                   10185:        the latter variable.</p>
1.75      rillig   10186: </td>
                   10187: </tr>
1.148     asau     10188: <tr class="question">
1.75      rillig   10189: <td align="left" valign="top">
1.338     nia      10190: <a name="devfaq.bl3prefix"></a><a name="devfaq.bl3prefix.q"></a><p><b>24.4.</b></p>
1.75      rillig   10191: </td>
1.110     hubertf  10192: <td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
1.75      rillig   10193:        VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
                   10194:        say it's empty?</p></td>
                   10195: </tr>
                   10196: <tr class="answer">
1.91      rillig   10197: <td align="left" valign="top"></td>
1.75      rillig   10198: <td align="left" valign="top"><p>For optimization reasons, some variables are only
1.128     wiz      10199:        available in the <span class="quote">&#8220;<span class="quote">wrapper</span>&#8221;</span> phase and later. To
                   10200:        <span class="quote">&#8220;<span class="quote">simulate</span>&#8221;</span> the wrapper phase, append
1.110     hubertf  10201:        <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
1.75      rillig   10202:        command.</p></td>
                   10203: </tr>
1.148     asau     10204: <tr class="question">
1.78      rillig   10205: <td align="left" valign="top">
1.338     nia      10206: <a name="devfaq.master_sites"></a><a name="devfaq.master_sites.q"></a><p><b>24.5.</b></p>
1.78      rillig   10207: </td>
                   10208: <td align="left" valign="top"><p>What does
1.220     wiz      10209:        <code class="code">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
                   10210:        don't understand the <code class="code">:=</code> inside
1.78      rillig   10211:        it.</p></td>
                   10212: </tr>
                   10213: <tr class="answer">
1.91      rillig   10214: <td align="left" valign="top"></td>
1.338     nia      10215: <td align="left" valign="top"><p>The <code class="code">:=</code> is not an
                   10216:        assignment operator, even though it may look like one.
1.78      rillig   10217:        Instead, it is a degenerate form of
1.220     wiz      10218:        <code class="code">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
1.322     leot     10219:        which is documented in the <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/make.1"><span class="citerefentry"><span class="refentrytitle">make</span>(1)</span></a> man page and which is
1.220     wiz      10220:        commonly used in the form <code class="code">${SRCS:.c=.o}</code>. In the
1.78      rillig   10221:        case of <code class="varname">MASTER_SITE_*</code>,
                   10222:        <em class="replaceable"><code>old_string</code></em> is the empty string and
                   10223:        <em class="replaceable"><code>new_string</code></em> is
1.220     wiz      10224:        <code class="code">package/</code>. That's where the
                   10225:        <code class="code">:</code> and the <code class="code">=</code> fall
1.78      rillig   10226:        together.</p></td>
                   10227: </tr>
1.148     asau     10228: <tr class="question">
1.78      rillig   10229: <td align="left" valign="top">
1.338     nia      10230: <a name="devfaq.mailinglists"></a><a name="devfaq.mailinglists.q"></a><p><b>24.6.</b></p>
1.78      rillig   10231: </td>
                   10232: <td align="left" valign="top"><p>Which mailing lists are there for package
                   10233:        developers?</p></td>
                   10234: </tr>
                   10235: <tr class="answer">
1.91      rillig   10236: <td align="left" valign="top"></td>
1.148     asau     10237: <td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
1.289     leot     10238: <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.78      rillig   10239: <dd><p>This is a list for technical discussions related
                   10240:        to pkgsrc development, e.g. soliciting feedback for changes to
                   10241:        pkgsrc infrastructure, proposed new features, questions related
                   10242:        to porting pkgsrc to a new platform, advice for maintaining a
                   10243:        package, patches that affect many packages, help requests moved
                   10244:        from pkgsrc-users when an infrastructure bug is found,
                   10245:        etc.</p></dd>
1.289     leot     10246: <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.78      rillig   10247: <dd><p>All bug reports in category "pkg" sent with
1.322     leot     10248:        <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/send-pr.1"><span class="citerefentry"><span class="refentrytitle">send-pr</span>(1)</span></a> appear here. Please do not report your bugs here
1.78      rillig   10249:        directly; use one of the other mailing
                   10250:        lists.</p></dd>
                   10251: </dl></div></td>
                   10252: </tr>
1.148     asau     10253: <tr class="question">
1.80      rillig   10254: <td align="left" valign="top">
1.338     nia      10255: <a name="devfaq.documentation"></a><a name="devfaq.documentation.q"></a><p><b>24.7.</b></p>
1.80      rillig   10256: </td>
                   10257: <td align="left" valign="top"><p>Where is the pkgsrc
                   10258:        documentation?</p></td>
                   10259: </tr>
                   10260: <tr class="answer">
1.91      rillig   10261: <td align="left" valign="top"></td>
1.80      rillig   10262: <td align="left" valign="top">
                   10263: <p>There are many places where you can find
                   10264:        documentation about pkgsrc:</p>
1.148     asau     10265: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      10266: <li class="listitem"><p>The pkgsrc guide (this document) is a collection
1.80      rillig   10267:        of chapters that explain large parts of pkgsrc, but some
                   10268:        chapters tend to be outdated. Which ones they are is hard to
                   10269:        say.</p></li>
1.289     leot     10270: <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.80      rillig   10271:        about certain features, announcements of new parts of the pkgsrc
                   10272:        infrastructure and sometimes even announcements that a certain
                   10273:        feature has been marked as obsolete. The benefit here is that
                   10274:        each message has a date appended to it.</p></li>
1.128     wiz      10275: <li class="listitem"><p>Many of the files in the
1.80      rillig   10276:        <code class="filename">mk/</code> directory start with a comment that
                   10277:        describes the purpose of the file and how it can be used by the
1.92      rillig   10278:        pkgsrc user and package authors. An easy way to find this
1.110     hubertf  10279:        documentation is to run <span class="command"><strong>bmake
1.92      rillig   10280:        help</strong></span>.</p></li>
1.128     wiz      10281: <li class="listitem"><p>The CVS log messages are a rich source of
1.80      rillig   10282:        information, but they tend to be highly abbreviated, especially
                   10283:        for actions that occur often. Some contain a detailed
                   10284:        description of what has changed, but they are geared towards the
                   10285:        other pkgsrc developers, not towards an average pkgsrc user.
                   10286:        They also only document <span class="emphasis"><em>changes</em></span>, so if you
                   10287:        don't know what has been before, these messages may not be worth
                   10288:        too much to you.</p></li>
1.128     wiz      10289: <li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">&#8220;<span class="quote">implicitly
                   10290:        documented</span>&#8221;</span>, that is the documentation exists only in the
1.80      rillig   10291:        mind of the developer who wrote the code. To get this
1.110     hubertf  10292:        information, use the <span class="command"><strong>cvs annotate</strong></span> command
1.80      rillig   10293:        to see who has written it and ask on the
                   10294:        <code class="literal">tech-pkg</code> mailing list, so that others can
                   10295:        find your questions later (see above). To be sure that the
                   10296:        developer in charge reads the mail, you may CC him or
                   10297:        her.</p></li>
                   10298: </ul></div>
1.299     rillig   10299: </td>
                   10300: </tr>
                   10301: <tr class="question">
                   10302: <td align="left" valign="top">
1.338     nia      10303: <a name="devfaq.too-much-time"></a><a name="devfaq.too-much-time.q"></a><p><b>24.8.</b></p>
1.299     rillig   10304: </td>
1.338     nia      10305: <td align="left" valign="top"><p>I have a little time to kill.
1.299     rillig   10306: What shall I do?</p></td>
                   10307: </tr>
                   10308: <tr class="answer">
                   10309: <td align="left" valign="top"></td>
                   10310: <td align="left" valign="top">
                   10311: <p>This is not really an FAQ yet, but here's the answer
                   10312: anyway.</p>
1.148     asau     10313: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.299     rillig   10314: <li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
1.322     leot     10315:     <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_chk/index.html" target="_top"><code class="filename">pkgtools/pkg_chk</code></a> package).  It
1.299     rillig   10316:     will tell you about newer versions of installed packages that are
                   10317:     available, but not yet updated in pkgsrc.</p></li>
                   10318: <li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code>
                   10319:     &mdash; it contains a list of suggested new packages and a list of
                   10320:     cleanups and enhancements for pkgsrc that would be nice to
                   10321:     have.</p></li>
                   10322: <li class="listitem"><p>Review packages for which review was requested on
                   10323:     the <a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a>
                   10324:     mailing list.</p></li>
1.85      jmmv     10325: </ul></div>
1.299     rillig   10326: </td>
1.85      jmmv     10327: </tr>
                   10328: </tbody>
1.299     rillig   10329: </table>
1.85      jmmv     10330: </div>
                   10331: </div>
1.75      rillig   10332: </div>
1.148     asau     10333: <div class="part">
1.75      rillig   10334: <div class="titlepage"><div><div><h1 class="title">
                   10335: <a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div>
1.148     asau     10336: <div class="partintro">
1.75      rillig   10337: <div></div>
                   10338: <p>This part of the guide deals with everything
                   10339:        from the infrastructure that is behind the interfaces described
                   10340:        in the developer's guide. A casual package maintainer should not
                   10341:        need anything from this part.</p>
                   10342: <div class="toc">
                   10343: <p><b>Table of Contents</b></p>
1.210     leot     10344: <dl class="toc">
1.299     rillig   10345: <dt><span class="chapter"><a href="#infr.design">25. Design of the pkgsrc infrastructure</a></span></dt>
1.75      rillig   10346: <dd><dl>
1.299     rillig   10347: <dt><span class="sect1"><a href="#infr.vardef">25.1. The meaning of variable definitions</a></span></dt>
                   10348: <dt><span class="sect1"><a href="#infr.vardef.problems">25.2. Avoiding problems before they arise</a></span></dt>
                   10349: <dt><span class="sect1"><a href="#infr.var">25.3. Variable evaluation</a></span></dt>
1.75      rillig   10350: <dd><dl>
1.299     rillig   10351: <dt><span class="sect2"><a href="#infr.var.load">25.3.1. At load time</a></span></dt>
                   10352: <dt><span class="sect2"><a href="#infr.var.run">25.3.2. At runtime</a></span></dt>
1.75      rillig   10353: </dl></dd>
1.299     rillig   10354: <dt><span class="sect1"><a href="#infr.varspec">25.4. How can variables be specified?</a></span></dt>
                   10355: <dt><span class="sect1"><a href="#infr.design.intf">25.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75      rillig   10356: <dd><dl>
1.299     rillig   10357: <dt><span class="sect2"><a href="#infr.design.intf.proc">25.5.1. Procedures with parameters</a></span></dt>
                   10358: <dt><span class="sect2"><a href="#infr.design.intf.action">25.5.2. Actions taken on behalf of parameters</a></span></dt>
1.81      rillig   10359: </dl></dd>
1.299     rillig   10360: <dt><span class="sect1"><a href="#infr.order">25.6. The order in which files are loaded</a></span></dt>
1.81      rillig   10361: <dd><dl>
1.299     rillig   10362: <dt><span class="sect2"><a href="#infr.order.prefs">25.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
                   10363: <dt><span class="sect2"><a href="#infr.order.pkg">25.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.75      rillig   10364: </dl></dd>
                   10365: </dl></dd>
1.299     rillig   10366: <dt><span class="chapter"><a href="#regression">26. Regression tests</a></span></dt>
1.75      rillig   10367: <dd><dl>
1.299     rillig   10368: <dt><span class="sect1"><a href="#regression.run">26.1. Running the regression tests</a></span></dt>
                   10369: <dt><span class="sect1"><a href="#regression.new">26.2. Adding a new regression test</a></span></dt>
1.75      rillig   10370: <dd><dl>
1.299     rillig   10371: <dt><span class="sect2"><a href="#regression.fun.override">26.2.1. Overridable functions</a></span></dt>
                   10372: <dt><span class="sect2"><a href="#regression.fun.helper">26.2.2. Helper functions</a></span></dt>
1.75      rillig   10373: </dl></dd>
                   10374: </dl></dd>
1.299     rillig   10375: <dt><span class="chapter"><a href="#porting">27. Porting pkgsrc</a></span></dt>
                   10376: <dd><dl><dt><span class="sect1"><a href="#porting.opsys">27.1. Porting pkgsrc to a new operating system</a></span></dt></dl></dd>
1.75      rillig   10377: </dl>
                   10378: </div>
                   10379: </div>
1.148     asau     10380: <div class="chapter">
1.75      rillig   10381: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   10382: <a name="infr.design"></a>Chapter 25. Design of the pkgsrc infrastructure</h2></div></div></div>
1.75      rillig   10383: <div class="toc">
                   10384: <p><b>Table of Contents</b></p>
1.210     leot     10385: <dl class="toc">
1.299     rillig   10386: <dt><span class="sect1"><a href="#infr.vardef">25.1. The meaning of variable definitions</a></span></dt>
                   10387: <dt><span class="sect1"><a href="#infr.vardef.problems">25.2. Avoiding problems before they arise</a></span></dt>
                   10388: <dt><span class="sect1"><a href="#infr.var">25.3. Variable evaluation</a></span></dt>
1.81      rillig   10389: <dd><dl>
1.299     rillig   10390: <dt><span class="sect2"><a href="#infr.var.load">25.3.1. At load time</a></span></dt>
                   10391: <dt><span class="sect2"><a href="#infr.var.run">25.3.2. At runtime</a></span></dt>
1.81      rillig   10392: </dl></dd>
1.299     rillig   10393: <dt><span class="sect1"><a href="#infr.varspec">25.4. How can variables be specified?</a></span></dt>
                   10394: <dt><span class="sect1"><a href="#infr.design.intf">25.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75      rillig   10395: <dd><dl>
1.299     rillig   10396: <dt><span class="sect2"><a href="#infr.design.intf.proc">25.5.1. Procedures with parameters</a></span></dt>
                   10397: <dt><span class="sect2"><a href="#infr.design.intf.action">25.5.2. Actions taken on behalf of parameters</a></span></dt>
1.75      rillig   10398: </dl></dd>
1.299     rillig   10399: <dt><span class="sect1"><a href="#infr.order">25.6. The order in which files are loaded</a></span></dt>
1.75      rillig   10400: <dd><dl>
1.299     rillig   10401: <dt><span class="sect2"><a href="#infr.order.prefs">25.6.1. The order in <code class="filename">bsd.prefs.mk</code></a></span></dt>
                   10402: <dt><span class="sect2"><a href="#infr.order.pkg">25.6.2. The order in <code class="filename">bsd.pkg.mk</code></a></span></dt>
1.75      rillig   10403: </dl></dd>
                   10404: </dl>
                   10405: </div>
                   10406: <p>The pkgsrc infrastructure consists of many small Makefile
                   10407:        fragments. Each such fragment needs a properly specified
                   10408:        interface. This chapter explains how such an interface looks
                   10409:        like.</p>
1.148     asau     10410: <div class="sect1">
1.75      rillig   10411: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10412: <a name="infr.vardef"></a>25.1. The meaning of variable definitions</h2></div></div></div>
1.81      rillig   10413: <p>Whenever a variable is defined in the pkgsrc
                   10414:        infrastructure, the location and the way of definition provide
                   10415:        much information about the intended use of that variable.
                   10416:        Additionally, more documentation may be found in a header
                   10417:        comment or in this pkgsrc guide.</p>
                   10418: <p>A special file is
                   10419:        <code class="filename">mk/defaults/mk.conf</code>, which lists all
                   10420:        variables that are intended to be user-defined. They are either
                   10421:        defined using the <code class="literal">?=</code> operator or they are
                   10422:        left undefined because defining them to anything would
1.128     wiz      10423:        effectively mean <span class="quote">&#8220;<span class="quote">yes</span>&#8221;</span>. All these variables may be
1.81      rillig   10424:        overridden by the pkgsrc user in the <code class="varname">MAKECONF</code>
                   10425:        file.</p>
                   10426: <p>Outside this file, the following conventions apply:
                   10427:        Variables that are defined using the <code class="literal">?=</code>
                   10428:        operator may be overridden by a package.</p>
                   10429: <p>Variables that are defined using the <code class="literal">=</code>
                   10430:        operator may be used read-only at run-time.</p>
                   10431: <p>Variables whose name starts with an underscore must not be
                   10432:        accessed outside the pkgsrc infrastructure at all. They may
                   10433:        change without further notice.</p>
1.148     asau     10434: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.81      rillig   10435: <h3 class="title">Note</h3>
                   10436: <p>These conventions are currently not applied
                   10437:        consistently to the complete pkgsrc
                   10438:        infrastructure.</p>
                   10439: </div>
                   10440: </div>
1.148     asau     10441: <div class="sect1">
1.81      rillig   10442: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10443: <a name="infr.vardef.problems"></a>25.2. Avoiding problems before they arise</h2></div></div></div>
1.81      rillig   10444: <p>All variables that contain lists of things should default
                   10445:        to being empty. Two examples that do not follow this rule are
                   10446:        <code class="varname">USE_LANGUAGES</code> and
                   10447:        <code class="varname">DISTFILES</code>. These variables cannot simply be
                   10448:        modified using the <code class="literal">+=</code> operator in package
                   10449:        <code class="filename">Makefile</code>s (or other files included by
                   10450:        them), since there is no guarantee whether the variable is
                   10451:        already set or not, and what its value is. In the case of
1.128     wiz      10452:        <code class="varname">DISTFILES</code>, the packages <span class="quote">&#8220;<span class="quote">know</span>&#8221;</span>
1.81      rillig   10453:        the default value and just define it as in the following
                   10454:        example.</p>
                   10455: <pre class="programlisting">
1.100     rillig   10456: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
1.81      rillig   10457: </pre>
                   10458: <p>Because of the selection of this default value, the same
                   10459:        value appears in many package Makefiles. Similarly for
                   10460:        <code class="varname">USE_LANGUAGES</code>, but in this case the default
1.128     wiz      10461:        value (<span class="quote">&#8220;<span class="quote"><code class="literal">c</code></span>&#8221;</span>) is so short that it
1.81      rillig   10462:        doesn't stand out. Nevertheless it is mentioned in many
                   10463:        files.</p>
                   10464: </div>
1.148     asau     10465: <div class="sect1">
1.81      rillig   10466: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10467: <a name="infr.var"></a>25.3. Variable evaluation</h2></div></div></div>
1.148     asau     10468: <div class="sect2">
1.75      rillig   10469: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10470: <a name="infr.var.load"></a>25.3.1. At load time</h3></div></div></div>
1.75      rillig   10471: <p>Variable evaluation takes place either at load time or at
                   10472:        runtime, depending on the context in which they occur. The
                   10473:        contexts where variables are evaluated at load time are:</p>
1.148     asau     10474: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      10475: <li class="listitem"><p>The right hand side of the <code class="literal">:=</code>
1.75      rillig   10476:        and <code class="literal">!=</code> operators,</p></li>
1.128     wiz      10477: <li class="listitem"><p>Make directives like <code class="literal">.if</code> or
1.75      rillig   10478:        <code class="literal">.for</code>,</p></li>
1.128     wiz      10479: <li class="listitem"><p>Dependency lines.</p></li>
1.75      rillig   10480: </ul></div>
                   10481: <p>A special exception are references to the iteration
                   10482:        variables of <code class="literal">.for</code> loops, which are expanded
                   10483:        inline, no matter in which context they appear.</p>
                   10484: <p>As the values of variables may change during load time,
                   10485:        care must be taken not to evaluate them by accident. Typical
                   10486:        examples for variables that should not be evaluated at load time
                   10487:        are <code class="varname">DEPENDS</code> and
                   10488:        <code class="varname">CONFIGURE_ARGS</code>. To make the effect more
                   10489:        clear, here is an example:</p>
                   10490: <pre class="programlisting">
1.100     rillig   10491: CONFIGURE_ARGS=         # none
                   10492: CFLAGS=                 -O
                   10493: CONFIGURE_ARGS+=        CFLAGS=${CFLAGS:Q}
1.1       grant    10494: 
1.100     rillig   10495: CONFIGURE_ARGS:=        ${CONFIGURE_ARGS}
1.1       grant    10496: 
1.100     rillig   10497: CFLAGS+=                -Wall
1.222     sevan    10498: </pre>
1.75      rillig   10499: <p>This code shows how the use of the <code class="literal">:=</code>
                   10500:        operator can quickly lead to unexpected results. The first
                   10501:        paragraph is fairly common code. The second paragraph evaluates
                   10502:        the <code class="varname">CONFIGURE_ARGS</code> variable, which results in
                   10503:        <code class="literal">CFLAGS=-O</code>. In the third paragraph, the
                   10504:        <code class="literal">-Wall</code> is appended to the
                   10505:        <code class="varname">CFLAGS</code>, but this addition will not appear in
                   10506:        <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three
                   10507:        paragraphs from above typically occur in completely unrelated
                   10508:        files.</p>
                   10509: </div>
1.148     asau     10510: <div class="sect2">
1.75      rillig   10511: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10512: <a name="infr.var.run"></a>25.3.2. At runtime</h3></div></div></div>
1.75      rillig   10513: <p>After all the files have been loaded, the values of the
                   10514:        variables cannot be changed anymore. Variables that are used in
                   10515:        the shell commands are expanded at this point.</p>
                   10516: </div>
                   10517: </div>
1.148     asau     10518: <div class="sect1">
1.75      rillig   10519: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10520: <a name="infr.varspec"></a>25.4. How can variables be specified?</h2></div></div></div>
1.78      rillig   10521: <p>There are many ways in which the definition and use of a
1.218     rillig   10522:        variable can be restricted in order to detect bugs and violations
                   10523:        of the (mostly unwritten) policies. A package can be checked with
                   10524:        <code class="literal">pkglint -Wall</code> to see whether it meets these
                   10525:        rules.</p>
1.78      rillig   10526: </div>
1.148     asau     10527: <div class="sect1">
1.78      rillig   10528: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10529: <a name="infr.design.intf"></a>25.5. Designing interfaces for Makefile fragments</h2></div></div></div>
1.76      rillig   10530: <p>Most of the <code class="filename">.mk</code> files fall into one
1.75      rillig   10531:        of the following classes. Cases where a file falls into more
                   10532:        than one class should be avoided as it often leads to subtle
                   10533:        bugs.</p>
1.148     asau     10534: <div class="sect2">
1.75      rillig   10535: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10536: <a name="infr.design.intf.proc"></a>25.5.1. Procedures with parameters</h3></div></div></div>
1.75      rillig   10537: <p>In a traditional imperative programming language some of
1.76      rillig   10538:        the <code class="filename">.mk</code> files could be described as
1.126     jakllsch 10539:        procedures. They take some input parameters and&mdash;after
                   10540:        inclusion&mdash;provide a result in output parameters. Since all
1.76      rillig   10541:        variables in <code class="filename">Makefile</code>s have global scope
1.75      rillig   10542:        care must be taken not to use parameter names that have already
                   10543:        another meaning. For example, <code class="varname">PKGNAME</code> is a
                   10544:        bad choice for a parameter name.</p>
                   10545: <p>Procedures are completely evaluated at preprocessing time.
                   10546:        That is, when calling a procedure all input parameters must be
                   10547:        completely resolvable. For example,
                   10548:        <code class="varname">CONFIGURE_ARGS</code> should never be an input
                   10549:        parameter since it is very likely that further text will be
                   10550:        added after calling the procedure, which would effectively apply
                   10551:        the procedure to only a part of the variable. Also, references
1.218     rillig   10552:        to other variables will be modified after calling the
1.75      rillig   10553:        procedure.</p>
                   10554: <p>A procedure can declare its output parameters either as
                   10555:        suitable for use in preprocessing directives or as only
                   10556:        available at runtime. The latter alternative is for variables
                   10557:        that contain references to other runtime variables.</p>
                   10558: <p>Procedures shall be written such that it is possible to
                   10559:        call the procedure more than once. That is, the file must not
                   10560:        contain multiple-inclusion guards.</p>
                   10561: <p>Examples for procedures are
1.76      rillig   10562:        <code class="filename">mk/bsd.options.mk</code> and
                   10563:        <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express
1.75      rillig   10564:        that the parameters are evaluated at load time, they should be
                   10565:        assigned using the <code class="literal">:=</code> operator, which should
                   10566:        be used only for this purpose.</p>
                   10567: </div>
1.148     asau     10568: <div class="sect2">
1.75      rillig   10569: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10570: <a name="infr.design.intf.action"></a>25.5.2. Actions taken on behalf of parameters</h3></div></div></div>
1.75      rillig   10571: <p>Action files take some input parameters and may define
                   10572:        runtime variables. They shall not define loadtime variables.
                   10573:        There are action files that are included implicitly by the
                   10574:        pkgsrc infrastructure, while other must be included
                   10575:        explicitly.</p>
                   10576: <p>An example for action files is
1.76      rillig   10577:        <code class="filename">mk/subst.mk</code>.</p>
1.75      rillig   10578: </div>
                   10579: </div>
1.148     asau     10580: <div class="sect1">
1.81      rillig   10581: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10582: <a name="infr.order"></a>25.6. The order in which files are loaded</h2></div></div></div>
1.81      rillig   10583: <p>Package <code class="filename">Makefile</code>s usually consist of
                   10584:        a set of variable definitions, and include the file
                   10585:        <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line.
                   10586:        Before that, they may also include various other
                   10587:        <code class="filename">*.mk</code> files if they need to query the
                   10588:        availability of certain features like the type of compiler or
                   10589:        the X11 implementation. Due to the heavy use of preprocessor
                   10590:        directives like <code class="literal">.if</code> and
                   10591:        <code class="literal">.for</code>, the order in which the files are loaded
                   10592:        matters.</p>
                   10593: <p>This section describes at which point the various files
                   10594:        are loaded and gives reasons for that order.</p>
1.148     asau     10595: <div class="sect2">
1.81      rillig   10596: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10597: <a name="infr.order.prefs"></a>25.6.1. The order in <code class="filename">bsd.prefs.mk</code>
1.93      rillig   10598: </h3></div></div></div>
                   10599: <p>The very first action in <code class="filename">bsd.prefs.mk</code>
1.81      rillig   10600:        is to define some essential variables like
                   10601:        <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and
                   10602:        <code class="varname">MACHINE_ARCH</code>.</p>
                   10603: <p>Then, the user settings are loaded from the file specified
1.110     hubertf  10604:        in <code class="varname">MAKECONF</code>, which is usually <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.
1.104     rillig   10605:        After that, those variables
1.81      rillig   10606:        that have not been overridden by the user are loaded from
                   10607:        <code class="filename">mk/defaults/mk.conf</code>.</p>
                   10608: <p>After the user settings, the system settings and platform
                   10609:        settings are loaded, which may override the user
                   10610:        settings.</p>
                   10611: <p>Then, the tool definitions are loaded. The tool wrappers
                   10612:        are not yet in effect. This only happens when building a
                   10613:        package, so the proper variables must be used instead of the
                   10614:        direct tool names.</p>
                   10615: <p>As the last steps, some essential variables from the
                   10616:        wrapper and the package system flavor are loaded, as well as the
                   10617:        variables that have been cached in earlier phases of a package
                   10618:        build.</p>
                   10619: </div>
1.148     asau     10620: <div class="sect2">
1.81      rillig   10621: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10622: <a name="infr.order.pkg"></a>25.6.2. The order in <code class="filename">bsd.pkg.mk</code>
1.93      rillig   10623: </h3></div></div></div>
1.81      rillig   10624: <p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p>
                   10625: <p>Then, the various <code class="filename">*-vars.mk</code> files are
                   10626:        loaded, which fill default values for those variables that have
1.93      rillig   10627:        not been defined by the package. These variables may later
1.81      rillig   10628:        be used even in unrelated files.</p>
                   10629: <p>Then, the file <code class="filename">bsd.pkg.error.mk</code>
                   10630:        provides the target <code class="literal">error-check</code> that is added
                   10631:        as a special dependency to all other targets that use
                   10632:        <code class="varname">DELAYED_ERROR_MSG</code> or
                   10633:        <code class="varname">DELAYED_WARNING_MSG</code>.</p>
                   10634: <p>Then, the package-specific hacks from
                   10635:        <code class="filename">hacks.mk</code> are included.</p>
                   10636: <p>Then, various other files follow. Most of them don't have
                   10637:        any dependencies on what they need to have included before or
                   10638:        after them, though some do.</p>
                   10639: <p>The code to check <code class="varname">PKG_FAIL_REASON</code> and
                   10640:        <code class="varname">PKG_SKIP_REASON</code> is then executed, which
                   10641:        restricts the use of these variables to all the files that have
                   10642:        been included before. Appearances in later files will be
                   10643:        silently ignored.</p>
                   10644: <p>Then, the files for the main targets are included, in the
                   10645:        order of later execution, though the actual order should not
                   10646:        matter.</p>
                   10647: <p>At last, some more files are included that don't set any
                   10648:        interesting variables but rather just define make targets to be
                   10649:        executed.</p>
                   10650: </div>
                   10651: </div>
1.75      rillig   10652: </div>
1.148     asau     10653: <div class="chapter">
1.75      rillig   10654: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   10655: <a name="regression"></a>Chapter 26. Regression tests</h2></div></div></div>
1.75      rillig   10656: <div class="toc">
                   10657: <p><b>Table of Contents</b></p>
1.210     leot     10658: <dl class="toc">
1.299     rillig   10659: <dt><span class="sect1"><a href="#regression.run">26.1. Running the regression tests</a></span></dt>
                   10660: <dt><span class="sect1"><a href="#regression.new">26.2. Adding a new regression test</a></span></dt>
1.75      rillig   10661: <dd><dl>
1.299     rillig   10662: <dt><span class="sect2"><a href="#regression.fun.override">26.2.1. Overridable functions</a></span></dt>
                   10663: <dt><span class="sect2"><a href="#regression.fun.helper">26.2.2. Helper functions</a></span></dt>
1.75      rillig   10664: </dl></dd>
                   10665: </dl>
                   10666: </div>
                   10667: <p>The pkgsrc infrastructure consists of a large codebase,
                   10668:        and there are many corners where every little bit of a file is
                   10669:        well thought out, making pkgsrc likely to fail as soon as
                   10670:        anything is changed near those parts. To prevent most changes
                   10671:        from breaking anything, a suite of regression tests should go
                   10672:        along with every important part of the pkgsrc infrastructure.
                   10673:        This chapter describes how regression tests work in pkgsrc and
                   10674:        how you can add new tests.</p>
1.148     asau     10675: <div class="sect1">
1.75      rillig   10676: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10677: <a name="regression.run"></a>26.1. Running the regression tests</h2></div></div></div>
1.322     leot     10678: <p>You first need to install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkg_regress/index.html" target="_top"><code class="filename">pkgtools/pkg_regress</code></a> package, which
1.110     hubertf  10679:        provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
1.75      rillig   10680:        can simply run that command, which will run all tests in the
1.283     rillig   10681:        <code class="filename">regress/</code> directory.</p>
1.75      rillig   10682: </div>
1.148     asau     10683: <div class="sect1">
1.75      rillig   10684: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10685: <a name="regression.new"></a>26.2. Adding a new regression test</h2></div></div></div>
1.283     rillig   10686: <p>Every directory in the <code class="filename">regress/</code>
                   10687:        directory that contains a file called <code class="filename">spec</code>
1.75      rillig   10688:        is considered a regression test. This file is a shell program
1.110     hubertf  10689:        that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
1.75      rillig   10690:        The following functions can be overridden to suit your
                   10691:        needs.</p>
1.148     asau     10692: <div class="sect2">
1.75      rillig   10693: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10694: <a name="regression.fun.override"></a>26.2.1. Overridable functions</h3></div></div></div>
1.218     rillig   10695: <p>These functions do not take any parameters. Although they
                   10696:        are called in <span class="quote">&#8220;<span class="quote">set -e</span>&#8221;</span> mode, they don't stop at the
1.289     leot     10697:        first failing command. See <a class="ulink" href="https://stackoverflow.com/q/4072984" target="_top">this Stack Overflow
1.218     rillig   10698:        question</a> for details.</p>
1.148     asau     10699: <div class="variablelist"><dl class="variablelist">
1.218     rillig   10700: <dt><span class="term"><code class="varname">do_setup</code></span></dt>
1.75      rillig   10701: <dd><p>This function prepares the environment for the
                   10702:        test. By default it does nothing.</p></dd>
1.218     rillig   10703: <dt><span class="term"><code class="varname">do_test</code></span></dt>
                   10704: <dd>
                   10705: <p>This function runs the actual test. By default,
1.75      rillig   10706:        it calls <code class="varname">TEST_MAKE</code> with the arguments
                   10707:        <code class="varname">MAKEARGS_TEST</code> and writes its output including
                   10708:        error messages into the file
1.218     rillig   10709:        <code class="varname">TEST_OUTFILE</code>.</p>
                   10710: <p>When defining this function, make sure that all output that
                   10711:        needs to be checked is written to the correct output file.
                   10712:        Example:</p>
                   10713: <pre class="programlisting">
                   10714: do_test() {
1.223     rillig   10715:         echo "Example output"
1.218     rillig   10716: } 1&gt;$TEST_OUTFILE 2&gt;&amp;1
                   10717: </pre>
                   10718: </dd>
                   10719: <dt><span class="term"><code class="varname">check_result</code></span></dt>
                   10720: <dd>
                   10721: <p>This function is run after the test and is
1.75      rillig   10722:        typically used to compare the actual output from the one that is
                   10723:        expected. It can make use of the various helper functions from
1.218     rillig   10724:        the next section. Example:</p>
                   10725: <pre class="programlisting">
                   10726: check_result() {
1.223     rillig   10727:         exit_status 0
                   10728:         output_require "Example"
                   10729:         output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
                   10730:         output_prohibit "no such file or directory"
1.283     rillig   10731:         regress_fail "expected $expected but got $actual for input $input"
1.218     rillig   10732: }
                   10733: </pre>
                   10734: </dd>
                   10735: <dt><span class="term"><code class="varname">do_cleanup</code></span></dt>
1.75      rillig   10736: <dd><p>This function cleans everything up after the
                   10737:        test has been run. By default it does nothing.</p></dd>
                   10738: </dl></div>
                   10739: </div>
1.148     asau     10740: <div class="sect2">
1.75      rillig   10741: <div class="titlepage"><div><div><h3 class="title">
1.299     rillig   10742: <a name="regression.fun.helper"></a>26.2.2. Helper functions</h3></div></div></div>
1.148     asau     10743: <div class="variablelist"><dl class="variablelist">
1.283     rillig   10744: <dt><span class="term"><code class="varname">regress_fail <em class="replaceable"><code>message...</code></em></code></span></dt>
                   10745: <dd><p>This function makes the test fail with the given error message.</p></dd>
1.218     rillig   10746: <dt><span class="term"><code class="varname">exit_status expected</code></span></dt>
1.75      rillig   10747: <dd><p>This function compares the exitcode of the
1.218     rillig   10748:        <span class="command"><strong>do_test</strong></span> function with its first parameter.
1.75      rillig   10749:        If they differ, the test will fail.</p></dd>
1.218     rillig   10750: <dt><span class="term"><code class="varname">output_require regex...</code></span></dt>
                   10751: <dd>
                   10752: <p>This function checks for each of its parameters
                   10753:        if the output from <span class="command"><strong>do_test</strong></span> matches the
1.75      rillig   10754:        extended regular expression. If it does not, the test will
1.218     rillig   10755:        fail. Example:</p>
                   10756: <pre class="programlisting">
1.219     rillig   10757: output_require "looks fine"
                   10758: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.218     rillig   10759: </pre>
                   10760: </dd>
1.292     leot     10761: <dt><span class="term"><code class="varname">output_prohibit regex...</code></span></dt>
1.75      rillig   10762: <dd><p>This function checks for each of its parameters
1.110     hubertf  10763:        if the output from <span class="command"><strong>do_test()</strong></span> does
1.75      rillig   10764:        <span class="emphasis"><em>not</em></span> match the extended regular expression.
                   10765:        If any of the regular expressions matches, the test will
                   10766:        fail.</p></dd>
                   10767: </dl></div>
                   10768: </div>
                   10769: </div>
                   10770: </div>
1.148     asau     10771: <div class="chapter">
1.75      rillig   10772: <div class="titlepage"><div><div><h2 class="title">
1.299     rillig   10773: <a name="porting"></a>Chapter 27. Porting pkgsrc</h2></div></div></div>
1.75      rillig   10774: <div class="toc">
                   10775: <p><b>Table of Contents</b></p>
1.299     rillig   10776: <dl class="toc"><dt><span class="sect1"><a href="#porting.opsys">27.1. Porting pkgsrc to a new operating system</a></span></dt></dl>
1.75      rillig   10777: </div>
                   10778: <p>The pkgsrc system has already been ported to many
                   10779:        operating systems, hardware architectures and compilers. This
                   10780:        chapter explains the necessary steps to make pkgsrc even more
                   10781:        portable.</p>
1.148     asau     10782: <div class="sect1">
1.75      rillig   10783: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299     rillig   10784: <a name="porting.opsys"></a>27.1. Porting pkgsrc to a new operating system</h2></div></div></div>
1.75      rillig   10785: <p>To port pkgsrc to a new operating system (called
                   10786:        <code class="literal">MyOS</code> in this example), you need to touch the
                   10787:        following files:</p>
1.148     asau     10788: <div class="variablelist"><dl class="variablelist">
1.93      rillig   10789: <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>
1.75      rillig   10790: <dd><p>This file contains some basic definitions, for
                   10791:        example the name of the C
                   10792:        compiler.</p></dd>
1.76      rillig   10793: <dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt>
1.75      rillig   10794: <dd><p>Insert code that defines the variables
                   10795:        <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>,
1.327     wiz      10796:        <code class="varname">OPSYS_VERSION</code>, <code class="varname">LOWER_VENDOR</code>,
1.75      rillig   10797:        <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>,
                   10798:        <code class="varname">APPEND_ELF</code>, and the other variables that
                   10799:        appear in this file.</p></dd>
1.93      rillig   10800: <dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75      rillig   10801: <dd><p>This file contains the platform-specific
                   10802:        definitions that are used by pkgsrc. Start by copying one of the
                   10803:        other files and edit it to your
                   10804:        needs.</p></dd>
1.93      rillig   10805: <dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75      rillig   10806: <dd><p>This file defines the paths to all the tools
                   10807:        that are needed by one or the other package in pkgsrc, as well
                   10808:        as by pkgsrc itself. Find out where these tools are on your
                   10809:        platform and add them.</p></dd>
                   10810: </dl></div>
                   10811: <p>Now, you should be able to build some basic packages, like
1.322     leot     10812:        <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/lang/perl5/index.html" target="_top"><code class="filename">lang/perl5</code></a>, <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/shells/bash/index.html" target="_top"><code class="filename">shells/bash</code></a>.</p>
1.75      rillig   10813: </div>
                   10814: </div>
                   10815: </div>
1.148     asau     10816: <div class="appendix">
                   10817: <div class="titlepage"><div><div><h1 class="title">
                   10818: <a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
1.75      rillig   10819: <div class="toc">
                   10820: <p><b>Table of Contents</b></p>
1.210     leot     10821: <dl class="toc">
1.75      rillig   10822: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
                   10823: <dd><dl>
                   10824: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
                   10825: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
                   10826: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.287     rillig   10827: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
1.75      rillig   10828: </dl></dd>
                   10829: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
                   10830: </dl>
                   10831: </div>
                   10832: <p>We checked to find a piece of software that wasn't in the packages
                   10833:     collection, and picked GNU bison. Quite why someone would want to have
1.110     hubertf  10834:     <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
1.75      rillig   10835:     present in the tree is beyond us, but it's useful for the purposes of
                   10836:     this exercise.</p>
1.148     asau     10837: <div class="sect1">
1.75      rillig   10838: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   10839: <a name="example-files"></a>A.1. files</h2></div></div></div>
1.148     asau     10840: <div class="sect2">
1.75      rillig   10841: <div class="titlepage"><div><div><h3 class="title">
                   10842: <a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
                   10843: <pre class="programlisting">
1.100     rillig   10844: # $NetBSD$
                   10845: #
1.1       grant    10846: 
1.100     rillig   10847: DISTNAME=       bison-1.25
                   10848: CATEGORIES=     devel
1.286     rillig   10849: MASTER_SITES=   ${MASTER_SITE_GNU:=bison/}
1.1       grant    10850: 
1.136     dholland 10851: MAINTAINER=     pkgsrc-users@NetBSD.org
1.289     leot     10852: HOMEPAGE=       https://www.gnu.org/software/bison/bison.html
1.100     rillig   10853: COMMENT=        GNU yacc clone
1.1       grant    10854: 
1.100     rillig   10855: GNU_CONFIGURE=  yes
1.152     wiz      10856: INFO_FILES=     yes
1.1       grant    10857: 
1.100     rillig   10858: .include "../../mk/bsd.pkg.mk"
1.1       grant    10859: </pre>
1.75      rillig   10860: </div>
1.148     asau     10861: <div class="sect2">
1.75      rillig   10862: <div class="titlepage"><div><div><h3 class="title">
                   10863: <a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
                   10864: <pre class="programlisting">
1.100     rillig   10865: GNU version of yacc.  Can make re-entrant parsers, and numerous other
1.322     leot     10866: improvements.  Why you would want this when Berkeley <a class="citerefentry" href="https://man.NetBSD.org/NetBSD-9.2/i386/yacc.1"><span class="citerefentry"><span class="refentrytitle">yacc</span>(1)</span></a> is part
1.100     rillig   10867: of the NetBSD source tree is beyond me.
1.1       grant    10868: </pre>
1.75      rillig   10869: </div>
1.148     asau     10870: <div class="sect2">
1.75      rillig   10871: <div class="titlepage"><div><div><h3 class="title">
                   10872: <a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
                   10873: <pre class="programlisting">
1.100     rillig   10874: @comment $NetBSD$
                   10875: bin/bison
                   10876: man/man1/bison.1.gz
                   10877: share/bison.simple
                   10878: share/bison.hairy
1.1       grant    10879: </pre>
1.75      rillig   10880: </div>
1.148     asau     10881: <div class="sect2">
1.75      rillig   10882: <div class="titlepage"><div><div><h3 class="title">
1.287     rillig   10883: <a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with pkglint</h3></div></div></div>
1.75      rillig   10884: <p>The NetBSD package system comes with
1.322     leot     10885:         <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/pkgtools/pkglint/index.html" target="_top"><code class="filename">pkgtools/pkglint</code></a>
1.75      rillig   10886:        which helps to check the contents of these
                   10887:        files. After installation it is quite easy to use, just change to the
1.286     rillig   10888:        directory of the package you wish to examine and run
1.110     hubertf  10889:        <span class="command"><strong>pkglint</strong></span>:</p>
1.75      rillig   10890: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
1.286     rillig   10891: ERROR: Makefile: Each package must define its LICENSE.
                   10892: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
                   10893: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
                   10894: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
                   10895: 1 error, 2 warnings and 1 note found.
                   10896: (Run "pkglint -e" to show explanations.)
                   10897: (Run "pkglint -fs" to show what can be fixed automatically.)
1.287     rillig   10898: (Run "pkglint -F" to automatically fix some issues.)</pre>
1.75      rillig   10899: <p>Depending on the supplied command line arguments (see pkglint(1)),
1.285     rillig   10900:        more checks will be performed. Use e.g. <span class="command"><strong>pkglint
1.75      rillig   10901:        -Wall</strong></span> for a very thorough check.</p>
                   10902: </div>
                   10903: </div>
1.148     asau     10904: <div class="sect1">
1.75      rillig   10905: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   10906: <a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
                   10907: <p>Create the directory where the package lives,
                   10908:       plus any auxiliary directories:</p>
                   10909: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10910: <code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
                   10911: <code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
                   10912: <code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
1.76      rillig   10913: <p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
1.299     rillig   10914:       <code class="filename">PLIST</code> (see <a class="xref" href="#components" title="Chapter 12. Package components - files, directories and contents">Chapter 12, <i>Package components - files, directories and contents</i></a>)
1.75      rillig   10915:       then continue with fetching the distfile:</p>
                   10916: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
1.1       grant    10917: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10918: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10919: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10920: ftp: Error retrieving file: 500 Internal error
                   10921: 
                   10922: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10923: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10924: ftp: Error retrieving file: 500 Internal error
                   10925: 
                   10926: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10927: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1.75      rillig   10928: Successfully retrieved file.</pre>
                   10929: <p>Generate the checksum of the distfile into
1.76      rillig   10930:       <code class="filename">distinfo</code>:</p>
1.88      wiz      10931: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
1.75      rillig   10932: <p>Now compile:</p>
                   10933: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
1.1       grant    10934: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10935: ===&gt;  Extracting for bison-1.25
                   10936: ===&gt;  Patching for bison-1.25
                   10937: ===&gt;   Ignoring empty patch directory
                   10938: ===&gt;  Configuring for bison-1.25
                   10939: creating cache ./config.cache
                   10940: checking for gcc... cc
                   10941: checking whether we are using GNU C... yes
                   10942: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10943: checking how to run the C preprocessor... cc -E
                   10944: checking for minix/config.h... no
                   10945: checking for POSIXized ISC... no
                   10946: checking whether cross-compiling... no
                   10947: checking for ANSI C header files... yes
                   10948: checking for string.h... yes
                   10949: checking for stdlib.h... yes
                   10950: checking for memory.h... yes
                   10951: checking for working const... yes
                   10952: checking for working alloca.h... no
                   10953: checking for alloca... yes
                   10954: checking for strerror... yes
                   10955: updating cache ./config.cache
                   10956: creating ./config.status
                   10957: creating Makefile
                   10958: ===&gt;  Building for bison-1.25
                   10959: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g LR0.c
                   10960: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g allocate.c
                   10961: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g closure.c
                   10962: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g conflicts.c
                   10963: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g derives.c
1.68      rillig   10964: 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
1.1       grant    10965: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g getargs.c
                   10966: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g gram.c
                   10967: 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
                   10968: 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
                   10969: 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
                   10970: 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
                   10971: 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
                   10972: 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
                   10973: 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
                   10974: 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
                   10975: 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
                   10976: 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
                   10977: 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
                   10978: 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
                   10979: 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
                   10980: 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
                   10981: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10982: rm -f bison.s1
1.75      rillig   10983: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1</pre>
                   10984: <p>Everything seems OK, so install the files:</p>
                   10985: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
1.1       grant    10986: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10987: ===&gt;  Installing for bison-1.25
                   10988: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10989: rm -f /usr/pkg/bin/bison
                   10990: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10991: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10992: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10993: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10994: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10995: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10996: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
1.75      rillig   10997: ===&gt;  Registering installation for bison-1.25</pre>
                   10998: <p>You can now use bison, and also - if you decide so - remove it with
1.110     hubertf  10999:       <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
1.75      rillig   11000:       binary package, do this now:</p>
                   11001: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
1.1       grant    11002: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11003: ===&gt;  Building package for bison-1.25
                   11004: Creating package bison-1.25.tgz
                   11005: Registering depends:.
1.75      rillig   11006: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
                   11007: <p>Now that you don't need the source and object files
                   11008:       any more, clean up:</p>
                   11009: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make clean</code></strong>
                   11010: ===&gt;  Cleaning for bison-1.25</pre>
                   11011: </div>
                   11012: </div>
1.148     asau     11013: <div class="appendix">
                   11014: <div class="titlepage"><div><div><h1 class="title">
1.322     leot     11015: <a name="hardening"></a>Appendix B. Security hardening</h1></div></div></div>
1.75      rillig   11016: <div class="toc">
                   11017: <p><b>Table of Contents</b></p>
1.210     leot     11018: <dl class="toc">
1.322     leot     11019: <dt><span class="sect1"><a href="#hardening.mechanisms">B.1. Mechanisms</a></span></dt>
                   11020: <dd><dl>
                   11021: <dt><span class="sect2"><a href="#hardening.mechanisms.enabled">B.1.1. Enabled by default</a></span></dt>
                   11022: <dt><span class="sect2"><a href="#hardening.mechanisms.disabled">B.1.2. Not enabled by default</a></span></dt>
                   11023: </dl></dd>
                   11024: <dt><span class="sect1"><a href="#hardening.caveats">B.2. Caveats</a></span></dt>
                   11025: <dd><dl>
                   11026: <dt><span class="sect2"><a href="#hardening.caveats.pie">B.2.1. Problems with PKGSRC_MKPIE</a></span></dt>
                   11027: <dt><span class="sect2"><a href="#hardening.caveats.fortify">B.2.2. Problems with PKGSRC_USE_FORTIFY</a></span></dt>
                   11028: <dt><span class="sect2"><a href="#hardening.caveats.relro">B.2.3. Problems with PKGSRC_USE_RELRO</a></span></dt>
                   11029: <dt><span class="sect2"><a href="#hardening.caveats.ssp">B.2.4. Problems with PKGSRC_USE_SSP</a></span></dt>
                   11030: </dl></dd>
                   11031: <dt><span class="sect1"><a href="#hardening.audit">B.3. Auditing the system</a></span></dt>
                   11032: <dd><dl>
                   11033: <dt><span class="sect2"><a href="#hardening.audit.pie">B.3.1. Checking for PIE</a></span></dt>
                   11034: <dt><span class="sect2"><a href="#hardening.audit.relropartial">B.3.2. Checking for partial RELRO</a></span></dt>
                   11035: <dt><span class="sect2"><a href="#hardening.audit.relrofull">B.3.3. Checking for full RELRO</a></span></dt>
                   11036: <dt><span class="sect2"><a href="#hardening.audit.ssp">B.3.4. Checking for SSP</a></span></dt>
                   11037: </dl></dd>
1.75      rillig   11038: </dl>
                   11039: </div>
1.322     leot     11040: <p>
                   11041: A number of mechanisms are available in pkgsrc to improve the security of the
                   11042: resulting system. This page describes the mechanisms, and gives hints
                   11043: about detecting and fixing problems.
                   11044: </p>
                   11045: <p>
                   11046: Mechanisms can be enabled individually in
                   11047: <code class="filename">mk.conf</code>, and are
                   11048: individually described below.
                   11049: </p>
                   11050: <p>
                   11051: Typically, a feature will cause some programs to fail to build or work
                   11052: when first enabled. This can be due to latent problems in the
                   11053: program, and can be due to other reasons. After enough testing to
                   11054: have confidence that user problems will be quite rare, individual
                   11055: mechanisms will be enabled by default.
                   11056: </p>
                   11057: <p>
                   11058: For each mechanism, see the Caveats section below for an explanation
                   11059: of what might go wrong at compile time and at run time, and how to
                   11060: notice and address these problems.
                   11061: </p>
1.148     asau     11062: <div class="sect1">
1.75      rillig   11063: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322     leot     11064: <a name="hardening.mechanisms"></a>B.1. Mechanisms</h2></div></div></div>
                   11065: <div class="sect2">
                   11066: <div class="titlepage"><div><div><h3 class="title">
                   11067: <a name="hardening.mechanisms.enabled"></a>B.1.1. Enabled by default</h3></div></div></div>
                   11068: <div class="sect3">
                   11069: <div class="titlepage"><div><div><h4 class="title">
                   11070: <a name="hardening.mechanisms.enabled.fortify"></a>B.1.1.1. PKGSRC_USE_FORTIFY</h4></div></div></div>
                   11071: <p>
                   11072: This allows substitute wrappers to be used for some commonly used
                   11073: library functions that do not have built-in bounds checking - but
                   11074: could in some cases.
                   11075: </p>
                   11076: <p>
                   11077: Two mitigation levels are available:
                   11078: </p>
                   11079: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   11080: <li class="listitem"><p>"weak" only enables checks at compile-time.</p></li>
                   11081: <li class="listitem"><p>"strong" enables checks at compile-time and runtime.</p></li>
                   11082: </ul></div>
                   11083: <p>
                   11084: "strong" has been enabled by default since pkgsrc-2017Q3.
                   11085: </p>
                   11086: </div>
                   11087: <div class="sect3">
                   11088: <div class="titlepage"><div><div><h4 class="title">
                   11089: <a name="hardening.mechanisms.enabled.ssp"></a>B.1.1.2. PKGSRC_USE_SSP</h4></div></div></div>
                   11090: <p>
                   11091: This enables a stack-smashing protection mitigation. It is done by adding a
                   11092: guard variable to functions with vulnerable objects. The guards are initialized
                   11093: when a function is entered and then checked when the function exits. The guard
                   11094: check will fail and the program forcibly exited if the variable was modified in
                   11095: the meantime. This can happen in case of buffer overflows or memory corruption,
                   11096: and therefore exposing these bugs.
                   11097: </p>
                   11098: <p>
                   11099: Different mitigation levels are available:
                   11100: </p>
                   11101: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   11102: <li class="listitem"><p>"yes", which will only protect functions considered vulnerable
                   11103: by the compiler;</p></li>
                   11104: <li class="listitem"><p>"all", which will protect every function;</p></li>
                   11105: <li class="listitem"><p>"strong", the default, which will apply a better balance between the
                   11106: two settings above.</p></li>
                   11107: </ul></div>
                   11108: <p>
                   11109: This mitigation is supported by both GCC and clang. It may be supported in
                   11110: additional compilers, possibly under a different name. It is particularly useful
                   11111: for unsafe programming languages, such as C/C++.
                   11112: </p>
                   11113: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   11114: <li class="listitem"><p>"yes" is enabled by default where known supported since pkgsrc-2017Q3.</p></li>
                   11115: <li class="listitem"><p>"strong" is enabled by default where known supported since pkgsrc-2021Q4.</p></li>
                   11116: </ul></div>
                   11117: <p>More details can be found here:</p>
                   11118: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                   11119: <a class="ulink" href="https://en.wikipedia.org/wiki/Buffer_overflow_protection" target="_top">Buffer overflow protection on Wikipedia</a>
                   11120: </p></li></ul></div>
                   11121: </div>
                   11122: <div class="sect3">
                   11123: <div class="titlepage"><div><div><h4 class="title">
                   11124: <a name="hardening.mechanisms.enabled.pie"></a>B.1.1.3. PKGSRC_MKPIE</h4></div></div></div>
                   11125: <p>
                   11126: This requests the creation of PIE (Position Independent Executables) for all
                   11127: executables. The PIE mechanism is normally used for shared libraries, so that
                   11128: they can be loaded at differing addresses at runtime. PIE itself does not have
                   11129: useful security properties; however, it is necessary to fully leverage some,
                   11130: such as ASLR.  Some operating systems support Address Space Layout Randomization
                   11131: (ASLR), which causes different addresses to be used each time a program is run.
                   11132: This makes it more difficult for an attacker to guess addresses and thus makes
                   11133: exploits harder to construct. With PIE, ASLR can really be applied to the entire
                   11134: program, instead of the stack and heap only.
                   11135: </p>
                   11136: <p>
                   11137: PIE executables will only be built for toolchains that are known to support PIE.
                   11138: Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
                   11139: </p>
                   11140: <p>
                   11141: <code class="varname">PKGSRC_MKPIE</code> was enabled by default after the pkgsrc-2021Q3 branch.
                   11142: </p>
1.75      rillig   11143: </div>
1.325     gutterid 11144: <div class="sect3">
                   11145: <div class="titlepage"><div><div><h4 class="title">
1.334     nia      11146: <a name="hardening.mechanisms.enabled.relro"></a>B.1.1.4. PKGSRC_USE_RELRO</h4></div></div></div>
1.322     leot     11147: <p>
                   11148: This also makes the exploitation of some security vulnerabilities more
                   11149: difficult in some cases.
                   11150: </p>
                   11151: <p>Two different mitigation levels are available:</p>
                   11152: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   11153: <li class="listitem"><p>
1.334     nia      11154: partial (the default): the ELF sections are reordered so that internal data sections
1.322     leot     11155: precede the program's own data sections, and non-PLT GOT is read-only;
                   11156: </p></li>
                   11157: <li class="listitem"><p>
                   11158: full: in addition to partial RELRO, every relocation is performed immediately
1.333     nia      11159: when starting the program, allowing the entire GOT to be read-only.  This
                   11160: can greatly slow down startup of large programs.
1.322     leot     11161: </p></li>
                   11162: </ul></div>
                   11163: <p>
                   11164: This is currently supported by GCC. Many software distributions now enable this
1.335     nia      11165: feature by default, at the "partial" level.
1.322     leot     11166: </p>
                   11167: <p>
                   11168: More details can be found here:
                   11169: </p>
                   11170: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                   11171: <a class="ulink" href="https://www.redhat.com/en/blog/hardening-elf-binaries-using-relocation-read-only-relro" target="_top">Hardening ELF binaries using Relocation Read-Only (RELRO)</a>
                   11172: </p></li></ul></div>
1.75      rillig   11173: </div>
1.334     nia      11174: </div>
                   11175: <div class="sect2">
                   11176: <div class="titlepage"><div><div><h3 class="title">
                   11177: <a name="hardening.mechanisms.disabled"></a>B.1.2. Not enabled by default</h3></div></div></div>
                   11178: <div class="sect3">
                   11179: <div class="titlepage"><div><div><h4 class="title">
                   11180: <a name="hardening.mechanisms.disabled.repro"></a>B.1.2.1. PKGSRC_MKREPRO</h4></div></div></div>
                   11181: <p>
                   11182: With this option, pkgsrc will try to build packages reproducibly. This allows
                   11183: packages built from the same tree and with the same options, to produce
                   11184: identical results bit by bit. This option should be combined with ASLR and
                   11185: <code class="varname">PKGSRC_MKPIE</code> to avoid predictable address offsets for
                   11186: attackers attempting to exploit security vulnerabilities.
                   11187: </p>
                   11188: <p>
                   11189: More details can be found here:
                   11190: </p>
                   11191: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
                   11192: <a class="ulink" href="https://reproducible-builds.org/" target="_top">Reproducible Builds - a set of software development practices that create an independently-verifiable path from source to binary code</a>
                   11193: </p></li></ul></div>
                   11194: <p>
                   11195: More work likely needs to be done before pkgsrc is fully reproducible.
                   11196: </p>
                   11197: </div>
1.322     leot     11198: <div class="sect3">
                   11199: <div class="titlepage"><div><div><h4 class="title">
1.334     nia      11200: <a name="hardening.mechanisms.disabled.stackcheck"></a>B.1.2.2. PKGSRC_USE_STACK_CHECK</h4></div></div></div>
1.322     leot     11201: <p>
                   11202: This uses <code class="literal">-fstack-check</code> with GCC for
                   11203: another stack protection mitigation.
                   11204: </p>
                   11205: <p>
                   11206: It asks the compiler to generate code verifying that it does not corrupt the
                   11207: stack. According to GCC's manual page, this is really only useful for
                   11208: multi-threaded programs.
                   11209: </p>
1.76      rillig   11210: </div>
                   11211: </div>
                   11212: </div>
1.148     asau     11213: <div class="sect1">
1.76      rillig   11214: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322     leot     11215: <a name="hardening.caveats"></a>B.2. Caveats</h2></div></div></div>
                   11216: <div class="sect2">
                   11217: <div class="titlepage"><div><div><h3 class="title">
                   11218: <a name="hardening.caveats.pie"></a>B.2.1. Problems with PKGSRC_MKPIE</h3></div></div></div>
                   11219: <div class="sect3">
                   11220: <div class="titlepage"><div><div><h4 class="title">
                   11221: <a name="hardening.caveats.pie.build"></a>B.2.1.1. Packages failing to build</h4></div></div></div>
                   11222: <p>
                   11223: A number of packages may fail to build with this option enabled. The
                   11224: failures are often related to the absence of the <code class="literal">-fPIC</code>
                   11225: compilation flag when building libraries or executables (or ideally
                   11226: <code class="literal">-fPIE</code> in the latter case). This flag is added to the
                   11227: <code class="varname">CFLAGS</code> already, but requires the package to
                   11228: actually support it.
                   11229: </p>
                   11230: <div class="sect4">
                   11231: <div class="titlepage"><div><div><h5 class="title">
                   11232: <a name="hardening.caveats.pie.build.fix"></a>B.2.1.1.1. How to fix</h5></div></div></div>
                   11233: <p>
                   11234: These instructions are meant as a reference only; they likely need to be adapted
                   11235: for many packages individually.
                   11236: </p>
                   11237: <p>
                   11238: For packages using <code class="filename">Makefiles</code>:
                   11239: </p>
                   11240: <pre class="programlisting">
                   11241: MAKE_FLAGS+=   CFLAGS=${CFLAGS:Q}
                   11242: MAKE_FLAGS+=   LDFLAGS=${LDFLAGS:Q}
                   11243: </pre>
                   11244: <p>
                   11245: For packages using <code class="filename">Imakefiles</code>:
                   11246: </p>
                   11247: <pre class="programlisting">
                   11248: MAKE_FLAGS+=   CCOPTIONS=${CFLAGS:Q}
                   11249: MAKE_FLAGS+=   LOCAL_LDFLAGS=${LDFLAGS:Q}
                   11250: </pre>
                   11251: </div>
                   11252: </div>
                   11253: <div class="sect3">
                   11254: <div class="titlepage"><div><div><h4 class="title">
                   11255: <a name="hardening.caveats.pie.crash"></a>B.2.1.2. Run-time crashes</h4></div></div></div>
                   11256: <p>
                   11257: Some programs may fail to run, or crash at random times once built as PIE. Two
                   11258: scenarios are essentially possible. This is nearly always due to a bug in
                   11259: the program being exposed due to ASLR.
                   11260: </p>
                   11261: </div>
                   11262: <div class="sect3">
                   11263: <div class="titlepage"><div><div><h4 class="title">
                   11264: <a name="hardening.caveats.pie.disable"></a>B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis</h4></div></div></div>
                   11265: <p>
                   11266: Ideally, packages should be fixed for compatibility with MKPIE.
                   11267: However, in some cases this is very difficult, due to complex build systems,
                   11268: packages using non-standard toolchains, or programming languages with odd
                   11269: bootstrapping mechanisms.
                   11270: </p>
                   11271: <p>
                   11272: To disable <code class="varname">PKGSRC_MKPIE</code> on a per-package basis, set
                   11273: <code class="varname">MKPIE_SUPPORTED= no</code> in the package's Makefile before
                   11274: <code class="filename">bsd.prefs.mk</code> is included.
                   11275: </p>
                   11276: </div>
                   11277: </div>
                   11278: <div class="sect2">
                   11279: <div class="titlepage"><div><div><h3 class="title">
                   11280: <a name="hardening.caveats.fortify"></a>B.2.2. Problems with PKGSRC_USE_FORTIFY</h3></div></div></div>
                   11281: <div class="sect3">
                   11282: <div class="titlepage"><div><div><h4 class="title">
                   11283: <a name="hardening.caveats.fortify.build"></a>B.2.2.1. Packages failing to build</h4></div></div></div>
                   11284: <p>
                   11285: This feature makes use of pre-processing directives to look for hardened,
                   11286: alternative implementations of essential library calls. Some programs may fail
                   11287: to build as a result; this usually happens for those trying too hard to be
                   11288: portable, or otherwise abusing definitions in the standard library.
                   11289: </p>
                   11290: </div>
                   11291: <div class="sect3">
                   11292: <div class="titlepage"><div><div><h4 class="title">
                   11293: <a name="hardening.caveats.fortify.crash"></a>B.2.2.2. Run-time crashes</h4></div></div></div>
                   11294: <p>
                   11295: This feature may cause some programs to crash, usually indicating an
                   11296: actual bug in the program. The fix will typically involve patching the
                   11297: original program's source code.
                   11298: </p>
                   11299: </div>
                   11300: <div class="sect3">
                   11301: <div class="titlepage"><div><div><h4 class="title">
                   11302: <a name="hardening.caveats.fortify.opt"></a>B.2.2.3. Optimization is required</h4></div></div></div>
                   11303: <p>
                   11304: At least in the case of GCC, FORTIFY will only be applied if optimization is
                   11305: applied while compiling. This means that the <code class="varname">CFLAGS</code> should
                   11306: also contain <code class="literal">-O</code>, <code class="literal">-O2</code> or another
                   11307: optimization level. This cannot easily be applied globally, as some packages
                   11308: may require specific optimization levels.
                   11309: </p>
                   11310: </div>
                   11311: <div class="sect3">
                   11312: <div class="titlepage"><div><div><h4 class="title">
                   11313: <a name="hardening.caveats.fortify.disable"></a>B.2.2.4. Disabling FORTIFY on a per-package basis</h4></div></div></div>
                   11314: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   11315: <h3 class="title">Note</h3>
                   11316: <p>FORTIFY should not be disabled to work around runtime crashes in
                   11317: the program!  This is a very bad idea and will expose you to security
                   11318: vulnerabilities.
                   11319: </p>
                   11320: </div>
                   11321: <p>
                   11322: To disable FORTIFY on a per-package basis, set the following
                   11323: in the package's <code class="filename">Makefile</code>
                   11324: before <code class="filename">bsd.prefs.mk</code> is included:
                   11325: </p>
                   11326: <pre class="programlisting">
                   11327: FORTIFY_SUPPORTED=     no
                   11328: </pre>
                   11329: </div>
                   11330: </div>
                   11331: <div class="sect2">
                   11332: <div class="titlepage"><div><div><h3 class="title">
                   11333: <a name="hardening.caveats.relro"></a>B.2.3. Problems with PKGSRC_USE_RELRO</h3></div></div></div>
                   11334: <div class="sect3">
                   11335: <div class="titlepage"><div><div><h4 class="title">
                   11336: <a name="hardening.caveats.relro.performance"></a>B.2.3.1. Performance impact</h4></div></div></div>
                   11337: <p>
                   11338: For better protection, full RELRO requires every symbol to be resolved when the
                   11339: program starts, rather than simply when required at run-time. This will have
                   11340: more impact on programs using a lot of symbols, or linked to libraries exposing
                   11341: a lot of symbols. Therefore, daemons or programs otherwise running in
                   11342: background are affected only when started. Programs loading plug-ins at
                   11343: run-time are affected when loading the plug-ins.
                   11344: </p>
                   11345: <p>
                   11346: The impact is not expected to be noticeable on modern hardware, except in some
                   11347: cases for big programs.
                   11348: </p>
                   11349: </div>
                   11350: <div class="sect3">
                   11351: <div class="titlepage"><div><div><h4 class="title">
                   11352: <a name="hardening.caveats.relro.crash"></a>B.2.3.2. Run-time crashes</h4></div></div></div>
                   11353: <p>
                   11354: Some programs handle plug-ins and dependencies in a way that conflicts with
                   11355: RELRO: for instance, with an initialization routine listing any other plug-in
                   11356: required. With full RELRO, the missing symbols are resolved before the
                   11357: initialization routine can run, and the dynamic loader will not be able to find
                   11358: them directly and abort as a result. Unfortunately, this is how Xorg loads its
                   11359: drivers. Partial RELRO can be applied instead in this case.
                   11360: </p>
                   11361: </div>
                   11362: <div class="sect3">
                   11363: <div class="titlepage"><div><div><h4 class="title">
                   11364: <a name="hardening.caveats.relro.disable"></a>B.2.3.3. Disabling RELRO on a per-package basis</h4></div></div></div>
                   11365: <p>
                   11366: To disable RELRO on a per-package basis, set the following
                   11367: in the package's <code class="filename">Makefile</code>
                   11368: before <code class="filename">bsd.prefs.mk</code> is included:
                   11369: </p>
                   11370: <pre class="programlisting">
                   11371: RELRO_SUPPORTED=       no
                   11372: </pre>
1.324     nia      11373: <p>
                   11374: It is also possible to at most enable partial RELRO, by
                   11375: setting <code class="varname">RELRO_SUPPORTED</code> to <code class="literal">partial</code>.
                   11376: </p>
1.322     leot     11377: </div>
                   11378: </div>
                   11379: <div class="sect2">
                   11380: <div class="titlepage"><div><div><h3 class="title">
                   11381: <a name="hardening.caveats.ssp"></a>B.2.4. Problems with PKGSRC_USE_SSP</h3></div></div></div>
                   11382: <div class="sect3">
                   11383: <div class="titlepage"><div><div><h4 class="title">
                   11384: <a name="hardening.caveats.ssp.build"></a>B.2.4.1. Packages failing to build</h4></div></div></div>
                   11385: <p>
                   11386: The stack-smashing protection provided by this option does not work for some
                   11387: programs. The most common situation in which this happens is when the program
                   11388: allocates variables on the stack, with the size determined at run-time.
                   11389: </p>
                   11390: </div>
                   11391: <div class="sect3">
                   11392: <div class="titlepage"><div><div><h4 class="title">
                   11393: <a name="hardening.caveats.ssp.crash"></a>B.2.4.2. Run-time crashes</h4></div></div></div>
                   11394: <p>
                   11395: Again, this feature may cause some programs to crash via a
                   11396: <code class="varname">SIGABRT</code>, usually indicating an actual bug in the program.
                   11397: </p>
                   11398: <p>
                   11399: On NetBSD <code class="varname">LOG_CRIT</code> level syslog
                   11400: messages are sent and - by default -
                   11401: appended to <code class="filename">/var/log/messages</code>, e.g.:
                   11402: </p>
                   11403: <pre class="programlisting">
                   11404: Jan  6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
                   11405: </pre>
                   11406: <p>
                   11407: (where <code class="literal">hostname</code> is the hostname(1) and
                   11408: <code class="literal">program</code> is the basename(1) of the program crashed).
                   11409: </p>
                   11410: <p>
                   11411: Patching the original program is then required.
                   11412: </p>
                   11413: <p>
                   11414: Rebuilding the package via:
                   11415: </p>
                   11416: <pre class="programlisting">
                   11417: <strong class="userinput"><code>% env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace</code></strong>
                   11418: </pre>
                   11419: <p>
                   11420: and inspecting the backtrace of the coredump via the debugger
                   11421: should point out the problematic call by inspecting the frame
                   11422: calling the _chk() (SSP) function.
                   11423: </p>
                   11424: </div>
                   11425: <div class="sect3">
                   11426: <div class="titlepage"><div><div><h4 class="title">
                   11427: <a name="hardening.caveats.ssp.performance"></a>B.2.4.3. Performance impact</h4></div></div></div>
                   11428: <p>
                   11429: The compiler emits extra code when using this feature: a check for buffer
                   11430: overflows is performed when entering and exiting functions, requiring an extra
                   11431: variable on the stack. The level of protection can otherwise be adjusted to
                   11432: affect only those functions considered more sensitive by the compiler (with
                   11433: -fstack-protector instead of -fstack-protector-all).
                   11434: </p>
                   11435: <p>
                   11436: The impact is not expected to be noticeable on modern hardware. However,
                   11437: programs with a hard requirement to run at the fastest possible speed should
                   11438: avoid using this feature, or using libraries built with this feature.
                   11439: </p>
                   11440: </div>
                   11441: <div class="sect3">
                   11442: <div class="titlepage"><div><div><h4 class="title">
                   11443: <a name="hardening.caveats.ssp.disable"></a>B.2.4.4. Disabling SSP on a per-package basis</h4></div></div></div>
                   11444: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   11445: <h3 class="title">Note</h3>
                   11446: <p>SSP should not be disabled to work around runtime crashes in
                   11447: the program!  This is a very bad idea and will expose you to security
                   11448: vulnerabilities.</p>
                   11449: </div>
                   11450: <p>
                   11451: To disable SSP on a per-package basis, set the following
                   11452: in the package's <code class="filename">Makefile</code>
                   11453: before <code class="filename">bsd.prefs.mk</code> is included:
                   11454: </p>
                   11455: <pre class="programlisting">
                   11456: SSP_SUPPORTED= no
                   11457: </pre>
                   11458: </div>
                   11459: </div>
                   11460: </div>
                   11461: <div class="sect1">
                   11462: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11463: <a name="hardening.audit"></a>B.3. Auditing the system</h2></div></div></div>
                   11464: <p>
                   11465: The illusion of security is worse than having no security at all. This section
                   11466: lists a number of ways to ensure the security features requested are actually
                   11467: effective.
                   11468: </p>
                   11469: <p>
                   11470: These instructions were obtained and tested on a system derived from NetBSD 7
                   11471: (amd64). YMMV.
                   11472: </p>
                   11473: <div class="sect2">
                   11474: <div class="titlepage"><div><div><h3 class="title">
                   11475: <a name="hardening.audit.pie"></a>B.3.1. Checking for PIE</h3></div></div></div>
                   11476: <p>
                   11477: The ELF executable type in use changes for binaries built as PIE; without:
                   11478: </p>
                   11479: <pre class="programlisting">
                   11480: <strong class="userinput"><code>$ file /path/to/bin/ary</code></strong>
                   11481: /path/to/bin/ary: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
                   11482: </pre>
                   11483: <p>as opposed to the following binary, built as PIE:</p>
                   11484: <pre class="programlisting">
                   11485: <strong class="userinput"><code>$ file /path/to/pie/bin/ary</code></strong>
                   11486: /path/to/pie/bin/ary: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 7.0, not stripped
                   11487: </pre>
                   11488: <p>
                   11489: The latter result is then what is expected.
                   11490: </p>
                   11491: </div>
                   11492: <div class="sect2">
                   11493: <div class="titlepage"><div><div><h3 class="title">
                   11494: <a name="hardening.audit.relropartial"></a>B.3.2. Checking for partial RELRO</h3></div></div></div>
                   11495: <p>
                   11496: The following command should list a section called RELRO:
                   11497: </p>
                   11498: <pre class="programlisting">
                   11499: <strong class="userinput"><code>$ objdump -p /path/to/bin/ary</code></strong>
                   11500: 
                   11501: /path/to/bin/ary:     file format elf64-x86-64
                   11502: 
                   11503: Program Header:
                   11504: [...]
                   11505:    RELRO off    0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
                   11506: </pre>
                   11507: <p>
                   11508: This check is now performed automatically if
                   11509: <code class="varname">PKG_DEVELOPER</code> is set and RELRO is enabled.
                   11510: </p>
                   11511: </div>
                   11512: <div class="sect2">
                   11513: <div class="titlepage"><div><div><h3 class="title">
                   11514: <a name="hardening.audit.relrofull"></a>B.3.3. Checking for full RELRO</h3></div></div></div>
                   11515: <p>
                   11516: The dynamic loader will apply RELRO immediately when detecting the presence of
                   11517: the <code class="varname">BIND_NOW</code> flag:
                   11518: </p>
                   11519: <pre class="programlisting">
                   11520: <strong class="userinput"><code>$ objdump -x /path/to/bin/ary</code></strong>
                   11521: 
                   11522: /path/to/bin/ary:     file format elf64-x86-64
                   11523: 
                   11524: Dynamic Section:
                   11525: [...]
                   11526:   BIND_NOW             0x0000000000000000
                   11527: </pre>
                   11528: <p>
                   11529: This has to be combined with partial RELRO (see above) to be fully efficient.
                   11530: </p>
                   11531: <p>
                   11532: This check is now performed automatically (where supported) if
                   11533: <code class="varname">PKG_DEVELOPER</code> is set.
                   11534: </p>
                   11535: </div>
                   11536: <div class="sect2">
                   11537: <div class="titlepage"><div><div><h3 class="title">
                   11538: <a name="hardening.audit.ssp"></a>B.3.4. Checking for SSP</h3></div></div></div>
1.323     nia      11539: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
                   11540: <h3 class="title">Note</h3>
                   11541: <p>
                   11542: Checking for SSP using this method only works where the operating system
                   11543: uses <code class="literal">libssp</code>. <code class="literal">libssp</code> is not used
                   11544: on recent NetBSD/FreeBSD/Linux versions.
                   11545: </p>
                   11546: </div>
1.322     leot     11547: <p>
                   11548: Building objects, binaries and libraries with SSP will affect the presence of
                   11549: additional symbols in the resulting file:
                   11550: </p>
                   11551: <pre class="programlisting">
                   11552: <strong class="userinput"><code>$ nm /path/to/bin/ary</code></strong>
                   11553: [...]
                   11554:                  U __stack_chk_fail
                   11555: 0000000000600ea0 B __stack_chk_guard
                   11556: </pre>
                   11557: <p>
                   11558: This is an indicator that the program was indeed built with support for SSP.
                   11559: </p>
                   11560: <p>
                   11561: This check is now performed automatically (where supported) if
                   11562: <code class="varname">PKG_DEVELOPER</code> is set and SSP is enabled.
                   11563: </p>
                   11564: </div>
                   11565: </div>
                   11566: </div>
                   11567: <div class="appendix">
                   11568: <div class="titlepage"><div><div><h1 class="title">
                   11569: <a name="logs"></a>Appendix C. Build logs</h1></div></div></div>
                   11570: <div class="toc">
                   11571: <p><b>Table of Contents</b></p>
                   11572: <dl class="toc">
                   11573: <dt><span class="sect1"><a href="#logs.building">C.1. Building figlet</a></span></dt>
                   11574: <dt><span class="sect1"><a href="#logs.package">C.2. Packaging figlet</a></span></dt>
                   11575: </dl>
                   11576: </div>
                   11577: <div class="sect1">
                   11578: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11579: <a name="logs.building"></a>C.1. Building figlet</h2></div></div></div>
                   11580: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
                   11581: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11582: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11583: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11584: =&gt; [172219 bytes]
                   11585: Connected to ftp.plig.net.
                   11586: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11587: 331 Guest login ok, send your complete e-mail address as password.
                   11588: 230-You are user #5 of 500 simultaneous users allowed.
                   11589: 230-
                   11590: 230-  ___ _             _ _
                   11591: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___
                   11592: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11593: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11594: 230-         |_|   |_|     |___|         |___|
                   11595: 230-
                   11596: 230-** Welcome to ftp.plig.org **
                   11597: 230-
                   11598: 230-Please note that all transfers from this FTP site are logged. If you
                   11599: 230-do not like this, please disconnect now.
                   11600: 230-
                   11601: 230-This archive is available via
                   11602: 230-
                   11603: 230-HTTP:  http://ftp.plig.org/
                   11604: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11605: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11606: 230-
                   11607: 230-Please email comments, bug reports and requests for packages to be
                   11608: 230-mirrored to ftp-admin@plig.org.
                   11609: 230-
                   11610: 230-
                   11611: 230 Logged in anonymously.
                   11612: Remote system type is UNIX.
                   11613: Using binary mode to transfer files.
                   11614: 200 Type okay.
                   11615: 250 "/pub" is new cwd.
                   11616: 250-"/pub/figlet" is new cwd.
                   11617: 250-
                   11618: 250-Welcome to the figlet archive at ftp.figlet.org
                   11619: 250-
                   11620: 250-   ftp://ftp.figlet.org/pub/figlet/
                   11621: 250-
                   11622: 250-The official FIGlet web page is:
                   11623: 250-   http://www.figlet.org/
                   11624: 250-
                   11625: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11626: 250-contribute a font or something else, you can email us.
                   11627: 250
                   11628: 250 "/pub/figlet/program" is new cwd.
                   11629: 250 "/pub/figlet/program/unix" is new cwd.
                   11630: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11631: 502 Unimplemented command.
                   11632: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11633: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11634: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11635: 226 Transfer completed.
                   11636: 172219 bytes received in 00:02 (75.99 KB/s)
                   11637: 221 Goodbye.
                   11638: =&gt; Checksum OK for figlet221.tar.gz.
                   11639: ===&gt; Extracting for figlet-2.2.1nb2
                   11640: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11641: ===&gt; Patching for figlet-2.2.1nb2
                   11642: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11643: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11644: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11645: ===&gt; Configuring for figlet-2.2.1nb2
                   11646: ===&gt; Building for figlet-2.2.1nb2
                   11647: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11648: chmod a+x figlet
                   11649: gcc -O2 -o chkfont chkfont.c
                   11650: =&gt; Unwrapping files-to-be-installed.
                   11651: <code class="prompt">#</code>
                   11652: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
                   11653: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11654: ===&gt; Installing for figlet-2.2.1nb2
                   11655: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11656: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11657: mkdir -p /usr/pkg/share/figlet
                   11658: cp figlet /usr/pkg/bin
                   11659: cp chkfont /usr/pkg/bin
                   11660: chmod 555 figlist showfigfonts
                   11661: cp figlist /usr/pkg/bin
                   11662: cp showfigfonts /usr/pkg/bin
                   11663: cp fonts/*.flf /usr/pkg/share/figlet
                   11664: cp fonts/*.flc /usr/pkg/share/figlet
                   11665: cp figlet.6 /usr/pkg/man/man6
                   11666: ===&gt; Registering installation for figlet-2.2.1nb2
                   11667: <code class="prompt">#</code></pre>
                   11668: </div>
                   11669: <div class="sect1">
                   11670: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11671: <a name="logs.package"></a>C.2. Packaging figlet</h2></div></div></div>
                   11672: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
                   11673: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11674: ===&gt; Packaging figlet-2.2.1nb2
                   11675: ===&gt; Building binary package for figlet-2.2.1nb2
                   11676: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11677: Using SrcDir value of /usr/pkg
                   11678: Registering depends:.
                   11679: <code class="prompt">#</code></pre>
                   11680: </div>
                   11681: </div>
                   11682: <div class="appendix">
                   11683: <div class="titlepage"><div><div><h1 class="title">
                   11684: <a name="ftp-layout"></a>Appendix D. Directory layout of the pkgsrc FTP server</h1></div></div></div>
                   11685: <div class="toc">
                   11686: <p><b>Table of Contents</b></p>
                   11687: <dl class="toc">
                   11688: <dt><span class="sect1"><a href="#ftp-distfiles">D.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
                   11689: <dt><span class="sect1"><a href="#ftp-misc">D.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
                   11690: <dt><span class="sect1"><a href="#ftp-packages">D.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
                   11691: <dt><span class="sect1"><a href="#ftp-reports">D.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
                   11692: <dt><span class="sect1"><a href="#ftp-source">D.5. <code class="filename">current</code>,
                   11693: <code class="filename">stable</code>,
                   11694: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
                   11695: source packages</a></span></dt>
                   11696: </dl>
                   11697: </div>
                   11698: <p>As in other big projects, the directory layout of pkgsrc
                   11699:        is quite complex for newbies. This chapter explains where you
                   11700:        find things on the FTP server. The base directory on
                   11701:        <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>.
                   11702:        On other servers it may be different, but inside this directory,
                   11703:        everything should look the same, no matter on which server you
                   11704:        are. This directory contains some subdirectories, which are
                   11705:        explained below.</p>
                   11706: <div class="sect1">
                   11707: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11708: <a name="ftp-distfiles"></a>D.1. <code class="filename">distfiles</code>: The distributed source files</h2></div></div></div>
                   11709: <p>The directory <code class="filename">distfiles</code> contains lots
                   11710:        of archive files from all pkgsrc packages, which are mirrored
                   11711:        here. The subdirectories are called after their package names
                   11712:        and are used when the distributed files have names that don't
                   11713:        explicitly contain a version number or are otherwise too generic
                   11714:        (for example <code class="filename">release.tar.gz</code>).</p>
                   11715: </div>
                   11716: <div class="sect1">
                   11717: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11718: <a name="ftp-misc"></a>D.2. <code class="filename">misc</code>: Miscellaneous things</h2></div></div></div>
                   11719: <p>This directory contains things that individual pkgsrc
                   11720:        developers find worth publishing.</p>
                   11721: </div>
                   11722: <div class="sect1">
                   11723: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11724: <a name="ftp-packages"></a>D.3. <code class="filename">packages</code>: Binary packages</h2></div></div></div>
                   11725: <p>This directory contains binary packages for the various
                   11726:        platforms that are supported by pkgsrc.
                   11727:        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>
                   11728: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
                   11729: <li class="listitem"><p><code class="varname">OPSYS</code> is the name of the
                   11730:        operating system for which the packages have been built. The
                   11731:        name is taken from the output of the <span class="command"><strong>uname</strong></span>
                   11732:        command, so it may differ from the one you are used to
                   11733:        hear.</p></li>
                   11734: <li class="listitem"><p><code class="varname">ARCH</code> is the hardware
                   11735:        architecture of the platform for which the packages have been
                   11736:        built. It also includes the <code class="varname">ABI</code> (Application
                   11737:        Binary Interface) for platforms that have several of
                   11738:        them.</p></li>
                   11739: <li class="listitem"><p><code class="varname">OSVERSION</code> is the version of
                   11740:        the operating system. For version numbers that change often (for
                   11741:        example NetBSD-current), the often-changing part should be
                   11742:        replaced with an <code class="literal">x</code>, for example
                   11743:        <code class="literal">4.99.x</code>.</p></li>
                   11744: <li class="listitem"><p><code class="varname">TAG</code> is either
                   11745:        <code class="literal">20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
                   11746:        for a stable branch, or <code class="literal">head</code> for packages
                   11747:        built from the HEAD branch. The latter should only be used when
                   11748:        the packages are updated on a regular basis. Otherwise the date
                   11749:        from checking out pkgsrc should be appended, for example
                   11750:        <code class="literal">head_20071015</code>.</p></li>
                   11751: </ul></div>
                   11752: <p>The rationale for exactly this scheme is that the pkgsrc users looking for binary packages
                   11753:        can quickly click through the directories on the
                   11754:        server and find the best binary packages for their machines. Since they
                   11755:        usually know the operating system and the hardware architecture, OPSYS
                   11756:        and ARCH are placed first. After these choices, they can select the
                   11757:        best combination of OSVERSION and TAG together, since it is usually the
                   11758:        case that packages stay compatible between different version of the
                   11759:        operating system.</p>
                   11760: <p>In each of these directories, there is a
                   11761:        whole binary packages collection for a specific platform. It has a directory called
                   11762:        <code class="filename">All</code> which contains all binary packages.
                   11763:        Besides that, there are various category directories that
                   11764:        contain symbolic links to the real binary packages.</p>
                   11765: </div>
                   11766: <div class="sect1">
                   11767: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
                   11768: <a name="ftp-reports"></a>D.4. <code class="filename">reports</code>: Bulk build reports</h2></div></div></div>
1.108     rillig   11769: <p>Here are the reports from bulk builds, for those who want
                   11770:        to fix packages that didn't build on some of the platforms. The
1.322     leot     11771:        structure of subdirectories should look like the one in <a class="xref" href="#ftp-packages" title="D.3. packages: Binary packages">Section D.3, &#8220;<code class="filename">packages</code>: Binary packages&#8221;</a>.</p>
1.108     rillig   11772: </div>
1.148     asau     11773: <div class="sect1">
1.108     rillig   11774: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322     leot     11775: <a name="ftp-source"></a>D.5. <code class="filename">current</code>,
1.261     leot     11776: <code class="filename">stable</code>,
1.126     jakllsch 11777: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76      rillig   11778: source packages</h2></div></div></div>
1.128     wiz      11779: <p>These directories contain the <span class="quote">&#8220;<span class="quote">real</span>&#8221;</span> pkgsrc,
1.76      rillig   11780:        that is the files that define how to create binary packages from
                   11781:        source archives.</p>
1.262     leot     11782: <p>Each of the <code class="filename">current</code>,
                   11783:        <code class="filename">stable</code> and
                   11784:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
                   11785:        directories share the same structure.  They each contain a
                   11786:        <code class="filename">pkgsrc</code> directory and
                   11787:        <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> file.</p>
1.76      rillig   11788: <p>The directory <code class="filename">pkgsrc</code> contains a
1.89      rillig   11789:        snapshot of the CVS repository, which is updated regularly. The
1.262     leot     11790:        file <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> contains the same
                   11791:        as the directory, ready to be downloaded as a whole.</p>
                   11792: <p>The <code class="filename">current</code> directory contains files
                   11793:        related to the HEAD branch of the CVS repository.
                   11794:        In this directory there is an additional file called
                   11795:        <code class="filename">pkgsrc-readmes.tar.{bz,gz,xz}</code> that contains
                   11796:        all pkgsrc <code class="filename">README</code>s with information about
                   11797:        categories and packages.
                   11798:        </p>
                   11799: <p>The <code class="filename">stable</code> directory is a symlink to
                   11800:        the latest 
                   11801:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
                   11802:        </p>
                   11803: <p>The
                   11804:        <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
                   11805:        directories contain files related to the 
                   11806:        <code class="filename">-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
                   11807:        stable branch of the CVS repository. In these directories there is
                   11808:        an additional file called
                   11809:        <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.76      rillig   11810:        which contains the state of pkgsrc when it was branched.</p>
                   11811: </div>
1.75      rillig   11812: </div>
1.148     asau     11813: <div class="appendix">
                   11814: <div class="titlepage"><div><div><h1 class="title">
1.322     leot     11815: <a name="help-topics"></a>Appendix E. Help topics</h1></div></div></div>
1.267     rillig   11816: <p>
                   11817:        The following list contains all help topics that are available
                   11818:        when running <span class="command"><strong>bmake help topic=:index</strong></span>.
                   11819: </p>
1.269     leot     11820: <table border="0" summary="Simple list" class="simplelist">
                   11821: <tr>
                   11822: <td>#!</td>
                   11823: <td>-lintl</td>
                   11824: </tr>
                   11825: <tr>
1.320     wiz      11826: <td>32bit</td>
1.269     leot     11827: <td>64bit</td>
1.320     wiz      11828: </tr>
                   11829: <tr>
1.269     leot     11830: <td>ABI</td>
1.320     wiz      11831: <td>ACCEPTABLE_LICENSES</td>
1.269     leot     11832: </tr>
                   11833: <tr>
                   11834: <td>ACROREAD_FONTPATH</td>
1.320     wiz      11835: <td>ADDITIONAL</td>
1.269     leot     11836: </tr>
                   11837: <tr>
                   11838: <td>AFAIK</td>
1.320     wiz      11839: <td>AIX</td>
1.269     leot     11840: </tr>
                   11841: <tr>
                   11842: <td>ALLOW_VULNERABLE_PACKAGES</td>
1.320     wiz      11843: <td>ALL_ENV</td>
1.269     leot     11844: </tr>
                   11845: <tr>
1.315     cirnatda 11846: <td>ALTERNATIVES_SRC</td>
1.343     gutterid 11847: <td>AMANDA_TMP</td>
1.342     wiz      11848: </tr>
                   11849: <tr>
                   11850: <td>AMANDA_USER</td>
1.343     gutterid 11851: <td>AMANDA_VAR</td>
1.338     nia      11852: </tr>
                   11853: <tr>
1.342     wiz      11854: <td>APACHE_GROUP</td>
1.343     gutterid 11855: <td>APACHE_MODULE_NAME</td>
1.332     rillig   11856: </tr>
                   11857: <tr>
1.342     wiz      11858: <td>APACHE_MODULE_SRC</td>
1.343     gutterid 11859: <td>APACHE_MODULE_SRCDIR</td>
1.329     leot     11860: </tr>
                   11861: <tr>
1.342     wiz      11862: <td>APACHE_PKG_PREFIX</td>
1.343     gutterid 11863: <td>APACHE_SUEXEC_CONFIGURE_ARGS</td>
1.327     wiz      11864: </tr>
                   11865: <tr>
1.342     wiz      11866: <td>APACHE_SUEXEC_DOCROOT</td>
1.343     gutterid 11867: <td>APACHE_USER</td>
1.311     leot     11868: </tr>
                   11869: <tr>
1.342     wiz      11870: <td>APPEND_ABI</td>
1.343     gutterid 11871: <td>APPEND_ELF</td>
1.292     leot     11872: </tr>
                   11873: <tr>
1.342     wiz      11874: <td>ARLA_CACHE</td>
1.343     gutterid 11875: <td>AUDIT_PACKAGES_FLAGS</td>
1.274     rillig   11876: </tr>
                   11877: <tr>
1.342     wiz      11878: <td>AUTOCONF_REQD</td>
1.343     gutterid 11879: <td>AUTOMAKE_OVERRIDE</td>
1.269     leot     11880: </tr>
                   11881: <tr>
1.342     wiz      11882: <td>AUTOMAKE_REQD</td>
1.343     gutterid 11883: <td>AUTO_MKDIRS</td>
1.269     leot     11884: </tr>
                   11885: <tr>
1.342     wiz      11886: <td>BDB185_DEFAULT</td>
1.343     gutterid 11887: <td>BDBBASE</td>
1.269     leot     11888: </tr>
                   11889: <tr>
1.342     wiz      11890: <td>BDB_ACCEPTED</td>
1.343     gutterid 11891: <td>BDB_DEFAULT</td>
1.269     leot     11892: </tr>
                   11893: <tr>
1.342     wiz      11894: <td>BDB_LIBS</td>
1.343     gutterid 11895: <td>BDB_TYPE</td>
1.269     leot     11896: </tr>
                   11897: <tr>
1.342     wiz      11898: <td>BINCIMAP_GROUP</td>
1.343     gutterid 11899: <td>BINCIMAP_USER</td>
1.269     leot     11900: </tr>
                   11901: <tr>
1.342     wiz      11902: <td>BIND_DIR</td>
1.343     gutterid 11903: <td>BIND_GROUP</td>
1.269     leot     11904: </tr>
                   11905: <tr>
1.342     wiz      11906: <td>BIND_USER</td>
1.343     gutterid 11907: <td>BINOWN</td>
1.269     leot     11908: </tr>
                   11909: <tr>
1.342     wiz      11910: <td>BINPKG_SITES</td>
1.343     gutterid 11911: <td>BIN_INSTALL_FLAGS</td>
1.269     leot     11912: </tr>
                   11913: <tr>
1.342     wiz      11914: <td>BISON_PKGDATADIR</td>
1.343     gutterid 11915: <td>BLAS</td>
1.269     leot     11916: </tr>
                   11917: <tr>
1.342     wiz      11918: <td>BLAS_ACCEPTED</td>
1.343     gutterid 11919: <td>BLAS_C_INTERFACE</td>
1.269     leot     11920: </tr>
                   11921: <tr>
1.342     wiz      11922: <td>BLAS_INCLUDES</td>
1.343     gutterid 11923: <td>BLAS_INDEX64</td>
1.312     gdt      11924: </tr>
                   11925: <tr>
1.342     wiz      11926: <td>BLAS_LIBS</td>
1.344     gutterid 11927: <td>BLAS_PC</td>
                   11928: </tr>
                   11929: <tr>
1.343     gutterid 11930: <td>BLAS_TYPE</td>
1.344     gutterid 11931: <td>BOOTSTRAP_DEPENDS</td>
1.269     leot     11932: </tr>
                   11933: <tr>
1.343     gutterid 11934: <td>BROKEN</td>
1.344     gutterid 11935: <td>BROKEN_EXCEPT_ON_PLATFORM</td>
1.269     leot     11936: </tr>
                   11937: <tr>
1.343     gutterid 11938: <td>BROKEN_ON_PLATFORM</td>
1.344     gutterid 11939: <td>BSDSRCDIR</td>
1.303     bacon    11940: </tr>
                   11941: <tr>
1.343     gutterid 11942: <td>BSDXSRCDIR</td>
1.344     gutterid 11943: <td>BSD_MAKE_ENV</td>
1.320     wiz      11944: </tr>
                   11945: <tr>
1.343     gutterid 11946: <td>BUILDLINK_AUTO_DIRS</td>
1.344     gutterid 11947: <td>BUILDLINK_AUTO_VARS</td>
1.269     leot     11948: </tr>
                   11949: <tr>
1.343     gutterid 11950: <td>BUILDLINK_CFLAGS</td>
1.344     gutterid 11951: <td>BUILDLINK_CONTENTS_FILTER</td>
1.292     leot     11952: </tr>
                   11953: <tr>
1.329     leot     11954: <td>BUILDLINK_CPPFLAGS</td>
1.344     gutterid 11955: <td>BUILDLINK_FILES</td>
1.269     leot     11956: </tr>
                   11957: <tr>
1.331     gutterid 11958: <td>BUILDLINK_FILES_CMD</td>
1.344     gutterid 11959: <td>BUILDLINK_FNAME_TRANSFORM</td>
1.320     wiz      11960: </tr>
                   11961: <tr>
1.331     gutterid 11962: <td>BUILDLINK_LDFLAGS</td>
1.344     gutterid 11963: <td>BUILDLINK_LIBS</td>
1.269     leot     11964: </tr>
                   11965: <tr>
1.331     gutterid 11966: <td>BUILDLINK_OPSYS_SUPPORT_PTHREAD</td>
1.344     gutterid 11967: <td>BUILDLINK_PKGNAME</td>
1.269     leot     11968: </tr>
                   11969: <tr>
1.331     gutterid 11970: <td>BUILDLINK_PREFIX</td>
1.344     gutterid 11971: <td>BUILDLINK_RPATHDIRS</td>
1.269     leot     11972: </tr>
                   11973: <tr>
1.331     gutterid 11974: <td>BUILDLINK_TREE</td>
1.344     gutterid 11975: <td>BUILD_DEFS</td>
1.269     leot     11976: </tr>
                   11977: <tr>
1.331     gutterid 11978: <td>BUILD_DEFS_EFFECTS</td>
1.344     gutterid 11979: <td>BUILD_DEPENDS</td>
1.269     leot     11980: </tr>
                   11981: <tr>
1.331     gutterid 11982: <td>BUILD_DIRS</td>
1.344     gutterid 11983: <td>BUILD_ENV_SHELL</td>
1.269     leot     11984: </tr>
                   11985: <tr>
1.331     gutterid 11986: <td>BUILD_MAKE_CMD</td>
1.344     gutterid 11987: <td>BUILD_MAKE_FLAGS</td>
1.269     leot     11988: </tr>
                   11989: <tr>
1.331     gutterid 11990: <td>BUILD_TARGET</td>
1.344     gutterid 11991: <td>BUILTIN_FIND_FILES</td>
1.269     leot     11992: </tr>
                   11993: <tr>
1.331     gutterid 11994: <td>BUILTIN_FIND_FILES_VAR</td>
1.344     gutterid 11995: <td>BUILTIN_FIND_GREP</td>
1.269     leot     11996: </tr>
                   11997: <tr>
1.331     gutterid 11998: <td>BUILTIN_FIND_HEADERS</td>
1.344     gutterid 11999: <td>BUILTIN_FIND_HEADERS_VAR</td>
1.269     leot     12000: </tr>
                   12001: <tr>
1.331     gutterid 12002: <td>BUILTIN_FIND_PKGCONFIG</td>
1.344     gutterid 12003: <td>BUILTIN_FIND_PKGCONFIG_VAR</td>
1.269     leot     12004: </tr>
                   12005: <tr>
1.331     gutterid 12006: <td>BUILTIN_PKG</td>
1.344     gutterid 12007: <td>BUILTIN_TEST_CURSES_DEFINES</td>
1.309     gutterid 12008: </tr>
                   12009: <tr>
1.331     gutterid 12010: <td>BUILTIN_TEST_CURSES_FUNCS</td>
1.344     gutterid 12011: <td>BUILTIN_VERSION_SCRIPT</td>
1.269     leot     12012: </tr>
                   12013: <tr>
1.331     gutterid 12014: <td>BUILTIN_X11_TYPE</td>
1.344     gutterid 12015: <td>BUILTIN_X11_VERSION</td>
1.269     leot     12016: </tr>
                   12017: <tr>
1.331     gutterid 12018: <td>CACTI_GROUP</td>
1.344     gutterid 12019: <td>CACTI_USER</td>
1.269     leot     12020: </tr>
                   12021: <tr>
1.331     gutterid 12022: <td>CANNA_GROUP</td>
1.344     gutterid 12023: <td>CANNA_USER</td>
1.269     leot     12024: </tr>
                   12025: <tr>
1.331     gutterid 12026: <td>CAT</td>
1.344     gutterid 12027: <td>CBLAS_LIBS</td>
1.269     leot     12028: </tr>
                   12029: <tr>
1.344     gutterid 12030: <td>CBLAS_PC</td>
1.331     gutterid 12031: <td>CCACHE_BASE</td>
1.269     leot     12032: </tr>
                   12033: <tr>
1.303     bacon    12034: <td>CCACHE_DIR</td>
1.331     gutterid 12035: <td>CCACHE_LOGFILE</td>
1.269     leot     12036: </tr>
                   12037: <tr>
1.303     bacon    12038: <td>CC_VERSION</td>
1.331     gutterid 12039: <td>CC_VERSION_STRING</td>
1.269     leot     12040: </tr>
                   12041: <tr>
1.303     bacon    12042: <td>CDRECORD_CONF</td>
1.331     gutterid 12043: <td>CDROM_PKG_URL_DIR</td>
1.269     leot     12044: </tr>
                   12045: <tr>
1.303     bacon    12046: <td>CDROM_PKG_URL_HOST</td>
1.341     gutterid 12047: <td>CHANGES</td>
1.338     nia      12048: </tr>
                   12049: <tr>
1.341     gutterid 12050: <td>CHECK_COMPILER</td>
1.343     gutterid 12051: <td>CHECK_FAKEHOME</td>
1.342     wiz      12052: </tr>
                   12053: <tr>
                   12054: <td>CHECK_FILES</td>
1.343     gutterid 12055: <td>CHECK_FILES_SKIP</td>
1.332     rillig   12056: </tr>
                   12057: <tr>
1.342     wiz      12058: <td>CHECK_FILES_STRICT</td>
1.343     gutterid 12059: <td>CHECK_HEADERS</td>
1.329     leot     12060: </tr>
                   12061: <tr>
1.342     wiz      12062: <td>CHECK_HEADERS_SKIP</td>
1.343     gutterid 12063: <td>CHECK_INTERPRETER</td>
1.327     wiz      12064: </tr>
                   12065: <tr>
1.342     wiz      12066: <td>CHECK_INTERPRETER_SKIP</td>
1.343     gutterid 12067: <td>CHECK_PERMS</td>
1.320     wiz      12068: </tr>
                   12069: <tr>
1.342     wiz      12070: <td>CHECK_PERMS_AUTOFIX</td>
1.343     gutterid 12071: <td>CHECK_PERMS_SKIP</td>
1.311     leot     12072: </tr>
                   12073: <tr>
1.342     wiz      12074: <td>CHECK_PIE</td>
1.343     gutterid 12075: <td>CHECK_PIE_SKIP</td>
1.292     leot     12076: </tr>
                   12077: <tr>
1.342     wiz      12078: <td>CHECK_PIE_SUPPORTED</td>
1.343     gutterid 12079: <td>CHECK_PORTABILITY</td>
1.274     rillig   12080: </tr>
                   12081: <tr>
1.342     wiz      12082: <td>CHECK_PORTABILITY_EXPERIMENTAL</td>
1.343     gutterid 12083: <td>CHECK_PORTABILITY_SKIP</td>
1.331     gutterid 12084: </tr>
                   12085: <tr>
1.342     wiz      12086: <td>CHECK_RELRO</td>
1.343     gutterid 12087: <td>CHECK_RELRO_SKIP</td>
1.269     leot     12088: </tr>
                   12089: <tr>
1.342     wiz      12090: <td>CHECK_RELRO_SUPPORTED</td>
1.343     gutterid 12091: <td>CHECK_SHLIBS</td>
1.269     leot     12092: </tr>
                   12093: <tr>
1.342     wiz      12094: <td>CHECK_SHLIBS_SKIP</td>
1.343     gutterid 12095: <td>CHECK_SHLIBS_SUPPORTED</td>
1.269     leot     12096: </tr>
                   12097: <tr>
1.342     wiz      12098: <td>CHECK_SHLIBS_TOXIC</td>
1.343     gutterid 12099: <td>CHECK_SSP</td>
1.269     leot     12100: </tr>
                   12101: <tr>
1.342     wiz      12102: <td>CHECK_SSP_SKIP</td>
1.343     gutterid 12103: <td>CHECK_SSP_SUPPORTED</td>
1.269     leot     12104: </tr>
                   12105: <tr>
1.342     wiz      12106: <td>CHECK_STRIPPED</td>
1.343     gutterid 12107: <td>CHECK_STRIPPED_SKIP</td>
1.269     leot     12108: </tr>
                   12109: <tr>
1.342     wiz      12110: <td>CHECK_WRKREF</td>
1.343     gutterid 12111: <td>CHECK_WRKREF_EXTRA_DIRS</td>
1.269     leot     12112: </tr>
                   12113: <tr>
1.342     wiz      12114: <td>CHECK_WRKREF_SKIP</td>
1.343     gutterid 12115: <td>CLAMAV_DBDIR</td>
1.269     leot     12116: </tr>
                   12117: <tr>
1.342     wiz      12118: <td>CLAMAV_GROUP</td>
1.343     gutterid 12119: <td>CLAMAV_USER</td>
1.269     leot     12120: </tr>
                   12121: <tr>
1.342     wiz      12122: <td>CLANGBASE</td>
1.343     gutterid 12123: <td>CLEANDEPENDS</td>
1.269     leot     12124: </tr>
                   12125: <tr>
1.342     wiz      12126: <td>CMAKE_DEPENDENCIES_REWRITE</td>
1.343     gutterid 12127: <td>CMAKE_INSTALL_NAME_DIR</td>
1.269     leot     12128: </tr>
                   12129: <tr>
1.342     wiz      12130: <td>CMAKE_INSTALL_PREFIX</td>
1.343     gutterid 12131: <td>CMAKE_MODULE_PATH_OVERRIDE</td>
1.269     leot     12132: </tr>
                   12133: <tr>
1.342     wiz      12134: <td>CMAKE_PKGSRC_BUILD_FLAGS</td>
1.343     gutterid 12135: <td>CMAKE_PREFIX_PATH</td>
1.269     leot     12136: </tr>
                   12137: <tr>
1.342     wiz      12138: <td>CMAKE_USE_GNU_INSTALL_DIRS</td>
1.305     bacon    12139: <td>COMPILER_RPATH_FLAG</td>
1.269     leot     12140: </tr>
                   12141: <tr>
1.341     gutterid 12142: <td>COMPILER_USE_SYMLINKS</td>
1.305     bacon    12143: <td>CONFIGURE_ARGS</td>
1.269     leot     12144: </tr>
                   12145: <tr>
1.341     gutterid 12146: <td>CONFIGURE_DIRS</td>
1.305     bacon    12147: <td>CONFIGURE_ENV</td>
1.269     leot     12148: </tr>
                   12149: <tr>
1.341     gutterid 12150: <td>CONFIGURE_ENV_SHELL</td>
1.305     bacon    12151: <td>CONFIGURE_HAS_INFODIR</td>
1.269     leot     12152: </tr>
                   12153: <tr>
1.341     gutterid 12154: <td>CONFIGURE_HAS_MANDIR</td>
1.305     bacon    12155: <td>CONFIGURE_SCRIPT</td>
1.269     leot     12156: </tr>
                   12157: <tr>
1.341     gutterid 12158: <td>CONFIG_SHELL</td>
1.305     bacon    12159: <td>CONFIG_SHELL_FLAGS</td>
1.269     leot     12160: </tr>
                   12161: <tr>
1.341     gutterid 12162: <td>CONF_FILES</td>
1.305     bacon    12163: <td>CONF_FILES_MODE</td>
1.269     leot     12164: </tr>
                   12165: <tr>
1.341     gutterid 12166: <td>CONF_FILES_PERMS</td>
1.305     bacon    12167: <td>CONSERVER_DEFAULTHOST</td>
1.269     leot     12168: </tr>
                   12169: <tr>
1.341     gutterid 12170: <td>CONSERVER_DEFAULTPORT</td>
1.305     bacon    12171: <td>CP</td>
1.269     leot     12172: </tr>
                   12173: <tr>
1.347   ! gutterid 12174: <td>CPE</td>
        !          12175: <td>CPE_EDITION</td>
        !          12176: </tr>
        !          12177: <tr>
        !          12178: <td>CPE_LANG</td>
        !          12179: <td>CPE_OTHER</td>
        !          12180: </tr>
        !          12181: <tr>
        !          12182: <td>CPE_PART</td>
        !          12183: <td>CPE_PRODUCT</td>
        !          12184: </tr>
        !          12185: <tr>
        !          12186: <td>CPE_SW_EDITION</td>
        !          12187: <td>CPE_TARGET_HW</td>
        !          12188: </tr>
        !          12189: <tr>
        !          12190: <td>CPE_TARGET_SW</td>
        !          12191: <td>CPE_UPDATE</td>
        !          12192: </tr>
        !          12193: <tr>
        !          12194: <td>CPE_URI</td>
        !          12195: <td>CPE_VENDOR</td>
        !          12196: </tr>
        !          12197: <tr>
        !          12198: <td>CPE_VERSION</td>
1.341     gutterid 12199: <td>CPP</td>
1.269     leot     12200: </tr>
                   12201: <tr>
1.347   ! gutterid 12202: <td>CPP_PRECOMP_FLAGS</td>
1.341     gutterid 12203: <td>CREATE_WRKDIR_SYMLINK</td>
1.269     leot     12204: </tr>
                   12205: <tr>
1.347   ! gutterid 12206: <td>CROSSBASE</td>
1.341     gutterid 12207: <td>CTFCONVERT</td>
1.269     leot     12208: </tr>
                   12209: <tr>
1.347   ! gutterid 12210: <td>CTF_FILES_SKIP</td>
1.341     gutterid 12211: <td>CTF_SUPPORTED</td>
1.269     leot     12212: </tr>
                   12213: <tr>
1.347   ! gutterid 12214: <td>CTYPE</td>
1.341     gutterid 12215: <td>CUPS_GROUP</td>
1.269     leot     12216: </tr>
                   12217: <tr>
1.347   ! gutterid 12218: <td>CUPS_SYSTEM_GROUPS</td>
1.341     gutterid 12219: <td>CUPS_USER</td>
1.292     leot     12220: </tr>
                   12221: <tr>
1.347   ! gutterid 12222: <td>CURSES_DEFAULT</td>
1.341     gutterid 12223: <td>CURSES_TYPE</td>
1.342     wiz      12224: </tr>
                   12225: <tr>
1.347   ! gutterid 12226: <td>CXX</td>
1.342     wiz      12227: <td>CYRUS_GROUP</td>
1.332     rillig   12228: </tr>
                   12229: <tr>
1.347   ! gutterid 12230: <td>CYRUS_IDLE</td>
1.342     wiz      12231: <td>CYRUS_USER</td>
1.329     leot     12232: </tr>
                   12233: <tr>
1.347   ! gutterid 12234: <td>DAEMONTOOLS_GROUP</td>
1.342     wiz      12235: <td>DAEMONTOOLS_LOG_USER</td>
1.327     wiz      12236: </tr>
                   12237: <tr>
1.347   ! gutterid 12238: <td>DARWIN_NO_SYSTEM_LIBS</td>
1.342     wiz      12239: <td>DARWIN_REQUIRES_FILTER</td>
1.320     wiz      12240: </tr>
                   12241: <tr>
1.347   ! gutterid 12242: <td>DBUS_GROUP</td>
1.342     wiz      12243: <td>DBUS_USER</td>
1.311     leot     12244: </tr>
                   12245: <tr>
1.347   ! gutterid 12246: <td>DEFANG_GROUP</td>
1.342     wiz      12247: <td>DEFANG_USER</td>
1.269     leot     12248: </tr>
                   12249: <tr>
1.347   ! gutterid 12250: <td>DEFAULT_ACCEPTABLE_LICENSES</td>
1.342     wiz      12251: <td>DEFAULT_DISTFILES</td>
1.269     leot     12252: </tr>
                   12253: <tr>
1.347   ! gutterid 12254: <td>DEFAULT_IRC_SERVER</td>
1.342     wiz      12255: <td>DEFAULT_SERIAL_DEVICE</td>
1.269     leot     12256: </tr>
                   12257: <tr>
1.347   ! gutterid 12258: <td>DEF_UMASK</td>
1.342     wiz      12259: <td>DEINSTALLDEPENDS</td>
1.309     gutterid 12260: </tr>
                   12261: <tr>
1.347   ! gutterid 12262: <td>DEINSTALL_SRC</td>
1.342     wiz      12263: <td>DEINSTALL_TEMPLATES</td>
1.269     leot     12264: </tr>
                   12265: <tr>
1.347   ! gutterid 12266: <td>DELAYED_ERROR_MSG</td>
1.342     wiz      12267: <td>DELAYED_WARNING_MSG</td>
1.269     leot     12268: </tr>
                   12269: <tr>
1.347   ! gutterid 12270: <td>DEPENDS</td>
1.342     wiz      12271: <td>DEPENDS_TARGET</td>
1.269     leot     12272: </tr>
                   12273: <tr>
1.347   ! gutterid 12274: <td>DEPENDS_TYPE</td>
1.342     wiz      12275: <td>DESTDIR</td>
1.269     leot     12276: </tr>
                   12277: <tr>
1.347   ! gutterid 12278: <td>DESTDIR_VARNAME</td>
1.342     wiz      12279: <td>DIALER_GROUP</td>
1.269     leot     12280: </tr>
                   12281: <tr>
1.347   ! gutterid 12282: <td>DIGEST_REQD</td>
1.342     wiz      12283: <td>DISTDIR</td>
1.269     leot     12284: </tr>
                   12285: <tr>
1.347   ! gutterid 12286: <td>DISTFILES</td>
1.342     wiz      12287: <td>DISTINFO_FILE</td>
1.269     leot     12288: </tr>
                   12289: <tr>
1.347   ! gutterid 12290: <td>DISTNAME</td>
1.342     wiz      12291: <td>DIST_PATH</td>
1.269     leot     12292: </tr>
                   12293: <tr>
1.347   ! gutterid 12294: <td>DIST_SUBDIR</td>
1.342     wiz      12295: <td>DJBDNS_AXFR_USER</td>
1.269     leot     12296: </tr>
                   12297: <tr>
1.347   ! gutterid 12298: <td>DJBDNS_CACHE_USER</td>
1.342     wiz      12299: <td>DJBDNS_DJBDNS_GROUP</td>
1.269     leot     12300: </tr>
                   12301: <tr>
1.347   ! gutterid 12302: <td>DJBDNS_LOG_USER</td>
1.342     wiz      12303: <td>DJBDNS_RBL_USER</td>
1.269     leot     12304: </tr>
                   12305: <tr>
1.347   ! gutterid 12306: <td>DJBDNS_TINY_USER</td>
1.342     wiz      12307: <td>DLOPEN_REQUIRE_PTHREADS</td>
1.269     leot     12308: </tr>
                   12309: <tr>
1.347   ! gutterid 12310: <td>DL_AUTO_VARS</td>
1.342     wiz      12311: <td>DL_CFLAGS</td>
1.269     leot     12312: </tr>
                   12313: <tr>
1.347   ! gutterid 12314: <td>DL_LDFLAGS</td>
1.342     wiz      12315: <td>DL_LIBS</td>
1.269     leot     12316: </tr>
                   12317: <tr>
1.347   ! gutterid 12318: <td>DNS</td>
1.342     wiz      12319: <td>DOCOWN</td>
1.269     leot     12320: </tr>
                   12321: <tr>
1.347   ! gutterid 12322: <td>DOWNLOADED_DISTFILE</td>
1.342     wiz      12323: <td>DQCACHE_GROUP</td>
1.269     leot     12324: </tr>
                   12325: <tr>
1.347   ! gutterid 12326: <td>DQCACHE_USER</td>
1.342     wiz      12327: <td>DT_LAYOUT</td>
1.333     nia      12328: </tr>
                   12329: <tr>
1.347   ! gutterid 12330: <td>DYNAMIC_SITES_CMD</td>
1.342     wiz      12331: <td>DYNAMIC_SITES_SCRIPT</td>
1.269     leot     12332: </tr>
                   12333: <tr>
1.347   ! gutterid 12334: <td>ECHO</td>
1.342     wiz      12335: <td>ECHO_N</td>
1.269     leot     12336: </tr>
                   12337: <tr>
1.347   ! gutterid 12338: <td>ELK_GUI</td>
1.342     wiz      12339: <td>EMACS_TYPE</td>
1.269     leot     12340: </tr>
                   12341: <tr>
1.347   ! gutterid 12342: <td>EMULDIR</td>
1.342     wiz      12343: <td>EMULSUBDIR</td>
1.269     leot     12344: </tr>
                   12345: <tr>
1.347   ! gutterid 12346: <td>EMULSUBDIRSLASH</td>
1.342     wiz      12347: <td>EMUL_ARCH</td>
1.269     leot     12348: </tr>
                   12349: <tr>
1.347   ! gutterid 12350: <td>EMUL_DISTRO</td>
1.342     wiz      12351: <td>EMUL_EXEC_FMT</td>
1.269     leot     12352: </tr>
                   12353: <tr>
1.347   ! gutterid 12354: <td>EMUL_IS_NATIVE</td>
1.342     wiz      12355: <td>EMUL_MODULES</td>
1.269     leot     12356: </tr>
                   12357: <tr>
1.347   ! gutterid 12358: <td>EMUL_OPSYS</td>
1.342     wiz      12359: <td>EMUL_PKG_FMT</td>
1.269     leot     12360: </tr>
                   12361: <tr>
1.347   ! gutterid 12362: <td>EMUL_PLATFORM</td>
1.342     wiz      12363: <td>EMUL_PLATFORMS</td>
1.269     leot     12364: </tr>
                   12365: <tr>
1.347   ! gutterid 12366: <td>EMUL_PREFER</td>
1.342     wiz      12367: <td>EMUL_REQD</td>
1.269     leot     12368: </tr>
                   12369: <tr>
1.347   ! gutterid 12370: <td>EMUL_TYPE</td>
1.342     wiz      12371: <td>ERROR_MSG</td>
1.269     leot     12372: </tr>
                   12373: <tr>
1.347   ! gutterid 12374: <td>EXIM_GROUP</td>
1.342     wiz      12375: <td>EXIM_USER</td>
1.269     leot     12376: </tr>
                   12377: <tr>
1.347   ! gutterid 12378: <td>EXPORT_SYMBOLS_LDFLAGS</td>
1.342     wiz      12379: <td>EXTRACTOR</td>
1.269     leot     12380: </tr>
                   12381: <tr>
1.347   ! gutterid 12382: <td>EXTRACT_CMD</td>
1.342     wiz      12383: <td>EXTRACT_CMD_DEFAULT</td>
1.338     nia      12384: </tr>
                   12385: <tr>
1.347   ! gutterid 12386: <td>EXTRACT_DIR</td>
1.342     wiz      12387: <td>EXTRACT_ELEMENTS</td>
1.269     leot     12388: </tr>
                   12389: <tr>
1.347   ! gutterid 12390: <td>EXTRACT_ENV</td>
1.342     wiz      12391: <td>EXTRACT_ONLY</td>
1.269     leot     12392: </tr>
                   12393: <tr>
1.347   ! gutterid 12394: <td>EXTRACT_OPTS</td>
1.342     wiz      12395: <td>EXTRACT_SUFX</td>
1.269     leot     12396: </tr>
                   12397: <tr>
1.347   ! gutterid 12398: <td>EXTRACT_USING</td>
1.342     wiz      12399: <td>FAIL</td>
1.269     leot     12400: </tr>
                   12401: <tr>
1.347   ! gutterid 12402: <td>FAILOVER_FETCH</td>
1.342     wiz      12403: <td>FAIL_MSG</td>
1.269     leot     12404: </tr>
                   12405: <tr>
1.347   ! gutterid 12406: <td>FAKE_NCURSES</td>
1.342     wiz      12407: <td>FAM</td>
1.269     leot     12408: </tr>
                   12409: <tr>
1.347   ! gutterid 12410: <td>FAM_ACCEPTED</td>
1.342     wiz      12411: <td>FAM_DEFAULT</td>
1.269     leot     12412: </tr>
                   12413: <tr>
1.347   ! gutterid 12414: <td>FAM_SERVER</td>
1.342     wiz      12415: <td>FCPATH</td>
1.269     leot     12416: </tr>
                   12417: <tr>
1.347   ! gutterid 12418: <td>FEATURE_CPPFLAGS</td>
1.342     wiz      12419: <td>FEATURE_LDFLAGS</td>
1.269     leot     12420: </tr>
                   12421: <tr>
1.347   ! gutterid 12422: <td>FEATURE_LIBS</td>
1.342     wiz      12423: <td>FETCH_AFTER_ARGS</td>
1.292     leot     12424: </tr>
                   12425: <tr>
1.347   ! gutterid 12426: <td>FETCH_BEFORE_ARGS</td>
1.342     wiz      12427: <td>FETCH_CMD</td>
1.269     leot     12428: </tr>
                   12429: <tr>
1.347   ! gutterid 12430: <td>FETCH_OUTPUT_ARGS</td>
1.342     wiz      12431: <td>FETCH_PROXY</td>
1.269     leot     12432: </tr>
                   12433: <tr>
1.347   ! gutterid 12434: <td>FETCH_RESUME_ARGS</td>
1.342     wiz      12435: <td>FETCH_TIMEOUT</td>
1.269     leot     12436: </tr>
                   12437: <tr>
1.347   ! gutterid 12438: <td>FETCH_USE_IPV4_ONLY</td>
1.342     wiz      12439: <td>FETCH_USING</td>
1.269     leot     12440: </tr>
                   12441: <tr>
1.347   ! gutterid 12442: <td>FILES_SUBST</td>
1.342     wiz      12443: <td>FILES_SUBST_SED</td>
1.274     rillig   12444: </tr>
                   12445: <tr>
1.347   ! gutterid 12446: <td>FIX_SYSTEM_HEADERS</td>
1.341     gutterid 12447: <td>FONTS_DIRS</td>
1.292     leot     12448: </tr>
                   12449: <tr>
1.347   ! gutterid 12450: <td>FONTS_VERBOSE</td>
1.341     gutterid 12451: <td>FOO_HACKS_MK</td>
1.269     leot     12452: </tr>
                   12453: <tr>
1.347   ! gutterid 12454: <td>FOX_USE_XUNICODE</td>
1.341     gutterid 12455: <td>FREEWNN_GROUP</td>
1.269     leot     12456: </tr>
                   12457: <tr>
1.347   ! gutterid 12458: <td>FREEWNN_USER</td>
1.341     gutterid 12459: <td>FTP_PKG_URL_DIR</td>
1.269     leot     12460: </tr>
                   12461: <tr>
1.347   ! gutterid 12462: <td>FTP_PKG_URL_HOST</td>
1.341     gutterid 12463: <td>GAMEDATAMODE</td>
1.269     leot     12464: </tr>
                   12465: <tr>
1.347   ! gutterid 12466: <td>GAMEDATA_PERMS</td>
1.341     gutterid 12467: <td>GAMEDIRMODE</td>
1.269     leot     12468: </tr>
                   12469: <tr>
1.347   ! gutterid 12470: <td>GAMEDIR_PERMS</td>
1.341     gutterid 12471: <td>GAMEGRP</td>
1.269     leot     12472: </tr>
                   12473: <tr>
1.347   ! gutterid 12474: <td>GAMEMODE</td>
1.341     gutterid 12475: <td>GAMEOWN</td>
1.269     leot     12476: </tr>
                   12477: <tr>
1.347   ! gutterid 12478: <td>GAMES_GROUP</td>
1.341     gutterid 12479: <td>GAMES_USER</td>
1.269     leot     12480: </tr>
                   12481: <tr>
1.347   ! gutterid 12482: <td>GCC</td>
1.341     gutterid 12483: <td>GCCBASE</td>
1.269     leot     12484: </tr>
                   12485: <tr>
1.347   ! gutterid 12486: <td>GCC_REQD</td>
1.341     gutterid 12487: <td>GCC_VERSION_SUFFIX</td>
1.269     leot     12488: </tr>
                   12489: <tr>
1.347   ! gutterid 12490: <td>GEM_BUILD</td>
1.341     gutterid 12491: <td>GEM_CLEANBUILD</td>
1.269     leot     12492: </tr>
                   12493: <tr>
1.347   ! gutterid 12494: <td>GEM_CLEANBUILD_EXTENSIONS</td>
1.341     gutterid 12495: <td>GEM_DOCDIR</td>
1.292     leot     12496: </tr>
                   12497: <tr>
1.347   ! gutterid 12498: <td>GEM_EXTSDIR</td>
1.341     gutterid 12499: <td>GEM_HOME</td>
1.269     leot     12500: </tr>
                   12501: <tr>
1.347   ! gutterid 12502: <td>GEM_KEEPBUILD</td>
1.341     gutterid 12503: <td>GEM_LIBDIR</td>
1.269     leot     12504: </tr>
                   12505: <tr>
1.347   ! gutterid 12506: <td>GEM_NAME</td>
1.341     gutterid 12507: <td>GEM_PATH</td>
1.269     leot     12508: </tr>
                   12509: <tr>
1.347   ! gutterid 12510: <td>GEM_PLUGINSDIR</td>
1.341     gutterid 12511: <td>GEM_SPECFILE</td>
1.269     leot     12512: </tr>
                   12513: <tr>
1.347   ! gutterid 12514: <td>GENERATE_PLIST</td>
1.341     gutterid 12515: <td>GHC</td>
1.292     leot     12516: </tr>
                   12517: <tr>
1.347   ! gutterid 12518: <td>GHOSTSCRIPT_REQD</td>
1.341     gutterid 12519: <td>GITHUB_PROJECT</td>
1.311     leot     12520: </tr>
                   12521: <tr>
1.347   ! gutterid 12522: <td>GITHUB_RELEASE</td>
1.341     gutterid 12523: <td>GITHUB_SUBMODULES</td>
1.269     leot     12524: </tr>
                   12525: <tr>
1.347   ! gutterid 12526: <td>GITHUB_TAG</td>
1.341     gutterid 12527: <td>GITHUB_TYPE</td>
1.338     nia      12528: </tr>
                   12529: <tr>
1.347   ! gutterid 12530: <td>GITLAB_PROJECT</td>
1.341     gutterid 12531: <td>GITLAB_RELEASE</td>
1.338     nia      12532: </tr>
                   12533: <tr>
1.347   ! gutterid 12534: <td>GITLAB_SUBMODULES</td>
1.341     gutterid 12535: <td>GITLAB_TAG</td>
1.338     nia      12536: </tr>
                   12537: <tr>
1.347   ! gutterid 12538: <td>GITLAB_TYPE</td>
1.341     gutterid 12539: <td>GNU</td>
1.342     wiz      12540: </tr>
                   12541: <tr>
1.347   ! gutterid 12542: <td>GNU_CONFIGURE</td>
1.342     wiz      12543: <td>GNU_CONFIGURE_INFODIR</td>
1.269     leot     12544: </tr>
                   12545: <tr>
1.347   ! gutterid 12546: <td>GNU_CONFIGURE_MANDIR</td>
1.342     wiz      12547: <td>GNU_CONFIGURE_QUIET</td>
1.269     leot     12548: </tr>
                   12549: <tr>
1.347   ! gutterid 12550: <td>GNU_CONFIGURE_STRICT</td>
1.342     wiz      12551: <td>GODEP_REDIRECTS</td>
1.269     leot     12552: </tr>
                   12553: <tr>
1.347   ! gutterid 12554: <td>GO_BUILD_PATTERN</td>
1.342     wiz      12555: <td>GO_DEPS</td>
1.276     leot     12556: </tr>
                   12557: <tr>
1.347   ! gutterid 12558: <td>GO_DIST_BASE</td>
1.342     wiz      12559: <td>GO_EXTRA_MOD_DIRS</td>
1.269     leot     12560: </tr>
                   12561: <tr>
1.347   ! gutterid 12562: <td>GO_MODULE_FILES</td>
1.342     wiz      12563: <td>GO_SRCPATH</td>
1.269     leot     12564: </tr>
                   12565: <tr>
1.347   ! gutterid 12566: <td>GROUP_SPECIFIC_PKGS</td>
1.343     gutterid 12567: <td>GRUB_NETWORK_CARDS</td>
1.269     leot     12568: </tr>
                   12569: <tr>
1.347   ! gutterid 12570: <td>GRUB_PRESET_COMMAND</td>
1.343     gutterid 12571: <td>GRUB_SCAN_ARGS</td>
1.311     leot     12572: </tr>
                   12573: <tr>
1.347   ! gutterid 12574: <td>GZIP</td>
1.337     gutterid 12575: <td>HASKELL_ENABLE_DYNAMIC_EXECUTABLE</td>
1.332     rillig   12576: </tr>
                   12577: <tr>
1.347   ! gutterid 12578: <td>HASKELL_ENABLE_HADDOCK_DOCUMENTATION</td>
1.337     gutterid 12579: <td>HASKELL_ENABLE_LIBRARY_PROFILING</td>
1.341     gutterid 12580: </tr>
                   12581: <tr>
1.347   ! gutterid 12582: <td>HASKELL_ENABLE_SHARED_LIBRARY</td>
1.341     gutterid 12583: <td>HASKELL_OPTIMIZATION_LEVEL</td>
1.335     nia      12584: </tr>
                   12585: <tr>
1.347   ! gutterid 12586: <td>HASKELL_PKG_NAME</td>
1.344     gutterid 12587: <td>HASKELL_UNRESTRICT_DEPENDENCIES</td>
                   12588: </tr>
                   12589: <tr>
1.347   ! gutterid 12590: <td>HAS_CONFIGURE</td>
1.341     gutterid 12591: <td>HEADER_TEMPLATES</td>
1.329     leot     12592: </tr>
                   12593: <tr>
1.347   ! gutterid 12594: <td>HOMEPAGE</td>
1.343     gutterid 12595: <td>HOST_PKGTOOLS_ARGS</td>
1.342     wiz      12596: </tr>
                   12597: <tr>
1.347   ! gutterid 12598: <td>HOST_SPECIFIC_PKGS</td>
1.343     gutterid 12599: <td>HOWL_GROUP</td>
1.338     nia      12600: </tr>
                   12601: <tr>
1.347   ! gutterid 12602: <td>HOWL_USER</td>
1.343     gutterid 12603: <td>ICCBASE</td>
1.269     leot     12604: </tr>
                   12605: <tr>
1.347   ! gutterid 12606: <td>ICECAST_CHROOTDIR</td>
1.343     gutterid 12607: <td>ICON_THEMES</td>
1.305     bacon    12608: </tr>
                   12609: <tr>
1.347   ! gutterid 12610: <td>IDOBASE</td>
1.343     gutterid 12611: <td>IGNORE_CCACHE</td>
1.269     leot     12612: </tr>
                   12613: <tr>
1.347   ! gutterid 12614: <td>IGNORE_INFO_DIRS</td>
1.343     gutterid 12615: <td>IGNORE_INTERACTIVE_FETCH</td>
1.269     leot     12616: </tr>
                   12617: <tr>
1.347   ! gutterid 12618: <td>IMAKE</td>
1.343     gutterid 12619: <td>IMAKEOPTS</td>
1.269     leot     12620: </tr>
                   12621: <tr>
1.347   ! gutterid 12622: <td>IMAKE_MAKE</td>
1.343     gutterid 12623: <td>IMAKE_MANINSTALL</td>
1.269     leot     12624: </tr>
                   12625: <tr>
1.347   ! gutterid 12626: <td>IMAP_UW_CCLIENT_MBOX_FMT</td>
1.343     gutterid 12627: <td>IMDICTDIR</td>
1.269     leot     12628: </tr>
                   12629: <tr>
1.347   ! gutterid 12630: <td>INCOMPAT_CURSES</td>
1.343     gutterid 12631: <td>INFO_DIR</td>
1.269     leot     12632: </tr>
                   12633: <tr>
1.347   ! gutterid 12634: <td>INFO_FILES</td>
1.343     gutterid 12635: <td>INFO_FILES_VERBOSE</td>
1.269     leot     12636: </tr>
                   12637: <tr>
1.347   ! gutterid 12638: <td>INFO_MSG</td>
1.343     gutterid 12639: <td>INIT_SYSTEM</td>
1.269     leot     12640: </tr>
                   12641: <tr>
1.347   ! gutterid 12642: <td>INN_DATA_DIR</td>
1.343     gutterid 12643: <td>INN_GROUP</td>
1.269     leot     12644: </tr>
                   12645: <tr>
1.347   ! gutterid 12646: <td>INN_USER</td>
1.343     gutterid 12647: <td>INSTALLATION_DIRS</td>
1.287     rillig   12648: </tr>
                   12649: <tr>
1.347   ! gutterid 12650: <td>INSTALLATION_DIRS_FROM_PLIST</td>
1.343     gutterid 12651: <td>INSTALL_ENV</td>
1.269     leot     12652: </tr>
                   12653: <tr>
1.347   ! gutterid 12654: <td>INSTALL_SH_OVERRIDE</td>
1.343     gutterid 12655: <td>INSTALL_SRC</td>
1.269     leot     12656: </tr>
                   12657: <tr>
1.347   ! gutterid 12658: <td>INSTALL_TEMPLATES</td>
1.343     gutterid 12659: <td>INSTALL_UNSTRIPPED</td>
1.269     leot     12660: </tr>
                   12661: <tr>
1.347   ! gutterid 12662: <td>IRCD_HYBRID_IRC_GROUP</td>
1.343     gutterid 12663: <td>IRCD_HYBRID_IRC_USER</td>
1.269     leot     12664: </tr>
                   12665: <tr>
1.347   ! gutterid 12666: <td>IRCD_HYBRID_MAXCONN</td>
1.343     gutterid 12667: <td>IRCD_HYBRID_NICLEN</td>
1.269     leot     12668: </tr>
                   12669: <tr>
1.347   ! gutterid 12670: <td>IRCD_HYBRID_SYSLOG_EVENTS</td>
1.343     gutterid 12671: <td>IRCD_HYBRID_SYSLOG_FACILITY</td>
1.269     leot     12672: </tr>
                   12673: <tr>
1.347   ! gutterid 12674: <td>IRCD_HYBRID_TOPICLEN</td>
1.343     gutterid 12675: <td>IRIX</td>
1.269     leot     12676: </tr>
                   12677: <tr>
1.347   ! gutterid 12678: <td>IRRD_USE_PGP</td>
1.343     gutterid 12679: <td>JABBERD_GROUP</td>
1.269     leot     12680: </tr>
                   12681: <tr>
1.347   ! gutterid 12682: <td>JABBERD_LOGDIR</td>
1.343     gutterid 12683: <td>JABBERD_PIDDIR</td>
1.347   ! gutterid 12684: </tr>
        !          12685: <tr>
1.344     gutterid 12686: <td>JABBERD_SPOOLDIR</td>
1.347   ! gutterid 12687: <td>JABBERD_USER</td>
1.269     leot     12688: </tr>
                   12689: <tr>
1.344     gutterid 12690: <td>JAVA_BINPREFIX</td>
1.347   ! gutterid 12691: <td>JAVA_CLASSPATH</td>
1.292     leot     12692: </tr>
                   12693: <tr>
1.344     gutterid 12694: <td>JAVA_HOME</td>
1.347   ! gutterid 12695: <td>JAVA_LD_LIBRARY_PATH</td>
1.342     wiz      12696: </tr>
                   12697: <tr>
1.344     gutterid 12698: <td>JAVA_NAME</td>
1.347   ! gutterid 12699: <td>JAVA_UNLIMIT</td>
1.311     leot     12700: </tr>
                   12701: <tr>
1.344     gutterid 12702: <td>JAVA_WRAPPERS</td>
1.347   ! gutterid 12703: <td>JPEG_ACCEPTED</td>
1.269     leot     12704: </tr>
                   12705: <tr>
1.344     gutterid 12706: <td>JPEG_DEFAULT</td>
1.347   ! gutterid 12707: <td>KERBEROS</td>
1.332     rillig   12708: </tr>
                   12709: <tr>
1.344     gutterid 12710: <td>KERMIT_SUID_UUCP</td>
1.347   ! gutterid 12711: <td>KJS_USE_PCRE</td>
1.332     rillig   12712: </tr>
                   12713: <tr>
1.344     gutterid 12714: <td>KNEWS_DOMAIN_FILE</td>
1.347   ! gutterid 12715: <td>KNEWS_DOMAIN_NAME</td>
1.269     leot     12716: </tr>
                   12717: <tr>
1.344     gutterid 12718: <td>KRB5_ACCEPTED</td>
1.347   ! gutterid 12719: <td>KRB5_DEFAULT</td>
1.269     leot     12720: </tr>
                   12721: <tr>
1.344     gutterid 12722: <td>LANGUAGES</td>
1.347   ! gutterid 12723: <td>LAPACKE_LIBS</td>
1.269     leot     12724: </tr>
                   12725: <tr>
1.344     gutterid 12726: <td>LAPACKE_PC</td>
1.347   ! gutterid 12727: <td>LAPACK_LIBS</td>
1.269     leot     12728: </tr>
                   12729: <tr>
1.344     gutterid 12730: <td>LAPACK_PC</td>
1.347   ! gutterid 12731: <td>LATEX2HTML_ICONPATH</td>
1.292     leot     12732: </tr>
                   12733: <tr>
1.342     wiz      12734: <td>LDCONFIG_ADD_CMD</td>
1.347   ! gutterid 12735: <td>LDCONFIG_REMOVE_CMD</td>
1.271     brook    12736: </tr>
                   12737: <tr>
1.342     wiz      12738: <td>LDD</td>
1.347   ! gutterid 12739: <td>LEAFNODE_DATA_DIR</td>
1.269     leot     12740: </tr>
                   12741: <tr>
1.342     wiz      12742: <td>LEAFNODE_GROUP</td>
1.347   ! gutterid 12743: <td>LEAFNODE_USER</td>
1.269     leot     12744: </tr>
                   12745: <tr>
1.342     wiz      12746: <td>LIBDVDCSS_HOMEPAGE</td>
1.347   ! gutterid 12747: <td>LIBDVDCSS_MASTER_SITES</td>
1.269     leot     12748: </tr>
                   12749: <tr>
1.342     wiz      12750: <td>LIBRSVG_TYPE</td>
1.347   ! gutterid 12751: <td>LIBTOOL</td>
1.269     leot     12752: </tr>
                   12753: <tr>
1.342     wiz      12754: <td>LIBTOOLIZE_PLIST</td>
1.347   ! gutterid 12755: <td>LIBTOOL_M4_OVERRIDE</td>
1.320     wiz      12756: </tr>
                   12757: <tr>
1.342     wiz      12758: <td>LIBUSB_TYPE</td>
1.347   ! gutterid 12759: <td>LICENSE</td>
1.270     leot     12760: </tr>
                   12761: <tr>
1.342     wiz      12762: <td>LINKER_RPATH_FLAG</td>
1.347   ! gutterid 12763: <td>LINK_RPATH_FLAG</td>
1.269     leot     12764: </tr>
                   12765: <tr>
1.335     nia      12766: <td>LINUX_LOCALES</td>
1.347   ! gutterid 12767: <td>LOCALBASE</td>
1.338     nia      12768: </tr>
                   12769: <tr>
                   12770: <td>LOCALBASE_LOCKTYPE</td>
1.347   ! gutterid 12771: <td>LOCALPATCHES</td>
1.269     leot     12772: </tr>
                   12773: <tr>
1.338     nia      12774: <td>LOVE_DATA</td>
1.347   ! gutterid 12775: <td>LOVE_GAME</td>
1.329     leot     12776: </tr>
                   12777: <tr>
1.338     nia      12778: <td>LOVE_VERSION</td>
1.347   ! gutterid 12779: <td>LP32PLATFORMS</td>
1.269     leot     12780: </tr>
                   12781: <tr>
1.338     nia      12782: <td>LP64PLATFORMS</td>
1.347   ! gutterid 12783: <td>LUA_BUSTED_ARGS</td>
1.269     leot     12784: </tr>
                   12785: <tr>
1.338     nia      12786: <td>LUA_CDIR</td>
1.347   ! gutterid 12787: <td>LUA_COMPILER</td>
1.269     leot     12788: </tr>
                   12789: <tr>
1.338     nia      12790: <td>LUA_DOCDIR</td>
1.347   ! gutterid 12791: <td>LUA_EXAMPLESDIR</td>
1.336     nia      12792: </tr>
                   12793: <tr>
1.338     nia      12794: <td>LUA_INCDIR</td>
1.347   ! gutterid 12795: <td>LUA_INTERPRETER</td>
1.333     nia      12796: </tr>
                   12797: <tr>
1.338     nia      12798: <td>LUA_LDIR</td>
1.347   ! gutterid 12799: <td>LUA_LINKER_MAGIC</td>
1.333     nia      12800: </tr>
                   12801: <tr>
1.338     nia      12802: <td>LUA_PKGPREFIX</td>
1.347   ! gutterid 12803: <td>LUA_SELF_CONFLICT</td>
1.333     nia      12804: </tr>
                   12805: <tr>
1.338     nia      12806: <td>LUA_USE_BUSTED</td>
1.347   ! gutterid 12807: <td>LUA_VERSIONS_ACCEPTED</td>
1.333     nia      12808: </tr>
                   12809: <tr>
1.338     nia      12810: <td>LUA_VERSIONS_INCOMPATIBLE</td>
1.347   ! gutterid 12811: <td>LUA_VERSION_DEFAULT</td>
1.333     nia      12812: </tr>
                   12813: <tr>
1.338     nia      12814: <td>LUA_VERSION_REQD</td>
1.347   ! gutterid 12815: <td>Lua</td>
1.333     nia      12816: </tr>
                   12817: <tr>
1.338     nia      12818: <td>MACHINE_PLATFORM</td>
1.347   ! gutterid 12819: <td>MAILAGENT_DOMAIN</td>
1.333     nia      12820: </tr>
                   12821: <tr>
1.338     nia      12822: <td>MAILAGENT_EMAIL</td>
1.347   ! gutterid 12823: <td>MAILAGENT_FQDN</td>
1.269     leot     12824: </tr>
                   12825: <tr>
1.338     nia      12826: <td>MAILAGENT_ORGANIZATION</td>
1.347   ! gutterid 12827: <td>MAJORDOMO_HOMEDIR</td>
1.320     wiz      12828: </tr>
                   12829: <tr>
1.340     gutterid 12830: <td>MAKEINFO_ARGS</td>
1.347   ! gutterid 12831: <td>MAKE_DIRS</td>
1.342     wiz      12832: </tr>
                   12833: <tr>
                   12834: <td>MAKE_DIRS_PERMS</td>
1.347   ! gutterid 12835: <td>MAKE_ENV</td>
1.269     leot     12836: </tr>
                   12837: <tr>
1.342     wiz      12838: <td>MAKE_FILE</td>
1.347   ! gutterid 12839: <td>MAKE_FLAGS</td>
1.327     wiz      12840: </tr>
                   12841: <tr>
1.342     wiz      12842: <td>MAKE_JOBS</td>
1.347   ! gutterid 12843: <td>MAKE_JOBS_SAFE</td>
1.269     leot     12844: </tr>
                   12845: <tr>
1.342     wiz      12846: <td>MAKE_PROGRAM</td>
1.347   ! gutterid 12847: <td>MANCOMPRESSED_IF_MANZ</td>
1.269     leot     12848: </tr>
                   12849: <tr>
1.342     wiz      12850: <td>MANINSTALL</td>
1.347   ! gutterid 12851: <td>MANZ</td>
1.269     leot     12852: </tr>
                   12853: <tr>
1.342     wiz      12854: <td>MASTER_SITES</td>
1.347   ! gutterid 12855: <td>MASTER_SITE_BACKUP</td>
1.303     bacon    12856: </tr>
                   12857: <tr>
1.342     wiz      12858: <td>MASTER_SITE_LOCAL</td>
1.347   ! gutterid 12859: <td>MASTER_SITE_MOZILLA</td>
1.269     leot     12860: </tr>
                   12861: <tr>
1.342     wiz      12862: <td>MASTER_SITE_OVERRIDE</td>
1.347   ! gutterid 12863: <td>MASTER_SITE_PERL_CPAN</td>
1.269     leot     12864: </tr>
                   12865: <tr>
1.342     wiz      12866: <td>MASTER_SORT</td>
1.347   ! gutterid 12867: <td>MASTER_SORT_RANDOM</td>
1.269     leot     12868: </tr>
                   12869: <tr>
1.342     wiz      12870: <td>MASTER_SORT_REGEX</td>
1.347   ! gutterid 12871: <td>MECAB_CHARSET</td>
1.269     leot     12872: </tr>
                   12873: <tr>
1.342     wiz      12874: <td>MEDIATOMB_GROUP</td>
1.347   ! gutterid 12875: <td>MEDIATOMB_USER</td>
1.269     leot     12876: </tr>
                   12877: <tr>
1.342     wiz      12878: <td>MIPSPROBASE</td>
1.347   ! gutterid 12879: <td>MIREDO_GROUP</td>
1.269     leot     12880: </tr>
                   12881: <tr>
1.342     wiz      12882: <td>MIREDO_USER</td>
1.347   ! gutterid 12883: <td>MISSING_FEATURES</td>
1.269     leot     12884: </tr>
                   12885: <tr>
1.342     wiz      12886: <td>MKDIR</td>
1.347   ! gutterid 12887: <td>MKPIE_SUPPORTED</td>
1.269     leot     12888: </tr>
                   12889: <tr>
1.342     wiz      12890: <td>MLDONKEY_GROUP</td>
1.347   ! gutterid 12891: <td>MLDONKEY_HOME</td>
1.269     leot     12892: </tr>
                   12893: <tr>
1.342     wiz      12894: <td>MLDONKEY_USER</td>
1.347   ! gutterid 12895: <td>MONOTONE_GROUP</td>
1.269     leot     12896: </tr>
                   12897: <tr>
1.342     wiz      12898: <td>MONOTONE_USER</td>
1.347   ! gutterid 12899: <td>MOTIFBASE</td>
1.322     leot     12900: </tr>
                   12901: <tr>
1.342     wiz      12902: <td>MOTIF_TYPE</td>
1.347   ! gutterid 12903: <td>MOTIF_TYPE_DEFAULT</td>
1.269     leot     12904: </tr>
                   12905: <tr>
1.342     wiz      12906: <td>MPI_TYPE</td>
1.347   ! gutterid 12907: <td>MSGFMT_STRIP_MSGCTXT</td>
1.269     leot     12908: </tr>
                   12909: <tr>
1.342     wiz      12910: <td>MSGFMT_STRIP_MSGID_PLURAL</td>
1.347   ! gutterid 12911: <td>MTOOLS_ENABLE_FLOPPYD</td>
1.269     leot     12912: </tr>
                   12913: <tr>
1.336     nia      12914: <td>MV</td>
1.347   ! gutterid 12915: <td>MYSQL_CHARSET</td>
1.338     nia      12916: </tr>
                   12917: <tr>
                   12918: <td>MYSQL_DATADIR</td>
1.347   ! gutterid 12919: <td>MYSQL_EXTRA_CHARSET</td>
1.329     leot     12920: </tr>
                   12921: <tr>
1.338     nia      12922: <td>MYSQL_GROUP</td>
1.347   ! gutterid 12923: <td>MYSQL_USER</td>
1.269     leot     12924: </tr>
                   12925: <tr>
1.338     nia      12926: <td>MYSQL_VERSION</td>
1.347   ! gutterid 12927: <td>MYSQL_VERSIONS_ACCEPTED</td>
1.320     wiz      12928: </tr>
                   12929: <tr>
1.338     nia      12930: <td>MYSQL_VERSIONS_ALL</td>
1.347   ! gutterid 12931: <td>MYSQL_VERSION_DEFAULT</td>
1.269     leot     12932: </tr>
                   12933: <tr>
1.338     nia      12934: <td>NAGIOSCMD_GROUP</td>
1.347   ! gutterid 12935: <td>NAGIOSDIR</td>
1.269     leot     12936: </tr>
                   12937: <tr>
1.338     nia      12938: <td>NAGIOS_GROUP</td>
1.347   ! gutterid 12939: <td>NAGIOS_USER</td>
1.269     leot     12940: </tr>
                   12941: <tr>
1.338     nia      12942: <td>NATIVE_APPEND_ABI</td>
1.347   ! gutterid 12943: <td>NATIVE_APPEND_ELF</td>
1.309     gutterid 12944: </tr>
                   12945: <tr>
1.338     nia      12946: <td>NATIVE_EXEC_FMT</td>
1.347   ! gutterid 12947: <td>NATIVE_MACHINE_PLATFORM</td>
1.269     leot     12948: </tr>
                   12949: <tr>
1.338     nia      12950: <td>NATIVE_OBJECT_FMT</td>
1.347   ! gutterid 12951: <td>NBPAX_PROGRAM_PREFIX</td>
1.269     leot     12952: </tr>
                   12953: <tr>
1.338     nia      12954: <td>NETBSD_LOGIN_NAME</td>
1.347   ! gutterid 12955: <td>NMH_EDITOR</td>
1.269     leot     12956: </tr>
                   12957: <tr>
1.338     nia      12958: <td>NMH_MTA</td>
1.347   ! gutterid 12959: <td>NMH_PAGER</td>
1.269     leot     12960: </tr>
                   12961: <tr>
1.338     nia      12962: <td>NODE_VERSIONS_ACCEPTED</td>
1.347   ! gutterid 12963: <td>NODE_VERSIONS_INCOMPATIBLE</td>
1.269     leot     12964: </tr>
                   12965: <tr>
1.338     nia      12966: <td>NODE_VERSION_DEFAULT</td>
1.347   ! gutterid 12967: <td>NODE_VERSION_REQD</td>
1.269     leot     12968: </tr>
                   12969: <tr>
1.338     nia      12970: <td>NOLOGIN</td>
1.347   ! gutterid 12971: <td>NOTE</td>
1.344     gutterid 12972: </tr>
                   12973: <tr>
                   12974: <td>NOT_FOR_PLATFORM</td>
1.347   ! gutterid 12975: <td>NOT_PAX_ASLR_SAFE</td>
1.333     nia      12976: </tr>
                   12977: <tr>
1.344     gutterid 12978: <td>NOT_PAX_MPROTECT_SAFE</td>
1.347   ! gutterid 12979: <td>NO_BUILD</td>
1.333     nia      12980: </tr>
                   12981: <tr>
1.344     gutterid 12982: <td>NO_CHECKSUM</td>
1.347   ! gutterid 12983: <td>NO_CONFIGURE</td>
1.293     rillig   12984: </tr>
                   12985: <tr>
1.344     gutterid 12986: <td>NO_SKIP</td>
1.347   ! gutterid 12987: <td>NS_PREFERRED</td>
1.269     leot     12988: </tr>
                   12989: <tr>
1.344     gutterid 12990: <td>NULLMAILER_GROUP</td>
1.347   ! gutterid 12991: <td>NULLMAILER_USER</td>
1.269     leot     12992: </tr>
                   12993: <tr>
1.344     gutterid 12994: <td>OASIS</td>
1.347   ! gutterid 12995: <td>OASIS_BUILD_ARGS</td>
1.269     leot     12996: </tr>
                   12997: <tr>
1.344     gutterid 12998: <td>OBJHOSTNAME</td>
1.347   ! gutterid 12999: <td>OBJMACHINE</td>
1.269     leot     13000: </tr>
                   13001: <tr>
1.344     gutterid 13002: <td>OCAML_FINDLIB_DIRS</td>
1.347   ! gutterid 13003: <td>OCAML_FINDLIB_REGISTER</td>
1.269     leot     13004: </tr>
                   13005: <tr>
1.344     gutterid 13006: <td>OCAML_FINDLIB_REGISTER_VERBOSE</td>
1.347   ! gutterid 13007: <td>OCAML_SITELIBDIR</td>
1.269     leot     13008: </tr>
                   13009: <tr>
1.344     gutterid 13010: <td>OCAML_TOPKG_DOCDIR</td>
1.347   ! gutterid 13011: <td>OCAML_USE_DUNE</td>
1.269     leot     13012: </tr>
                   13013: <tr>
1.344     gutterid 13014: <td>OCAML_USE_FINDLIB</td>
1.347   ! gutterid 13015: <td>OCAML_USE_OASIS</td>
1.269     leot     13016: </tr>
                   13017: <tr>
1.344     gutterid 13018: <td>OCAML_USE_OASIS_DYNRUN</td>
1.347   ! gutterid 13019: <td>OCAML_USE_OPAM</td>
1.269     leot     13020: </tr>
                   13021: <tr>
1.344     gutterid 13022: <td>OCAML_USE_TOPKG</td>
1.347   ! gutterid 13023: <td>OMF</td>
1.269     leot     13024: </tr>
                   13025: <tr>
1.344     gutterid 13026: <td>ONLY_FOR_COMPILER</td>
1.347   ! gutterid 13027: <td>ONLY_FOR_PLATFORM</td>
1.269     leot     13028: </tr>
                   13029: <tr>
1.344     gutterid 13030: <td>OPENSSH_CHROOT</td>
1.347   ! gutterid 13031: <td>OPENSSH_GROUP</td>
1.269     leot     13032: </tr>
                   13033: <tr>
1.344     gutterid 13034: <td>OPENSSH_USER</td>
1.347   ! gutterid 13035: <td>OPSYS</td>
1.269     leot     13036: </tr>
                   13037: <tr>
1.344     gutterid 13038: <td>OPSYS_EMULDIR</td>
1.347   ! gutterid 13039: <td>OPSYS_VERSION</td>
1.269     leot     13040: </tr>
                   13041: <tr>
1.344     gutterid 13042: <td>OS</td>
1.347   ! gutterid 13043: <td>OSS_TYPE</td>
1.269     leot     13044: </tr>
                   13045: <tr>
1.344     gutterid 13046: <td>OSX</td>
1.347   ! gutterid 13047: <td>OSX_TOLERATE_SDK_SKEW</td>
1.269     leot     13048: </tr>
                   13049: <tr>
1.344     gutterid 13050: <td>OS_VARIANT</td>
1.347   ! gutterid 13051: <td>OS_VERSION</td>
1.269     leot     13052: </tr>
                   13053: <tr>
1.344     gutterid 13054: <td>OTF_FONTS_DIR</td>
1.347   ! gutterid 13055: <td>OVERRIDE_DIRDEPTH</td>
1.338     nia      13056: </tr>
                   13057: <tr>
1.344     gutterid 13058: <td>OVERRIDE_GEMSPEC</td>
1.347   ! gutterid 13059: <td>OVERRIDE_GNU_CONFIG_SCRIPTS</td>
1.327     wiz      13060: </tr>
                   13061: <tr>
1.344     gutterid 13062: <td>OWN_DIRS</td>
1.347   ! gutterid 13063: <td>OWN_DIRS_PERMS</td>
1.329     leot     13064: </tr>
                   13065: <tr>
1.344     gutterid 13066: <td>P4GROUP</td>
1.347   ! gutterid 13067: <td>P4PORT</td>
1.342     wiz      13068: </tr>
                   13069: <tr>
1.344     gutterid 13070: <td>P4ROOT</td>
1.347   ! gutterid 13071: <td>P4USER</td>
1.320     wiz      13072: </tr>
                   13073: <tr>
1.344     gutterid 13074: <td>PACKAGES</td>
1.347   ! gutterid 13075: <td>PALMOS_DEFAULT_SDK</td>
1.269     leot     13076: </tr>
                   13077: <tr>
1.344     gutterid 13078: <td>PAMBASE</td>
1.347   ! gutterid 13079: <td>PAM_DEFAULT</td>
1.269     leot     13080: </tr>
                   13081: <tr>
1.344     gutterid 13082: <td>PAPERSIZE</td>
1.347   ! gutterid 13083: <td>PASSIVE_FETCH</td>
1.269     leot     13084: </tr>
                   13085: <tr>
1.344     gutterid 13086: <td>PATCHDIR</td>
1.347   ! gutterid 13087: <td>PATCHFILES</td>
1.269     leot     13088: </tr>
                   13089: <tr>
1.344     gutterid 13090: <td>PATCH_ARGS</td>
1.347   ! gutterid 13091: <td>PATCH_DEBUG</td>
1.269     leot     13092: </tr>
                   13093: <tr>
1.344     gutterid 13094: <td>PATCH_DIST_ARGS</td>
1.347   ! gutterid 13095: <td>PATCH_DIST_CAT</td>
1.269     leot     13096: </tr>
                   13097: <tr>
1.344     gutterid 13098: <td>PATCH_DIST_STRIP</td>
1.347   ! gutterid 13099: <td>PATCH_FUZZ_FACTOR</td>
1.324     nia      13100: </tr>
                   13101: <tr>
1.344     gutterid 13102: <td>PATCH_STRIP</td>
1.347   ! gutterid 13103: <td>PATH</td>
1.269     leot     13104: </tr>
                   13105: <tr>
1.344     gutterid 13106: <td>PCCBASE</td>
1.347   ! gutterid 13107: <td>PEAR_CMD</td>
1.269     leot     13108: </tr>
                   13109: <tr>
1.344     gutterid 13110: <td>PEAR_LIB</td>
1.347   ! gutterid 13111: <td>PEAR_PACKAGE_XML</td>
1.342     wiz      13112: </tr>
                   13113: <tr>
1.344     gutterid 13114: <td>PERL5</td>
1.347   ! gutterid 13115: <td>PERL5_CONFIGURE</td>
1.269     leot     13116: </tr>
                   13117: <tr>
1.344     gutterid 13118: <td>PERL5_CONFIGURE_DIRS</td>
1.347   ! gutterid 13119: <td>PERL5_LDFLAGS</td>
1.332     rillig   13120: </tr>
                   13121: <tr>
1.344     gutterid 13122: <td>PERL5_LICENSE</td>
1.347   ! gutterid 13123: <td>PERL5_MODULE_TYPE</td>
1.320     wiz      13124: </tr>
                   13125: <tr>
1.344     gutterid 13126: <td>PERL5_PACKLIST</td>
1.347   ! gutterid 13127: <td>PERL5_PACKLIST_DIR</td>
1.292     leot     13128: </tr>
                   13129: <tr>
1.344     gutterid 13130: <td>PERL5_PERLBASE</td>
1.347   ! gutterid 13131: <td>PERL5_SITEBASE</td>
1.274     rillig   13132: </tr>
                   13133: <tr>
1.344     gutterid 13134: <td>PERL5_USE_PACKLIST</td>
1.347   ! gutterid 13135: <td>PERL5_VENDORBASE</td>
1.274     rillig   13136: </tr>
                   13137: <tr>
1.344     gutterid 13138: <td>PFCTL</td>
1.347   ! gutterid 13139: <td>PFVAR_H</td>
1.269     leot     13140: </tr>
                   13141: <tr>
1.344     gutterid 13142: <td>PF_VERSION</td>
1.347   ! gutterid 13143: <td>PGGROUP</td>
1.269     leot     13144: </tr>
                   13145: <tr>
1.344     gutterid 13146: <td>PGHOME</td>
1.347   ! gutterid 13147: <td>PGPKGSRCDIR</td>
1.269     leot     13148: </tr>
                   13149: <tr>
1.344     gutterid 13150: <td>PGSQL_TYPE</td>
1.347   ! gutterid 13151: <td>PGSQL_VERSION</td>
1.269     leot     13152: </tr>
                   13153: <tr>
1.344     gutterid 13154: <td>PGSQL_VERSIONS_ACCEPTED</td>
1.347   ! gutterid 13155: <td>PGSQL_VERSION_DEFAULT</td>
1.269     leot     13156: </tr>
                   13157: <tr>
1.344     gutterid 13158: <td>PGUSER</td>
1.347   ! gutterid 13159: <td>PG_LIB_EXT</td>
1.269     leot     13160: </tr>
                   13161: <tr>
1.344     gutterid 13162: <td>PHP</td>
1.347   ! gutterid 13163: <td>PHPCOMMON_MK</td>
1.269     leot     13164: </tr>
                   13165: <tr>
1.344     gutterid 13166: <td>PHPPKGSRCDIR</td>
1.347   ! gutterid 13167: <td>PHP_BASE_VERS</td>
1.269     leot     13168: </tr>
                   13169: <tr>
1.344     gutterid 13170: <td>PHP_CHECK_INSTALLED</td>
1.347   ! gutterid 13171: <td>PHP_EXTENSION_DIR</td>
1.269     leot     13172: </tr>
                   13173: <tr>
1.344     gutterid 13174: <td>PHP_INITIAL_TEENY</td>
1.347   ! gutterid 13175: <td>PHP_PKG_PREFIX</td>
1.269     leot     13176: </tr>
                   13177: <tr>
1.344     gutterid 13178: <td>PHP_VERSION</td>
1.347   ! gutterid 13179: <td>PHP_VERSIONS_ACCEPTED</td>
1.269     leot     13180: </tr>
                   13181: <tr>
1.344     gutterid 13182: <td>PHP_VERSIONS_INCOMPATIBLE</td>
1.347   ! gutterid 13183: <td>PHP_VERSION_DEFAULT</td>
1.269     leot     13184: </tr>
                   13185: <tr>
1.344     gutterid 13186: <td>PHP_VERSION_REQD</td>
1.347   ! gutterid 13187: <td>PILRC_USE_GTK</td>
1.269     leot     13188: </tr>
                   13189: <tr>
1.344     gutterid 13190: <td>PKGCONFIG_BASE</td>
1.347   ! gutterid 13191: <td>PKGCONFIG_FILE</td>
1.269     leot     13192: </tr>
                   13193: <tr>
1.344     gutterid 13194: <td>PKGCONFIG_OVERRIDE</td>
1.347   ! gutterid 13195: <td>PKGCONFIG_OVERRIDE_STAGE</td>
1.269     leot     13196: </tr>
                   13197: <tr>
1.344     gutterid 13198: <td>PKGDIR</td>
1.347   ! gutterid 13199: <td>PKGGNUDIR</td>
1.269     leot     13200: </tr>
                   13201: <tr>
1.344     gutterid 13202: <td>PKGINFODIR</td>
1.347   ! gutterid 13203: <td>PKGLOCALEDIR</td>
1.269     leot     13204: </tr>
                   13205: <tr>
1.344     gutterid 13206: <td>PKGMANDIR</td>
1.347   ! gutterid 13207: <td>PKGNAME</td>
1.269     leot     13208: </tr>
                   13209: <tr>
1.344     gutterid 13210: <td>PKGNAME_REQD</td>
1.347   ! gutterid 13211: <td>PKGPATH</td>
1.269     leot     13212: </tr>
                   13213: <tr>
1.344     gutterid 13214: <td>PKGREVISION</td>
1.347   ! gutterid 13215: <td>PKGSRC_BLAS_TYPES</td>
1.269     leot     13216: </tr>
                   13217: <tr>
1.344     gutterid 13218: <td>PKGSRC_CHANGES</td>
1.347   ! gutterid 13219: <td>PKGSRC_COMPILER</td>
1.269     leot     13220: </tr>
                   13221: <tr>
1.344     gutterid 13222: <td>PKGSRC_KEEP_BIN_PKGS</td>
1.347   ! gutterid 13223: <td>PKGSRC_LOCKTYPE</td>
1.269     leot     13224: </tr>
                   13225: <tr>
1.344     gutterid 13226: <td>PKGSRC_MAKE_ENV</td>
1.347   ! gutterid 13227: <td>PKGSRC_MESSAGE_RECIPIENTS</td>
1.269     leot     13228: </tr>
                   13229: <tr>
1.344     gutterid 13230: <td>PKGSRC_MKPIE</td>
1.347   ! gutterid 13231: <td>PKGSRC_MKREPRO</td>
1.269     leot     13232: </tr>
                   13233: <tr>
1.344     gutterid 13234: <td>PKGSRC_OVERRIDE_MKPIE</td>
1.347   ! gutterid 13235: <td>PKGSRC_RUN_TEST</td>
1.292     leot     13236: </tr>
                   13237: <tr>
1.344     gutterid 13238: <td>PKGSRC_SETENV</td>
1.347   ! gutterid 13239: <td>PKGSRC_SLEEPSECS</td>
1.269     leot     13240: </tr>
                   13241: <tr>
1.344     gutterid 13242: <td>PKGSRC_TODO</td>
1.347   ! gutterid 13243: <td>PKGSRC_USE_CTF</td>
1.274     rillig   13244: </tr>
                   13245: <tr>
1.344     gutterid 13246: <td>PKGSRC_USE_FORTIFY</td>
1.347   ! gutterid 13247: <td>PKGSRC_USE_MKTOOLS</td>
1.269     leot     13248: </tr>
                   13249: <tr>
1.344     gutterid 13250: <td>PKGSRC_USE_RELRO</td>
1.347   ! gutterid 13251: <td>PKGSRC_USE_SSP</td>
1.269     leot     13252: </tr>
                   13253: <tr>
1.344     gutterid 13254: <td>PKGSRC_USE_STACK_CHECK</td>
1.347   ! gutterid 13255: <td>PKGTASKS_DATAFILE</td>
1.269     leot     13256: </tr>
                   13257: <tr>
1.344     gutterid 13258: <td>PKGTOOLS_ARGS</td>
1.347   ! gutterid 13259: <td>PKGTOOLS_ENV</td>
1.269     leot     13260: </tr>
                   13261: <tr>
1.344     gutterid 13262: <td>PKG_ALTERNATIVES</td>
1.347   ! gutterid 13263: <td>PKG_APACHE</td>
1.269     leot     13264: </tr>
                   13265: <tr>
1.344     gutterid 13266: <td>PKG_APACHE_ACCEPTED</td>
1.347   ! gutterid 13267: <td>PKG_APACHE_DEFAULT</td>
1.269     leot     13268: </tr>
                   13269: <tr>
1.344     gutterid 13270: <td>PKG_BEST_EXISTS</td>
1.347   ! gutterid 13271: <td>PKG_BUILD_OPTIONS</td>
1.269     leot     13272: </tr>
                   13273: <tr>
1.344     gutterid 13274: <td>PKG_COMPRESSION</td>
1.347   ! gutterid 13275: <td>PKG_CONFIG</td>
1.269     leot     13276: </tr>
                   13277: <tr>
1.344     gutterid 13278: <td>PKG_CONFIG_PERMS</td>
1.347   ! gutterid 13279: <td>PKG_CREATE_USERGROUP</td>
1.269     leot     13280: </tr>
                   13281: <tr>
1.344     gutterid 13282: <td>PKG_DB_TMPDIR</td>
1.347   ! gutterid 13283: <td>PKG_DEBUG_LEVEL</td>
1.269     leot     13284: </tr>
                   13285: <tr>
1.344     gutterid 13286: <td>PKG_DEFAULT_OPTIONS</td>
1.347   ! gutterid 13287: <td>PKG_DESTDIR_SUPPORT</td>
1.269     leot     13288: </tr>
                   13289: <tr>
1.344     gutterid 13290: <td>PKG_DEVELOPER</td>
1.347   ! gutterid 13291: <td>PKG_DISABLED_OPTIONS</td>
1.269     leot     13292: </tr>
                   13293: <tr>
1.344     gutterid 13294: <td>PKG_FATAL_ERRORS</td>
1.347   ! gutterid 13295: <td>PKG_FC</td>
1.269     leot     13296: </tr>
                   13297: <tr>
1.344     gutterid 13298: <td>PKG_FILELIST_CMD</td>
1.347   ! gutterid 13299: <td>PKG_GECOS</td>
1.269     leot     13300: </tr>
                   13301: <tr>
1.344     gutterid 13302: <td>PKG_GID</td>
1.347   ! gutterid 13303: <td>PKG_GROUPS</td>
1.269     leot     13304: </tr>
                   13305: <tr>
1.344     gutterid 13306: <td>PKG_GROUPS_VARS</td>
1.347   ! gutterid 13307: <td>PKG_HOME</td>
1.269     leot     13308: </tr>
                   13309: <tr>
1.344     gutterid 13310: <td>PKG_INIT_SCRIPTS</td>
1.347   ! gutterid 13311: <td>PKG_JAVA_HOME</td>
1.269     leot     13312: </tr>
                   13313: <tr>
1.344     gutterid 13314: <td>PKG_JVM</td>
1.347   ! gutterid 13315: <td>PKG_JVMS_ACCEPTED</td>
1.269     leot     13316: </tr>
                   13317: <tr>
1.344     gutterid 13318: <td>PKG_JVM_DEFAULT</td>
1.347   ! gutterid 13319: <td>PKG_LEGACY_OPTIONS</td>
1.269     leot     13320: </tr>
                   13321: <tr>
1.344     gutterid 13322: <td>PKG_LIBTOOL</td>
1.347   ! gutterid 13323: <td>PKG_MKSYMLINKS</td>
1.269     leot     13324: </tr>
                   13325: <tr>
1.344     gutterid 13326: <td>PKG_OPTIONS</td>
1.347   ! gutterid 13327: <td>PKG_OPTIONS_DEPRECATED_WARNINGS</td>
1.269     leot     13328: </tr>
                   13329: <tr>
1.344     gutterid 13330: <td>PKG_OPTIONS_LEGACY_OPTS</td>
1.347   ! gutterid 13331: <td>PKG_OPTIONS_LEGACY_VARS</td>
1.341     gutterid 13332: </tr>
                   13333: <tr>
1.344     gutterid 13334: <td>PKG_OPTIONS_NONEMPTY_SETS</td>
1.347   ! gutterid 13335: <td>PKG_OPTIONS_OPTIONAL_GROUPS</td>
1.269     leot     13336: </tr>
                   13337: <tr>
1.344     gutterid 13338: <td>PKG_OPTIONS_REQUIRED_GROUPS</td>
1.347   ! gutterid 13339: <td>PKG_OPTIONS_VAR</td>
1.269     leot     13340: </tr>
                   13341: <tr>
1.344     gutterid 13342: <td>PKG_PHP</td>
1.347   ! gutterid 13343: <td>PKG_PHP_MAJOR_VERS</td>
1.269     leot     13344: </tr>
                   13345: <tr>
1.344     gutterid 13346: <td>PKG_PHP_VERSION</td>
1.347   ! gutterid 13347: <td>PKG_RCD_SCRIPTS</td>
1.269     leot     13348: </tr>
                   13349: <tr>
1.344     gutterid 13350: <td>PKG_REFCOUNT_DBDIR</td>
1.347   ! gutterid 13351: <td>PKG_REGISTER_SHELLS</td>
1.269     leot     13352: </tr>
                   13353: <tr>
1.344     gutterid 13354: <td>PKG_RESUME_TRANSFERS</td>
1.347   ! gutterid 13355: <td>PKG_SHELL</td>
1.269     leot     13356: </tr>
                   13357: <tr>
1.344     gutterid 13358: <td>PKG_SUGGESTED_OPTIONS</td>
1.347   ! gutterid 13359: <td>PKG_SUPPORTED_OPTIONS</td>
1.269     leot     13360: </tr>
                   13361: <tr>
1.344     gutterid 13362: <td>PKG_SYSCONFBASE</td>
1.347   ! gutterid 13363: <td>PKG_SYSCONFBASEDIR</td>
1.269     leot     13364: </tr>
                   13365: <tr>
1.344     gutterid 13366: <td>PKG_SYSCONFDIR</td>
1.347   ! gutterid 13367: <td>PKG_SYSCONFDIR_PERMS</td>
1.269     leot     13368: </tr>
                   13369: <tr>
1.344     gutterid 13370: <td>PKG_SYSCONFSUBDIR</td>
1.347   ! gutterid 13371: <td>PKG_SYSCONFVAR</td>
1.269     leot     13372: </tr>
                   13373: <tr>
1.344     gutterid 13374: <td>PKG_TOOLS_BIN</td>
1.347   ! gutterid 13375: <td>PKG_UID</td>
1.269     leot     13376: </tr>
                   13377: <tr>
1.344     gutterid 13378: <td>PKG_UPDATE_FONTS_DB</td>
1.347   ! gutterid 13379: <td>PKG_USERS</td>
1.269     leot     13380: </tr>
                   13381: <tr>
1.344     gutterid 13382: <td>PKG_USERS_VARS</td>
1.347   ! gutterid 13383: <td>PKG_VERBOSE</td>
1.269     leot     13384: </tr>
                   13385: <tr>
1.344     gutterid 13386: <td>PLEASE</td>
1.347   ! gutterid 13387: <td>PLIST</td>
1.269     leot     13388: </tr>
                   13389: <tr>
1.344     gutterid 13390: <td>PLIST_AWK</td>
1.347   ! gutterid 13391: <td>PLIST_AWK_ENV</td>
1.269     leot     13392: </tr>
                   13393: <tr>
1.344     gutterid 13394: <td>PLIST_SRC</td>
1.347   ! gutterid 13395: <td>PLIST_SUBST</td>
1.269     leot     13396: </tr>
                   13397: <tr>
1.344     gutterid 13398: <td>PLIST_TYPE</td>
1.347   ! gutterid 13399: <td>PLIST_VARS</td>
1.269     leot     13400: </tr>
                   13401: <tr>
1.344     gutterid 13402: <td>POPTOP_USE_MPPE</td>
1.347   ! gutterid 13403: <td>POSSIBLE_GFORTRAN_VERSION</td>
1.269     leot     13404: </tr>
                   13405: <tr>
1.344     gutterid 13406: <td>POST_FETCH_HOOK</td>
1.347   ! gutterid 13407: <td>PREFER</td>
1.269     leot     13408: </tr>
                   13409: <tr>
1.344     gutterid 13410: <td>PREFER_NATIVE</td>
1.347   ! gutterid 13411: <td>PREFER_NATIVE_PTHREADS</td>
1.269     leot     13412: </tr>
                   13413: <tr>
1.344     gutterid 13414: <td>PREFER_PKGSRC</td>
1.347   ! gutterid 13415: <td>PREFIX</td>
1.269     leot     13416: </tr>
                   13417: <tr>
1.344     gutterid 13418: <td>PREPEND_PATH</td>
1.347   ! gutterid 13419: <td>PRE_ROOT_CMD</td>
1.269     leot     13420: </tr>
                   13421: <tr>
1.344     gutterid 13422: <td>PRIVILEGED_STAGES</td>
1.347   ! gutterid 13423: <td>PS</td>
1.269     leot     13424: </tr>
                   13425: <tr>
1.344     gutterid 13426: <td>PTHREAD_AUTO_VARS</td>
1.347   ! gutterid 13427: <td>PTHREAD_CFLAGS</td>
1.269     leot     13428: </tr>
                   13429: <tr>
1.344     gutterid 13430: <td>PTHREAD_LDFLAGS</td>
1.347   ! gutterid 13431: <td>PTHREAD_LIBS</td>
1.269     leot     13432: </tr>
                   13433: <tr>
1.344     gutterid 13434: <td>PTHREAD_OPTS</td>
1.347   ! gutterid 13435: <td>PTHREAD_TYPE</td>
1.269     leot     13436: </tr>
                   13437: <tr>
1.344     gutterid 13438: <td>PVM_SSH</td>
1.347   ! gutterid 13439: <td>PYPKGPREFIX</td>
1.269     leot     13440: </tr>
                   13441: <tr>
1.344     gutterid 13442: <td>PYTHON_FOR_BUILD_ONLY</td>
1.347   ! gutterid 13443: <td>PYTHON_SELF_CONFLICT</td>
1.269     leot     13444: </tr>
                   13445: <tr>
1.344     gutterid 13446: <td>PYTHON_VERSIONED_DEPENDENCIES</td>
1.347   ! gutterid 13447: <td>PYTHON_VERSIONS_ACCEPTED</td>
1.269     leot     13448: </tr>
                   13449: <tr>
1.344     gutterid 13450: <td>PYTHON_VERSIONS_INCOMPATIBLE</td>
1.347   ! gutterid 13451: <td>PYTHON_VERSION_DEFAULT</td>
1.269     leot     13452: </tr>
                   13453: <tr>
1.344     gutterid 13454: <td>PYTHON_VERSION_REQD</td>
1.347   ! gutterid 13455: <td>PYVERSSUFFIX</td>
1.269     leot     13456: </tr>
                   13457: <tr>
1.344     gutterid 13458: <td>QMAILDIR</td>
1.347   ! gutterid 13459: <td>QMAIL_ALIAS_USER</td>
1.269     leot     13460: </tr>
                   13461: <tr>
1.344     gutterid 13462: <td>QMAIL_DAEMON_USER</td>
1.347   ! gutterid 13463: <td>QMAIL_LOG_USER</td>
1.269     leot     13464: </tr>
                   13465: <tr>
1.344     gutterid 13466: <td>QMAIL_NOFILES_GROUP</td>
1.347   ! gutterid 13467: <td>QMAIL_PASSWD_USER</td>
1.269     leot     13468: </tr>
                   13469: <tr>
1.344     gutterid 13470: <td>QMAIL_QMAIL_GROUP</td>
1.347   ! gutterid 13471: <td>QMAIL_QUEUE_DIR</td>
1.269     leot     13472: </tr>
                   13473: <tr>
1.344     gutterid 13474: <td>QMAIL_QUEUE_EXTRA</td>
1.347   ! gutterid 13475: <td>QMAIL_QUEUE_USER</td>
1.269     leot     13476: </tr>
                   13477: <tr>
1.344     gutterid 13478: <td>QMAIL_REMOTE_USER</td>
1.347   ! gutterid 13479: <td>QMAIL_ROOT_USER</td>
1.269     leot     13480: </tr>
                   13481: <tr>
1.344     gutterid 13482: <td>QMAIL_SEND_USER</td>
1.347   ! gutterid 13483: <td>QORE_LATEST_MODULE_API</td>
1.269     leot     13484: </tr>
                   13485: <tr>
1.344     gutterid 13486: <td>QORE_MODULE_API</td>
1.347   ! gutterid 13487: <td>QORE_MODULE_DIR</td>
1.269     leot     13488: </tr>
                   13489: <tr>
1.344     gutterid 13490: <td>QORE_USER_MODULE_DIR</td>
1.347   ! gutterid 13491: <td>QORE_VERSION</td>
1.269     leot     13492: </tr>
                   13493: <tr>
1.344     gutterid 13494: <td>QPOPPER_FAC</td>
1.347   ! gutterid 13495: <td>QPOPPER_SPOOL_DIR</td>
1.269     leot     13496: </tr>
                   13497: <tr>
1.344     gutterid 13498: <td>QPOPPER_USER</td>
1.347   ! gutterid 13499: <td>RAKE_NAME</td>
1.333     nia      13500: </tr>
                   13501: <tr>
1.344     gutterid 13502: <td>RASMOL_DEPTH</td>
1.347   ! gutterid 13503: <td>RCD_SCRIPTS</td>
1.333     nia      13504: </tr>
                   13505: <tr>
1.344     gutterid 13506: <td>RCD_SCRIPTS_DIR</td>
1.347   ! gutterid 13507: <td>RCD_SCRIPTS_EXAMPLEDIR</td>
1.342     wiz      13508: </tr>
                   13509: <tr>
1.344     gutterid 13510: <td>RCD_SCRIPTS_MODE</td>
1.347   ! gutterid 13511: <td>RCD_SCRIPTS_SHELL</td>
1.269     leot     13512: </tr>
                   13513: <tr>
1.344     gutterid 13514: <td>RCD_SCRIPT_SRC</td>
1.347   ! gutterid 13515: <td>RDOC</td>
1.329     leot     13516: </tr>
                   13517: <tr>
1.344     gutterid 13518: <td>READLINE_DEFAULT</td>
1.347   ! gutterid 13519: <td>READLINE_TYPE</td>
1.320     wiz      13520: </tr>
                   13521: <tr>
1.344     gutterid 13522: <td>REAL_ROOT_GROUP</td>
1.347   ! gutterid 13523: <td>REAL_ROOT_USER</td>
1.338     nia      13524: </tr>
                   13525: <tr>
1.344     gutterid 13526: <td>RECURSIVE_MAKE</td>
1.347   ! gutterid 13527: <td>RELAY_CTRL_DIR</td>
1.292     leot     13528: </tr>
                   13529: <tr>
1.344     gutterid 13530: <td>RELRO_SUPPORTED</td>
1.347   ! gutterid 13531: <td>REPLACE_AWK</td>
1.329     leot     13532: </tr>
                   13533: <tr>
1.344     gutterid 13534: <td>REPLACE_BASH</td>
1.347   ! gutterid 13535: <td>REPLACE_CSH</td>
1.327     wiz      13536: </tr>
                   13537: <tr>
1.344     gutterid 13538: <td>REPLACE_KSH</td>
1.347   ! gutterid 13539: <td>REPLACE_LUA</td>
1.269     leot     13540: </tr>
                   13541: <tr>
1.344     gutterid 13542: <td>REPLACE_NODEJS</td>
1.347   ! gutterid 13543: <td>REPLACE_OCTAVE</td>
1.320     wiz      13544: </tr>
                   13545: <tr>
1.344     gutterid 13546: <td>REPLACE_PERL</td>
1.347   ! gutterid 13547: <td>REPLACE_PERL6</td>
1.311     leot     13548: </tr>
                   13549: <tr>
1.344     gutterid 13550: <td>REPLACE_PHP</td>
1.347   ! gutterid 13551: <td>REPLACE_PYTHON</td>
1.269     leot     13552: </tr>
                   13553: <tr>
1.344     gutterid 13554: <td>REPLACE_QORE</td>
1.347   ! gutterid 13555: <td>REPLACE_R</td>
1.333     nia      13556: </tr>
                   13557: <tr>
1.344     gutterid 13558: <td>REPLACE_RUBY</td>
1.347   ! gutterid 13559: <td>REPLACE_RUBY_DIRS</td>
1.269     leot     13560: </tr>
                   13561: <tr>
1.344     gutterid 13562: <td>REPLACE_RUBY_PAT</td>
1.347   ! gutterid 13563: <td>REPLACE_SH</td>
1.331     gutterid 13564: </tr>
                   13565: <tr>
1.344     gutterid 13566: <td>REPLACE_TEXLUA</td>
1.347   ! gutterid 13567: <td>REPLACE_WISH</td>
1.269     leot     13568: </tr>
                   13569: <tr>
1.344     gutterid 13570: <td>REQD_DIRS</td>
1.347   ! gutterid 13571: <td>REQD_DIRS_PERMS</td>
1.333     nia      13572: </tr>
                   13573: <tr>
1.344     gutterid 13574: <td>REQD_FILES</td>
1.347   ! gutterid 13575: <td>REQD_FILES_MODE</td>
1.269     leot     13576: </tr>
                   13577: <tr>
1.344     gutterid 13578: <td>REQD_FILES_PERMS</td>
1.347   ! gutterid 13579: <td>RESOLV_AUTO_VARS</td>
1.269     leot     13580: </tr>
                   13581: <tr>
1.344     gutterid 13582: <td>RESOLV_LDFLAGS</td>
1.347   ! gutterid 13583: <td>RESOLV_LIBS</td>
1.269     leot     13584: </tr>
                   13585: <tr>
1.344     gutterid 13586: <td>RM</td>
1.347   ! gutterid 13587: <td>ROOT_CMD</td>
1.269     leot     13588: </tr>
                   13589: <tr>
1.344     gutterid 13590: <td>ROOT_GROUP</td>
1.347   ! gutterid 13591: <td>ROOT_USER</td>
1.269     leot     13592: </tr>
                   13593: <tr>
1.344     gutterid 13594: <td>RPCGEN</td>
1.347   ! gutterid 13595: <td>RPM</td>
1.320     wiz      13596: </tr>
                   13597: <tr>
1.344     gutterid 13598: <td>RPM2PKG_PLIST</td>
1.347   ! gutterid 13599: <td>RPM2PKG_PREFIX</td>
1.332     rillig   13600: </tr>
                   13601: <tr>
1.344     gutterid 13602: <td>RPM2PKG_STAGE</td>
1.347   ! gutterid 13603: <td>RPM2PKG_STRIP</td>
1.329     leot     13604: </tr>
                   13605: <tr>
1.344     gutterid 13606: <td>RPM2PKG_SUBPREFIX</td>
1.347   ! gutterid 13607: <td>RPMFILES</td>
1.327     wiz      13608: </tr>
                   13609: <tr>
1.344     gutterid 13610: <td>RPMIGNOREPATH</td>
1.347   ! gutterid 13611: <td>RPM_DB_PREFIX</td>
1.269     leot     13612: </tr>
                   13613: <tr>
1.344     gutterid 13614: <td>RSSH_CVS_PATH</td>
1.347   ! gutterid 13615: <td>RSSH_RDIST_PATH</td>
1.311     leot     13616: </tr>
                   13617: <tr>
1.344     gutterid 13618: <td>RSSH_RSYNC_PATH</td>
1.347   ! gutterid 13619: <td>RSSH_SCP_PATH</td>
1.269     leot     13620: </tr>
                   13621: <tr>
1.344     gutterid 13622: <td>RSSH_SFTP_SERVER_PATH</td>
1.347   ! gutterid 13623: <td>RUBY</td>
1.269     leot     13624: </tr>
                   13625: <tr>
1.344     gutterid 13626: <td>RUBYGEM</td>
1.347   ! gutterid 13627: <td>RUBYGEM_MANPAGES</td>
1.269     leot     13628: </tr>
                   13629: <tr>
1.341     gutterid 13630: <td>RUBYGEM_NAME</td>
1.347   ! gutterid 13631: <td>RUBYGEM_OPTIONS</td>
1.346     jnemeth  13632: </tr>
                   13633: <tr>
                   13634: <td>RUBYGEM_USE_MANPAGES</td>
1.347   ! gutterid 13635: <td>RUBYGEM_VERBOSE</td>
1.269     leot     13636: </tr>
                   13637: <tr>
1.344     gutterid 13638: <td>RUBY_ABI_VERSION</td>
1.347   ! gutterid 13639: <td>RUBY_ARCH</td>
1.269     leot     13640: </tr>
                   13641: <tr>
1.344     gutterid 13642: <td>RUBY_ARCHINC</td>
1.347   ! gutterid 13643: <td>RUBY_ARCHLIB</td>
1.269     leot     13644: </tr>
                   13645: <tr>
1.344     gutterid 13646: <td>RUBY_BASE</td>
1.347   ! gutterid 13647: <td>RUBY_BASERIDIR</td>
1.269     leot     13648: </tr>
                   13649: <tr>
1.344     gutterid 13650: <td>RUBY_BUILD_DOCUMENT</td>
1.347   ! gutterid 13651: <td>RUBY_DLEXT</td>
1.269     leot     13652: </tr>
                   13653: <tr>
1.344     gutterid 13654: <td>RUBY_DOC</td>
1.347   ! gutterid 13655: <td>RUBY_DYNAMIC_DIRS</td>
1.269     leot     13656: </tr>
                   13657: <tr>
1.344     gutterid 13658: <td>RUBY_EG</td>
1.347   ! gutterid 13659: <td>RUBY_ENCODING_ARG</td>
1.269     leot     13660: </tr>
                   13661: <tr>
1.344     gutterid 13662: <td>RUBY_EXTCONF</td>
1.347   ! gutterid 13663: <td>RUBY_EXTCONF_CHECK</td>
1.269     leot     13664: </tr>
                   13665: <tr>
1.344     gutterid 13666: <td>RUBY_EXTCONF_DEBUG</td>
1.347   ! gutterid 13667: <td>RUBY_EXTCONF_MAKEFILE</td>
1.269     leot     13668: </tr>
                   13669: <tr>
1.344     gutterid 13670: <td>RUBY_GEM_ARCH</td>
1.347   ! gutterid 13671: <td>RUBY_GEM_BASE</td>
1.269     leot     13672: </tr>
                   13673: <tr>
1.344     gutterid 13674: <td>RUBY_INC</td>
1.347   ! gutterid 13675: <td>RUBY_LIB</td>
1.269     leot     13676: </tr>
                   13677: <tr>
1.344     gutterid 13678: <td>RUBY_LIB_BASE</td>
1.347   ! gutterid 13679: <td>RUBY_NAME</td>
1.269     leot     13680: </tr>
                   13681: <tr>
1.344     gutterid 13682: <td>RUBY_NOVERSION</td>
1.347   ! gutterid 13683: <td>RUBY_PKGPREFIX</td>
1.338     nia      13684: </tr>
                   13685: <tr>
1.344     gutterid 13686: <td>RUBY_RAILS</td>
1.347   ! gutterid 13687: <td>RUBY_RAILS52_VERSION</td>
1.269     leot     13688: </tr>
                   13689: <tr>
1.344     gutterid 13690: <td>RUBY_RAILS60_VERSION</td>
1.347   ! gutterid 13691: <td>RUBY_RAILS61_VERSION</td>
1.269     leot     13692: </tr>
                   13693: <tr>
1.344     gutterid 13694: <td>RUBY_RAILS70_VERSION</td>
1.347   ! gutterid 13695: <td>RUBY_RAILS_ACCEPTED</td>
1.269     leot     13696: </tr>
                   13697: <tr>
1.344     gutterid 13698: <td>RUBY_RAILS_DEFAULT</td>
1.347   ! gutterid 13699: <td>RUBY_RAILS_REQD</td>
1.269     leot     13700: </tr>
                   13701: <tr>
1.344     gutterid 13702: <td>RUBY_RAILS_STRICT_DEP</td>
1.347   ! gutterid 13703: <td>RUBY_RIDIR</td>
1.269     leot     13704: </tr>
                   13705: <tr>
1.344     gutterid 13706: <td>RUBY_SETUP</td>
1.347   ! gutterid 13707: <td>RUBY_SHLIB</td>
1.269     leot     13708: </tr>
                   13709: <tr>
1.344     gutterid 13710: <td>RUBY_SHLIBALIAS</td>
1.347   ! gutterid 13711: <td>RUBY_SHLIBVER</td>
1.269     leot     13712: </tr>
                   13713: <tr>
1.344     gutterid 13714: <td>RUBY_SIMPLE_INSTALL</td>
1.347   ! gutterid 13715: <td>RUBY_SITEARCHLIB</td>
1.269     leot     13716: </tr>
                   13717: <tr>
1.344     gutterid 13718: <td>RUBY_SITELIB</td>
1.347   ! gutterid 13719: <td>RUBY_SITELIB_BASE</td>
1.312     gdt      13720: </tr>
                   13721: <tr>
1.344     gutterid 13722: <td>RUBY_SITERIDIR</td>
1.347   ! gutterid 13723: <td>RUBY_SLEXT</td>
1.289     leot     13724: </tr>
                   13725: <tr>
1.344     gutterid 13726: <td>RUBY_SRCDIR</td>
1.347   ! gutterid 13727: <td>RUBY_STATICLIB</td>
1.269     leot     13728: </tr>
                   13729: <tr>
1.344     gutterid 13730: <td>RUBY_SUFFIX</td>
1.347   ! gutterid 13731: <td>RUBY_SYSRIDIR</td>
1.269     leot     13732: </tr>
                   13733: <tr>
1.344     gutterid 13734: <td>RUBY_USE_PTHREAD</td>
1.347   ! gutterid 13735: <td>RUBY_VENDORARCHLIB</td>
1.269     leot     13736: </tr>
                   13737: <tr>
1.344     gutterid 13738: <td>RUBY_VENDORLIB</td>
1.347   ! gutterid 13739: <td>RUBY_VENDORLIB_BASE</td>
1.269     leot     13740: </tr>
                   13741: <tr>
1.344     gutterid 13742: <td>RUBY_VER</td>
1.347   ! gutterid 13743: <td>RUBY_VERSION</td>
1.269     leot     13744: </tr>
                   13745: <tr>
1.344     gutterid 13746: <td>RUBY_VERSIONS_ACCEPTED</td>
1.347   ! gutterid 13747: <td>RUBY_VERSIONS_INCOMPATIBLE</td>
1.269     leot     13748: </tr>
                   13749: <tr>
1.344     gutterid 13750: <td>RUBY_VERSION_DEFAULT</td>
1.347   ! gutterid 13751: <td>RUBY_VERSION_REQD</td>
1.269     leot     13752: </tr>
                   13753: <tr>
1.344     gutterid 13754: <td>RUBY_VER_DIR</td>
1.347   ! gutterid 13755: <td>RUN</td>
1.269     leot     13756: </tr>
                   13757: <tr>
1.344     gutterid 13758: <td>RUN_LDCONFIG</td>
1.347   ! gutterid 13759: <td>RUST_TYPE</td>
1.269     leot     13760: </tr>
                   13761: <tr>
1.344     gutterid 13762: <td>SCO</td>
1.347   ! gutterid 13763: <td>SCREWS_GROUP</td>
1.269     leot     13764: </tr>
                   13765: <tr>
1.344     gutterid 13766: <td>SCREWS_USER</td>
1.347   ! gutterid 13767: <td>SCRIPTS_ENV</td>
1.269     leot     13768: </tr>
                   13769: <tr>
1.344     gutterid 13770: <td>SCROLLKEEPER_DATADIR</td>
1.347   ! gutterid 13771: <td>SCROLLKEEPER_REBUILDDB</td>
1.269     leot     13772: </tr>
                   13773: <tr>
1.344     gutterid 13774: <td>SCROLLKEEPER_UPDATEDB</td>
1.347   ! gutterid 13775: <td>SDIST_PAWD</td>
1.269     leot     13776: </tr>
                   13777: <tr>
1.344     gutterid 13778: <td>SDL12_TYPE</td>
1.347   ! gutterid 13779: <td>SERIAL_DEVICES</td>
1.269     leot     13780: </tr>
                   13781: <tr>
1.344     gutterid 13782: <td>SETGIDGAME</td>
1.347   ! gutterid 13783: <td>SETGID_GAMES_PERMS</td>
1.269     leot     13784: </tr>
                   13785: <tr>
1.344     gutterid 13786: <td>SETUID_ROOT_PERMS</td>
1.347   ! gutterid 13787: <td>SH</td>
1.336     nia      13788: </tr>
                   13789: <tr>
1.344     gutterid 13790: <td>SHLIB</td>
1.347   ! gutterid 13791: <td>SIGN_PACKAGES</td>
1.269     leot     13792: </tr>
                   13793: <tr>
1.344     gutterid 13794: <td>SILC_CLIENT_WITH_PERL</td>
1.347   ! gutterid 13795: <td>SITE_SPECIFIC_PKGS</td>
1.342     wiz      13796: </tr>
                   13797: <tr>
1.344     gutterid 13798: <td>SKIP_DEPENDS</td>
1.347   ! gutterid 13799: <td>SMF_INSTANCES</td>
1.269     leot     13800: </tr>
                   13801: <tr>
1.344     gutterid 13802: <td>SMF_MANIFEST</td>
1.347   ! gutterid 13803: <td>SMF_METHODS</td>
1.269     leot     13804: </tr>
                   13805: <tr>
1.344     gutterid 13806: <td>SMF_METHOD_SHELL</td>
1.347   ! gutterid 13807: <td>SMF_METHOD_SRC</td>
1.292     leot     13808: </tr>
                   13809: <tr>
1.344     gutterid 13810: <td>SMF_NAME</td>
1.347   ! gutterid 13811: <td>SMF_PREFIX</td>
1.269     leot     13812: </tr>
                   13813: <tr>
1.344     gutterid 13814: <td>SMF_SRCDIR</td>
1.347   ! gutterid 13815: <td>SNIPROXY_GROUP</td>
1.332     rillig   13816: </tr>
                   13817: <tr>
1.344     gutterid 13818: <td>SNIPROXY_USER</td>
1.347   ! gutterid 13819: <td>SOURCE_BUFFSIZE</td>
1.269     leot     13820: </tr>
                   13821: <tr>
1.344     gutterid 13822: <td>SPECIAL_PERMS</td>
1.347   ! gutterid 13823: <td>SPECIFIC_PKGS</td>
1.274     rillig   13824: </tr>
                   13825: <tr>
1.344     gutterid 13826: <td>SSH_SUID</td>
1.347   ! gutterid 13827: <td>SSP_SUPPORTED</td>
1.269     leot     13828: </tr>
                   13829: <tr>
1.344     gutterid 13830: <td>SSYNC_PAWD</td>
1.347   ! gutterid 13831: <td>STEP_MSG</td>
1.269     leot     13832: </tr>
                   13833: <tr>
1.344     gutterid 13834: <td>STRIP</td>
1.347   ! gutterid 13835: <td>STRIP_DBG</td>
1.269     leot     13836: </tr>
                   13837: <tr>
1.344     gutterid 13838: <td>STRIP_DEBUG</td>
1.347   ! gutterid 13839: <td>STRIP_DEBUG_SUPPORTED</td>
1.269     leot     13840: </tr>
                   13841: <tr>
1.344     gutterid 13842: <td>STRIP_FILES_SKIP</td>
1.347   ! gutterid 13843: <td>SU</td>
1.269     leot     13844: </tr>
                   13845: <tr>
1.344     gutterid 13846: <td>SUBDIR</td>
1.347   ! gutterid 13847: <td>SUBST</td>
1.269     leot     13848: </tr>
                   13849: <tr>
1.344     gutterid 13850: <td>SUBST_CLASSES</td>
1.347   ! gutterid 13851: <td>SUBST_FILES</td>
1.269     leot     13852: </tr>
                   13853: <tr>
1.344     gutterid 13854: <td>SUBST_FILTER_CMD</td>
1.347   ! gutterid 13855: <td>SUBST_MESSAGE</td>
1.269     leot     13856: </tr>
                   13857: <tr>
1.344     gutterid 13858: <td>SUBST_NOOP_OK</td>
1.347   ! gutterid 13859: <td>SUBST_SED</td>
1.269     leot     13860: </tr>
                   13861: <tr>
1.344     gutterid 13862: <td>SUBST_SHOW_DIFF</td>
1.347   ! gutterid 13863: <td>SUBST_SKIP_TEXT_CHECK</td>
1.269     leot     13864: </tr>
                   13865: <tr>
1.344     gutterid 13866: <td>SUBST_STAGE</td>
1.347   ! gutterid 13867: <td>SUBST_VARS</td>
1.269     leot     13868: </tr>
                   13869: <tr>
1.344     gutterid 13870: <td>SUNWSPROBASE</td>
1.347   ! gutterid 13871: <td>SUSE_PREFER</td>
1.289     leot     13872: </tr>
                   13873: <tr>
1.344     gutterid 13874: <td>SU_CMD</td>
1.347   ! gutterid 13875: <td>SYSCONFBASE</td>
1.269     leot     13876: </tr>
                   13877: <tr>
1.344     gutterid 13878: <td>TARGET_ARCH</td>
1.347   ! gutterid 13879: <td>TBL</td>
1.342     wiz      13880: </tr>
                   13881: <tr>
1.344     gutterid 13882: <td>TERMCAP_TYPE</td>
1.347   ! gutterid 13883: <td>TERMINFO_DEFAULT</td>
1.269     leot     13884: </tr>
                   13885: <tr>
1.344     gutterid 13886: <td>TERMINFO_TYPE</td>
1.347   ! gutterid 13887: <td>TEST</td>
1.332     rillig   13888: </tr>
                   13889: <tr>
1.344     gutterid 13890: <td>TEST_DEPENDS</td>
1.347   ! gutterid 13891: <td>TEST_DIRS</td>
1.327     wiz      13892: </tr>
                   13893: <tr>
1.344     gutterid 13894: <td>TEST_ENV</td>
1.347   ! gutterid 13895: <td>TEST_ENV_SHELL</td>
1.332     rillig   13896: </tr>
                   13897: <tr>
1.344     gutterid 13898: <td>TEST_MAKE_CMD</td>
1.347   ! gutterid 13899: <td>TEST_MAKE_FLAGS</td>
1.320     wiz      13900: </tr>
                   13901: <tr>
1.344     gutterid 13902: <td>TEST_TARGET</td>
1.347   ! gutterid 13903: <td>TEXLIVE_IGNORE_PATTERNS</td>
1.303     bacon    13904: </tr>
                   13905: <tr>
1.344     gutterid 13906: <td>TEXLIVE_REV</td>
1.347   ! gutterid 13907: <td>TEXLIVE_UNVERSIONED</td>
1.274     rillig   13908: </tr>
                   13909: <tr>
1.344     gutterid 13910: <td>TEXMFSITE</td>
1.347   ! gutterid 13911: <td>TEX_FORMATS</td>
1.269     leot     13912: </tr>
                   13913: <tr>
1.344     gutterid 13914: <td>TEX_HYPHEN_DAT</td>
1.347   ! gutterid 13915: <td>TEX_HYPHEN_DEF</td>
1.269     leot     13916: </tr>
                   13917: <tr>
1.344     gutterid 13918: <td>TEX_TEXMF_DIRS</td>
1.347   ! gutterid 13919: <td>THTTPD_LOG_FACILITY</td>
1.269     leot     13920: </tr>
                   13921: <tr>
1.344     gutterid 13922: <td>TINYDYN_USER</td>
1.347   ! gutterid 13923: <td>TLSWRAPPER_CHROOT</td>
1.269     leot     13924: </tr>
                   13925: <tr>
1.344     gutterid 13926: <td>TO</td>
1.347   ! gutterid 13927: <td>TOOLS_ALIASES</td>
1.269     leot     13928: </tr>
                   13929: <tr>
1.344     gutterid 13930: <td>TOOLS_ALWAYS_WRAP</td>
1.347   ! gutterid 13931: <td>TOOLS_ARGS</td>
1.269     leot     13932: </tr>
                   13933: <tr>
1.344     gutterid 13934: <td>TOOLS_BROKEN</td>
1.347   ! gutterid 13935: <td>TOOLS_CMD</td>
1.269     leot     13936: </tr>
                   13937: <tr>
1.344     gutterid 13938: <td>TOOLS_CMDLINE_SED</td>
1.347   ! gutterid 13939: <td>TOOLS_CREATE</td>
1.269     leot     13940: </tr>
                   13941: <tr>
1.344     gutterid 13942: <td>TOOLS_CROSS_DESTDIR</td>
1.347   ! gutterid 13943: <td>TOOLS_DIR</td>
1.269     leot     13944: </tr>
                   13945: <tr>
1.344     gutterid 13946: <td>TOOLS_FAIL</td>
1.347   ! gutterid 13947: <td>TOOLS_GNU_MISSING</td>
1.269     leot     13948: </tr>
                   13949: <tr>
1.344     gutterid 13950: <td>TOOLS_LDCONFIG</td>
1.347   ! gutterid 13951: <td>TOOLS_NOOP</td>
1.269     leot     13952: </tr>
                   13953: <tr>
1.344     gutterid 13954: <td>TOOLS_PATH</td>
1.347   ! gutterid 13955: <td>TOOLS_SCRIPT</td>
1.269     leot     13956: </tr>
                   13957: <tr>
1.344     gutterid 13958: <td>TOOLS_USE_CROSS_COMPILE</td>
1.347   ! gutterid 13959: <td>TOOL_DEPENDS</td>
1.269     leot     13960: </tr>
                   13961: <tr>
1.344     gutterid 13962: <td>TTF_FONTS_DIR</td>
1.347   ! gutterid 13963: <td>TYPE</td>
1.269     leot     13964: </tr>
                   13965: <tr>
1.344     gutterid 13966: <td>UAC_REQD_EXECS</td>
1.347   ! gutterid 13967: <td>UCSPI_SSL_GROUP</td>
1.338     nia      13968: </tr>
                   13969: <tr>
1.344     gutterid 13970: <td>UCSPI_SSL_USER</td>
1.347   ! gutterid 13971: <td>UNLIMIT_RESOURCES</td>
1.269     leot     13972: </tr>
                   13973: <tr>
1.344     gutterid 13974: <td>UNPRIVILEGED</td>
1.347   ! gutterid 13975: <td>UNPRIVILEGED_GROUP</td>
1.329     leot     13976: </tr>
                   13977: <tr>
1.344     gutterid 13978: <td>UNPRIVILEGED_GROUPS</td>
1.347   ! gutterid 13979: <td>UNPRIVILEGED_USER</td>
1.327     wiz      13980: </tr>
                   13981: <tr>
1.344     gutterid 13982: <td>UNWRAP_FILES</td>
1.347   ! gutterid 13983: <td>UNWRAP_PATTERNS</td>
1.269     leot     13984: </tr>
                   13985: <tr>
1.344     gutterid 13986: <td>UPDATE_GEMSPEC</td>
1.347   ! gutterid 13987: <td>UPDATE_TARGET</td>
1.269     leot     13988: </tr>
                   13989: <tr>
1.344     gutterid 13990: <td>URI</td>
1.347   ! gutterid 13991: <td>USERGROUP_PHASE</td>
1.269     leot     13992: </tr>
                   13993: <tr>
1.344     gutterid 13994: <td>USERPPP_GROUP</td>
1.347   ! gutterid 13995: <td>USER_SPECIFIC_PKGS</td>
1.269     leot     13996: </tr>
                   13997: <tr>
1.344     gutterid 13998: <td>USE_ABI_DEPENDS</td>
1.347   ! gutterid 13999: <td>USE_APR</td>
1.269     leot     14000: </tr>
                   14001: <tr>
1.344     gutterid 14002: <td>USE_BSD_MAKEFILE</td>
1.347   ! gutterid 14003: <td>USE_BUILTIN</td>
1.269     leot     14004: </tr>
                   14005: <tr>
1.344     gutterid 14006: <td>USE_CROSS_COMPILE</td>
1.347   ! gutterid 14007: <td>USE_CURSES</td>
1.269     leot     14008: </tr>
                   14009: <tr>
1.344     gutterid 14010: <td>USE_CWRAPPERS</td>
1.347   ! gutterid 14011: <td>USE_DB185</td>
1.269     leot     14012: </tr>
                   14013: <tr>
1.344     gutterid 14014: <td>USE_FEATURES</td>
1.347   ! gutterid 14015: <td>USE_GAMESGROUP</td>
1.269     leot     14016: </tr>
                   14017: <tr>
1.344     gutterid 14018: <td>USE_GCC_RUNTIME</td>
1.347   ! gutterid 14019: <td>USE_IMAKE</td>
1.320     wiz      14020: </tr>
                   14021: <tr>
1.344     gutterid 14022: <td>USE_JAVA</td>
1.347   ! gutterid 14023: <td>USE_JAVA2</td>
1.269     leot     14024: </tr>
                   14025: <tr>
1.344     gutterid 14026: <td>USE_LANGUAGES</td>
1.347   ! gutterid 14027: <td>USE_LIBTOOL</td>
1.269     leot     14028: </tr>
                   14029: <tr>
1.344     gutterid 14030: <td>USE_NATIVE_GCC</td>
1.347   ! gutterid 14031: <td>USE_NETBSD_REPO</td>
1.269     leot     14032: </tr>
                   14033: <tr>
1.344     gutterid 14034: <td>USE_PKGSRC_GCC</td>
1.347   ! gutterid 14035: <td>USE_PKGSRC_GCC_RUNTIME</td>
1.269     leot     14036: </tr>
                   14037: <tr>
1.344     gutterid 14038: <td>USE_PKGTASKS</td>
1.347   ! gutterid 14039: <td>USE_PKG_ADMIN_DIGEST</td>
1.269     leot     14040: </tr>
                   14041: <tr>
1.344     gutterid 14042: <td>USE_RUBY_EXTCONF</td>
1.347   ! gutterid 14043: <td>USE_RUBY_INSTALL</td>
1.269     leot     14044: </tr>
                   14045: <tr>
1.344     gutterid 14046: <td>USE_RUBY_SETUP</td>
1.347   ! gutterid 14047: <td>USE_RUBY_SETUP_PKG</td>
1.269     leot     14048: </tr>
                   14049: <tr>
1.344     gutterid 14050: <td>USE_TOOLS</td>
1.347   ! gutterid 14051: <td>UUCP_GROUP</td>
1.269     leot     14052: </tr>
                   14053: <tr>
1.344     gutterid 14054: <td>UUCP_USER</td>
1.347   ! gutterid 14055: <td>VARBASE</td>
1.269     leot     14056: </tr>
                   14057: <tr>
1.344     gutterid 14058: <td>VARNAME</td>
1.347   ! gutterid 14059: <td>VIM_EXTRA_OPTS</td>
1.269     leot     14060: </tr>
                   14061: <tr>
1.344     gutterid 14062: <td>WARNING_MSG</td>
1.347   ! gutterid 14063: <td>WCALC_CGIDIR</td>
1.269     leot     14064: </tr>
                   14065: <tr>
1.344     gutterid 14066: <td>WCALC_CGIPATH</td>
1.347   ! gutterid 14067: <td>WCALC_HTMLDIR</td>
1.269     leot     14068: </tr>
                   14069: <tr>
1.344     gutterid 14070: <td>WCALC_HTMLPATH</td>
1.347   ! gutterid 14071: <td>WDM_MANAGERS</td>
1.269     leot     14072: </tr>
                   14073: <tr>
1.344     gutterid 14074: <td>WRAPPER_CC</td>
1.347   ! gutterid 14075: <td>WRAPPER_REORDER_CMDS</td>
1.269     leot     14076: </tr>
                   14077: <tr>
1.344     gutterid 14078: <td>WRKDIR</td>
1.347   ! gutterid 14079: <td>WRKDIR_BASENAME</td>
1.269     leot     14080: </tr>
                   14081: <tr>
1.344     gutterid 14082: <td>WRKDIR_LOCKTYPE</td>
1.347   ! gutterid 14083: <td>WRKLOG</td>
1.269     leot     14084: </tr>
                   14085: <tr>
1.344     gutterid 14086: <td>WRKOBJDIR</td>
1.347   ! gutterid 14087: <td>WRKSRC</td>
1.269     leot     14088: </tr>
                   14089: <tr>
1.344     gutterid 14090: <td>X10_PORT</td>
1.347   ! gutterid 14091: <td>X11</td>
1.269     leot     14092: </tr>
                   14093: <tr>
1.344     gutterid 14094: <td>X11BASE</td>
1.347   ! gutterid 14095: <td>X11_PKGSRCDIR</td>
1.269     leot     14096: </tr>
                   14097: <tr>
1.344     gutterid 14098: <td>X11_TYPE</td>
1.347   ! gutterid 14099: <td>X509_CERTIFICATE</td>
1.303     bacon    14100: </tr>
                   14101: <tr>
1.344     gutterid 14102: <td>X509_KEY</td>
1.347   ! gutterid 14103: <td>XAW_TYPE</td>
1.269     leot     14104: </tr>
                   14105: <tr>
1.344     gutterid 14106: <td>XLOCK_DEFAULT_MODE</td>
1.347   ! gutterid 14107: <td>XMKMF</td>
1.269     leot     14108: </tr>
                   14109: <tr>
1.344     gutterid 14110: <td>XMKMF_FLAGS</td>
1.347   ! gutterid 14111: <td>XXX</td>
1.269     leot     14112: </tr>
                   14113: <tr>
1.344     gutterid 14114: <td>YES</td>
1.347   ! gutterid 14115: <td>ZSH_STATIC</td>
1.269     leot     14116: </tr>
                   14117: <tr>
1.344     gutterid 14118: <td>__stdc__</td>
1.347   ! gutterid 14119: <td>_vargroups</td>
1.342     wiz      14120: </tr>
                   14121: <tr>
1.344     gutterid 14122: <td>accept</td>
1.347   ! gutterid 14123: <td>acquire-localbase-lock</td>
1.269     leot     14124: </tr>
                   14125: <tr>
1.344     gutterid 14126: <td>acquire-lock</td>
1.347   ! gutterid 14127: <td>add</td>
1.274     rillig   14128: </tr>
                   14129: <tr>
1.344     gutterid 14130: <td>added</td>
1.347   ! gutterid 14131: <td>administrator</td>
1.332     rillig   14132: </tr>
                   14133: <tr>
1.344     gutterid 14134: <td>alloca</td>
1.347   ! gutterid 14135: <td>alternatives</td>
1.269     leot     14136: </tr>
                   14137: <tr>
1.344     gutterid 14138: <td>aslr</td>
1.347   ! gutterid 14139: <td>asprintf</td>
1.316     cirnatda 14140: </tr>
                   14141: <tr>
1.344     gutterid 14142: <td>atlas</td>
1.347   ! gutterid 14143: <td>autoconf</td>
1.289     leot     14144: </tr>
                   14145: <tr>
1.344     gutterid 14146: <td>automake</td>
1.347   ! gutterid 14147: <td>autoreconf</td>
1.269     leot     14148: </tr>
                   14149: <tr>
1.344     gutterid 14150: <td>awk</td>
1.347   ! gutterid 14151: <td>bash</td>
1.269     leot     14152: </tr>
                   14153: <tr>
1.344     gutterid 14154: <td>big-endian</td>
1.347   ! gutterid 14155: <td>bin-install</td>
1.289     leot     14156: </tr>
                   14157: <tr>
1.344     gutterid 14158: <td>bind</td>
1.347   ! gutterid 14159: <td>binpkg-list</td>
1.269     leot     14160: </tr>
                   14161: <tr>
1.344     gutterid 14162: <td>blas</td>
1.347   ! gutterid 14163: <td>bootstrap-depends</td>
1.269     leot     14164: </tr>
                   14165: <tr>
1.344     gutterid 14166: <td>broken</td>
1.347   ! gutterid 14167: <td>broken_on_platform</td>
1.269     leot     14168: </tr>
                   14169: <tr>
1.344     gutterid 14170: <td>bsd</td>
1.347   ! gutterid 14171: <td>bsd.prog.mk</td>
1.271     brook    14172: </tr>
                   14173: <tr>
1.344     gutterid 14174: <td>build</td>
1.347   ! gutterid 14175: <td>build-env</td>
1.269     leot     14176: </tr>
                   14177: <tr>
1.344     gutterid 14178: <td>buildlink-directories</td>
1.347   ! gutterid 14179: <td>buildlink-oss-soundcard-h</td>
1.292     leot     14180: </tr>
                   14181: <tr>
1.344     gutterid 14182: <td>c</td>
1.347   ! gutterid 14183: <td>c++</td>
1.274     rillig   14184: </tr>
                   14185: <tr>
1.344     gutterid 14186: <td>ccache</td>
1.347   ! gutterid 14187: <td>cce</td>
1.269     leot     14188: </tr>
                   14189: <tr>
1.344     gutterid 14190: <td>cdefs</td>
1.347   ! gutterid 14191: <td>ceil</td>
1.289     leot     14192: </tr>
                   14193: <tr>
1.344     gutterid 14194: <td>changes</td>
1.347   ! gutterid 14195: <td>changes-entry</td>
1.269     leot     14196: </tr>
                   14197: <tr>
1.344     gutterid 14198: <td>changes-entry-noupdate</td>
1.347   ! gutterid 14199: <td>check</td>
1.269     leot     14200: </tr>
                   14201: <tr>
1.344     gutterid 14202: <td>check-clean</td>
1.347   ! gutterid 14203: <td>check-files</td>
1.269     leot     14204: </tr>
                   14205: <tr>
1.344     gutterid 14206: <td>check-files-clean</td>
1.347   ! gutterid 14207: <td>check-vulnerable</td>
1.269     leot     14208: </tr>
                   14209: <tr>
1.344     gutterid 14210: <td>checksum</td>
1.347   ! gutterid 14211: <td>checksum-phase</td>
1.289     leot     14212: </tr>
                   14213: <tr>
1.344     gutterid 14214: <td>clean</td>
1.347   ! gutterid 14215: <td>clean-depends</td>
1.269     leot     14216: </tr>
                   14217: <tr>
1.344     gutterid 14218: <td>cleandir</td>
1.347   ! gutterid 14219: <td>commit</td>
1.269     leot     14220: </tr>
                   14221: <tr>
1.344     gutterid 14222: <td>commit-changes-entry</td>
1.347   ! gutterid 14223: <td>compact</td>
1.269     leot     14224: </tr>
                   14225: <tr>
1.344     gutterid 14226: <td>compiler</td>
1.347   ! gutterid 14227: <td>conf</td>
1.269     leot     14228: </tr>
                   14229: <tr>
1.344     gutterid 14230: <td>config.guess</td>
1.347   ! gutterid 14231: <td>config.sub</td>
1.269     leot     14232: </tr>
                   14233: <tr>
1.344     gutterid 14234: <td>configuration</td>
1.347   ! gutterid 14235: <td>configure</td>
1.269     leot     14236: </tr>
                   14237: <tr>
1.344     gutterid 14238: <td>configure-env</td>
1.347   ! gutterid 14239: <td>configure-help</td>
1.269     leot     14240: </tr>
                   14241: <tr>
1.344     gutterid 14242: <td>configure_args</td>
1.347   ! gutterid 14243: <td>connect</td>
1.269     leot     14244: </tr>
                   14245: <tr>
1.344     gutterid 14246: <td>cos</td>
1.347   ! gutterid 14247: <td>cpe</td>
1.269     leot     14248: </tr>
                   14249: <tr>
1.343     gutterid 14250: <td>cputime</td>
1.344     gutterid 14251: <td>create-usergroup</td>
1.269     leot     14252: </tr>
                   14253: <tr>
1.343     gutterid 14254: <td>csh</td>
1.344     gutterid 14255: <td>ctf</td>
1.269     leot     14256: </tr>
                   14257: <tr>
1.340     gutterid 14258: <td>debug</td>
1.344     gutterid 14259: <td>declaration</td>
1.338     nia      14260: </tr>
                   14261: <tr>
1.340     gutterid 14262: <td>declare</td>
1.344     gutterid 14263: <td>defined</td>
1.289     leot     14264: </tr>
                   14265: <tr>
1.340     gutterid 14266: <td>depend</td>
1.344     gutterid 14267: <td>dependencies</td>
1.329     leot     14268: </tr>
                   14269: <tr>
1.340     gutterid 14270: <td>depends</td>
1.344     gutterid 14271: <td>depends-checksum</td>
1.320     wiz      14272: </tr>
                   14273: <tr>
1.340     gutterid 14274: <td>depends-fetch</td>
1.344     gutterid 14275: <td>deps</td>
1.269     leot     14276: </tr>
                   14277: <tr>
1.340     gutterid 14278: <td>describe</td>
1.344     gutterid 14279: <td>destdir</td>
1.311     leot     14280: </tr>
                   14281: <tr>
1.340     gutterid 14282: <td>disable</td>
1.344     gutterid 14283: <td>distclean</td>
1.269     leot     14284: </tr>
                   14285: <tr>
1.340     gutterid 14286: <td>distinfo</td>
1.344     gutterid 14287: <td>dl</td>
1.269     leot     14288: </tr>
                   14289: <tr>
1.340     gutterid 14290: <td>dlopen</td>
1.344     gutterid 14291: <td>do-buildlink</td>
1.269     leot     14292: </tr>
                   14293: <tr>
1.340     gutterid 14294: <td>do-clean</td>
1.344     gutterid 14295: <td>do-configure</td>
1.269     leot     14296: </tr>
                   14297: <tr>
1.340     gutterid 14298: <td>do-configure-post-hook</td>
1.344     gutterid 14299: <td>do-extract</td>
1.269     leot     14300: </tr>
                   14301: <tr>
1.340     gutterid 14302: <td>do-fetch</td>
1.344     gutterid 14303: <td>do-install</td>
1.277     rillig   14304: </tr>
                   14305: <tr>
1.340     gutterid 14306: <td>emul</td>
1.344     gutterid 14307: <td>emul-distinfo</td>
1.269     leot     14308: </tr>
                   14309: <tr>
1.340     gutterid 14310: <td>emul-fetch</td>
1.344     gutterid 14311: <td>emulation</td>
1.332     rillig   14312: </tr>
                   14313: <tr>
1.340     gutterid 14314: <td>emulator</td>
1.344     gutterid 14315: <td>enable</td>
1.269     leot     14316: </tr>
                   14317: <tr>
1.336     nia      14318: <td>endian</td>
1.344     gutterid 14319: <td>enomem</td>
1.269     leot     14320: </tr>
                   14321: <tr>
1.343     gutterid 14322: <td>ensurepip</td>
1.344     gutterid 14323: <td>err</td>
1.342     wiz      14324: </tr>
                   14325: <tr>
1.343     gutterid 14326: <td>errx</td>
1.344     gutterid 14327: <td>etc</td>
1.329     leot     14328: </tr>
                   14329: <tr>
1.343     gutterid 14330: <td>exp</td>
1.344     gutterid 14331: <td>extract-rpm</td>
1.269     leot     14332: </tr>
                   14333: <tr>
1.343     gutterid 14334: <td>fabs</td>
1.344     gutterid 14335: <td>feature</td>
1.320     wiz      14336: </tr>
                   14337: <tr>
1.343     gutterid 14338: <td>features</td>
1.344     gutterid 14339: <td>fetch</td>
1.311     leot     14340: </tr>
                   14341: <tr>
1.343     gutterid 14342: <td>fetch-list</td>
1.344     gutterid 14343: <td>follows</td>
1.269     leot     14344: </tr>
                   14345: <tr>
1.343     gutterid 14346: <td>forbids</td>
1.344     gutterid 14347: <td>form</td>
1.269     leot     14348: </tr>
                   14349: <tr>
1.343     gutterid 14350: <td>format</td>
1.344     gutterid 14351: <td>fortify</td>
1.289     leot     14352: </tr>
                   14353: <tr>
1.335     nia      14354: <td>fortify_source</td>
1.344     gutterid 14355: <td>friend</td>
1.332     rillig   14356: </tr>
                   14357: <tr>
1.340     gutterid 14358: <td>fts</td>
1.344     gutterid 14359: <td>fts_close</td>
1.338     nia      14360: </tr>
                   14361: <tr>
1.340     gutterid 14362: <td>fts_open</td>
1.344     gutterid 14363: <td>fts_read</td>
1.269     leot     14364: </tr>
                   14365: <tr>
1.340     gutterid 14366: <td>fts_set</td>
1.344     gutterid 14367: <td>gcc</td>
1.269     leot     14368: </tr>
                   14369: <tr>
1.340     gutterid 14370: <td>gethostbyaddr</td>
1.344     gutterid 14371: <td>gethostbyname</td>
1.269     leot     14372: </tr>
                   14373: <tr>
1.340     gutterid 14374: <td>gethostbyname2</td>
1.344     gutterid 14375: <td>getopt_long</td>
1.269     leot     14376: </tr>
                   14377: <tr>
1.340     gutterid 14378: <td>getprogname</td>
1.344     gutterid 14379: <td>getservbyname</td>
1.289     leot     14380: </tr>
                   14381: <tr>
1.340     gutterid 14382: <td>getservbyport</td>
1.344     gutterid 14383: <td>getservent</td>
1.269     leot     14384: </tr>
                   14385: <tr>
1.332     rillig   14386: <td>gettext</td>
1.344     gutterid 14387: <td>github</td>
1.289     leot     14388: </tr>
                   14389: <tr>
1.343     gutterid 14390: <td>gitlab</td>
1.344     gutterid 14391: <td>glob</td>
1.342     wiz      14392: </tr>
                   14393: <tr>
1.343     gutterid 14394: <td>gnu</td>
1.344     gutterid 14395: <td>gnu_configure_strict</td>
1.338     nia      14396: </tr>
                   14397: <tr>
1.343     gutterid 14398: <td>go</td>
1.344     gutterid 14399: <td>go-deps</td>
1.332     rillig   14400: </tr>
                   14401: <tr>
1.343     gutterid 14402: <td>golang</td>
1.344     gutterid 14403: <td>guess-license</td>
1.269     leot     14404: </tr>
                   14405: <tr>
1.343     gutterid 14406: <td>hashbang</td>
1.344     gutterid 14407: <td>heimdal</td>
1.274     rillig   14408: </tr>
                   14409: <tr>
1.338     nia      14410: <td>help</td>
1.344     gutterid 14411: <td>imake</td>
1.269     leot     14412: </tr>
                   14413: <tr>
1.340     gutterid 14414: <td>increment</td>
1.344     gutterid 14415: <td>indirect</td>
1.329     leot     14416: </tr>
                   14417: <tr>
1.340     gutterid 14418: <td>inet_aton</td>
1.344     gutterid 14419: <td>interp</td>
1.269     leot     14420: </tr>
                   14421: <tr>
1.340     gutterid 14422: <td>interpreter</td>
1.344     gutterid 14423: <td>intl</td>
1.320     wiz      14424: </tr>
                   14425: <tr>
1.340     gutterid 14426: <td>ip4</td>
1.344     gutterid 14427: <td>ip6</td>
1.311     leot     14428: </tr>
                   14429: <tr>
1.340     gutterid 14430: <td>ipv4</td>
1.344     gutterid 14431: <td>ipv6</td>
1.269     leot     14432: </tr>
                   14433: <tr>
1.340     gutterid 14434: <td>iso</td>
1.344     gutterid 14435: <td>kerberos</td>
1.269     leot     14436: </tr>
                   14437: <tr>
1.340     gutterid 14438: <td>krb</td>
1.344     gutterid 14439: <td>krb5</td>
1.269     leot     14440: </tr>
                   14441: <tr>
1.340     gutterid 14442: <td>ksh</td>
1.344     gutterid 14443: <td>lapack</td>
1.269     leot     14444: </tr>
                   14445: <tr>
1.340     gutterid 14446: <td>latex</td>
1.344     gutterid 14447: <td>libintl_bindtextdomain</td>
1.303     bacon    14448: </tr>
                   14449: <tr>
1.340     gutterid 14450: <td>libintl_gettext</td>
1.344     gutterid 14451: <td>libintl_textdomain</td>
1.303     bacon    14452: </tr>
                   14453: <tr>
1.340     gutterid 14454: <td>libnbcompat</td>
1.344     gutterid 14455: <td>libs</td>
1.269     leot     14456: </tr>
                   14457: <tr>
1.340     gutterid 14458: <td>libtool</td>
1.344     gutterid 14459: <td>licence</td>
1.292     leot     14460: </tr>
                   14461: <tr>
1.340     gutterid 14462: <td>license</td>
1.344     gutterid 14463: <td>lintl</td>
1.269     leot     14464: </tr>
                   14465: <tr>
1.340     gutterid 14466: <td>little-endian</td>
1.344     gutterid 14467: <td>lock</td>
1.289     leot     14468: </tr>
                   14469: <tr>
1.340     gutterid 14470: <td>locking</td>
1.344     gutterid 14471: <td>lua</td>
1.274     rillig   14472: </tr>
                   14473: <tr>
1.340     gutterid 14474: <td>lvalue</td>
1.344     gutterid 14475: <td>make</td>
1.271     brook    14476: </tr>
                   14477: <tr>
1.340     gutterid 14478: <td>makesum</td>
1.344     gutterid 14479: <td>memory</td>
1.269     leot     14480: </tr>
                   14481: <tr>
1.343     gutterid 14482: <td>meta</td>
1.344     gutterid 14483: <td>meta-package</td>
1.342     wiz      14484: </tr>
                   14485: <tr>
1.343     gutterid 14486: <td>meta_package</td>
1.344     gutterid 14487: <td>mit-krb5</td>
1.269     leot     14488: </tr>
                   14489: <tr>
1.343     gutterid 14490: <td>mk.conf</td>
1.344     gutterid 14491: <td>mkl</td>
1.269     leot     14492: </tr>
                   14493: <tr>
1.343     gutterid 14494: <td>mount</td>
1.344     gutterid 14495: <td>move</td>
1.292     leot     14496: </tr>
                   14497: <tr>
1.343     gutterid 14498: <td>moved</td>
1.344     gutterid 14499: <td>mprotect</td>
1.274     rillig   14500: </tr>
                   14501: <tr>
1.343     gutterid 14502: <td>mremap</td>
1.344     gutterid 14503: <td>nb</td>
1.341     gutterid 14504: </tr>
                   14505: <tr>
1.343     gutterid 14506: <td>nbcompat</td>
1.344     gutterid 14507: <td>netlib</td>
1.269     leot     14508: </tr>
                   14509: <tr>
1.343     gutterid 14510: <td>node</td>
1.344     gutterid 14511: <td>node.js</td>
1.269     leot     14512: </tr>
                   14513: <tr>
1.343     gutterid 14514: <td>nodejs</td>
1.344     gutterid 14515: <td>obstack</td>
1.333     nia      14516: </tr>
                   14517: <tr>
1.343     gutterid 14518: <td>obstack_ptr_grow</td>
1.344     gutterid 14519: <td>occurs</td>
1.333     nia      14520: </tr>
                   14521: <tr>
1.343     gutterid 14522: <td>only</td>
1.344     gutterid 14523: <td>openblas</td>
1.320     wiz      14524: </tr>
                   14525: <tr>
1.343     gutterid 14526: <td>options</td>
1.344     gutterid 14527: <td>options.mk</td>
1.269     leot     14528: </tr>
                   14529: <tr>
1.343     gutterid 14530: <td>order</td>
1.344     gutterid 14531: <td>override</td>
1.269     leot     14532: </tr>
                   14533: <tr>
1.343     gutterid 14534: <td>override-intltool</td>
1.344     gutterid 14535: <td>override-message-intltool</td>
1.269     leot     14536: </tr>
                   14537: <tr>
1.343     gutterid 14538: <td>package</td>
1.344     gutterid 14539: <td>parallel</td>
1.271     brook    14540: </tr>
                   14541: <tr>
1.343     gutterid 14542: <td>path</td>
1.344     gutterid 14543: <td>pax</td>
1.269     leot     14544: </tr>
                   14545: <tr>
1.343     gutterid 14546: <td>paxctl</td>
1.344     gutterid 14547: <td>pbulk-index</td>
1.269     leot     14548: </tr>
                   14549: <tr>
1.343     gutterid 14550: <td>pc</td>
1.344     gutterid 14551: <td>perl</td>
1.269     leot     14552: </tr>
                   14553: <tr>
1.343     gutterid 14554: <td>perl5</td>
1.344     gutterid 14555: <td>perms</td>
1.269     leot     14556: </tr>
                   14557: <tr>
1.343     gutterid 14558: <td>php</td>
1.344     gutterid 14559: <td>pkg-build-options</td>
1.269     leot     14560: </tr>
                   14561: <tr>
1.343     gutterid 14562: <td>pkg-config</td>
1.344     gutterid 14563: <td>pkg_build_options</td>
1.269     leot     14564: </tr>
                   14565: <tr>
1.343     gutterid 14566: <td>platform</td>
1.344     gutterid 14567: <td>plist</td>
1.269     leot     14568: </tr>
                   14569: <tr>
1.343     gutterid 14570: <td>post-extract</td>
1.344     gutterid 14571: <td>post-fetch</td>
1.269     leot     14572: </tr>
                   14573: <tr>
1.343     gutterid 14574: <td>post-wrapper</td>
1.344     gutterid 14575: <td>pre-build-checks-hook</td>
1.269     leot     14576: </tr>
                   14577: <tr>
1.343     gutterid 14578: <td>pre-configure</td>
1.344     gutterid 14579: <td>pre-configure-checks-hook</td>
1.269     leot     14580: </tr>
                   14581: <tr>
1.343     gutterid 14582: <td>pre-extract</td>
1.344     gutterid 14583: <td>pre-fetch</td>
1.269     leot     14584: </tr>
                   14585: <tr>
1.343     gutterid 14586: <td>print-go-deps</td>
1.344     gutterid 14587: <td>print-plist</td>
1.289     leot     14588: </tr>
                   14589: <tr>
1.343     gutterid 14590: <td>print-summary-data</td>
1.344     gutterid 14591: <td>privileged-install-hook</td>
1.269     leot     14592: </tr>
                   14593: <tr>
1.343     gutterid 14594: <td>pypi</td>
1.344     gutterid 14595: <td>python</td>
1.269     leot     14596: </tr>
                   14597: <tr>
1.343     gutterid 14598: <td>r</td>
1.344     gutterid 14599: <td>readme-all</td>
1.269     leot     14600: </tr>
                   14601: <tr>
1.343     gutterid 14602: <td>recursive</td>
1.344     gutterid 14603: <td>recv</td>
1.269     leot     14604: </tr>
                   14605: <tr>
1.343     gutterid 14606: <td>recvfrom</td>
1.344     gutterid 14607: <td>regcomp</td>
1.269     leot     14608: </tr>
                   14609: <tr>
1.343     gutterid 14610: <td>release-localbase-lock</td>
1.344     gutterid 14611: <td>release-lock</td>
1.289     leot     14612: </tr>
                   14613: <tr>
1.343     gutterid 14614: <td>relro</td>
1.344     gutterid 14615: <td>remove</td>
1.289     leot     14616: </tr>
                   14617: <tr>
1.343     gutterid 14618: <td>removed</td>
1.344     gutterid 14619: <td>rename</td>
1.269     leot     14620: </tr>
                   14621: <tr>
1.343     gutterid 14622: <td>renamed</td>
1.344     gutterid 14623: <td>reorder</td>
1.341     gutterid 14624: </tr>
                   14625: <tr>
1.343     gutterid 14626: <td>replace</td>
1.344     gutterid 14627: <td>replace_interpreter</td>
1.341     gutterid 14628: </tr>
                   14629: <tr>
1.343     gutterid 14630: <td>reproducible</td>
1.344     gutterid 14631: <td>resolv</td>
1.269     leot     14632: </tr>
                   14633: <tr>
1.343     gutterid 14634: <td>root</td>
1.344     gutterid 14635: <td>ruby</td>
1.269     leot     14636: </tr>
                   14637: <tr>
1.343     gutterid 14638: <td>send</td>
1.344     gutterid 14639: <td>sendfile</td>
1.269     leot     14640: </tr>
                   14641: <tr>
1.343     gutterid 14642: <td>sendto</td>
1.344     gutterid 14643: <td>setenv</td>
1.289     leot     14644: </tr>
                   14645: <tr>
1.343     gutterid 14646: <td>setgid</td>
1.344     gutterid 14647: <td>setprogname</td>
1.269     leot     14648: </tr>
                   14649: <tr>
1.343     gutterid 14650: <td>setuid</td>
1.344     gutterid 14651: <td>sh</td>
1.269     leot     14652: </tr>
                   14653: <tr>
1.343     gutterid 14654: <td>shebang</td>
1.344     gutterid 14655: <td>show</td>
1.269     leot     14656: </tr>
                   14657: <tr>
1.343     gutterid 14658: <td>show-all</td>
1.344     gutterid 14659: <td>show-build-defs</td>
1.269     leot     14660: </tr>
                   14661: <tr>
1.343     gutterid 14662: <td>show-depends</td>
1.344     gutterid 14663: <td>show-depends-dirs</td>
1.296     rillig   14664: </tr>
                   14665: <tr>
1.343     gutterid 14666: <td>show-depends-pkgpaths</td>
1.344     gutterid 14667: <td>show-depends-recursive</td>
1.269     leot     14668: </tr>
                   14669: <tr>
1.343     gutterid 14670: <td>show-deps</td>
1.344     gutterid 14671: <td>show-distfiles</td>
1.337     gutterid 14672: </tr>
                   14673: <tr>
1.343     gutterid 14674: <td>show-downlevel</td>
1.344     gutterid 14675: <td>show-subdir-var</td>
1.338     nia      14676: </tr>
                   14677: <tr>
1.343     gutterid 14678: <td>show-tools</td>
1.344     gutterid 14679: <td>show-var</td>
1.269     leot     14680: </tr>
                   14681: <tr>
1.343     gutterid 14682: <td>show-vars</td>
1.344     gutterid 14683: <td>snprintf</td>
1.269     leot     14684: </tr>
                   14685: <tr>
1.343     gutterid 14686: <td>socket</td>
1.344     gutterid 14687: <td>ssp</td>
1.269     leot     14688: </tr>
                   14689: <tr>
1.343     gutterid 14690: <td>st_mode</td>
1.344     gutterid 14691: <td>stage-install</td>
1.269     leot     14692: </tr>
                   14693: <tr>
1.343     gutterid 14694: <td>strcasestr</td>
1.344     gutterid 14695: <td>strict</td>
1.289     leot     14696: </tr>
                   14697: <tr>
1.343     gutterid 14698: <td>strip</td>
1.344     gutterid 14699: <td>strndup</td>
1.269     leot     14700: </tr>
                   14701: <tr>
1.343     gutterid 14702: <td>strnlen</td>
1.344     gutterid 14703: <td>strsep</td>
1.269     leot     14704: </tr>
                   14705: <tr>
1.343     gutterid 14706: <td>subst</td>
1.344     gutterid 14707: <td>substitutions</td>
1.277     rillig   14708: </tr>
                   14709: <tr>
1.341     gutterid 14710: <td>sun</td>
1.344     gutterid 14711: <td>sunpro</td>
1.329     leot     14712: </tr>
                   14713: <tr>
1.341     gutterid 14714: <td>sunwspro</td>
1.344     gutterid 14715: <td>symlink</td>
1.327     wiz      14716: </tr>
                   14717: <tr>
1.343     gutterid 14718: <td>test</td>
1.344     gutterid 14719: <td>test-env</td>
1.342     wiz      14720: </tr>
                   14721: <tr>
1.343     gutterid 14722: <td>tex</td>
1.344     gutterid 14723: <td>texlive</td>
1.338     nia      14724: </tr>
                   14725: <tr>
1.343     gutterid 14726: <td>tmp</td>
1.344     gutterid 14727: <td>todo</td>
1.269     leot     14728: </tr>
                   14729: <tr>
1.343     gutterid 14730: <td>tool</td>
1.344     gutterid 14731: <td>tools</td>
1.269     leot     14732: </tr>
                   14733: <tr>
1.343     gutterid 14734: <td>tools-libtool-m4-override</td>
1.344     gutterid 14735: <td>transitive</td>
1.269     leot     14736: </tr>
                   14737: <tr>
1.343     gutterid 14738: <td>type</td>
1.344     gutterid 14739: <td>ulimit</td>
1.269     leot     14740: </tr>
                   14741: <tr>
1.343     gutterid 14742: <td>undefined</td>
1.344     gutterid 14743: <td>undo-replace</td>
1.269     leot     14744: </tr>
                   14745: <tr>
1.343     gutterid 14746: <td>unlimit</td>
1.344     gutterid 14747: <td>unprivileged</td>
1.269     leot     14748: </tr>
                   14749: <tr>
1.343     gutterid 14750: <td>unprivileged-install-hook</td>
1.344     gutterid 14751: <td>unstripped</td>
1.269     leot     14752: </tr>
                   14753: <tr>
1.343     gutterid 14754: <td>update</td>
1.344     gutterid 14755: <td>updated</td>
1.269     leot     14756: </tr>
                   14757: <tr>
1.343     gutterid 14758: <td>upload</td>
1.344     gutterid 14759: <td>upload-distfiles</td>
1.269     leot     14760: </tr>
                   14761: <tr>
1.343     gutterid 14762: <td>use_tools</td>
1.344     gutterid 14763: <td>user</td>
1.269     leot     14764: </tr>
                   14765: <tr>
1.343     gutterid 14766: <td>utimes</td>
1.344     gutterid 14767: <td>vasprintf</td>
1.269     leot     14768: </tr>
                   14769: <tr>
1.343     gutterid 14770: <td>verbose</td>
1.344     gutterid 14771: <td>vsnprintf</td>
1.269     leot     14772: </tr>
                   14773: <tr>
1.343     gutterid 14774: <td>warn</td>
1.344     gutterid 14775: <td>warning</td>
1.269     leot     14776: </tr>
                   14777: <tr>
1.343     gutterid 14778: <td>warnings</td>
1.344     gutterid 14779: <td>warnx</td>
1.269     leot     14780: </tr>
                   14781: <tr>
1.343     gutterid 14782: <td>wattr_off</td>
1.344     gutterid 14783: <td>wattr_on</td>
1.269     leot     14784: </tr>
                   14785: <tr>
1.343     gutterid 14786: <td>work</td>
1.344     gutterid 14787: <td>wrapper</td>
1.269     leot     14788: </tr>
                   14789: <tr>
1.289     leot     14790: <td>wrkdir</td>
1.344     gutterid 14791: <td> </td>
1.269     leot     14792: </tr>
                   14793: </table>
1.267     rillig   14794: </div>
                   14795: <div class="appendix">
                   14796: <div class="titlepage"><div><div><h1 class="title">
1.322     leot     14797: <a name="editing"></a>Appendix F. Editing guidelines for the pkgsrc guide</h1></div></div></div>
1.75      rillig   14798: <div class="toc">
                   14799: <p><b>Table of Contents</b></p>
1.210     leot     14800: <dl class="toc">
1.322     leot     14801: <dt><span class="sect1"><a href="#targets">F.1. Make targets</a></span></dt>
                   14802: <dt><span class="sect1"><a href="#procedure">F.2. Procedure</a></span></dt>
1.75      rillig   14803: </dl>
                   14804: </div>
1.79      rillig   14805: <p>This section contains information on editing the pkgsrc
                   14806:        guide itself.</p>
1.148     asau     14807: <div class="sect1">
1.75      rillig   14808: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322     leot     14809: <a name="targets"></a>F.1. Make targets</h2></div></div></div>
1.79      rillig   14810: <p>The pkgsrc guide's source code is stored in
                   14811:        <code class="filename">pkgsrc/doc/guide/files</code>, and several files
                   14812:        are created from it:</p>
1.148     asau     14813: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128     wiz      14814: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.txt</code></p></li>
                   14815: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.html</code></p></li>
1.289     leot     14816: <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>
                   14817: <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.79      rillig   14818:        The PDF version of the pkgsrc guide.</p></li>
1.289     leot     14819: <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.79      rillig   14820:        PostScript version of the pkgsrc guide.</p></li>
1.75      rillig   14821: </ul></div>
                   14822: </div>
1.148     asau     14823: <div class="sect1">
1.75      rillig   14824: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322     leot     14825: <a name="procedure"></a>F.2. Procedure</h2></div></div></div>
1.79      rillig   14826: <p>The procedure to edit the pkgsrc guide is:</p>
1.128     wiz      14827: <div class="procedure"><ol class="procedure" type="1">
1.304     bacon    14828: <li class="step"><p>Make sure you have checked out the htdocs repository
                   14829:        into a sibling directory of your pkgsrc directory.  You will need
                   14830:        the ability to commit from both pkgsrc and htdocs.</p></li>
1.148     asau     14831: <li class="step"><p>Make sure you have the packages needed to
1.83      wiz      14832:        regenerate the pkgsrc guide (and other XML-based NetBSD
1.151     obache   14833:        documentation) installed. These are automatically installed when
1.322     leot     14834:        you install the <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/meta-pkgs/pkgsrc-guide-tools/index.html" target="_top"><code class="filename">meta-pkgs/pkgsrc-guide-tools</code></a> package.</p></li>
1.148     asau     14835: <li class="step"><p>Run <span class="command"><strong>cd doc/guide</strong></span> to get to the
1.79      rillig   14836:        right directory. All further steps will take place
                   14837:        here.</p></li>
1.148     asau     14838: <li class="step"><p>Edit the XML file(s) in
1.79      rillig   14839:        <code class="filename">files/</code>.</p></li>
1.148     asau     14840: <li class="step"><p>Run <span class="command"><strong>bmake</strong></span> to check the pkgsrc
1.79      rillig   14841:        guide for valid XML and to build the final output files. If you
                   14842:        get any errors at this stage, you can just edit the files, as
                   14843:        there are only symbolic links in the working directory, pointing
                   14844:        to the files in <code class="filename">files/</code>.</p></li>
1.148     asau     14845: <li class="step"><p><span class="command"><strong>(cd files &amp;&amp; cvs
1.79      rillig   14846:        commit)</strong></span></p></li>
1.148     asau     14847: <li class="step"><p>Run <span class="command"><strong>bmake clean &amp;&amp; bmake</strong></span> to
1.79      rillig   14848:        regenerate the output files with the proper RCS
                   14849:        Ids.</p></li>
1.148     asau     14850: <li class="step">
1.110     hubertf  14851: <p>Run <span class="command"><strong>bmake regen</strong></span> to install and
1.91      rillig   14852:        commit the files in both <code class="filename">pkgsrc/doc</code> and
                   14853:        <code class="filename">htdocs</code>.</p>
1.148     asau     14854: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.91      rillig   14855: <h3 class="title">Note</h3>
                   14856: <p>If you have added, removed or renamed some chapters,
1.110     hubertf  14857:        you need to synchronize them using <span class="command"><strong>cvs add</strong></span> or
                   14858:        <span class="command"><strong>cvs delete</strong></span> in the htdocs
1.91      rillig   14859:        directory.</p>
                   14860: </div>
                   14861: </li>
1.79      rillig   14862: </ol></div>
1.75      rillig   14863: </div>
                   14864: </div>
                   14865: </div></body>
1.1       grant    14866: </html>

CVSweb <webmaster@jp.NetBSD.org>