Annotation of pkgsrc/doc/pkgsrc.html, revision 1.355
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"><<a class="email" href="mailto:agc@NetBSD.org">agc@NetBSD.org</a>></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"><<a class="email" href="mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>></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>
1.355 ! rillig 106: <dt><span class="sect1"><a href="#native-or-pkgsrc-preference">6.3. Preferences for native or pkgsrc software</a></span></dt>
! 107: <dt><span class="sect1"><a href="#variables-affecting-installation">6.4. Variables affecting the installation process</a></span></dt>
! 108: <dt><span class="sect1"><a href="#conf.compiler">6.5. Selecting and configuring the compiler</a></span></dt>
! 109: <dd><dl>
! 110: <dt><span class="sect2"><a href="#selecting-the-compiler">6.5.1. Selecting the compiler</a></span></dt>
! 111: <dt><span class="sect2"><a href="#conf.cflags">6.5.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
! 112: <dt><span class="sect2"><a href="#conf.ldflags">6.5.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.88 wiz 113: </dl></dd>
1.355 ! rillig 114: <dt><span class="sect1"><a href="#developer-advanced-settings">6.6. Developer/advanced settings</a></span></dt>
! 115: <dt><span class="sect1"><a href="#selecting-build-options">6.7. Selecting Build Options</a></span></dt>
1.75 rillig 116: </dl></dd>
1.267 rillig 117: <dt><span class="chapter"><a href="#binary">7. Creating binary packages</a></span></dt>
1.75 rillig 118: <dd><dl>
1.267 rillig 119: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
120: <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 121: </dl></dd>
1.267 rillig 122: <dt><span class="chapter"><a href="#bulk">8. Creating binary packages for everything in pkgsrc (bulk
1.106 rillig 123: builds)</a></span></dt>
1.75 rillig 124: <dd><dl>
1.267 rillig 125: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.295 rillig 126: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.267 rillig 127: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
128: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.293 rillig 129: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
130: <dd><dl>
1.294 rillig 131: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
132: <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 133: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
134: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
135: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
136: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
137: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
138: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
139: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
140: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.293 rillig 141: </dl></dd>
142: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
143: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.267 rillig 144: </dl></dd>
145: <dt><span class="chapter"><a href="#files">9. Directory layout of the installed files</a></span></dt>
146: <dd><dl>
147: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
148: <dt><span class="sect1"><a href="#files.varbase">9.2. File system layout in <code class="literal">${VARBASE}</code></a></span></dt>
149: </dl></dd>
150: <dt><span class="chapter"><a href="#faq">10. Frequently Asked Questions</a></span></dt>
151: <dd><dl>
152: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
153: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
154: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
155: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
156: <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>
157: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
158: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
159: <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>
160: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
161: <dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">“<span class="quote">Don't know how to make
1.128 wiz 162: /usr/share/tmac/tmac.andoc</span>”</span> mean?</a></span></dt>
1.267 rillig 163: <dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">“<span class="quote">Could not find bsd.own.mk</span>”</span> mean?</a></span></dt>
1.336 nia 164: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' or `priv` with pkgsrc</a></span></dt>
1.267 rillig 165: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
166: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
167: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
168: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
169: <dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">“<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>”</span> mean?</a></span></dt>
1.75 rillig 170: </dl></dd>
171: </dl></dd>
172: <dt><span class="part"><a href="#developers-guide">II. The pkgsrc developer's guide</a></span></dt>
173: <dd><dl>
1.267 rillig 174: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
1.299 rillig 175: <dt><span class="chapter"><a href="#components">12. Package components - files, directories and contents</a></span></dt>
1.91 rillig 176: <dd><dl>
1.299 rillig 177: <dt><span class="sect1"><a href="#components.Makefile">12.1. <code class="filename">Makefile</code></a></span></dt>
178: <dt><span class="sect1"><a href="#components.distinfo">12.2. <code class="filename">distinfo</code></a></span></dt>
179: <dt><span class="sect1"><a href="#components.patches">12.3. <code class="filename">patches/*</code></a></span></dt>
1.91 rillig 180: <dd><dl>
1.299 rillig 181: <dt><span class="sect2"><a href="#components.patch.structure">12.3.1. Structure of a single patch file</a></span></dt>
182: <dt><span class="sect2"><a href="#components.patches.caveats">12.3.2. Creating patch files</a></span></dt>
183: <dt><span class="sect2"><a href="#components.patches.sources">12.3.3. Sources where the patch files come from</a></span></dt>
184: <dt><span class="sect2"><a href="#components.patches.guidelines">12.3.4. Patching guidelines</a></span></dt>
185: <dt><span class="sect2"><a href="#components.patches.feedback">12.3.5. Feedback to the author</a></span></dt>
1.91 rillig 186: </dl></dd>
1.299 rillig 187: <dt><span class="sect1"><a href="#other-mandatory-files">12.4. Other mandatory files</a></span></dt>
188: <dt><span class="sect1"><a href="#components.optional">12.5. Optional files</a></span></dt>
189: <dd><dl>
190: <dt><span class="sect2"><a href="#components.optional.bin">12.5.1. Files affecting the binary package</a></span></dt>
191: <dt><span class="sect2"><a href="#components.optional.build">12.5.2. Files affecting the build process</a></span></dt>
192: <dt><span class="sect2"><a href="#components.optional.none">12.5.3. Files affecting nothing at all</a></span></dt>
193: </dl></dd>
194: <dt><span class="sect1"><a href="#work-dir">12.6. <code class="filename">work*</code></a></span></dt>
195: <dt><span class="sect1"><a href="#files-dir">12.7. <code class="filename">files/*</code></a></span></dt>
1.106 rillig 196: </dl></dd>
1.299 rillig 197: <dt><span class="chapter"><a href="#build">13. The build process</a></span></dt>
1.106 rillig 198: <dd><dl>
1.299 rillig 199: <dt><span class="sect1"><a href="#build.intro">13.1. Introduction</a></span></dt>
200: <dt><span class="sect1"><a href="#build.prefix">13.2. Program location</a></span></dt>
201: <dt><span class="sect1"><a href="#build.builddirs">13.3. Directories used during the build process</a></span></dt>
202: <dt><span class="sect1"><a href="#build.running">13.4. Running a phase</a></span></dt>
203: <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 204: <dd><dl>
1.299 rillig 205: <dt><span class="sect2"><a href="#build.fetch.what">13.5.1. What to fetch and where to get it from</a></span></dt>
206: <dt><span class="sect2"><a href="#build.fetch.how">13.5.2. How are the files fetched?</a></span></dt>
1.106 rillig 207: </dl></dd>
1.299 rillig 208: <dt><span class="sect1"><a href="#build.checksum">13.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
209: <dt><span class="sect1"><a href="#build.extract">13.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
210: <dt><span class="sect1"><a href="#build.patch">13.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
211: <dt><span class="sect1"><a href="#build.tools">13.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
212: <dt><span class="sect1"><a href="#build.wrapper">13.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
213: <dt><span class="sect1"><a href="#build.configure">13.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
214: <dt><span class="sect1"><a href="#build.build">13.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
215: <dt><span class="sect1"><a href="#build.test">13.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
216: <dt><span class="sect1"><a href="#build.install">13.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
217: <dt><span class="sect1"><a href="#build.package">13.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
218: <dt><span class="sect1"><a href="#build.clean">13.16. Cleaning up</a></span></dt>
219: <dt><span class="sect1"><a href="#build.helpful-targets">13.17. Other helpful targets</a></span></dt>
220: </dl></dd>
221: <dt><span class="chapter"><a href="#creating">14. Creating a new pkgsrc package from scratch</a></span></dt>
222: <dd><dl>
223: <dt><span class="sect1"><a href="#creating.common">14.1. Common types of packages</a></span></dt>
1.106 rillig 224: <dd><dl>
1.334 nia 225: <dt><span class="sect2"><a href="#creating.python-module">14.1.1. Python modules and programs</a></span></dt>
226: <dt><span class="sect2"><a href="#creating.R-package">14.1.2. R packages</a></span></dt>
227: <dt><span class="sect2"><a href="#creating.TeX-package">14.1.3. TeXlive packages</a></span></dt>
1.106 rillig 228: </dl></dd>
1.299 rillig 229: <dt><span class="sect1"><a href="#creating.examples">14.2. Examples</a></span></dt>
230: <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 231: </dl></dd>
1.299 rillig 232: <dt><span class="chapter"><a href="#makefile">15. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.106 rillig 233: <dd><dl>
1.299 rillig 234: <dt><span class="sect1"><a href="#makefile.style">15.1. Caveats</a></span></dt>
235: <dt><span class="sect1"><a href="#makefile.variables">15.2. <code class="filename">Makefile</code> variables</a></span></dt>
236: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">15.2.1. Naming conventions</a></span></dt></dl></dd>
237: <dt><span class="sect1"><a href="#makefile.code">15.3. Code snippets</a></span></dt>
1.106 rillig 238: <dd><dl>
1.299 rillig 239: <dt><span class="sect2"><a href="#adding-to-list">15.3.1. Adding things to a list</a></span></dt>
240: <dt><span class="sect2"><a href="#echo-literal">15.3.2. Echoing a string exactly as-is</a></span></dt>
241: <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>
242: <dt><span class="sect2"><a href="#empty-variables">15.3.4. Handling possibly empty variables</a></span></dt>
1.344 gutterid 243: <dt><span class="sect2"><a href="#makefile.yesno">15.3.5. Testing yes/no variables in conditions</a></span></dt>
1.106 rillig 244: </dl></dd>
245: </dl></dd>
1.299 rillig 246: <dt><span class="chapter"><a href="#options">16. Options handling</a></span></dt>
1.106 rillig 247: <dd><dl>
1.299 rillig 248: <dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
249: <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>
250: <dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
251: <dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
1.106 rillig 252: </dl></dd>
1.299 rillig 253: <dt><span class="chapter"><a href="#tools">17. Tools needed for building or running</a></span></dt>
1.106 rillig 254: <dd><dl>
1.299 rillig 255: <dt><span class="sect1"><a href="#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
256: <dt><span class="sect1"><a href="#package-tools">17.2. Tools needed by packages</a></span></dt>
257: <dt><span class="sect1"><a href="#platform-tools">17.3. Tools provided by platforms</a></span></dt>
258: </dl></dd>
259: <dt><span class="chapter"><a href="#buildlink">18. Buildlink methodology</a></span></dt>
260: <dd><dl>
261: <dt><span class="sect1"><a href="#converting-to-buildlink3">18.1. Converting packages to use buildlink3</a></span></dt>
262: <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 263: <dd><dl>
1.299 rillig 264: <dt><span class="sect2"><a href="#anatomy-of-bl3">18.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
265: <dt><span class="sect2"><a href="#updating-buildlink-depends">18.2.2. Updating
1.133 wiz 266: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
267: and
268: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
269: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106 rillig 270: </dl></dd>
1.299 rillig 271: <dt><span class="sect1"><a href="#writing-builtin.mk">18.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.355 ! rillig 272: <dd><dl><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></dl></dd>
1.299 rillig 273: </dl></dd>
274: <dt><span class="chapter"><a href="#plist">19. PLIST issues</a></span></dt>
1.106 rillig 275: <dd><dl>
1.299 rillig 276: <dt><span class="sect1"><a href="#rcs-id">19.1. RCS ID</a></span></dt>
277: <dt><span class="sect1"><a href="#automatic-plist-generation">19.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
278: <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>
279: <dt><span class="sect1"><a href="#plist.misc">19.4. Variable substitution in PLIST</a></span></dt>
280: <dt><span class="sect1"><a href="#manpage-compression">19.5. Man page compression</a></span></dt>
281: <dt><span class="sect1"><a href="#using-PLIST_SRC">19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
282: <dt><span class="sect1"><a href="#platform-specific-plist">19.7. Platform-specific and differing PLISTs</a></span></dt>
283: <dt><span class="sect1"><a href="#build-plist">19.8. Build-specific PLISTs</a></span></dt>
284: <dt><span class="sect1"><a href="#faq.common-dirs">19.9. Sharing directories between packages</a></span></dt>
1.106 rillig 285: </dl></dd>
1.299 rillig 286: <dt><span class="chapter"><a href="#pkginstall">20. The pkginstall framework</a></span></dt>
287: <dd><dl>
288: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">20.1. Files and directories outside the installation prefix</a></span></dt>
289: <dd><dl>
290: <dt><span class="sect2"><a href="#dirs-outside-prefix">20.1.1. Directory manipulation</a></span></dt>
291: <dt><span class="sect2"><a href="#files-outside-prefix">20.1.2. File manipulation</a></span></dt>
1.106 rillig 292: </dl></dd>
1.299 rillig 293: <dt><span class="sect1"><a href="#conf-files">20.2. Configuration files</a></span></dt>
1.106 rillig 294: <dd><dl>
1.299 rillig 295: <dt><span class="sect2"><a href="#conf-files-sysconfdir">20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
296: <dt><span class="sect2"><a href="#conf-files-configure">20.2.2. Telling the software where configuration files are</a></span></dt>
1.353 dholland 297: <dt><span class="sect2"><a href="#conf-files-patching">20.2.3. Patching installation</a></span></dt>
298: <dt><span class="sect2"><a href="#conf-files-declare">20.2.4. Declaring configuration files</a></span></dt>
299: <dt><span class="sect2"><a href="#conf-files-disable">20.2.5. Disabling handling of configuration files</a></span></dt>
1.299 rillig 300: </dl></dd>
301: <dt><span class="sect1"><a href="#rcd-scripts">20.3. System startup scripts</a></span></dt>
302: <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>
303: <dt><span class="sect1"><a href="#users-and-groups">20.4. System users and groups</a></span></dt>
304: <dt><span class="sect1"><a href="#shells">20.5. System shells</a></span></dt>
305: <dd><dl><dt><span class="sect2"><a href="#shells-disable">20.5.1. Disabling shell registration</a></span></dt></dl></dd>
306: <dt><span class="sect1"><a href="#fonts">20.6. Fonts</a></span></dt>
307: <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 308: </dl></dd>
309: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
310: <dd><dl>
311: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
312: <dd><dl>
313: <dt><span class="sect2"><a href="#pulling-vars-from-etc-mk.conf">21.1.1. How to pull in user-settable variables from <code class="filename">mk.conf</code></a></span></dt>
314: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
315: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
316: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
317: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
318: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
319: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
320: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
321: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
322: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
323: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
324: </dl></dd>
325: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
326: <dd><dl>
327: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
328: <dt><span class="sect2"><a href="#modified-distfiles-same-name">21.2.2. How to handle modified distfiles with the 'old' name</a></span></dt>
329: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
330: </dl></dd>
331: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
332: <dd><dl>
333: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
334: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
335: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
1.338 nia 336: <dt><span class="sect2"><a href="#meson">21.3.4. Meson / ninja</a></span></dt>
1.267 rillig 337: </dl></dd>
338: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
339: <dd><dl>
340: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
341: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
1.320 wiz 342: <dt><span class="sect2"><a href="#go-programming-language">21.4.3. Go</a></span></dt>
1.338 nia 343: <dt><span class="sect2"><a href="#rust-programming-language">21.4.4. Rust</a></span></dt>
344: <dt><span class="sect2"><a href="#perl-scripts">21.4.5. Packages containing Perl scripts</a></span></dt>
345: <dt><span class="sect2"><a href="#shell-scripts">21.4.6. Packages containing shell scripts</a></span></dt>
346: <dt><span class="sect2"><a href="#other-programming-languages">21.4.7. Other programming languages</a></span></dt>
1.267 rillig 347: </dl></dd>
348: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
349: <dd><dl>
350: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
351: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.287 rillig 352: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
353: <dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span></a></span></dt>
354: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.267 rillig 355: </dl></dd>
356: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
357: <dd><dl>
358: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
359: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
360: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
361: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
362: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
1.318 nia 363: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing Perl modules</a></span></dt>
1.267 rillig 364: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
365: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
1.318 nia 366: <dt><span class="sect2"><a href="#x11-fonts">21.6.9. Packages installing X11 fonts</a></span></dt>
367: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.10. Packages installing SGML or XML data</a></span></dt>
368: <dt><span class="sect2"><a href="#mime-database">21.6.11. Packages installing extensions to the MIME database</a></span></dt>
369: <dt><span class="sect2"><a href="#intltool">21.6.12. Packages using intltool</a></span></dt>
370: <dt><span class="sect2"><a href="#startup-scripts">21.6.13. Packages installing startup scripts</a></span></dt>
371: <dt><span class="sect2"><a href="#tex-packages">21.6.14. Packages installing TeX modules</a></span></dt>
372: <dt><span class="sect2"><a href="#emulation-packages">21.6.15. Packages supporting running binaries in
1.87 wiz 373: emulation</a></span></dt>
1.318 nia 374: <dt><span class="sect2"><a href="#hicolor-theme">21.6.16. Packages installing hicolor icons</a></span></dt>
375: <dt><span class="sect2"><a href="#desktop-files">21.6.17. Packages installing desktop files</a></span></dt>
1.77 rillig 376: </dl></dd>
1.267 rillig 377: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.77 rillig 378: </dl></dd>
1.299 rillig 379: <dt><span class="chapter"><a href="#gnome">22. GNOME packaging and porting</a></span></dt>
380: <dd><dl>
381: <dt><span class="sect1"><a href="#meta-packages">22.1. Meta packages</a></span></dt>
382: <dt><span class="sect1"><a href="#new-package">22.2. Packaging a GNOME application</a></span></dt>
383: <dt><span class="sect1"><a href="#full-update">22.3. Updating GNOME to a newer version</a></span></dt>
384: <dt><span class="sect1"><a href="#patching">22.4. Patching guidelines</a></span></dt>
385: </dl></dd>
1.267 rillig 386: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.77 rillig 387: <dd><dl>
1.267 rillig 388: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
389: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
390: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
391: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
392: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
393: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
394: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
395: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
396: </dl></dd>
397: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
1.75 rillig 398: </dl></dd>
399: <dt><span class="part"><a href="#infrastructure">III. The pkgsrc infrastructure internals</a></span></dt>
400: <dd><dl>
1.299 rillig 401: <dt><span class="chapter"><a href="#infr.design">25. Design of the pkgsrc infrastructure</a></span></dt>
1.75 rillig 402: <dd><dl>
1.299 rillig 403: <dt><span class="sect1"><a href="#infr.vardef">25.1. The meaning of variable definitions</a></span></dt>
404: <dt><span class="sect1"><a href="#infr.vardef.problems">25.2. Avoiding problems before they arise</a></span></dt>
405: <dt><span class="sect1"><a href="#infr.var">25.3. Variable evaluation</a></span></dt>
1.81 rillig 406: <dd><dl>
1.299 rillig 407: <dt><span class="sect2"><a href="#infr.var.load">25.3.1. At load time</a></span></dt>
408: <dt><span class="sect2"><a href="#infr.var.run">25.3.2. At runtime</a></span></dt>
1.81 rillig 409: </dl></dd>
1.299 rillig 410: <dt><span class="sect1"><a href="#infr.varspec">25.4. How can variables be specified?</a></span></dt>
411: <dt><span class="sect1"><a href="#infr.design.intf">25.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 412: <dd><dl>
1.299 rillig 413: <dt><span class="sect2"><a href="#infr.design.intf.proc">25.5.1. Procedures with parameters</a></span></dt>
414: <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 415: </dl></dd>
1.299 rillig 416: <dt><span class="sect1"><a href="#infr.order">25.6. The order in which files are loaded</a></span></dt>
1.75 rillig 417: <dd><dl>
1.299 rillig 418: <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>
419: <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 420: </dl></dd>
421: </dl></dd>
1.299 rillig 422: <dt><span class="chapter"><a href="#regression">26. Regression tests</a></span></dt>
1.75 rillig 423: <dd><dl>
1.299 rillig 424: <dt><span class="sect1"><a href="#regression.run">26.1. Running the regression tests</a></span></dt>
425: <dt><span class="sect1"><a href="#regression.new">26.2. Adding a new regression test</a></span></dt>
1.75 rillig 426: <dd><dl>
1.299 rillig 427: <dt><span class="sect2"><a href="#regression.fun.override">26.2.1. Overridable functions</a></span></dt>
428: <dt><span class="sect2"><a href="#regression.fun.helper">26.2.2. Helper functions</a></span></dt>
1.75 rillig 429: </dl></dd>
430: </dl></dd>
1.299 rillig 431: <dt><span class="chapter"><a href="#porting">27. Porting pkgsrc</a></span></dt>
432: <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 433: </dl></dd>
434: <dt><span class="appendix"><a href="#examples">A. A simple example package: bison</a></span></dt>
435: <dd><dl>
436: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
437: <dd><dl>
438: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
439: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
440: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.287 rillig 441: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
1.75 rillig 442: </dl></dd>
443: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
444: </dl></dd>
1.322 leot 445: <dt><span class="appendix"><a href="#hardening">B. Security hardening</a></span></dt>
1.75 rillig 446: <dd><dl>
1.322 leot 447: <dt><span class="sect1"><a href="#hardening.mechanisms">B.1. Mechanisms</a></span></dt>
448: <dd><dl>
449: <dt><span class="sect2"><a href="#hardening.mechanisms.enabled">B.1.1. Enabled by default</a></span></dt>
450: <dt><span class="sect2"><a href="#hardening.mechanisms.disabled">B.1.2. Not enabled by default</a></span></dt>
451: </dl></dd>
452: <dt><span class="sect1"><a href="#hardening.caveats">B.2. Caveats</a></span></dt>
453: <dd><dl>
454: <dt><span class="sect2"><a href="#hardening.caveats.pie">B.2.1. Problems with PKGSRC_MKPIE</a></span></dt>
455: <dt><span class="sect2"><a href="#hardening.caveats.fortify">B.2.2. Problems with PKGSRC_USE_FORTIFY</a></span></dt>
456: <dt><span class="sect2"><a href="#hardening.caveats.relro">B.2.3. Problems with PKGSRC_USE_RELRO</a></span></dt>
457: <dt><span class="sect2"><a href="#hardening.caveats.ssp">B.2.4. Problems with PKGSRC_USE_SSP</a></span></dt>
458: </dl></dd>
459: <dt><span class="sect1"><a href="#hardening.audit">B.3. Auditing the system</a></span></dt>
460: <dd><dl>
461: <dt><span class="sect2"><a href="#hardening.audit.pie">B.3.1. Checking for PIE</a></span></dt>
462: <dt><span class="sect2"><a href="#hardening.audit.relropartial">B.3.2. Checking for partial RELRO</a></span></dt>
463: <dt><span class="sect2"><a href="#hardening.audit.relrofull">B.3.3. Checking for full RELRO</a></span></dt>
464: <dt><span class="sect2"><a href="#hardening.audit.ssp">B.3.4. Checking for SSP</a></span></dt>
465: </dl></dd>
466: </dl></dd>
467: <dt><span class="appendix"><a href="#logs">C. Build logs</a></span></dt>
468: <dd><dl>
469: <dt><span class="sect1"><a href="#logs.building">C.1. Building figlet</a></span></dt>
470: <dt><span class="sect1"><a href="#logs.package">C.2. Packaging figlet</a></span></dt>
1.75 rillig 471: </dl></dd>
1.322 leot 472: <dt><span class="appendix"><a href="#ftp-layout">D. Directory layout of the pkgsrc FTP server</a></span></dt>
1.76 rillig 473: <dd><dl>
1.322 leot 474: <dt><span class="sect1"><a href="#ftp-distfiles">D.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
475: <dt><span class="sect1"><a href="#ftp-misc">D.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
476: <dt><span class="sect1"><a href="#ftp-packages">D.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
477: <dt><span class="sect1"><a href="#ftp-reports">D.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
478: <dt><span class="sect1"><a href="#ftp-source">D.5. <code class="filename">current</code>,
1.261 leot 479: <code class="filename">stable</code>,
1.128 wiz 480: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 481: source packages</a></span></dt>
482: </dl></dd>
1.322 leot 483: <dt><span class="appendix"><a href="#help-topics">E. Help topics</a></span></dt>
484: <dt><span class="appendix"><a href="#editing">F. Editing guidelines for the pkgsrc guide</a></span></dt>
1.75 rillig 485: <dd><dl>
1.322 leot 486: <dt><span class="sect1"><a href="#targets">F.1. Make targets</a></span></dt>
487: <dt><span class="sect1"><a href="#procedure">F.2. Procedure</a></span></dt>
1.75 rillig 488: </dl></dd>
489: </dl>
490: </div>
1.82 rillig 491: <div class="list-of-tables">
492: <p><b>List of Tables</b></p>
493: <dl>
494: <dt>1.1. <a href="#supported-platforms">Platforms supported by pkgsrc</a>
495: </dt>
1.299 rillig 496: <dt>12.1. <a href="#patch-examples">Patching examples</a>
1.85 jmmv 497: </dt>
1.299 rillig 498: <dt>22.1. <a href="#plist-handling">PLIST handling for GNOME packages</a>
1.85 jmmv 499: </dt>
1.82 rillig 500: </dl>
501: </div>
1.148 asau 502: <div class="chapter">
503: <div class="titlepage"><div><div><h1 class="title">
504: <a name="introduction"></a>Chapter 1. What is pkgsrc?</h1></div></div></div>
1.75 rillig 505: <div class="toc">
506: <p><b>Table of Contents</b></p>
1.210 leot 507: <dl class="toc">
1.75 rillig 508: <dt><span class="sect1"><a href="#introduction-section">1.1. Introduction</a></span></dt>
1.82 rillig 509: <dd><dl>
510: <dt><span class="sect2"><a href="#why-pkgsrc">1.1.1. Why pkgsrc?</a></span></dt>
511: <dt><span class="sect2"><a href="#intro.platforms">1.1.2. Supported platforms</a></span></dt>
512: </dl></dd>
1.75 rillig 513: <dt><span class="sect1"><a href="#overview">1.2. Overview</a></span></dt>
514: <dt><span class="sect1"><a href="#terminology">1.3. Terminology</a></span></dt>
1.88 wiz 515: <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 516: <dt><span class="sect1"><a href="#typography">1.4. Typography</a></span></dt>
517: </dl>
518: </div>
1.148 asau 519: <div class="sect1">
1.75 rillig 520: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
521: <a name="introduction-section"></a>1.1. Introduction</h2></div></div></div>
1.82 rillig 522: <p>There is a lot of software freely available for Unix-based
523: systems, which is usually available in form of the source code. Before
524: such software can be used, it needs to be configured to the local
525: system, compiled and installed, and this is exactly what The NetBSD
526: Packages Collection (pkgsrc) does. pkgsrc also has some basic commands
527: to handle binary packages, so that not every user has to build the
528: packages for himself, which is a time-costly task.</p>
1.75 rillig 529: <p>pkgsrc currently contains several thousand packages,
530: including:</p>
1.148 asau 531: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 532: <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 533: web server</p></li>
1.322 leot 534: <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 535: web browser</p></li>
1.322 leot 536: <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 537: Desktop Environment</p></li>
1.322 leot 538: <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 539: Desktop Environment</p></li>
540: </ul></div>
1.219 rillig 541: <p>… just to name a few.</p>
1.75 rillig 542: <p>pkgsrc has built-in support for handling varying dependencies,
543: such as pthreads and X11, and extended features such as IPv6 support on
544: a range of platforms.</p>
1.148 asau 545: <div class="sect2">
1.82 rillig 546: <div class="titlepage"><div><div><h3 class="title">
547: <a name="why-pkgsrc"></a>1.1.1. Why pkgsrc?</h3></div></div></div>
548: <p>
549: pkgsrc provides the following key features:
550: </p>
1.148 asau 551: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 552: <li class="listitem"><p>Easy building of software from source as well as the creation
1.82 rillig 553: and installation of binary packages. The source and latest
554: patches are retrieved from a master or mirror download site, checksum
555: verified, then built on your system. Support for binary-only
556: distributions is available for both native platforms and NetBSD
557: emulated platforms.</p></li>
1.128 wiz 558: <li class="listitem"><p>All packages are installed in a consistent directory tree,
1.82 rillig 559: including binaries, libraries, man pages and other
560: documentation.</p></li>
1.214 sevan 561: <li class="listitem"><p>Tracking of package dependencies automatically, including when
562: performing updates, to ensure required packages are installed. The
563: configuration files of various packages are handled automatically during
564: updates, so local changes are preserved.</p></li>
1.128 wiz 565: <li class="listitem"><p>Like NetBSD, pkgsrc is designed with portability in mind and
1.82 rillig 566: consists of highly portable code. This allows the greatest speed of
1.132 spz 567: development when porting to a new platform. This portability also
1.82 rillig 568: ensures that pkgsrc is <span class="emphasis"><em>consistent across all
569: platforms</em></span>.</p></li>
1.128 wiz 570: <li class="listitem"><p>The installation prefix, acceptable software licenses,
1.82 rillig 571: international encryption requirements and build-time options for a
572: large number of packages are all set in a simple, central
573: configuration file.</p></li>
1.128 wiz 574: <li class="listitem"><p>The entire source (not including the distribution files) is
1.82 rillig 575: freely available under a BSD license, so you may extend and adapt
576: pkgsrc to your needs. Support for local packages and patches is
577: available right out of the box, so you can configure it specifically
578: for your environment.</p></li>
579: </ul></div>
1.91 rillig 580: <p>The following principles are basic to pkgsrc:</p>
1.148 asau 581: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 582: <li class="listitem"><p><span class="quote">“<span class="quote">It should only work if it's right.</span>”</span>
1.126 jakllsch 583: — That means, if a package contains bugs, it's better to find
1.91 rillig 584: them and to complain about them rather than to just install the package
585: and hope that it works. There are numerous checks in pkgsrc that try to
1.322 leot 586: 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 587: of shell scripts), and post-installation checks (installed files,
588: references to shared libraries, script interpreters).</p></li>
1.128 wiz 589: <li class="listitem"><p><span class="quote">“<span class="quote">If it works, it should work everywhere</span>”</span>
1.126 jakllsch 590: — Like NetBSD has been ported to many hardware architectures,
1.91 rillig 591: pkgsrc has been ported to many operating systems. Care is taken that
592: packages behave the same on all platforms.</p></li>
593: </ul></div>
1.82 rillig 594: </div>
1.148 asau 595: <div class="sect2">
1.82 rillig 596: <div class="titlepage"><div><div><h3 class="title">
597: <a name="intro.platforms"></a>1.1.2. Supported platforms</h3></div></div></div>
598: <p>pkgsrc consists of both a source distribution and a binary
599: distribution for these operating systems. After retrieving the required
600: source or binaries, you can be up and running with pkgsrc in just
601: minutes!</p>
1.75 rillig 602: <p>pkgsrc was derived from FreeBSD's ports system, and
603: initially developed for NetBSD only. Since then, pkgsrc has
604: grown a lot, and now supports the following platforms:</p>
1.82 rillig 605: <div class="table">
606: <a name="supported-platforms"></a><p class="title"><b>Table 1.1. Platforms supported by pkgsrc</b></p>
1.216 tnn 607: <div class="table-contents"><table class="table" summary="Platforms supported by pkgsrc" border="1">
1.82 rillig 608: <colgroup>
609: <col>
610: <col>
1.202 sevan 611: <col>
1.82 rillig 612: </colgroup>
613: <thead><tr>
614: <th>Platform</th>
615: <th>Date Support Added</th>
1.202 sevan 616: <th>Notes</th>
1.82 rillig 617: </tr></thead>
618: <tbody>
619: <tr>
1.289 leot 620: <td><a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a></td>
1.82 rillig 621: <td align="center">Aug 1997</td>
1.202 sevan 622: <td class="auto-generated"> </td>
1.82 rillig 623: </tr>
624: <tr>
1.110 hubertf 625: <td><a class="ulink" href="http://wwws.sun.com/software/solaris/" target="_top">Solaris</a></td>
1.82 rillig 626: <td align="center">Mar 1999</td>
1.264 sevan 627: <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 628: </tr>
629: <tr>
1.289 leot 630: <td><a class="ulink" href="https://www.kernel.org/" target="_top">Linux</a></td>
1.82 rillig 631: <td align="center">Jun 1999</td>
1.264 sevan 632: <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 633: </tr>
634: <tr>
635: <td>
1.230 sevan 636: <a class="ulink" href="https://developer.apple.com/macos/" target="_top">Darwin / Mac OS X / OS X / macOS</a>
1.82 rillig 637: </td>
638: <td align="center">Oct 2001</td>
1.305 bacon 639: <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 640: </tr>
641: <tr>
1.289 leot 642: <td><a class="ulink" href="https://www.freebsd.org/" target="_top">FreeBSD</a></td>
1.82 rillig 643: <td align="center">Nov 2002</td>
1.264 sevan 644: <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 645: </tr>
646: <tr>
1.289 leot 647: <td><a class="ulink" href="https://www.openbsd.org/" target="_top">OpenBSD</a></td>
1.82 rillig 648: <td align="center">Nov 2002</td>
1.264 sevan 649: <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 650: </tr>
651: <tr>
1.289 leot 652: <td><a class="ulink" href="https://www.sgi.com/software/irix/" target="_top">IRIX</a></td>
1.82 rillig 653: <td align="center">Dec 2002</td>
1.202 sevan 654: <td>
1.264 sevan 655: <a class="ulink" href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/bootstrap/README.IRIX" target="_top">README.IRIX</a>
1.202 sevan 656: </td>
1.82 rillig 657: </tr>
658: <tr>
659: <td>BSD/OS</td>
660: <td align="center">Dec 2003</td>
1.202 sevan 661: <td class="auto-generated"> </td>
1.82 rillig 662: </tr>
663: <tr>
1.289 leot 664: <td><a class="ulink" href="https://www-1.ibm.com/servers/aix/" target="_top">AIX</a></td>
1.82 rillig 665: <td align="center">Dec 2003</td>
1.264 sevan 666: <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 667: </tr>
668: <tr>
669: <td>
1.289 leot 670: <a class="ulink" href="https://www.microsoft.com/windows/sfu/" target="_top">Interix</a>
1.82 rillig 671: (Microsoft Windows Services for Unix)
672: </td>
673: <td align="center">Mar 2004</td>
1.264 sevan 674: <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 675: </tr>
676: <tr>
1.289 leot 677: <td><a class="ulink" href="https://www.dragonflybsd.org/" target="_top">DragonFlyBSD</a></td>
1.82 rillig 678: <td align="center">Oct 2004</td>
1.202 sevan 679: <td class="auto-generated"> </td>
1.82 rillig 680: </tr>
681: <tr>
1.110 hubertf 682: <td><a class="ulink" href="http://www.tru64.org/" target="_top">OSF/1</a></td>
1.82 rillig 683: <td align="center">Nov 2004</td>
1.264 sevan 684: <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 685: </tr>
1.98 wiz 686: <tr>
1.289 leot 687: <td><a class="ulink" href="https://www.hp.com/products1/unix/" target="_top">HP-UX</a></td>
1.98 wiz 688: <td align="center">Apr 2007</td>
1.264 sevan 689: <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 690: </tr>
1.128 wiz 691: <tr>
1.289 leot 692: <td><a class="ulink" href="https://www.haiku-os.org/" target="_top">Haiku</a></td>
1.128 wiz 693: <td align="center">Sep 2010</td>
1.264 sevan 694: <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 695: </tr>
1.151 obache 696: <tr>
1.289 leot 697: <td><a class="ulink" href="https://www.mirbsd.org/" target="_top">MirBSD</a></td>
1.163 bsiegert 698: <td align="center">Jan 2011</td>
1.202 sevan 699: <td class="auto-generated"> </td>
1.151 obache 700: </tr>
701: <tr>
1.289 leot 702: <td><a class="ulink" href="https://www.minix3.org/" target="_top">Minix3</a></td>
1.151 obache 703: <td align="center">Nov 2011</td>
1.264 sevan 704: <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 705: </tr>
706: <tr>
1.289 leot 707: <td><a class="ulink" href="https://cygwin.com/" target="_top">Cygwin</a></td>
1.151 obache 708: <td align="center">Mar 2013</td>
1.264 sevan 709: <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 710: </tr>
1.166 jnemeth 711: <tr>
1.289 leot 712: <td><a class="ulink" href="https://www.debian.org/ports/kfreebsd-gnu/" target="_top">GNU/kFreeBSD</a></td>
1.166 jnemeth 713: <td align="center">Jul 2013</td>
1.264 sevan 714: <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 715: </tr>
1.214 sevan 716: <tr>
1.289 leot 717: <td><a class="ulink" href="https://www.bitrig.org/" target="_top">Bitrig</a></td>
1.214 sevan 718: <td align="center">Jun 2014</td>
1.344 gutterid 719: <td>Removed from pkgsrc Sep 2022</td>
1.214 sevan 720: </tr>
1.82 rillig 721: </tbody>
1.91 rillig 722: </table></div>
1.82 rillig 723: </div>
1.91 rillig 724: <br class="table-break">
1.82 rillig 725: </div>
1.75 rillig 726: </div>
1.148 asau 727: <div class="sect1">
1.75 rillig 728: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
729: <a name="overview"></a>1.2. Overview</h2></div></div></div>
730: <p>This document is divided into three parts. The first,
1.110 hubertf 731: <a class="link" href="#users-guide" title="Part I. The pkgsrc user's guide">The pkgsrc user's guide</a>,
1.75 rillig 732: describes how one can use one of the packages in the Package
733: Collection, either by installing a precompiled binary package,
1.93 rillig 734: or by building one's own copy using the NetBSD package system.
1.110 hubertf 735: 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 736: package so it can be easily built by other NetBSD users without
737: knowing about the package's building details. The third part,
1.110 hubertf 738: <a class="link" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">The pkgsrc infrastructure internals</a>
1.75 rillig 739: is intended for those who want to understand how pkgsrc is
740: implemented.</p>
741: <p>This document is available in various formats:
1.110 hubertf 742: <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 743: </div>
1.148 asau 744: <div class="sect1">
1.75 rillig 745: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
746: <a name="terminology"></a>1.3. Terminology</h2></div></div></div>
1.128 wiz 747: <p>There has been a lot of talk about <span class="quote">“<span class="quote">ports</span>”</span>,
748: <span class="quote">“<span class="quote">packages</span>”</span>, etc. so far. Here is a description of all the
1.75 rillig 749: terminology used within this document.</p>
1.148 asau 750: <div class="variablelist"><dl class="variablelist">
1.75 rillig 751: <dt><span class="term">Package</span></dt>
752: <dd><p>A set of files and building instructions
753: that describe what's necessary
754: to build a certain piece of software using
755: pkgsrc. Packages are traditionally stored under
1.236 wiz 756: <code class="filename">/usr/pkgsrc</code>,
757: but may be stored in any location,
758: referred to as <code class="varname">PKGSRCDIR</code>.</p></dd>
1.75 rillig 759: <dt><span class="term">The NetBSD package system</span></dt>
1.128 wiz 760: <dd><p>This is the former name of <span class="quote">“<span class="quote">pkgsrc</span>”</span>. It
1.87 wiz 761: is part of the NetBSD operating system and can be bootstrapped
762: to run on non-NetBSD operating systems as well. It handles
763: building (compiling), installing, and removing of
764: packages.</p></dd>
1.75 rillig 765: <dt><span class="term">Distfile</span></dt>
766: <dd><p>This term describes the file or files that are
767: provided by the author of the piece of software to
768: distribute his work. All the changes necessary to build on
769: NetBSD are reflected in the corresponding package. Usually
770: the distfile is in the form of a compressed tar-archive,
771: but other types are possible, too. Distfiles are usually
772: stored below
1.76 rillig 773: <code class="filename">/usr/pkgsrc/distfiles</code>.</p></dd>
1.75 rillig 774: <dt><span class="term">Port</span></dt>
775: <dd><p>This is the term used by FreeBSD and OpenBSD people
776: for what we call a package.
1.128 wiz 777: In NetBSD terminology, <span class="quote">“<span class="quote">port</span>”</span> refers to a different
1.75 rillig 778: architecture.</p></dd>
779: <dt><span class="term">Precompiled/binary package</span></dt>
780: <dd>
781: <p>A set of binaries built with pkgsrc from a distfile
1.76 rillig 782: and stuffed together in a single <code class="filename">.tgz</code>
1.75 rillig 783: file so it can be installed on machines of the same
784: machine architecture without the need to
785: recompile. Packages are usually generated in
1.76 rillig 786: <code class="filename">/usr/pkgsrc/packages</code>; there is also
1.132 spz 787: an archive on <a class="ulink" href="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/" target="_top">ftp.NetBSD.org</a>.</p>
1.128 wiz 788: <p>Sometimes, this is referred to by the term <span class="quote">“<span class="quote">package</span>”</span> too,
1.75 rillig 789: especially in the context of precompiled packages.</p>
790: </dd>
791: <dt><span class="term">Program</span></dt>
1.88 wiz 792: <dd><p>The piece of software to be installed which will be
793: constructed from all the files in the distfile by the
794: actions defined in the corresponding package.</p></dd>
1.75 rillig 795: </dl></div>
1.148 asau 796: <div class="sect2">
1.75 rillig 797: <div class="titlepage"><div><div><h3 class="title">
1.88 wiz 798: <a name="term.roles"></a>1.3.1. Roles involved in pkgsrc</h3></div></div></div>
1.148 asau 799: <div class="variablelist"><dl class="variablelist">
1.75 rillig 800: <dt><span class="term">pkgsrc users</span></dt>
801: <dd>
802: <p>The
803: pkgsrc users are people who use the packages provided by pkgsrc.
804: Typically they are system administrators. The people using the
1.128 wiz 805: software that is inside the packages (maybe called <span class="quote">“<span class="quote">end
806: users</span>”</span>) are not covered by the pkgsrc guide.</p>
1.75 rillig 807: <p>There are two kinds of pkgsrc users: Some only want to
808: install pre-built binary packages. Others build the pkgsrc
809: packages from source, either for installing them directly or for
1.110 hubertf 810: building binary packages themselves. For pkgsrc users <a class="xref" href="#users-guide" title="Part I. The pkgsrc user's guide">Part I, “The pkgsrc user's guide”</a> should provide all necessary
1.75 rillig 811: documentation.</p>
812: </dd>
813: <dt><span class="term">package maintainers</span></dt>
814: <dd><p>A
1.110 hubertf 815: package maintainer creates packages as described in <a class="xref" href="#developers-guide" title="Part II. The pkgsrc developer's guide">Part II, “The pkgsrc developer's guide”</a>.</p></dd>
1.75 rillig 816: <dt><span class="term">infrastructure developers</span></dt>
817: <dd><p>These people are involved in all those files
1.76 rillig 818: that live in the <code class="filename">mk/</code> directory and below.
1.110 hubertf 819: Only these people should need to read through <a class="xref" href="#infrastructure" title="Part III. The pkgsrc infrastructure internals">Part III, “The pkgsrc infrastructure internals”</a>, though others might be curious,
1.75 rillig 820: too.</p></dd>
821: </dl></div>
822: </div>
823: </div>
1.148 asau 824: <div class="sect1">
1.75 rillig 825: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
826: <a name="typography"></a>1.4. Typography</h2></div></div></div>
827: <p>When giving examples for commands, shell prompts are used to
828: show if the command should/can be issued as root, or if
1.128 wiz 829: <span class="quote">“<span class="quote">normal</span>”</span> user privileges are sufficient. We use a
1.226 sevan 830: <code class="prompt">#</code> for root's shell prompt, a <code class="prompt">%</code> for users'
831: shell prompt, assuming they use the C-shell or tcsh and a <code class="prompt">$</code> for
1.344 gutterid 832: Bourne shell and derivatives.</p>
1.75 rillig 833: </div>
834: </div>
1.148 asau 835: <div class="part">
1.75 rillig 836: <div class="titlepage"><div><div><h1 class="title">
837: <a name="users-guide"></a>Part I. The pkgsrc user's guide</h1></div></div></div>
838: <div class="toc">
839: <p><b>Table of Contents</b></p>
1.210 leot 840: <dl class="toc">
1.267 rillig 841: <dt><span class="chapter"><a href="#help-user">2. Getting help</a></span></dt>
842: <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 843: <dd><dl>
1.267 rillig 844: <dt><span class="sect1"><a href="#getting-first">3.1. Getting pkgsrc for the first time</a></span></dt>
1.75 rillig 845: <dd><dl>
1.267 rillig 846: <dt><span class="sect2"><a href="#getting-via-tar">3.1.1. As tar archive</a></span></dt>
847: <dt><span class="sect2"><a href="#getting-via-cvs">3.1.2. Via anonymous CVS</a></span></dt>
1.75 rillig 848: </dl></dd>
1.267 rillig 849: <dt><span class="sect1"><a href="#uptodate">3.2. Keeping pkgsrc up-to-date</a></span></dt>
1.75 rillig 850: <dd><dl>
1.267 rillig 851: <dt><span class="sect2"><a href="#uptodate-tar">3.2.1. Via tar files</a></span></dt>
852: <dt><span class="sect2"><a href="#uptodate-cvs">3.2.2. Via CVS</a></span></dt>
1.75 rillig 853: </dl></dd>
854: </dl></dd>
1.267 rillig 855: <dt><span class="chapter"><a href="#platforms">4. Using pkgsrc on systems other than NetBSD</a></span></dt>
1.75 rillig 856: <dd><dl>
1.267 rillig 857: <dt><span class="sect1"><a href="#binarydist">4.1. Binary distribution</a></span></dt>
858: <dt><span class="sect1"><a href="#bootstrapping-pkgsrc">4.2. Bootstrapping pkgsrc</a></span></dt>
1.75 rillig 859: </dl></dd>
1.267 rillig 860: <dt><span class="chapter"><a href="#using">5. Using pkgsrc</a></span></dt>
1.75 rillig 861: <dd><dl>
1.267 rillig 862: <dt><span class="sect1"><a href="#using-pkg">5.1. Using binary packages</a></span></dt>
1.75 rillig 863: <dd><dl>
1.267 rillig 864: <dt><span class="sect2"><a href="#finding-binary-packages">5.1.1. Finding binary packages</a></span></dt>
865: <dt><span class="sect2"><a href="#installing-binary-packages">5.1.2. Installing binary packages</a></span></dt>
1.317 nia 866: <dt><span class="sect2"><a href="#using.pkgin_update">5.1.3. Updating packages</a></span></dt>
867: <dt><span class="sect2"><a href="#using.pkg_delete">5.1.4. Deinstalling packages</a></span></dt>
868: <dt><span class="sect2"><a href="#using.pkg_info">5.1.5. Getting information about installed packages</a></span></dt>
869: <dt><span class="sect2"><a href="#vulnerabilities">5.1.6. Checking for security vulnerabilities in installed packages</a></span></dt>
870: <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>
871: <dt><span class="sect2"><a href="#using.pkg_admin">5.1.8. Other administrative functions</a></span></dt>
1.75 rillig 872: </dl></dd>
1.267 rillig 873: <dt><span class="sect1"><a href="#building-packages-from-source">5.2. Building packages from source</a></span></dt>
1.75 rillig 874: <dd><dl>
1.267 rillig 875: <dt><span class="sect2"><a href="#requirements">5.2.1. Requirements</a></span></dt>
876: <dt><span class="sect2"><a href="#fetching-distfiles">5.2.2. Fetching distfiles</a></span></dt>
877: <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 878: </dl></dd>
879: </dl></dd>
1.267 rillig 880: <dt><span class="chapter"><a href="#configuring">6. Configuring pkgsrc</a></span></dt>
1.75 rillig 881: <dd><dl>
1.267 rillig 882: <dt><span class="sect1"><a href="#general-configuration">6.1. General configuration</a></span></dt>
883: <dt><span class="sect1"><a href="#variables-affecting-build">6.2. Variables affecting the build process</a></span></dt>
1.355 ! rillig 884: <dt><span class="sect1"><a href="#native-or-pkgsrc-preference">6.3. Preferences for native or pkgsrc software</a></span></dt>
! 885: <dt><span class="sect1"><a href="#variables-affecting-installation">6.4. Variables affecting the installation process</a></span></dt>
! 886: <dt><span class="sect1"><a href="#conf.compiler">6.5. Selecting and configuring the compiler</a></span></dt>
! 887: <dd><dl>
! 888: <dt><span class="sect2"><a href="#selecting-the-compiler">6.5.1. Selecting the compiler</a></span></dt>
! 889: <dt><span class="sect2"><a href="#conf.cflags">6.5.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
! 890: <dt><span class="sect2"><a href="#conf.ldflags">6.5.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.88 wiz 891: </dl></dd>
1.355 ! rillig 892: <dt><span class="sect1"><a href="#developer-advanced-settings">6.6. Developer/advanced settings</a></span></dt>
! 893: <dt><span class="sect1"><a href="#selecting-build-options">6.7. 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">“<span class="quote">Don't know how to make
1.128 wiz 940: /usr/share/tmac/tmac.andoc</span>”</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">“<span class="quote">Could not find bsd.own.mk</span>”</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">“<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>”</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=…</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 && 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 && 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 && 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 && 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 && 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">“<span class="quote">-A</span>”</span> after the
1157: <span class="quote">“<span class="quote">update</span>”</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">“<span class="quote">-rpkgsrc-2021Q4</span>”</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">“<span class="quote">update</span>”</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, “Using binary packages”</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">“<span class="quote">--unprivileged</span>”</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">“<span class="quote">./bootstrap --help</span>”</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">“<span class="quote">make</span>”</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">“<span class="quote">pkg</span>”</span>
1266: in pkgsrc. The second way is to install the <span class="quote">“<span class="quote">src</span>”</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, “Bootstrapping pkgsrc”</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">“<span class="quote">version</span>”</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 >/dev/null 2>&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 >/dev/null 2>&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">“<span class="quote">-i</span>”</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, “The pkgsrc developer's guide”</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">“<span class="quote">comp</span>”</span> and the <span class="quote">“<span class="quote">text</span>”</span> distribution
1.88 wiz 1489: sets. If you want to build X11-related packages, the
1.128 wiz 1490: <span class="quote">“<span class="quote">xbase</span>”</span> and <span class="quote">“<span class="quote">xcomp</span>”</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">“<span class="quote">make</span>”</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">“<span class="quote">look under the
1623: covers</span>”</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">“<span class="quote">patch</span>”</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>
1.355 ! rillig 1682: <dt><span class="sect1"><a href="#native-or-pkgsrc-preference">6.3. Preferences for native or pkgsrc software</a></span></dt>
! 1683: <dt><span class="sect1"><a href="#variables-affecting-installation">6.4. Variables affecting the installation process</a></span></dt>
! 1684: <dt><span class="sect1"><a href="#conf.compiler">6.5. Selecting and configuring the compiler</a></span></dt>
! 1685: <dd><dl>
! 1686: <dt><span class="sect2"><a href="#selecting-the-compiler">6.5.1. Selecting the compiler</a></span></dt>
! 1687: <dt><span class="sect2"><a href="#conf.cflags">6.5.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</a></span></dt>
! 1688: <dt><span class="sect2"><a href="#conf.ldflags">6.5.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</a></span></dt>
1.88 wiz 1689: </dl></dd>
1.355 ! rillig 1690: <dt><span class="sect1"><a href="#developer-advanced-settings">6.6. Developer/advanced settings</a></span></dt>
! 1691: <dt><span class="sect1"><a href="#selecting-build-options">6.7. Selecting Build Options</a></span></dt>
1.75 rillig 1692: </dl>
1693: </div>
1.104 rillig 1694: <a name="mk.conf"></a><p>The whole pkgsrc system is configured in a single file, usually
1.89 rillig 1695: called <code class="filename">mk.conf</code>. In which directory pkgsrc looks for
1696: that file depends on the installation. On NetBSD, when you use
1.322 leot 1697: <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 1698: <code class="filename">/etc/</code>. In all other cases the default location is
1699: <code class="literal">${PREFIX}/etc/</code>, depending on where you told the
1700: bootstrap program to install the binary packages.</p>
1701: <p>The format of the configuration file is that of the usual
1702: BSD-style <code class="filename">Makefile</code>s. The whole pkgsrc configuration
1703: is done by setting variables in this file. Note that you can define all
1704: kinds of variables, and no special error checking (for example for
1.223 rillig 1705: spelling mistakes) takes place.</p>
1.148 asau 1706: <div class="sect1">
1.75 rillig 1707: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1708: <a name="general-configuration"></a>6.1. General configuration</h2></div></div></div>
1.223 rillig 1709: <p>The following variables apply to all
1.89 rillig 1710: pkgsrc packages. A complete list of the variables that can be
1711: configured by the user is available in
1712: <code class="filename">mk/defaults/mk.conf</code>, together with some
1713: comments that describe each variable's intent.</p>
1.148 asau 1714: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1715: <li class="listitem"><p><code class="varname">LOCALBASE</code>: Where
1.75 rillig 1716: packages will be installed. The default is
1.76 rillig 1717: <code class="filename">/usr/pkg</code>. Do not mix binary packages
1.75 rillig 1718: with different <code class="varname">LOCALBASE</code>s!</p></li>
1.128 wiz 1719: <li class="listitem"><p><code class="varname">CROSSBASE</code>: Where
1720: <span class="quote">“<span class="quote">cross</span>”</span> category packages will be
1.75 rillig 1721: installed. The default is
1.76 rillig 1722: <code class="filename">${LOCALBASE}/cross</code>.</p></li>
1.128 wiz 1723: <li class="listitem"><p><code class="varname">X11BASE</code>: Where
1.75 rillig 1724: X11 is installed on the system. The default is
1.194 bsiegert 1725: <code class="filename">/usr/X11R7</code>.</p></li>
1.128 wiz 1726: <li class="listitem"><p><code class="varname">DISTDIR</code>: Where to store the
1.75 rillig 1727: downloaded copies of the original source distributions used
1728: for building pkgsrc packages. The default is
1.76 rillig 1729: <code class="filename">${PKGSRCDIR}/distfiles</code>.</p></li>
1.128 wiz 1730: <li class="listitem"><p><code class="varname">PKG_DBDIR</code>: Where the
1.97 rillig 1731: database about installed packages is stored. The default is
1.230 sevan 1732: <code class="filename">/usr/pkg/pkgdb</code>.</p></li>
1.128 wiz 1733: <li class="listitem"><p><code class="varname">MASTER_SITE_OVERRIDE</code>:
1.75 rillig 1734: If set, override the packages'
1735: <code class="varname">MASTER_SITES</code> with this value.</p></li>
1.128 wiz 1736: <li class="listitem"><p><code class="varname">MASTER_SITE_BACKUP</code>:
1.75 rillig 1737: Backup location(s) for distribution files and patch files
1738: if not found locally or in
1.76 rillig 1739: <code class="filename">${MASTER_SITES}</code> or
1740: <code class="filename">${PATCH_SITES}</code> respectively.
1.230 sevan 1741: The defaults is
1742: <code class="filename">ftp://ftp.NetBSD.org/pub/pkgsrc/distfiles/${DIST_SUBDIR}/</code>.</p></li>
1.128 wiz 1743: <li class="listitem"><p><code class="varname">BINPKG_SITES</code>:
1.93 rillig 1744: List of sites carrying binary pkgs. <em class="replaceable"><code>rel</code></em> and
1745: <em class="replaceable"><code>arch</code></em> are replaced with OS
1.128 wiz 1746: release (<span class="quote">“<span class="quote">2.0</span>”</span>, etc.) and architecture
1747: (<span class="quote">“<span class="quote">mipsel</span>”</span>, etc.).</p></li>
1748: <li class="listitem"><p><code class="varname">ACCEPTABLE_LICENSES</code>:
1.125 wiz 1749: List of acceptable licenses. License names are case-sensitive.
1750: Whenever you try to build a package whose license is not in this
1751: list, you will get an error message. If the license condition is
1752: simple enough, the error message will include specific
1753: instructions on how to change this variable.</p></li>
1.75 rillig 1754: </ul></div>
1755: </div>
1.148 asau 1756: <div class="sect1">
1.75 rillig 1757: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 1758: <a name="variables-affecting-build"></a>6.2. Variables affecting the build process</h2></div></div></div>
1.219 rillig 1759: <p>
1.75 rillig 1760: </p>
1.148 asau 1761: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1762: <li class="listitem"><p><code class="varname">PACKAGES</code>: The top level
1.75 rillig 1763: directory for the binary packages. The default is
1.76 rillig 1764: <code class="filename">${PKGSRCDIR}/packages</code>.</p></li>
1.128 wiz 1765: <li class="listitem"><p><code class="varname">WRKOBJDIR</code>:
1.75 rillig 1766: The top level directory where, if defined, the separate
1767: working directories will get created, and symbolically
1.76 rillig 1768: linked to from <code class="filename">${WRKDIR}</code> (see below).
1.75 rillig 1769: This is useful for building packages on several
1.76 rillig 1770: architectures, then <code class="filename">${PKGSRCDIR}</code>
1771: can be NFS-mounted while <code class="filename">${WRKOBJDIR}</code>
1.75 rillig 1772: is local to every architecture. (It should be noted that
1773: <code class="varname">PKGSRCDIR</code> should not be set by the user
1.126 jakllsch 1774: — it is an internal definition which refers to the
1.75 rillig 1775: root of the pkgsrc tree. It is possible to have many
1776: pkgsrc tree instances.)</p></li>
1.128 wiz 1777: <li class="listitem"><p><code class="varname">LOCALPATCHES</code>:
1.75 rillig 1778: Directory for local patches that aren't part of pkgsrc.
1.299 rillig 1779: See <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, “<code class="filename">patches/*</code>”</a> for more
1.93 rillig 1780: information.</p></li>
1.128 wiz 1781: <li class="listitem"><p><code class="varname">PKGMAKECONF</code>: Location of
1.110 hubertf 1782: the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file used by a package's
1.75 rillig 1783: BSD-style Makefile. If this is not set,
1784: <code class="varname">MAKECONF</code> is set to
1.76 rillig 1785: <code class="filename">/dev/null</code> to avoid picking up
1786: settings used by builds in <code class="filename">/usr/src</code>.</p></li>
1.75 rillig 1787: </ul></div>
1788: </div>
1.148 asau 1789: <div class="sect1">
1.75 rillig 1790: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.355 ! rillig 1791: <a name="native-or-pkgsrc-preference"></a>6.3. Preferences for native or pkgsrc software</h2></div></div></div>
! 1792: <p>Whenever a package depends on a package that has a
! 1793: <code class="filename">builtin.mk</code> file, the dependent package can
! 1794: either use the built-in (native) version from the base system or the
! 1795: pkgsrc-provided version. This only affects dependencies, so it is
! 1796: still possible to build the pkgsrc package <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/devel/pcre++/index.html" target="_top"><code class="filename">devel/pcre++</code></a> even when other packages depend
! 1797: on the native pcre++ version instead.</p>
! 1798: <p>To force using the pkgsrc-provided version for a particular
! 1799: package, define <span class="quote">“<span class="quote"><code class="varname">PREFER_PKGSRC</code> =
! 1800: <em class="replaceable"><code>package-ID</code></em></span>”</span> in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. To force
! 1801: using the native package, define
! 1802: <span class="quote">“<span class="quote"><code class="varname">PREFER_NATIVE</code> =
! 1803: <em class="replaceable"><code>package-ID</code></em></span>”</span>. In both cases, the
! 1804: <em class="replaceable"><code>package-ID</code></em> is the one from the
! 1805: <code class="filename">buildlink3.mk</code> of the package. In most cases,
! 1806: this ID is the same as the directory name of the package, but for
! 1807: example, <code class="filename">devel/pcre++</code> has the
! 1808: package ID <span class="quote">“<span class="quote">pcrexx</span>”</span>.</p>
! 1809: <p>For the packages that are not listed by their package ID,
! 1810: pkgsrc uses the pkgsrc-provided version if
! 1811: <code class="varname">PREFER_PKGSRC</code> contains the word
! 1812: <span class="quote">“<span class="quote">yes</span>”</span>. Otherwise, if <code class="varname">PREFER_NATIVE</code>
! 1813: contains the word <span class="quote">“<span class="quote">yes</span>”</span>, pkgsrc uses the native
! 1814: version. For example, to require using the pkgsrc-provided versions
! 1815: for all but the most basic bits on a NetBSD system, you can
! 1816: set:</p>
! 1817: <pre class="programlisting">
! 1818: PREFER_PKGSRC= yes
! 1819: PREFER_NATIVE= getopt skey tcp_wrappers
! 1820: </pre>
! 1821: <p>A package <span class="emphasis"><em>must</em></span> have a
! 1822: <code class="filename">builtin.mk</code> file to be listed in
! 1823: <code class="varname">PREFER_NATIVE</code>, otherwise it is simply ignored in
! 1824: that list.</p>
! 1825: <p><code class="varname">PREFER_PKGSRC</code> and
! 1826: <code class="varname">PREFER_NATIVE</code> should be set during bootstrap to
! 1827: ensure that the bootstrap process does not use inapropriate native
! 1828: tools as dependencies for core packages.</p>
! 1829: <pre class="screen">
! 1830: <code class="prompt">#</code> <strong class="userinput"><code>./bootstrap --prefer-pkgsrc yes --prefer-native openssl</code></strong>
! 1831: </pre>
! 1832: <p>Switching between settings globally at a later date can
! 1833: introduce complications with dependency resolution. This is caused
! 1834: by packages built with the opposite preference being installed
! 1835: alongside each other. Hence, when changing any of these variables
! 1836: after bootstrap, you need to rebuild all packages depending on those
! 1837: whose preference has been changed. This is not trivial and should
! 1838: be avoided.</p>
! 1839: <p>When using pkgsrc on Linux systems, there is high risk of
! 1840: <span class="quote">“<span class="quote">leakage</span>”</span>, where programs installed by pkgsrc may
! 1841: inadvertently use a command or library not installed by pkgsrc, e.g.
! 1842: those installed by yum or apt. Such foreign dependencies may be
! 1843: installed, removed, or upgraded to a version incompatible with the
! 1844: pkgsrc package at any time, causing pkgsrc packages to subsequently
! 1845: malfunction. Pkgsrc cannot prevent this, as it has no control over
! 1846: other package managers. Another potential problem is that under
! 1847: Redhat Enterprise and related Linux systems, yum packages are only
! 1848: patched and never upgraded, so eventually they may become too
! 1849: outdated for use by pkgsrc. Even intentionally using foreign
! 1850: dependencies, not considered leakage, can lead to these problems, so
! 1851: it is generally discouraged. In order to minimize such problems,
! 1852: PREFER_PKGSRC defaults to <span class="quote">“<span class="quote">yes</span>”</span> on Linux systems. This ensures that
! 1853: pkgsrc is aware of any changes to dependency packages and can
! 1854: rebuild or upgrade the entire dependency tree as needed. This
! 1855: default can be overridden by setting --prefer-pkgsrc to a
! 1856: list of packages and --prefer-native to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
! 1857: </div>
! 1858: <div class="sect1">
! 1859: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
! 1860: <a name="variables-affecting-installation"></a>6.4. Variables affecting the installation process</h2></div></div></div>
1.312 gdt 1861: <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 1862: By default, binary packages of built packages are
1.263 leot 1863: preserved in <code class="filename">${PACKAGES}/All</code>. Setting
1.256 maya 1864: this variable to "no" prevents this.</p></li></ul></div>
1.217 jnemeth 1865: <p>Packages have to support installation into a
1.103 wiz 1866: subdirectory of <code class="varname">WRKDIR</code>. This allows a package
1867: to be built, before the actual filesystem is touched. DESTDIR
1868: support exists in two variations:</p>
1.148 asau 1869: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 1870: <li class="listitem"><p>Basic DESTDIR support means that the package
1.131 wiz 1871: installation and packaging is still run as root.</p></li>
1872: <li class="listitem"><p>Full DESTDIR support can run the complete
1873: build, installation and packaging as normal user. Root
1874: privileges are only needed to add packages.</p></li>
1875: </ul></div>
1.103 wiz 1876: <p>With basic DESTDIR support, <strong class="userinput"><code>make
1877: clean</code></strong> needs to be run as root.</p>
1.118 imil 1878: <p>Considering the <code class="filename">foo/bar</code> package,
1879: DESTDIR full support can be tested using the following commands
1880:
1881: </p>
1882: <pre class="programlisting">
1883: <code class="prompt">$</code> id
1884: uid=1000(myusername) gid=100(users) groups=100(users),0(wheel)
1885: <code class="prompt">$</code> mkdir $HOME/packages
1886: <code class="prompt">$</code> cd $PKGSRCDIR/foo/bar
1887: </pre>
1888: <p>
1889:
1890: Verify <code class="varname">DESTDIR</code> full support, no root privileges
1891: should be needed
1892:
1893: </p>
1894: <pre class="programlisting">
1.174 asau 1895: <code class="prompt">$</code> make stage-install
1.118 imil 1896: </pre>
1897: <p>
1898:
1899: Create a package without root privileges
1900:
1901: </p>
1902: <pre class="programlisting">
1.174 asau 1903: <code class="prompt">$</code> make PACKAGES=$HOME/packages package
1.118 imil 1904: </pre>
1905: <p>
1906:
1907: For the following command, you must be able to gain root
1.322 leot 1908: 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 1909:
1910: </p>
1911: <pre class="programlisting">
1.174 asau 1912: <code class="prompt">$</code> make PACKAGES=$HOME/packages install
1.118 imil 1913: </pre>
1914: <p>
1915:
1916: Then, as a simple user
1917:
1918: </p>
1919: <pre class="programlisting">
1920: <code class="prompt">$</code> make clean
1921: </pre>
1922: <p>
1923:
1924: </p>
1.103 wiz 1925: </div>
1.148 asau 1926: <div class="sect1">
1.103 wiz 1927: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.355 ! rillig 1928: <a name="conf.compiler"></a>6.5. Selecting and configuring the compiler</h2></div></div></div>
1.148 asau 1929: <div class="sect2">
1.78 rillig 1930: <div class="titlepage"><div><div><h3 class="title">
1.355 ! rillig 1931: <a name="selecting-the-compiler"></a>6.5.1. Selecting the compiler</h3></div></div></div>
1.89 rillig 1932: <p>By default, pkgsrc will use GCC to build packages. This may be
1933: overridden by setting the following variables in /etc/mk.conf:</p>
1.148 asau 1934: <div class="variablelist"><dl class="variablelist">
1.89 rillig 1935: <dt><span class="term"><code class="varname">PKGSRC_COMPILER</code>:</span></dt>
1936: <dd>
1937: <p>This is a list of values specifying the chain of
1938: compilers to invoke when building packages. Valid values
1939: are:</p>
1.148 asau 1940: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.174 asau 1941: <li class="listitem"><p><code class="varname">ccc</code>:
1942: Compaq C Compilers (Tru64)</p></li>
1943: <li class="listitem"><p><code class="varname">ccache</code>:
1944: compiler cache (chainable)</p></li>
1945: <li class="listitem"><p><code class="varname">clang</code>:
1946: Clang C and Objective-C compiler</p></li>
1.128 wiz 1947: <li class="listitem"><p><code class="varname">distcc</code>:
1.89 rillig 1948: distributed C/C++ (chainable)</p></li>
1.174 asau 1949: <li class="listitem"><p><code class="varname">f2c</code>:
1950: Fortran 77 to C compiler (chainable)</p></li>
1951: <li class="listitem"><p><code class="varname">icc</code>:
1952: Intel C++ Compiler (Linux)</p></li>
1953: <li class="listitem"><p><code class="varname">ido</code>:
1954: SGI IRIS Development Option cc (IRIX 5)</p></li>
1.128 wiz 1955: <li class="listitem"><p><code class="varname">gcc</code>:
1.89 rillig 1956: GNU C/C++ Compiler</p></li>
1.174 asau 1957: <li class="listitem"><p><code class="varname">hp</code>:
1958: HP-UX C/aC++ compilers</p></li>
1.128 wiz 1959: <li class="listitem"><p><code class="varname">mipspro</code>:
1.89 rillig 1960: Silicon Graphics, Inc. MIPSpro (n32/n64)</p></li>
1.174 asau 1961: <li class="listitem"><p><code class="varname">mipspro-ucode</code>:
1.89 rillig 1962: Silicon Graphics, Inc. MIPSpro (o32)</p></li>
1.128 wiz 1963: <li class="listitem"><p><code class="varname">sunpro</code>:
1.89 rillig 1964: Sun Microsystems, Inc. WorkShip/Forte/Sun ONE Studio</p></li>
1.174 asau 1965: <li class="listitem"><p><code class="varname">xlc</code>:
1.230 sevan 1966: IBM's XL C/C++ compiler suite</p></li>
1.89 rillig 1967: </ul></div>
1968: <p>The default is
1.128 wiz 1969: <span class="quote">“<span class="quote"><code class="varname">gcc</code></span>”</span>. You can use
1.89 rillig 1970: <code class="varname">ccache</code> and/or
1971: <code class="varname">distcc</code> with an appropriate
1972: <code class="varname">PKGSRC_COMPILER</code> setting,
1.128 wiz 1973: e.g. <span class="quote">“<span class="quote"><code class="varname">ccache gcc</code></span>”</span>. This
1.94 dmcmahil 1974: variable should always be terminated with a value for
1975: a real compiler. Note that only one real compiler
1.128 wiz 1976: should be listed (e.g. <span class="quote">“<span class="quote"><code class="varname">sunpro gcc</code></span>”</span>
1.94 dmcmahil 1977: is not allowed).</p>
1.89 rillig 1978: </dd>
1979: <dt><span class="term"><code class="varname">GCC_REQD</code>:</span></dt>
1980: <dd><p>This specifies the minimum version of GCC to use
1981: when building packages. If the system GCC doesn't
1982: satisfy this requirement, then pkgsrc will build and
1983: install one of the GCC packages to use instead.</p></dd>
1.266 leot 1984: <dt><span class="term"><code class="varname">PYTHON_VERSION_DEFAULT</code>:</span></dt>
1.225 maya 1985: <dd><p>Specifies which version of python to use when several
1986: options are available.</p></dd>
1987: <dt><span class="term"><code class="varname">PKGSRC_FORTRAN</code>:</span></dt>
1.291 gutterid 1988: <dd><p>Specifies the Fortran compiler to use.
1989: The default is <code class="varname">gfortran</code>.</p></dd>
1.225 maya 1990: <dt><span class="term"><code class="varname">GFORTRAN_VERSION</code>:</span></dt>
1991: <dd><p>If <code class="varname">PKGSRC_FORTRAN</code><code class="literal">=</code>
1992: <code class="varname">gfortran</code> is used, this option specifies which
1993: version to use.</p></dd>
1.89 rillig 1994: </dl></div>
1995: </div>
1.148 asau 1996: <div class="sect2">
1.89 rillig 1997: <div class="titlepage"><div><div><h3 class="title">
1.355 ! rillig 1998: <a name="conf.cflags"></a>6.5.2. Additional flags to the compiler (<code class="varname">CFLAGS</code>)</h3></div></div></div>
1.78 rillig 1999: <p>If you wish to set the <code class="varname">CFLAGS</code> variable,
2000: please make sure to use the <code class="literal">+=</code> operator
2001: instead of the <code class="literal">=</code> operator:</p>
2002: <pre class="programlisting">
1.100 rillig 2003: CFLAGS+= -your -flags
1.78 rillig 2004: </pre>
2005: <p>Using <code class="varname">CFLAGS=</code> (i.e. without the
1.128 wiz 2006: <span class="quote">“<span class="quote">+</span>”</span>) may lead to problems with packages that
1.117 jnemeth 2007: need to add their own flags. You may want to take a look
1.322 leot 2008: 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 2009: package if you're interested in optimization specifically
2010: for the current CPU. </p>
1.78 rillig 2011: </div>
1.148 asau 2012: <div class="sect2">
1.88 wiz 2013: <div class="titlepage"><div><div><h3 class="title">
1.355 ! rillig 2014: <a name="conf.ldflags"></a>6.5.3. Additional flags to the linker (<code class="varname">LDFLAGS</code>)</h3></div></div></div>
1.88 wiz 2015: <p>If you want to pass flags to the linker, both in the configure
2016: step and the build step, you can do this in two ways. Either set
2017: <code class="varname">LDFLAGS</code> or <code class="varname">LIBS</code>. The difference
2018: between the two is that <code class="varname">LIBS</code> will be appended to
2019: the command line, while <code class="varname">LDFLAGS</code> come earlier.
2020: <code class="varname">LDFLAGS</code> is pre-loaded with rpath settings for ELF
2021: machines depending on the setting of <code class="varname">USE_IMAKE</code> or
2022: the inclusion of <code class="filename">mk/x11.buildlink3.mk</code>. As with
2023: <code class="varname">CFLAGS</code>, if you do not wish to override these
2024: settings, use the <code class="literal">+=</code> operator:</p>
2025: <pre class="programlisting">
1.100 rillig 2026: LDFLAGS+= -your -linkerflags
1.88 wiz 2027: </pre>
2028: </div>
1.78 rillig 2029: </div>
1.148 asau 2030: <div class="sect1">
1.78 rillig 2031: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.355 ! rillig 2032: <a name="developer-advanced-settings"></a>6.6. Developer/advanced settings</h2></div></div></div>
1.194 bsiegert 2033: <p>
1.75 rillig 2034: </p>
1.148 asau 2035: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2036: <li class="listitem">
1.75 rillig 2037: <p><code class="varname">PKG_DEVELOPER</code>:
1.347 gutterid 2038: Run some sanity checks that package developers want:
2039: </p>
1.148 asau 2040: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
1.128 wiz 2041: <li class="listitem"><p>make sure patches apply with zero
1.347 gutterid 2042: fuzz</p></li>
1.128 wiz 2043: <li class="listitem"><p>run check-shlibs to see that all
1.347 gutterid 2044: binaries will find their shared libs.</p></li>
1.75 rillig 2045: </ul></div>
2046: </li>
1.347 gutterid 2047: <li class="listitem"><p><code class="varname">CHECK_FILES_STRICT</code>:
2048: Also check <code class="varname">VARBASE</code> and <code class="varname">PKG_SYSCONFDIR
2049: </code> values in PLIST entries.
2050: </p></li>
1.128 wiz 2051: <li class="listitem"><p><code class="varname">PKG_DEBUG_LEVEL</code>: The level
1.347 gutterid 2052: of debugging output which is displayed whilst making and
2053: installing the package. The default value for this is 0,
2054: which will not display the commands as they are executed
2055: (normal, default, quiet operation); the value 1 will display
2056: all shell commands before their invocation, and the value 2
2057: will display both the shell commands before their invocation,
2058: as well as their actual execution progress with <span class="command"><strong>set
2059: -x</strong></span>.</p></li>
1.75 rillig 2060: </ul></div>
2061: <p>
2062: </p>
2063: </div>
1.148 asau 2064: <div class="sect1">
1.75 rillig 2065: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.355 ! rillig 2066: <a name="selecting-build-options"></a>6.7. Selecting Build Options</h2></div></div></div>
1.88 wiz 2067: <p>Some packages have build time options, usually to select
2068: between different dependencies, enable optional support for big
2069: dependencies or enable experimental features.</p>
1.75 rillig 2070: <p>To see which options, if any, a package supports, and which
1.110 hubertf 2071: options are mutually exclusive, run <span class="command"><strong>make
1.88 wiz 2072: show-options</strong></span>, for example:</p>
1.75 rillig 2073: <pre class="programlisting">
2074: The following options are supported by this package:
2075: ssl Enable SSL support.
2076: Exactly one of the following gecko options is required:
2077: firefox Use firefox as gecko rendering engine.
2078: mozilla Use mozilla as gecko rendering engine.
2079: At most one of the following database options may be selected:
2080: mysql Enable support for MySQL database.
2081: pgsql Enable support for PostgreSQL database.
1.1 grant 2082:
1.75 rillig 2083: These options are enabled by default: firefox
2084: These options are currently enabled: mozilla ssl
1.1 grant 2085: </pre>
1.75 rillig 2086: <p>The following variables can be defined in
1.110 hubertf 2087: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to select which options to
1.88 wiz 2088: enable for a package: <code class="varname">PKG_DEFAULT_OPTIONS</code>,
2089: which can be used to select or disable options for all packages
2090: that support them, and
2091: <code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>,
2092: which can be used to select or disable options specifically for
2093: package <em class="replaceable"><code>pkgbase</code></em>. Options listed in
1.128 wiz 2094: these variables are selected, options preceded by <span class="quote">“<span class="quote">-</span>”</span>
1.88 wiz 2095: are disabled. A few examples:</p>
1.75 rillig 2096: <pre class="screen">
1.110 hubertf 2097: <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 2098: PKG_DEFAULT_OPTIONS= -arts -dvdread -esound
2099: PKG_OPTIONS.kdebase= debug -sasl
2100: PKG_OPTIONS.apache= suexec </pre>
1.111 rillig 2101: <p>It is important to note that options that were specifically
1.120 snj 2102: suggested by the package maintainer must be explicitly removed if
1.111 rillig 2103: you do not wish to include the option. If you are unsure you can view
2104: the current state with <span class="command"><strong>make show-options</strong></span>.</p>
1.88 wiz 2105: <p>The following settings are consulted in the order given, and
2106: the last setting that selects or disables an option is
2107: used:</p>
1.128 wiz 2108: <div class="orderedlist"><ol class="orderedlist" type="1">
2109: <li class="listitem"><p>the default options as suggested by the package
1.88 wiz 2110: maintainer</p></li>
1.128 wiz 2111: <li class="listitem"><p>the options implied by the settings of legacy
1.88 wiz 2112: variables (see below)</p></li>
1.128 wiz 2113: <li class="listitem"><p><code class="varname">PKG_DEFAULT_OPTIONS</code></p></li>
2114: <li class="listitem"><p><code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code></p></li>
1.75 rillig 2115: </ol></div>
2116: <p>For groups of mutually exclusive options, the last option
1.88 wiz 2117: selected is used, all others are automatically disabled. If an
2118: option of the group is explicitly disabled, the previously
2119: selected option, if any, is used. It is an error if no option
2120: from a required group of options is selected, and building the
2121: package will fail.</p>
2122: <p>Before the options framework was introduced, build options
2123: were selected by setting a variable (often named
2124: <code class="varname">USE_<em class="replaceable"><code>FOO</code></em></code>) in
1.110 hubertf 2125: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> for each option. To ease
1.88 wiz 2126: transition to the options framework for the user, these legacy
2127: variables are converted to the appropriate options setting
2128: (<code class="varname">PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em></code>)
2129: automatically. A warning is issued to prompt the user to update
1.110 hubertf 2130: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to use the options framework
1.88 wiz 2131: directly. Support for the legacy variables will be removed
2132: eventually.</p>
1.75 rillig 2133: </div>
2134: </div>
1.148 asau 2135: <div class="chapter">
1.75 rillig 2136: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2137: <a name="binary"></a>Chapter 7. Creating binary packages</h2></div></div></div>
1.75 rillig 2138: <div class="toc">
2139: <p><b>Table of Contents</b></p>
1.210 leot 2140: <dl class="toc">
1.267 rillig 2141: <dt><span class="sect1"><a href="#building-a-single-binary-package">7.1. Building a single binary package</a></span></dt>
2142: <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 2143: </dl>
2144: </div>
1.148 asau 2145: <div class="sect1">
1.75 rillig 2146: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2147: <a name="building-a-single-binary-package"></a>7.1. Building a single binary package</h2></div></div></div>
1.87 wiz 2148: <p>Once you have built and installed a package, you can create
2149: a <span class="emphasis"><em>binary package</em></span> which can be installed on
1.322 leot 2150: 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 2151: the same package on a group of hosts and wasting CPU time. It also
2152: provides a simple means for others to install your package, should
2153: you distribute it.</p>
2154: <p>To create a binary package, change into the appropriate
1.110 hubertf 2155: directory in pkgsrc, and run <span class="command"><strong>make
1.87 wiz 2156: package</strong></span>:</p>
2157: <pre class="screen">
1.223 rillig 2158: <code class="prompt">$</code> <strong class="userinput"><code>cd misc/figlet</code></strong>
2159: <code class="prompt">$</code> <strong class="userinput"><code>make package</code></strong>
2160: </pre>
1.87 wiz 2161: <p>This will build and install your package (if not already done),
2162: and then build a binary package from what was installed. You can
1.110 hubertf 2163: then use the <span class="command"><strong>pkg_*</strong></span> tools to manipulate
1.87 wiz 2164: it. Binary packages are created by default in
2165: <code class="filename">/usr/pkgsrc/packages</code>, in the form of a
1.322 leot 2166: gzipped tar file. See <a class="xref" href="#logs.package" title="C.2. Packaging figlet">Section C.2, “Packaging figlet”</a> for a
2167: 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 2168: <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 2169: such a binary package.</p>
1.75 rillig 2170: </div>
1.148 asau 2171: <div class="sect1">
1.75 rillig 2172: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2173: <a name="settings-for-creationg-of-binary-packages"></a>7.2. Settings for creation of binary packages</h2></div></div></div>
1.299 rillig 2174: <p>See <a class="xref" href="#build.helpful-targets" title="13.17. Other helpful targets">Section 13.17, “Other helpful targets”</a>.</p>
1.106 rillig 2175: </div>
2176: </div>
1.148 asau 2177: <div class="chapter">
1.106 rillig 2178: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2179: <a name="bulk"></a>Chapter 8. Creating binary packages for everything in pkgsrc (bulk
1.106 rillig 2180: builds)</h2></div></div></div>
2181: <div class="toc">
2182: <p><b>Table of Contents</b></p>
1.210 leot 2183: <dl class="toc">
1.267 rillig 2184: <dt><span class="sect1"><a href="#bulk.pre">8.1. Preparations</a></span></dt>
1.295 rillig 2185: <dt><span class="sect1"><a href="#bulk.pbulk">8.2. Running a bulk build</a></span></dt>
1.267 rillig 2186: <dd><dl><dt><span class="sect2"><a href="#bulk.pbulk.conf">8.2.1. Configuration</a></span></dt></dl></dd>
2187: <dt><span class="sect1"><a href="#bulk.req">8.3. Requirements of a full bulk build</a></span></dt>
1.293 rillig 2188: <dt><span class="sect1"><a href="#bulk.var">8.4. Bulk build variants</a></span></dt>
2189: <dd><dl>
1.294 rillig 2190: <dt><span class="sect2"><a href="#bulk.var.confopt">8.4.1. Detect unknown configure options</a></span></dt>
2191: <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 2192: <dt><span class="sect2"><a href="#bulk.var.builderr">8.4.3. Force compiler options only in the build phase</a></span></dt>
2193: <dt><span class="sect2"><a href="#bulk.var.dirs">8.4.4. Use custom directories</a></span></dt>
2194: <dt><span class="sect2"><a href="#bulk.var.warn">8.4.5. Turn warnings into errors</a></span></dt>
2195: <dt><span class="sect2"><a href="#bulk.var.pkglint">8.4.6. Reject packages for which pkglint reports errors</a></span></dt>
2196: <dt><span class="sect2"><a href="#bulk.var.strings">8.4.7. Reject packages that contain forbidden strings</a></span></dt>
2197: <dt><span class="sect2"><a href="#bulk.var.test">8.4.8. Reject packages whose self-test fails</a></span></dt>
2198: <dt><span class="sect2"><a href="#bulk.var.shvar">8.4.9. Reject packages that use undefined shell variables</a></span></dt>
2199: <dt><span class="sect2"><a href="#bulk.var.quiet">8.4.10. Turn off verbose logging</a></span></dt>
1.293 rillig 2200: </dl></dd>
2201: <dt><span class="sect1"><a href="#creating-cdroms">8.5. Creating a multiple CD-ROM packages collection</a></span></dt>
2202: <dd><dl><dt><span class="sect2"><a href="#cdpack-example">8.5.1. Example of cdpack</a></span></dt></dl></dd>
1.106 rillig 2203: </dl>
2204: </div>
1.290 gutterid 2205: <p>For a number of reasons, you may want to build binary packages
2206: for a large selected set of packages in pkgsrc, or even for all pkgsrc packages.
1.180 wiz 2207: For instance, when you have multiple machines that should run the same software,
2208: it is wasted time if they all build their packages themselves from source.
2209: Or you may want to build a list of packages you want and check them before
1.290 gutterid 2210: deploying onto production systems.
1.180 wiz 2211: There is a way of getting a set of binary packages:
1.290 gutterid 2212: the bulk build system, or pbulk ("p" stands for "parallel").
1.223 rillig 2213: This chapter describes how to set it up.</p>
1.148 asau 2214: <div class="sect1">
1.106 rillig 2215: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2216: <a name="bulk.pre"></a>8.1. Preparations</h2></div></div></div>
1.180 wiz 2217: <p>First of all, you have to decide whether you build all packages
2218: or a limited set of them. Full bulk builds usually consume a lot more resources,
2219: both space and time, than builds for some practical sets of packages.
1.290 gutterid 2220: A number of particularly heavy packages exist that are not actually
2221: interesting to a wide audience. (The approximate resource consumption for a
2222: 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, “Requirements of a full bulk build”</a>.)
2223: For limited bulk builds you need to make a list of packages you want to build.
1.223 rillig 2224: Note that all their dependencies will be built, so you don't need to track them manually.
1.180 wiz 2225: </p>
2226: <p>During bulk builds various packages are installed and deinstalled
2227: in <code class="filename">/usr/pkg</code> (or whatever <code class="filename">LOCALBASE</code> is),
2228: so make sure that you don't need any package during the builds.
1.223 rillig 2229: Essentially, you should provide a fresh system, either a chroot environment
1.180 wiz 2230: or something even more restrictive, depending on what the operating system provides,
2231: or dedicate the whole physical machine.
2232: As a useful side effect this makes sure that bulk builds cannot
2233: break anything in your system. There have been numerous cases where
1.106 rillig 2234: certain packages tried to install files outside the
2235: <code class="filename">LOCALBASE</code> or wanted to edit some files in
1.180 wiz 2236: <code class="filename">/etc</code>.
2237: </p>
1.106 rillig 2238: </div>
1.148 asau 2239: <div class="sect1">
1.106 rillig 2240: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.295 rillig 2241: <a name="bulk.pbulk"></a>8.2. Running a bulk build</h2></div></div></div>
2242: <p>Running a bulk build works roughly as follows:</p>
1.148 asau 2243: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2244: <li class="listitem"><p>First, build the pbulk infrastructure in a fresh pkgsrc location.</p></li>
2245: <li class="listitem"><p>Then, build each of the packages from a clean installation directory using the infrastructure.</p></li>
1.116 rillig 2246: </ul></div>
1.148 asau 2247: <div class="sect2">
1.116 rillig 2248: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 2249: <a name="bulk.pbulk.conf"></a>8.2.1. Configuration</h3></div></div></div>
1.223 rillig 2250: <p>To simplify configuration, we provide the helper script <code class="filename">mk/pbulk/pbulk.sh</code>.</p>
1.178 asau 2251: <p>In order to use it, prepare a clear system (real one, chroot environment, jail, zone, virtual machine).
2252: Configure network access to fetch distribution files.
1.223 rillig 2253: Create a user with name "pbulk".</p>
1.178 asau 2254: <p>Fetch and extract pkgsrc. Use a command like one of these:</p>
2255: <pre class="screen">
1.264 sevan 2256: <code class="prompt">#</code> <strong class="userinput"><code>(cd /usr && ftp -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong>
2257: <code class="prompt">#</code> <strong class="userinput"><code>(cd /usr && fetch -o - https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc.tar.gz | tar -zxf-)</code></strong>
1.181 wiz 2258: <code class="prompt">#</code> <strong class="userinput"><code>(cd /usr && cvs -Q -z3 -d anoncvs@anoncvs.NetBSD.org:/cvsroot get -P pkgsrc)</code></strong>
1.178 asau 2259: </pre>
2260: <p>Or any other way that fits (e.g., curl, wget).</p>
2261: <p>Deploy and configure pbulk tools, e.g.:</p>
2262: <pre class="screen">
1.230 sevan 2263: <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 2264: <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>
2265: <code class="prompt">#</code> <strong class="userinput"><code>sh pbulk.sh -nlc mk.conf.frag # native, apply settings, configure for limited build</code></strong>
2266: </pre>
2267: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2268: <h3 class="title">Note</h3>
2269: <p><code class="filename">mk.conf.frag</code> is a fragment of
2270: <code class="filename">mk.conf</code> that contains settings you want to
2271: apply to packages you build. For instance,</p>
2272: <pre class="programlisting">
1.223 rillig 2273: PKG_DEVELOPER= yes # perform more checks
2274: X11_TYPE= modular # use pkgsrc X11
2275: SKIP_LICENSE_CHECK= yes # accept all licences (useful
2276: # when building all packages)
1.178 asau 2277: </pre>
2278: </div>
2279: <p>If configured for limited list, replace the list in <code class="filename">/usr/pbulk/etc/pbulk.list</code>
1.223 rillig 2280: with your list of packages, one per line without empty lines or comments. E.g.:</p>
1.178 asau 2281: <pre class="programlisting">
2282: www/firefox
2283: mail/thunderbird
2284: misc/libreoffice4
2285: </pre>
1.179 asau 2286: <p>At this point you can also review configuration in <code class="filename">/usr/pbulk/etc</code>
2287: and make final amendments, if wanted.</p>
1.178 asau 2288: <p>Start it:</p>
2289: <pre class="screen">
2290: <code class="prompt">#</code> <strong class="userinput"><code>/usr/pbulk/bin/bulkbuild</code></strong>
2291: </pre>
2292: <p>After it finishes, you'll have <code class="filename">/mnt</code> filled with distribution files, binary packages, and reports,
2293: plain text summary in <code class="filename">/mnt/bulklog/meta/report.txt</code>
2294: </p>
2295: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2296: <h3 class="title">Note</h3>
2297: <p>The <code class="filename">pbulk.sh</code> script does not cover all possible use cases.
2298: While being ready to run, it serves as a good starting point to understand and build more complex setups.
2299: The script is kept small enough for better understanding.</p>
2300: </div>
2301: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
2302: <h3 class="title">Note</h3>
2303: <p>The <code class="filename">pbulk.sh</code> script supports running
1.320 wiz 2304: unprivileged bulk build and helps configuring distributed bulk builds.
2305: Distributed bulk builds support either building in worker chroots
2306: (each node is a path to a different chroot)
2307: that replicate the target system, including the pbulk prefix,
2308: or remote machines (each node is
2309: an IP address that must be accessible over SSH without a password).</p>
1.178 asau 2310: </div>
1.106 rillig 2311: </div>
2312: </div>
1.148 asau 2313: <div class="sect1">
1.106 rillig 2314: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2315: <a name="bulk.req"></a>8.3. Requirements of a full bulk build</h2></div></div></div>
1.180 wiz 2316: <p>A complete bulk build requires lots of disk space. Some of the
2317: disk space can be read-only, some other must be writable. Some can be on
2318: remote filesystems (such as NFS) and some should be local. Some can be
2319: temporary filesystems, others must survive a sudden reboot.</p>
2320: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.320 wiz 2321: <li class="listitem"><p>70 GB for the distfiles (read-write, remote, temporary)</p></li>
2322: <li class="listitem"><p>60 GB for the binary packages (read-write, remote, permanent)</p></li>
1.180 wiz 2323: <li class="listitem"><p>1 GB for the pkgsrc tree (read-only, remote, permanent)</p></li>
2324: <li class="listitem"><p>5 GB for <code class="filename">LOCALBASE</code> (read-write, local, temporary)</p></li>
2325: <li class="listitem"><p>10 GB for the log files (read-write, remote, permanent)</p></li>
2326: <li class="listitem"><p>5 GB for temporary files (read-write, local, temporary)</p></li>
2327: </ul></div>
2328: </div>
2329: <div class="sect1">
2330: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.293 rillig 2331: <a name="bulk.var"></a>8.4. Bulk build variants</h2></div></div></div>
2332: <p>To ensure that pkgsrc packages work in different configurations, it
2333: makes sense to run non-default bulk builds from time to time. This
2334: section lists some ideas for bulk builds that intentionally let packages
2335: fail if they don't follow the pkgsrc style.</p>
2336: <div class="sect2">
2337: <div class="titlepage"><div><div><h3 class="title">
1.294 rillig 2338: <a name="bulk.var.confopt"></a>8.4.1. Detect unknown configure options</h3></div></div></div>
1.293 rillig 2339: <p>Add the following line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2340: <pre class="programlisting">
2341: GNU_CONFIGURE_STRICT= yes
2342: </pre>
2343: <p>When a package fails this additional check, the most common cause
2344: is that the configure option was valid for an older version of the
2345: package but does not apply anymore. In that case, just remove it.</p>
2346: </div>
2347: <div class="sect2">
2348: <div class="titlepage"><div><div><h3 class="title">
1.294 rillig 2349: <a name="bulk.var.comperr"></a>8.4.2. Detect classes of bugs by forcing compiler warnings</h3></div></div></div>
1.293 rillig 2350: <p>The job of a compiler is not restricted to producing executable
1.294 rillig 2351: code, most compilers also detect typical programming mistakes. The pkgsrc
2352: compiler wrappers make it easy to force compiler options when the package
2353: is built. This can be used to find typical bugs across all packages that
2354: are in pkgsrc. By reporting these bugs upstream, the packages will be
2355: more reliable with the next updates.</p>
2356: <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 2357: <pre class="programlisting">
2358: CFLAGS+= -Werror=char-subscripts
1.294 rillig 2359: CFLAGS+= -Werror=implicit-function-declaration
1.293 rillig 2360: </pre>
1.294 rillig 2361: <p>When a package fails to build using these stricter compiler
2362: options, document the circumstances in which the compiler produced the
2363: error message. This includes:</p>
1.293 rillig 2364: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
2365: <li class="listitem"><p>The platform
2366: (<code class="varname">MACHINE_PLATFORM</code>)</p></li>
2367: <li class="listitem"><p>The source file</p></li>
2368: <li class="listitem"><p>An excerpt of the code. GCC and Clang already do this as
2369: part of the diagnostic.</p></li>
1.294 rillig 2370: <li class="listitem"><p>The exact error message from the compiler.</p></li>
1.293 rillig 2371: </ul></div>
2372: <p>If a package produces these error messages, but the package is
1.294 rillig 2373: 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
2374: in the next builds:</p>
1.293 rillig 2375: <pre class="programlisting">
1.294 rillig 2376: .if ${PKGPATH} == category/package
1.293 rillig 2377: # Version ${VERSION} failed on ${MACHINE_PLATFORM}:
2378: # error message
2379: # code
1.294 rillig 2380: # Reason why the code does not need to be fixed.
1.293 rillig 2381: BUILDLINK_TRANSFORM+= rm:-Werror=char-subscripts
1.294 rillig 2382: .endif
1.293 rillig 2383: </pre>
2384: <p>If the error messages from the compiler are valid and the code
1.294 rillig 2385: needs to be fixed, prepare a local patch (see
2386: <code class="varname">LOCALPATCHES</code>) and report the bug to the upstream
2387: authors of the package, providing them with the information you collected
2388: above.</p>
2389: <p>Patches that are not essential for the package to work should only
2390: be reported upstream but not committed to pkgsrc, to make future updates
2391: easier.</p>
1.293 rillig 2392: </div>
2393: <div class="sect2">
2394: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2395: <a name="bulk.var.builderr"></a>8.4.3. Force compiler options only in the build phase</h3></div></div></div>
2396: <p>When adding custom compiler flags via <code class="varname">CFLAGS</code>,
2397: these apply to all phases of the package build process. Especially in the
2398: configure phase, adding <code class="literal">-Werror</code> leads to wrong
2399: decisions. The GNU configure scripts feed many small test programs to the
2400: C compiler to see whether certain headers are available, functions are
2401: defined in a library and programs can be run. In many cases these
2402: programs would not survive a strict compiler run with <code class="literal">-Wall
2403: -Wextra -Werror</code>.</p>
2404: <p>The pkgsrc infrastructure is flexible enough to support compiler
2405: options being added between the <code class="literal">configure</code> and
2406: <code class="literal">build</code> phases. It's a little more complicated than the
2407: other examples in this section but still easy enough.</p>
2408: <p>The basic idea is to use the pkgsrc compiler wrapper to inject the
2409: desired compiler options. The compiler wrapper's original task is to hide
2410: unwanted directories of include files and to normalize compiler options.
2411: It does this by wrapping the compiler command and rewriting the command
2412: line. To see this in action, run <span class="command"><strong>bmake patch</strong></span> in a
2413: package directory and examine the
2414: <code class="filename">work/.cwrappers/config</code> directory. It contains
2415: individual configurations for the C compiler and the related tools. The
2416: plan is to find a hook between the configure and build phases, and to
2417: modify these configuration files at that point.</p>
2418: <p>To find this hook, have a look at
2419: <code class="filename">mk/build/build.mk</code>, which contains among others the
2420: <code class="literal">pre-build-checks-hook</code>. The word
2421: <code class="literal">checks</code> doesn't quite fit, but the
2422: <code class="literal">pre-build-hook</code> sounds good enough.</p>
2423: <p>The code to be included in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> is:</p>
2424: <pre class="programlisting">
2425: # Just a few example options.
2426: BUILD_ONLY_CFLAGS= -Wall -Werror -O2 -DTEMPDIR='"/tmp"'
2427:
2428: .if ${BUILD_ONLY_CFLAGS:U:M*}
2429: pre-build-checks-hook: add-build-only-cflags
2430:
2431: add-build-only-cflags: .PHONY
2432: ${RUN} cd ${CWRAPPERS_CONFIG_DIR}; \
2433: ${TEST} ! -f ${.TARGET} || exit 0; \
2434: for flag in ${BUILD_ONLY_CFLAGS}; do \
2435: ${ECHO} "append=$$flag" >> cc; \
2436: done; \
2437: > ${.TARGET}
2438: .endif
2439: </pre>
2440: <p>(When editing the <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, make sure that the commands of the
2441: <code class="literal">add-build-only-cflags</code> target are indented with a tab,
2442: not with spaces.)</p>
2443: <p>The condition in the <code class="literal">.if</code> statement contains the
2444: <code class="literal">:U</code> modifier to prevent parse errors if the variable
2445: should be undefined, possibly because it is only defined for a subset of
2446: the packages. The <code class="literal">:M*</code> modifier ensures that there is
2447: at least one compiler option, to prevent a syntax error in the shell
2448: parser.</p>
2449: <p>The code around the <code class="literal">${.TARGET}</code> variable ensures
2450: that the additional compiler options are only appended once, even if
2451: <span class="command"><strong>bmake build</strong></span> is run multiple times. To do this, it
2452: creates a marker file.</p>
2453: <p>To verify that this setup works, run <span class="command"><strong>bmake
2454: configure</strong></span> in a package directory. Up to now, everything works
2455: as usual. Examine the directory
2456: <code class="filename">work/.cwrappers/config</code> to see that the compiler
2457: options from <code class="varname">BUILD_ONLY_CFLAGS</code> are not yet added to
2458: the file <code class="filename">cc</code>. Examine the tail of the
2459: <code class="filename">work/.work.log</code> file to see that the normal compiler
2460: options are used.</p>
2461: <p>Now run <span class="command"><strong>bmake build</strong></span>. This will append the
2462: options to the file <code class="filename">cc</code> and will create the marker
2463: file in the same directory. After that, the build starts as usual, but
2464: with the added compiler options. Examine the tail of the file
2465: <code class="filename">work/.work.log</code> to see that the lines starting with
2466: <code class="literal">[*]</code> don't contain the compiler options, but the
2467: corresponding lines starting with <code class="literal"><.></code> do end
2468: with these options.</p>
2469: <p>Building packages using this setup variant and fixing the resulting
2470: 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, “Detect classes of bugs by forcing compiler warnings”</a>.</p>
2471: </div>
2472: <div class="sect2">
2473: <div class="titlepage"><div><div><h3 class="title">
2474: <a name="bulk.var.dirs"></a>8.4.4. Use custom directories</h3></div></div></div>
1.293 rillig 2475: <p>Some directories like <code class="varname">PREFIX</code>,
2476: <code class="varname">VARBASE</code>, <code class="varname">PKG_SYSCONFDIR</code>,
2477: <code class="varname">PKGMANDIR</code>, <code class="varname">PKG_INFODIR</code> can be
2478: configured in pkgsrc. Set these to arbitrary paths during bootstrap or
2479: afterwards in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2480: <pre class="programlisting">
2481: PREFIX= /a-random-uuid
2482: PKG_SYSCONFDIR= /a-random-uuid
2483: VARBASE= /a-random-uuid
2484: PKGMANDIR= a-random-uuid
2485: PKG_INFODIR= a-random-uuid
2486: </pre>
2487: </div>
2488: <div class="sect2">
2489: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2490: <a name="bulk.var.warn"></a>8.4.5. Turn warnings into errors</h3></div></div></div>
1.293 rillig 2491: <p>When building a package, warnings are typically ignored since they
2492: just flow by and do not cause the build to fail immediately. To find
2493: these warnings, redefine them to errors in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2494: <pre class="programlisting">
2495: DELAYED_WARNING_MSG= ${DELAYED_ERROR_MSG} "(was warning)"
2496: WARNING_MSG= ${FAIL_MSG} "(was warning)"
2497: </pre>
2498: <p>(There are many more classes of warnings in pkgsrc, and most of
2499: them can be redefined with a simple definition like above.</p>
1.294 rillig 2500: <p>If a package suggests to add <code class="varname">USE_TOOLS+=perl</code> to
1.293 rillig 2501: the package Makefile, research whether the package actually needs Perl.
2502: If it does, add <code class="varname">USE_TOOLS+=perl</code> to the package
2503: Makefile, and if it doesn't, add
2504: <code class="varname">TOOLS_BROKEN+=perl</code>.</p>
2505: </div>
2506: <div class="sect2">
2507: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2508: <a name="bulk.var.pkglint"></a>8.4.6. Reject packages for which pkglint reports errors</h3></div></div></div>
1.293 rillig 2509: <p>Using pkglint as part of the regular build process is mostly a
2510: waste of time. If you want to fix some of the warnings, just run pkglint
2511: recursively on the whole pkgsrc tree. This will take a few minutes (up to
2512: 10), which is much faster than a complete bulk build.</p>
2513: </div>
2514: <div class="sect2">
2515: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2516: <a name="bulk.var.strings"></a>8.4.7. Reject packages that contain forbidden strings</h3></div></div></div>
1.293 rillig 2517: <p>To ensure that the binary packages don't contain references to the
2518: build directory, there is already <code class="varname">CHECK_WRKREF</code>. If
2519: that variable includes the item <code class="literal">extra</code>, it is
2520: possible to define additional patterns that must not appear in any
2521: installed file. This is specified in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2522: <pre class="programlisting">
2523: CHECK_WRKREF= extra
2524: CHECK_WRKREF_EXTRA_DIRS+= /usr/local
2525: CHECK_WRKREF_EXTRA_DIRS+= /usr/pkg
2526: CHECK_WRKREF_EXTRA_DIRS+= @[A-Z][A-Z]*@
2527: </pre>
2528: <p>The above patterns will probably generate many false positives,
2529: therefore the results need to be taken with a grain of salt.</p>
2530: </div>
2531: <div class="sect2">
2532: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2533: <a name="bulk.var.test"></a>8.4.8. Reject packages whose self-test fails</h3></div></div></div>
1.293 rillig 2534: <p>To run the test suites that come with each package, add this line
2535: to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2536: <pre class="programlisting">
2537: PKGSRC_RUN_TEST= yes
2538: </pre>
2539: <p>Be prepared that even the most basic packages fail this test. When
2540: doing a bulk build with this, it will often abort in the early phase
2541: where the packages are scanned for their dependencies since there are
2542: cyclic dependencies. There is still a lot to do in this area.</p>
2543: </div>
2544: <div class="sect2">
2545: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2546: <a name="bulk.var.shvar"></a>8.4.9. Reject packages that use undefined shell variables</h3></div></div></div>
1.293 rillig 2547: <p>To catch typos in the shell snippets from the Makefile fragments,
2548: add the <code class="literal">-u</code> flag to most of the commands by adding this
2549: line to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2550: <pre class="programlisting">
2551: RUN= @set -eu;
2552: </pre>
1.296 rillig 2553: <p>After that, ensure that none of the bulk build log files (even
2554: those for successfully built packages) contains the string
2555: <code class="literal">parameter not set</code> or whatever error message the
2556: command <span class="command"><strong>sh -ceu '$undefined'</strong></span> outputs.</p>
1.293 rillig 2557: <p>See <code class="filename">mk/misc/common.mk</code> for the existing
2558: definition.</p>
2559: </div>
2560: <div class="sect2">
2561: <div class="titlepage"><div><div><h3 class="title">
1.296 rillig 2562: <a name="bulk.var.quiet"></a>8.4.10. Turn off verbose logging</h3></div></div></div>
1.293 rillig 2563: <p>The build logs of a package are often quite long. This allows error
2564: messages or other interesting details to hide between the noise. To make
2565: the actual error message stand out more, add these lines to
2566: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
2567: <pre class="programlisting">
2568: GNU_CONFIGURE_QUIET= yes
2569: MAKE_FLAGS+= -s
2570: </pre>
2571: <p>The <code class="literal">-s</code> option works for both GNU Make and BSD
2572: Make. On exotic platforms with their own make, it may be a little
2573: different.</p>
2574: </div>
2575: </div>
2576: <div class="sect1">
2577: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
2578: <a name="creating-cdroms"></a>8.5. Creating a multiple CD-ROM packages collection</h2></div></div></div>
1.87 wiz 2579: <p>After your pkgsrc bulk-build has completed, you may wish to
2580: create a CD-ROM set of the resulting binary packages to assist
2581: in installing packages on other machines. The
1.322 leot 2582: <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 2583: a simple tool for creating the ISO 9660 images.
1.110 hubertf 2584: <span class="command"><strong>cdpack</strong></span> arranges the packages on the CD-ROMs in a
1.87 wiz 2585: way that keeps all the dependencies for a given package on the same
2586: CD as that package.</p>
1.148 asau 2587: <div class="sect2">
1.75 rillig 2588: <div class="titlepage"><div><div><h3 class="title">
1.293 rillig 2589: <a name="cdpack-example"></a>8.5.1. Example of cdpack</h3></div></div></div>
1.87 wiz 2590: <p>Complete documentation for cdpack is found in the cdpack(1)
2591: man page. The following short example assumes that the binary
2592: packages are left in
2593: <code class="filename">/usr/pkgsrc/packages/All</code> and that
2594: sufficient disk space exists in <code class="filename">/u2</code> to
2595: hold the ISO 9660 images.</p>
2596: <pre class="screen">
2597: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /u2/images</code></strong>
1.75 rillig 2598: <code class="prompt">#</code> <strong class="userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
1.87 wiz 2599: <code class="prompt">#</code> <strong class="userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
2600: </pre>
2601: <p>If you wish to include a common set of files
2602: (<code class="filename">COPYRIGHT</code>, <code class="filename">README</code>,
2603: etc.) on each CD in the collection, then you need to create a
1.290 gutterid 2604: directory which contains these files, e.g.:</p>
1.87 wiz 2605: <pre class="screen">
2606: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common</code></strong>
1.75 rillig 2607: <code class="prompt">#</code> <strong class="userinput"><code>echo "This is a README" > /tmp/common/README</code></strong>
2608: <code class="prompt">#</code> <strong class="userinput"><code>echo "Another file" > /tmp/common/COPYING</code></strong>
2609: <code class="prompt">#</code> <strong class="userinput"><code>mkdir /tmp/common/bin</code></strong>
2610: <code class="prompt">#</code> <strong class="userinput"><code>echo "#!/bin/sh" > /tmp/common/bin/myscript</code></strong>
2611: <code class="prompt">#</code> <strong class="userinput"><code>echo "echo Hello world" >> /tmp/common/bin/myscript</code></strong>
1.87 wiz 2612: <code class="prompt">#</code> <strong class="userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
2613: </pre>
1.75 rillig 2614: <p>Now create the images:</p>
2615: <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 2616: <p>Each image will contain <code class="filename">README</code>,
1.87 wiz 2617: <code class="filename">COPYING</code>, and <code class="filename">bin/myscript</code>
2618: in their root directories.</p>
1.75 rillig 2619: </div>
2620: </div>
2621: </div>
1.148 asau 2622: <div class="chapter">
1.75 rillig 2623: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2624: <a name="files"></a>Chapter 9. Directory layout of the installed files</h2></div></div></div>
1.90 rillig 2625: <div class="toc">
2626: <p><b>Table of Contents</b></p>
1.210 leot 2627: <dl class="toc">
1.267 rillig 2628: <dt><span class="sect1"><a href="#files.localbase">9.1. File system layout in <code class="literal">${LOCALBASE}</code></a></span></dt>
2629: <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 2630: </dl>
2631: </div>
2632: <p>The files that are installed by pkgsrc are organized in a way that
2633: is similar to what you find in the <code class="filename">/usr</code> directory
2634: of the base system. But some details are different. This is because
2635: pkgsrc initially came from FreeBSD and had adopted its file system
2636: hierarchy. Later it was largely influenced by NetBSD. But no matter
2637: which operating system you are using pkgsrc with, you can expect the
2638: same layout for pkgsrc.</p>
1.91 rillig 2639: <p>There are mainly four root directories for pkgsrc, which are all
2640: configurable in the <code class="filename">bootstrap/bootstrap</code> script.
2641: When pkgsrc has been installed as root, the default locations
2642: are:</p>
2643: <pre class="programlisting">
1.100 rillig 2644: LOCALBASE= /usr/pkg
2645: PKG_SYSCONFBASE= /usr/pkg/etc
2646: VARBASE= /var
1.231 sevan 2647: PKG_DBDIR= /usr/pkg/pkgdb
1.91 rillig 2648: </pre>
2649: <p>In unprivileged mode (when pkgsrc has been installed as any other
2650: user), the default locations are:</p>
2651: <pre class="programlisting">
1.100 rillig 2652: LOCALBASE= ${HOME}/pkg
2653: PKG_SYSCONFBASE= ${HOME}/pkg/etc
2654: VARBASE= ${HOME}/pkg/var
1.231 sevan 2655: PKG_DBDIR= ${HOME}/pkg/pkgdb
1.91 rillig 2656: </pre>
2657: <p>What these four directories are for, and what they look like is
2658: explained below.</p>
1.148 asau 2659: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2660: <li class="listitem"><p><code class="varname">LOCALBASE</code> corresponds to the
1.90 rillig 2661: <code class="filename">/usr</code> directory in the base system. It is the
1.128 wiz 2662: <span class="quote">“<span class="quote">main</span>”</span> directory where the files are installed and contains
1.90 rillig 2663: the well-known subdirectories like <code class="filename">bin</code>,
2664: <code class="filename">include</code>, <code class="filename">lib</code>,
2665: <code class="filename">share</code> and
2666: <code class="filename">sbin</code>.</p></li>
1.128 wiz 2667: <li class="listitem"><p><code class="varname">VARBASE</code> corresponds to
1.90 rillig 2668: <code class="filename">/var</code> in the base system. Some programs (especially
2669: games, network daemons) need write access to it during normal
2670: operation.</p></li>
1.128 wiz 2671: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR</code> corresponds to
1.90 rillig 2672: <code class="filename">/etc</code> in the base system. It contains configuration
1.110 hubertf 2673: 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 2674: itself.</p></li>
2675: </ul></div>
1.148 asau 2676: <div class="sect1">
1.90 rillig 2677: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2678: <a name="files.localbase"></a>9.1. File system layout in <code class="literal">${LOCALBASE}</code>
1.93 rillig 2679: </h2></div></div></div>
1.90 rillig 2680: <p>The following directories exist in a typical pkgsrc installation
1.91 rillig 2681: in <code class="filename">${LOCALBASE}</code>.</p>
1.148 asau 2682: <div class="variablelist"><dl class="variablelist">
1.90 rillig 2683: <dt><span class="term"><code class="filename">bin</code></span></dt>
2684: <dd><p>Contains executable programs that are intended to be
2685: directly used by the end user.</p></dd>
2686: <dt><span class="term"><code class="filename">emul</code></span></dt>
2687: <dd><p>Contains files for the emulation layers of various other
2688: operating systems, especially for
2689: NetBSD.</p></dd>
2690: <dt><span class="term"><code class="filename">etc</code> (the usual location of
2691: <code class="filename">${PKG_SYSCONFDIR}</code>)</span></dt>
2692: <dd><p>Contains
2693: the configuration files.</p></dd>
2694: <dt><span class="term"><code class="filename">include</code></span></dt>
2695: <dd><p>Contains headers for the C and C++ programming
2696: languages.</p></dd>
2697: <dt><span class="term"><code class="filename">info</code></span></dt>
2698: <dd><p>Contains GNU info files of various
2699: packages.</p></dd>
2700: <dt><span class="term"><code class="filename">lib</code></span></dt>
2701: <dd><p>Contains shared and static
2702: libraries.</p></dd>
2703: <dt><span class="term"><code class="filename">libdata</code></span></dt>
2704: <dd><p>Contains data files that don't change after
2705: installation. Other data files belong into
2706: <code class="filename">${VARBASE}</code>.</p></dd>
2707: <dt><span class="term"><code class="filename">libexec</code></span></dt>
2708: <dd><p>Contains programs that are not intended to be used by
2709: end users, such as helper programs or network
2710: daemons.</p></dd>
2711: <dt><span class="term"><code class="filename">libexec/cgi-bin</code></span></dt>
2712: <dd><p>Contains programs that are intended to be executed as
2713: CGI scripts by a web server.</p></dd>
2714: <dt><span class="term"><code class="filename">man</code> (the usual value of
2715: <code class="filename">${PKGMANDIR}</code>)</span></dt>
2716: <dd><p>Contains brief
2717: documentation in form of manual pages.</p></dd>
2718: <dt><span class="term"><code class="filename">sbin</code></span></dt>
2719: <dd><p>Contains programs that are intended to be used only by
2720: the super-user.</p></dd>
2721: <dt><span class="term"><code class="filename">share</code></span></dt>
2722: <dd><p>Contains platform-independent data files that don't
2723: change after installation.</p></dd>
2724: <dt><span class="term"><code class="filename">share/doc</code></span></dt>
2725: <dd><p>Contains documentation files provided by the
2726: packages.</p></dd>
2727: <dt><span class="term"><code class="filename">share/examples</code></span></dt>
2728: <dd><p>Contains example files provided by the packages. Among
2729: others, the original configuration files are saved here and copied to
2730: <code class="filename">${PKG_SYSCONFDIR}</code> during
2731: installation.</p></dd>
2732: <dt><span class="term"><code class="filename">share/examples/rc.d</code></span></dt>
2733: <dd><p>Contains the original files for rc.d
2734: scripts.</p></dd>
2735: <dt><span class="term"><code class="filename">var</code> (the usual location of
2736: <code class="filename">${VARBASE}</code>)</span></dt>
2737: <dd><p>Contains files
2738: that may be modified after
2739: installation.</p></dd>
2740: </dl></div>
2741: </div>
1.148 asau 2742: <div class="sect1">
1.90 rillig 2743: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2744: <a name="files.varbase"></a>9.2. File system layout in <code class="literal">${VARBASE}</code>
1.93 rillig 2745: </h2></div></div></div>
1.148 asau 2746: <div class="variablelist"><dl class="variablelist">
1.90 rillig 2747: <dt><span class="term"><code class="filename">db/pkg</code> (the usual location of
2748: <code class="filename">${PKG_DBDIR}</code>)</span></dt>
2749: <dd><p>Contains
2750: information about the currently installed
2751: packages.</p></dd>
2752: <dt><span class="term"><code class="filename">games</code></span></dt>
2753: <dd><p>Contains highscore
2754: files.</p></dd>
2755: <dt><span class="term"><code class="filename">log</code></span></dt>
2756: <dd><p>Contains log files.</p></dd>
2757: <dt><span class="term"><code class="filename">run</code></span></dt>
2758: <dd><p>Contains informational files about daemons that are
2759: currently running.</p></dd>
2760: </dl></div>
2761: </div>
2762: </div>
1.148 asau 2763: <div class="chapter">
1.90 rillig 2764: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 2765: <a name="faq"></a>Chapter 10. Frequently Asked Questions</h2></div></div></div>
1.75 rillig 2766: <div class="toc">
2767: <p><b>Table of Contents</b></p>
1.210 leot 2768: <dl class="toc">
1.267 rillig 2769: <dt><span class="sect1"><a href="#mailing-list-pointers">10.1. Are there any mailing lists for pkg-related discussion?</a></span></dt>
2770: <dt><span class="sect1"><a href="#faq-pkgtools">10.2. Utilities for package management (pkgtools)</a></span></dt>
2771: <dt><span class="sect1"><a href="#non-root-pkgsrc">10.3. How to use pkgsrc as non-root</a></span></dt>
2772: <dt><span class="sect1"><a href="#resume-transfers">10.4. How to resume transfers when fetching distfiles?</a></span></dt>
2773: <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>
2774: <dt><span class="sect1"><a href="#fetch-behind-firewall">10.6. How to fetch files from behind a firewall</a></span></dt>
2775: <dt><span class="sect1"><a href="#fetch-https">10.7. How to fetch files from HTTPS sites</a></span></dt>
2776: <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>
2777: <dt><span class="sect1"><a href="#fetching-all-distfiles">10.9. How to fetch all distfiles at once</a></span></dt>
2778: <dt><span class="sect1"><a href="#tmac.andoc-missing">10.10. What does <span class="quote">“<span class="quote">Don't know how to make
1.128 wiz 2779: /usr/share/tmac/tmac.andoc</span>”</span> mean?</a></span></dt>
1.267 rillig 2780: <dt><span class="sect1"><a href="#bsd.own.mk-missing">10.11. What does <span class="quote">“<span class="quote">Could not find bsd.own.mk</span>”</span> mean?</a></span></dt>
1.336 nia 2781: <dt><span class="sect1"><a href="#using-sudo-with-pkgsrc">10.12. Using 'sudo' or `priv` with pkgsrc</a></span></dt>
1.267 rillig 2782: <dt><span class="sect1"><a href="#faq.conf">10.13. How do I change the location of configuration files?</a></span></dt>
2783: <dt><span class="sect1"><a href="#audit-packages">10.14. Automated security checks</a></span></dt>
2784: <dt><span class="sect1"><a href="#ufaq-cflags">10.15. Why do some packages ignore my <code class="varname">CFLAGS</code>?</a></span></dt>
2785: <dt><span class="sect1"><a href="#ufaq-fail">10.16. A package does not build. What shall I do?</a></span></dt>
2786: <dt><span class="sect1"><a href="#faq.rcs-conflicts">10.17. What does <span class="quote">“<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>”</span> mean?</a></span></dt>
1.75 rillig 2787: </dl>
2788: </div>
2789: <p>This section contains hints, tips & tricks on special things in
2790: pkgsrc that we didn't find a better place for in the previous chapters, and
2791: it contains items for both pkgsrc users and developers.</p>
1.148 asau 2792: <div class="sect1">
1.75 rillig 2793: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2794: <a name="mailing-list-pointers"></a>10.1. Are there any mailing lists for pkg-related discussion?</h2></div></div></div>
1.75 rillig 2795: <p>The following mailing lists may be of interest to pkgsrc users:</p>
1.148 asau 2796: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2797: <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 2798: This is a general purpose list for most issues regarding
2799: pkgsrc, regardless of platform, e.g. soliciting user help
2800: for pkgsrc configuration, unexpected build failures, using
2801: particular packages, upgrading pkgsrc installations,
2802: questions regarding the pkgsrc release branches, etc. General announcements or
2803: proposals for changes that impact the pkgsrc user community,
2804: e.g. major infrastructure changes, new features, package
2805: removals, etc., may also be posted.</p></li>
1.289 leot 2806: <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 2807: A list where the results of pkgsrc bulk builds are sent and
2808: discussed.</p></li>
1.289 leot 2809: <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 2810: This list is for those who are interested in getting a
2811: commit message for every change committed to pkgsrc. It is
2812: also available in digest form, meaning one daily message
2813: containing all commit messages for changes to the package
2814: source tree in that 24 hour period.</p></li>
2815: </ul></div>
2816: <p>To subscribe, do:</p>
2817: <pre class="programlisting">
1.100 rillig 2818: <code class="prompt">%</code> echo subscribe <em class="replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.75 rillig 2819: </pre>
2820: <p>Archives for all these mailing lists are available from
1.289 leot 2821: <a class="ulink" href="https://mail-index.NetBSD.org/" target="_top">https://mail-index.NetBSD.org/</a>.</p>
1.75 rillig 2822: </div>
1.148 asau 2823: <div class="sect1">
1.75 rillig 2824: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2825: <a name="faq-pkgtools"></a>10.2. Utilities for package management (pkgtools)</h2></div></div></div>
1.80 rillig 2826: <p>The directory <code class="filename">pkgsrc/pkgtools</code> contains
1.75 rillig 2827: a number of useful utilities for both users and developers of pkgsrc. This
1.233 sevan 2828: section attempts only to make the reader aware of some of the utilities and when
1.75 rillig 2829: they might be useful, and not to duplicate the documentation that comes
2830: with each package.</p>
2831: <p>Utilities used by pkgsrc (automatically installed when needed):</p>
1.322 leot 2832: <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 2833: Symlinks for use by buildlink.</p></li></ul></div>
2834: <p>OS tool augmentation (automatically installed when needed):</p>
1.148 asau 2835: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 2836: <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 2837: Calculates various kinds of checksums (including SHA3).</p></li>
1.322 leot 2838: <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 2839: Compatibility library for pkgsrc tools.</p></li>
1.322 leot 2840: <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 2841: non-BSD systems due to lack of native mtree.</p></li>
1.322 leot 2842: <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 2843: Up-to-date replacement for
1.76 rillig 2844: <code class="filename">/usr/sbin/pkg_install</code>, or for use on operating
1.75 rillig 2845: systems where pkg_install is not present.</p></li>
2846: </ul></div>
2847: <p>Utilities used by pkgsrc (not automatically installed):</p>
1.148 asau 2848: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 2849: <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 2850: Create a binary package from an
1.110 hubertf 2851: already-installed package. Used by <span class="command"><strong>make replace</strong></span> to
1.75 rillig 2852: save the old package.</p></li>
1.322 leot 2853: <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 2854: Adds extra functionality to pkgsrc, allowing it to fetch distfiles
2855: from multiple locations. It currently supports the following
2856: methods: multiple CD-ROMs and network FTP/HTTP connections.</p></li>
1.322 leot 2857: <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 2858: the best compiler flags to optimise code for your current
1.128 wiz 2859: CPU and compiler. </p></li>
1.75 rillig 2860: </ul></div>
2861: <p>Utilities for keeping track of installed packages, being up to date,
2862: etc:</p>
1.148 asau 2863: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 2864: <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 2865: update tool similar to apt(1). Download, install, and upgrade
2866: binary packages easily.</p></li>
1.322 leot 2867: <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 2868: packages whose installed versions do not match the latest pkgsrc
2869: entries.</p></li>
1.322 leot 2870: <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 2871: dependency graphs of packages, to aid in choosing a strategy for
2872: updating.</p></li>
1.322 leot 2873: <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
2874: 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>
2875: <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 2876: pkglint(1) program checks a pkgsrc entry for errors.</p></li>
1.322 leot 2877: <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 2878: does various checks on the complete pkgsrc system.</p></li>
1.322 leot 2879: <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 2880: packages you have installed.</p></li>
2881: </ul></div>
2882: <p>Utilities for people maintaining or creating individual packages:</p>
1.148 asau 2883: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 2884: <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 2885: making and maintaining patches for a package (includes pkgdiff,
2886: pkgvi, mkpatches, etc.).</p></li>
1.322 leot 2887: <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 2888: converting to pkgsrc.</p></li>
2889: </ul></div>
2890: <p>Utilities for people maintaining pkgsrc (or: more obscure pkg
2891: utilities)</p>
1.148 asau 2892: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 2893: <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 2894: packages in a chrooted area.</p></li>
1.322 leot 2895: <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 2896: kernel version for chrooted cross builds.</p></li>
2897: </ul></div>
2898: </div>
1.148 asau 2899: <div class="sect1">
1.75 rillig 2900: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2901: <a name="non-root-pkgsrc"></a>10.3. How to use pkgsrc as non-root</h2></div></div></div>
1.219 rillig 2902: <p>To install packages from source as a non-root user, download
1.267 rillig 2903: 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 2904: directory and run the command <span class="command"><strong>./bootstrap/bootstrap
2905: --unprivileged</strong></span>.</p>
2906: <p>This will install the binary part of pkgsrc to
2907: <code class="filename">~/pkg</code> and put the pkgsrc configuration <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>
2908: into <code class="filename">~/pkg/etc</code>.</p>
2909: <p>For more details, see <code class="filename">mk/unprivileged.mk</code>.</p>
1.75 rillig 2910: </div>
1.148 asau 2911: <div class="sect1">
1.75 rillig 2912: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2913: <a name="resume-transfers"></a>10.4. How to resume transfers when fetching distfiles?</h2></div></div></div>
1.75 rillig 2914: <p>By default, resuming transfers in pkgsrc is disabled, but you can
2915: enable this feature by adding the option
2916: <code class="varname">PKG_RESUME_TRANSFERS=YES</code> into
1.110 hubertf 2917: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. If, during a fetch step, an incomplete
1.75 rillig 2918: distfile is found, pkgsrc will try to resume it.</p>
2919: <p>You can also
1.168 wiz 2920: use a different program than the platform default program by changing the
1.117 jnemeth 2921: <code class="varname">FETCH_USING</code> variable. You can specify the program by
2922: using of ftp, fetch, wget or curl. Alternatively, fetching can be disabled
2923: by using the value manual. A value of custom disables the system defaults
2924: and dependency tracking for the fetch program. In that case you have to
2925: provide <code class="varname">FETCH_CMD</code>, <code class="varname">FETCH_BEFORE_ARGS</code>,
2926: <code class="varname">FETCH_RESUME_ARGS</code>, <code class="varname">FETCH_OUTPUT_ARGS</code>,
2927: <code class="varname">FETCH_AFTER_ARGS</code>.</p>
1.75 rillig 2928: <p>For example, if you want to use
1.117 jnemeth 2929: <code class="filename">wget</code> to download, you'll have to use something
1.75 rillig 2930: like:</p>
2931: <pre class="programlisting">
1.223 rillig 2932: FETCH_USING= wget
1.1 grant 2933: </pre>
1.75 rillig 2934: </div>
1.148 asau 2935: <div class="sect1">
1.75 rillig 2936: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2937: <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 2938: <p>If you want to use modular X.org from pkgsrc instead of your system's own X11
1.76 rillig 2939: (<code class="filename">/usr/X11R6</code>, <code class="filename">/usr/openwin</code>, ...)
1.75 rillig 2940: you will have to add the following line into
1.110 hubertf 2941: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>:</p>
1.75 rillig 2942: <pre class="programlisting">
1.103 wiz 2943: X11_TYPE=modular
1.1 grant 2944: </pre>
1.75 rillig 2945: </div>
1.148 asau 2946: <div class="sect1">
1.75 rillig 2947: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2948: <a name="fetch-behind-firewall"></a>10.6. How to fetch files from behind a firewall</h2></div></div></div>
1.75 rillig 2949: <p>If you are sitting behind a firewall which does not allow direct
2950: connections to Internet hosts (i.e. non-NAT), you may specify the
2951: relevant proxy hosts. This is done using an environment variable in the
2952: form of a URL, e.g. in Amdahl, the machine
1.128 wiz 2953: <span class="quote">“<span class="quote">orpheus.amdahl.com</span>”</span> is one of the firewalls, and it uses
1.75 rillig 2954: port 80 as the proxy port number. So the proxy environment variables
2955: are:</p>
2956: <pre class="programlisting">
1.100 rillig 2957: ftp_proxy=ftp://orpheus.amdahl.com:80/
2958: http_proxy=http://orpheus.amdahl.com:80/
1.1 grant 2959: </pre>
1.75 rillig 2960: </div>
1.148 asau 2961: <div class="sect1">
1.75 rillig 2962: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2963: <a name="fetch-https"></a>10.7. How to fetch files from HTTPS sites</h2></div></div></div>
1.173 wiz 2964: <p>Some fetch tools are not prepared to support HTTPS by default
2965: (for example, the one in NetBSD 6.0), or the one installed by the
2966: pkgsrc bootstrap (to avoid an openssl dependency that low in the
2967: dependency graph).</p>
2968: <p>Usually you won't notice, because distribution files are
2969: mirrored weekly to <span class="quote">“<span class="quote">ftp.NetBSD.org</span>”</span>, but that might not
2970: be often enough if you are following pkgsrc-current. In that case, set
2971: <code class="varname">FETCH_USING</code> in your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file to
2972: <span class="quote">“<span class="quote">curl</span>”</span> or <span class="quote">“<span class="quote">wget</span>”</span>, which are both compiled
2973: with HTTPS support by default. Of course, these tools need to be
2974: installed before you can use them this way.</p>
2975: </div>
2976: <div class="sect1">
2977: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2978: <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 2979: <p>This depends on which utility is used to retrieve distfiles. From
1.76 rillig 2980: <code class="filename">bsd.pkg.mk</code>, <code class="varname">FETCH_CMD</code> is assigned
1.75 rillig 2981: the first available command from the following list:</p>
1.148 asau 2982: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 2983: <li class="listitem"><p><code class="filename">${LOCALBASE}/bin/ftp</code></p></li>
2984: <li class="listitem"><p><code class="filename">/usr/bin/ftp</code></p></li>
1.75 rillig 2985: </ul></div>
2986: <p>On a default NetBSD installation, this will be
1.76 rillig 2987: <code class="filename">/usr/bin/ftp</code>, which automatically tries passive
1.75 rillig 2988: connections first, and falls back to active connections if the server
2989: refuses to do passive. For the other tools, add the following to your
1.110 hubertf 2990: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file:
1.75 rillig 2991: <code class="varname">PASSIVE_FETCH=1</code>.</p>
2992: <p>Having that option present will prevent
1.76 rillig 2993: <code class="filename">/usr/bin/ftp</code> from falling back to active
1.75 rillig 2994: transfers.</p>
2995: </div>
1.148 asau 2996: <div class="sect1">
1.75 rillig 2997: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 2998: <a name="fetching-all-distfiles"></a>10.9. How to fetch all distfiles at once</h2></div></div></div>
1.88 wiz 2999: <p>You would like to download all the distfiles in a single batch
1.110 hubertf 3000: from work or university, where you can't run a <span class="command"><strong>make
1.132 spz 3001: 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 3002: but downloading the entire directory may not be appropriate.</p>
1.110 hubertf 3003: <p>The answer here is to do a <span class="command"><strong>make fetch-list</strong></span> in
1.76 rillig 3004: <code class="filename">/usr/pkgsrc</code> or one of its subdirectories, carry the
1.75 rillig 3005: resulting list to your machine at work/school and use it there. If you
1.322 leot 3006: 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 3007: forget to set <code class="varname">FETCH_CMD</code> to something that fetches a
3008: URL:</p>
3009: <p>At home:</p>
3010: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
3011: <code class="prompt">%</code> <strong class="userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles >/tmp/fetch.sh</code></strong>
3012: <code class="prompt">%</code> <strong class="userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong></pre>
3013: <p>At work:</p>
3014: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>sh /tmp/fetch.sh</code></strong></pre>
1.76 rillig 3015: <p>then tar up <code class="filename">/tmp/distfiles</code> and take it
1.75 rillig 3016: home.</p>
3017: <p>If you have a machine running NetBSD, and you want to get
1.88 wiz 3018: <span class="emphasis"><em>all</em></span> distfiles (even ones that aren't for your
3019: machine architecture), you can do so by using the above-mentioned
1.110 hubertf 3020: <span class="command"><strong>make fetch-list</strong></span> approach, or fetch the distfiles
1.88 wiz 3021: directly by running:</p>
1.75 rillig 3022: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make mirror-distfiles</code></strong></pre>
3023: <p>If you even decide to ignore
3024: <code class="varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you can get everything
3025: by running:</p>
3026: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>make fetch NO_SKIP=yes</code></strong></pre>
3027: </div>
1.148 asau 3028: <div class="sect1">
1.75 rillig 3029: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3030: <a name="tmac.andoc-missing"></a>10.10. What does <span class="quote">“<span class="quote">Don't know how to make
1.128 wiz 3031: /usr/share/tmac/tmac.andoc</span>”</span> mean?</h2></div></div></div>
1.322 leot 3032: <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 3033: package, you get the error from make that it doesn't know how to make
1.76 rillig 3034: <code class="filename">/usr/share/tmac/tmac.andoc</code>? This indicates that
1.128 wiz 3035: you don't have installed the <span class="quote">“<span class="quote">text</span>”</span> set (nroff, ...) from
1.75 rillig 3036: the NetBSD base distribution on your machine. It is recommended to do
3037: that to format man pages.</p>
1.322 leot 3038: <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 3039: can get away with setting <code class="varname">NOMAN=YES</code> either in the
1.110 hubertf 3040: environment or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75 rillig 3041: </div>
1.148 asau 3042: <div class="sect1">
1.75 rillig 3043: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3044: <a name="bsd.own.mk-missing"></a>10.11. What does <span class="quote">“<span class="quote">Could not find bsd.own.mk</span>”</span> mean?</h2></div></div></div>
1.87 wiz 3045: <p>You didn't install the compiler set, <code class="filename">comp.tgz</code>,
1.75 rillig 3046: when you installed your NetBSD machine. Please get and install it, by
1.76 rillig 3047: extracting it in <code class="filename">/</code>:</p>
1.75 rillig 3048: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /</code></strong>
3049: <code class="prompt">#</code> <strong class="userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong></pre>
1.76 rillig 3050: <p><code class="filename">comp.tgz</code> is part of every NetBSD release. Get
1.110 hubertf 3051: the one that corresponds to your release (determine via <span class="command"><strong>uname
1.75 rillig 3052: -r</strong></span>).</p>
3053: </div>
1.148 asau 3054: <div class="sect1">
1.75 rillig 3055: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.336 nia 3056: <a name="using-sudo-with-pkgsrc"></a>10.12. Using 'sudo' or `priv` with pkgsrc</h2></div></div></div>
1.75 rillig 3057: <p>When installing packages as non-root user and using the just-in-time
1.322 leot 3058: <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 3059: password for each required package installed. To avoid this, the sudo
3060: package can be used, which does password caching over a limited time. To
1.336 nia 3061: use it, install <span class="command"><strong>sudo</strong></span> or
3062: <span class="command"><strong>priv</strong></span> (either as binary package, from
3063: <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 3064: <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 3065: following into your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, somewhere
1.98 wiz 3066: <span class="emphasis"><em>after</em></span> the definition of the
3067: <code class="varname">LOCALBASE</code> variable:</p>
1.75 rillig 3068: <pre class="programlisting">
1.100 rillig 3069: .if exists(${LOCALBASE}/bin/sudo)
3070: SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
3071: .endif
1.1 grant 3072: </pre>
1.75 rillig 3073: </div>
1.148 asau 3074: <div class="sect1">
1.75 rillig 3075: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3076: <a name="faq.conf"></a>10.13. How do I change the location of configuration files?</h2></div></div></div>
1.75 rillig 3077: <p>As the system administrator, you can choose where configuration files
3078: are installed. The default settings make all these files go into
1.76 rillig 3079: <code class="filename">${PREFIX}/etc</code> or some of its subdirectories; this may
1.75 rillig 3080: be suboptimal depending on your expectations (e.g., a read-only,
3081: NFS-exported <code class="varname">PREFIX</code> with a need of per-machine
3082: configuration of the provided packages).</p>
3083: <p>In order to change the defaults, you can modify the
3084: <code class="varname">PKG_SYSCONFBASE</code> variable (in
1.110 hubertf 3085: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>) to point to your preferred configuration
1.76 rillig 3086: directory; some common examples include <code class="filename">/etc</code> or
3087: <code class="filename">/etc/pkg</code>.</p>
1.75 rillig 3088: <p>Furthermore, you can change this value on a per-package basis by
3089: setting the <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> variable.
3090: <code class="varname">PKG_SYSCONFVAR</code>'s value usually matches the name of the
3091: package you would like to modify, that is, the contents of
3092: <code class="varname">PKGBASE</code>.</p>
3093: <p>Note that after changing these settings, you must rebuild and
3094: reinstall any affected packages.</p>
3095: </div>
1.148 asau 3096: <div class="sect1">
1.75 rillig 3097: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3098: <a name="audit-packages"></a>10.14. Automated security checks</h2></div></div></div>
1.75 rillig 3099: <p>Please be aware that there can often be bugs in third-party software,
3100: and some of these bugs can leave a machine vulnerable to exploitation by
3101: attackers. In an effort to lessen the exposure, the NetBSD packages team
3102: maintains a database of known-exploits to packages which have at one time
3103: been included in pkgsrc. The database can be downloaded automatically, and
3104: a security audit of all packages installed on a system can take place. To
1.114 jmcneill 3105: do this, refer to the following two tools (installed as part of the
1.322 leot 3106: <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 3107: <div class="orderedlist"><ol class="orderedlist" type="1">
3108: <li class="listitem">
1.122 reed 3109: <p><span class="command"><strong>pkg_admin fetch-pkg-vulnerabilities</strong></span>, an easy way to
1.75 rillig 3110: download a list of the security vulnerabilities information. This list
1.132 spz 3111: is kept up to date by the pkgsrc security team, and is distributed
3112: from the NetBSD ftp server:</p>
1.292 leot 3113: <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 3114: </li>
1.128 wiz 3115: <li class="listitem"><p><span class="command"><strong>pkg_admin audit</strong></span>, an easy way to audit the
3116: current machine, checking each known vulnerability. If a
1.75 rillig 3117: vulnerable package is installed, it will be shown by output to stdout,
3118: including a description of the type of vulnerability, and a URL
3119: containing more information.</p></li>
3120: </ol></div>
1.233 sevan 3121: <p>Use of these tools is strongly recommended!
1.317 nia 3122: See <a class="xref" href="#vulnerabilities" title="5.1.6. Checking for security vulnerabilities in installed packages">Section 5.1.6, “Checking for security vulnerabilities in installed packages”</a> for instructions on how to automate checking and
1.233 sevan 3123: reporting.</p>
3124: <p>If this database is installed, pkgsrc builds will use it to
3125: perform a security check before building any package.</p>
1.75 rillig 3126: </div>
1.148 asau 3127: <div class="sect1">
1.75 rillig 3128: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3129: <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 3130: <p>When you add your own preferences to the
3131: <code class="varname">CFLAGS</code> variable in your
1.110 hubertf 3132: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, these flags are passed in
1.76 rillig 3133: environment variables to the <code class="filename">./configure</code>
1.322 leot 3134: 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 3135: <code class="varname">CFLAGS</code> from the environment variable by
1.76 rillig 3136: overriding them in the <code class="filename">Makefile</code>s of their
1.75 rillig 3137: package.</p>
3138: <p>Currently there is no solution to this problem. If you
3139: really need the package to use your <code class="varname">CFLAGS</code>
1.110 hubertf 3140: you should run <span class="command"><strong>make patch</strong></span> in the package
1.76 rillig 3141: directory and then inspect any <code class="filename">Makefile</code> and
3142: <code class="filename">Makefile.in</code> for whether they define
1.75 rillig 3143: <code class="varname">CFLAGS</code> explicitly. Usually you can remove
1.128 wiz 3144: these lines. But be aware that some <span class="quote">“<span class="quote">smart</span>”</span>
1.75 rillig 3145: programmers write so bad code that it only works for the
3146: specific combination of <code class="varname">CFLAGS</code> they have
3147: chosen.</p>
1.287 rillig 3148: <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>
3149: <pre class="programlisting">
3150: CPPFLAGS+= -Dpkgsrc___CPPFLAGS
3151: CFLAGS+= -Dpkgsrc___CFLAGS
3152: CXXFLAGS+= -Dpkgsrc___CXXFLAGS
3153: </pre>
3154: <p>Then run <span class="command"><strong>bmake show-all-configure show-all-build</strong></span>
3155: to see whether the above flags are passed to the actual build
3156: commands in general.</p>
3157: <p>To find out whether the flags are passed to individual compiler
3158: commands, have a look at the file <code class="filename">work/.work.log</code>. In
3159: most cases, the flags from the original command lines (the lines starting
3160: with <code class="literal">[*]</code>) are passed unmodified to the actual compiler
3161: (the lines starting with <code class="literal"><.></code>). If the flag is
3162: missing from the actual compiler command, it must have been removed by
1.299 rillig 3163: the <a class="link" href="#build.wrapper" title="13.10. The wrapper phase">pkgsrc compiler wrappers</a>.</p>
1.75 rillig 3164: </div>
1.148 asau 3165: <div class="sect1">
1.80 rillig 3166: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3167: <a name="ufaq-fail"></a>10.16. A package does not build. What shall I do?</h2></div></div></div>
1.128 wiz 3168: <div class="procedure"><ol class="procedure" type="1">
1.148 asau 3169: <li class="step"><p>Make sure that your copy of pkgsrc is consistent. A
1.80 rillig 3170: case that occurs often is that people only update pkgsrc in
3171: parts, because of performance reasons. Since pkgsrc is one large
3172: system, not a collection of many small systems, there are
3173: sometimes changes that only work when the whole pkgsrc tree is
3174: updated.</p></li>
1.148 asau 3175: <li class="step"><p>Make sure that you don't have any CVS conflicts.
1.128 wiz 3176: Search for <span class="quote">“<span class="quote"><<<<<<</span>”</span> or
3177: <span class="quote">“<span class="quote">>>>>>></span>”</span> in all your pkgsrc
1.80 rillig 3178: files.</p></li>
1.148 asau 3179: <li class="step"><p>Make sure that you don't have old copies of the packages
1.110 hubertf 3180: extracted. Run <span class="command"><strong>make clean clean-depends</strong></span> to
1.80 rillig 3181: verify this.</p></li>
1.218 rillig 3182: <li class="step"><p>If you are a package developer who wants to invest
1.267 rillig 3183: 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 3184: <li class="step"><p>If the problem still exists, write a mail to the
1.80 rillig 3185: <code class="literal">pkgsrc-users</code> mailing list.</p></li>
3186: </ol></div>
3187: </div>
1.148 asau 3188: <div class="sect1">
1.88 wiz 3189: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 3190: <a name="faq.rcs-conflicts"></a>10.17. What does <span class="quote">“<span class="quote">Makefile appears to contain unresolved cvs/rcs/??? merge conflicts</span>”</span> mean?</h2></div></div></div>
1.89 rillig 3191: <p>You have modified a file from pkgsrc, and someone else has
3192: modified that same file afterwards in the CVS repository. Both changes
3193: are in the same region of the file, so when you updated pkgsrc, the
3194: <code class="literal">cvs</code> command marked the conflicting changes in the
3195: file. Because of these markers, the file is no longer a valid
3196: <code class="filename">Makefile</code>.</p>
3197: <p>Have a look at that file, and if you don't need your local changes
1.110 hubertf 3198: anymore, you can remove that file and run <span class="command"><strong>cvs -q update
1.89 rillig 3199: -dP</strong></span> in that directory to download the current version.</p>
3200: </div>
1.75 rillig 3201: </div>
3202: </div>
1.148 asau 3203: <div class="part">
1.75 rillig 3204: <div class="titlepage"><div><div><h1 class="title">
3205: <a name="developers-guide"></a>Part II. The pkgsrc developer's guide</h1></div></div></div>
1.148 asau 3206: <div class="partintro">
1.77 rillig 3207: <div></div>
3208: <p>This part of the book deals with creating and
1.128 wiz 3209: modifying packages. It starts with a <span class="quote">“<span class="quote">HOWTO</span>”</span>-like
1.77 rillig 3210: guide on creating a new package. The remaining chapters are more
3211: like a reference manual for pkgsrc.</p>
1.75 rillig 3212: <div class="toc">
3213: <p><b>Table of Contents</b></p>
1.210 leot 3214: <dl class="toc">
1.267 rillig 3215: <dt><span class="chapter"><a href="#help-devel">11. Getting help</a></span></dt>
1.299 rillig 3216: <dt><span class="chapter"><a href="#components">12. Package components - files, directories and contents</a></span></dt>
1.91 rillig 3217: <dd><dl>
1.299 rillig 3218: <dt><span class="sect1"><a href="#components.Makefile">12.1. <code class="filename">Makefile</code></a></span></dt>
3219: <dt><span class="sect1"><a href="#components.distinfo">12.2. <code class="filename">distinfo</code></a></span></dt>
3220: <dt><span class="sect1"><a href="#components.patches">12.3. <code class="filename">patches/*</code></a></span></dt>
1.91 rillig 3221: <dd><dl>
1.299 rillig 3222: <dt><span class="sect2"><a href="#components.patch.structure">12.3.1. Structure of a single patch file</a></span></dt>
3223: <dt><span class="sect2"><a href="#components.patches.caveats">12.3.2. Creating patch files</a></span></dt>
3224: <dt><span class="sect2"><a href="#components.patches.sources">12.3.3. Sources where the patch files come from</a></span></dt>
3225: <dt><span class="sect2"><a href="#components.patches.guidelines">12.3.4. Patching guidelines</a></span></dt>
3226: <dt><span class="sect2"><a href="#components.patches.feedback">12.3.5. Feedback to the author</a></span></dt>
1.91 rillig 3227: </dl></dd>
1.299 rillig 3228: <dt><span class="sect1"><a href="#other-mandatory-files">12.4. Other mandatory files</a></span></dt>
3229: <dt><span class="sect1"><a href="#components.optional">12.5. Optional files</a></span></dt>
3230: <dd><dl>
3231: <dt><span class="sect2"><a href="#components.optional.bin">12.5.1. Files affecting the binary package</a></span></dt>
3232: <dt><span class="sect2"><a href="#components.optional.build">12.5.2. Files affecting the build process</a></span></dt>
3233: <dt><span class="sect2"><a href="#components.optional.none">12.5.3. Files affecting nothing at all</a></span></dt>
3234: </dl></dd>
3235: <dt><span class="sect1"><a href="#work-dir">12.6. <code class="filename">work*</code></a></span></dt>
3236: <dt><span class="sect1"><a href="#files-dir">12.7. <code class="filename">files/*</code></a></span></dt>
1.106 rillig 3237: </dl></dd>
1.299 rillig 3238: <dt><span class="chapter"><a href="#build">13. The build process</a></span></dt>
1.106 rillig 3239: <dd><dl>
1.299 rillig 3240: <dt><span class="sect1"><a href="#build.intro">13.1. Introduction</a></span></dt>
3241: <dt><span class="sect1"><a href="#build.prefix">13.2. Program location</a></span></dt>
3242: <dt><span class="sect1"><a href="#build.builddirs">13.3. Directories used during the build process</a></span></dt>
3243: <dt><span class="sect1"><a href="#build.running">13.4. Running a phase</a></span></dt>
3244: <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 3245: <dd><dl>
1.299 rillig 3246: <dt><span class="sect2"><a href="#build.fetch.what">13.5.1. What to fetch and where to get it from</a></span></dt>
3247: <dt><span class="sect2"><a href="#build.fetch.how">13.5.2. How are the files fetched?</a></span></dt>
1.106 rillig 3248: </dl></dd>
1.299 rillig 3249: <dt><span class="sect1"><a href="#build.checksum">13.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
3250: <dt><span class="sect1"><a href="#build.extract">13.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
3251: <dt><span class="sect1"><a href="#build.patch">13.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
3252: <dt><span class="sect1"><a href="#build.tools">13.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
3253: <dt><span class="sect1"><a href="#build.wrapper">13.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
3254: <dt><span class="sect1"><a href="#build.configure">13.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
3255: <dt><span class="sect1"><a href="#build.build">13.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
3256: <dt><span class="sect1"><a href="#build.test">13.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
3257: <dt><span class="sect1"><a href="#build.install">13.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
3258: <dt><span class="sect1"><a href="#build.package">13.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
3259: <dt><span class="sect1"><a href="#build.clean">13.16. Cleaning up</a></span></dt>
3260: <dt><span class="sect1"><a href="#build.helpful-targets">13.17. Other helpful targets</a></span></dt>
3261: </dl></dd>
3262: <dt><span class="chapter"><a href="#creating">14. Creating a new pkgsrc package from scratch</a></span></dt>
3263: <dd><dl>
3264: <dt><span class="sect1"><a href="#creating.common">14.1. Common types of packages</a></span></dt>
1.106 rillig 3265: <dd><dl>
1.334 nia 3266: <dt><span class="sect2"><a href="#creating.python-module">14.1.1. Python modules and programs</a></span></dt>
3267: <dt><span class="sect2"><a href="#creating.R-package">14.1.2. R packages</a></span></dt>
3268: <dt><span class="sect2"><a href="#creating.TeX-package">14.1.3. TeXlive packages</a></span></dt>
1.106 rillig 3269: </dl></dd>
1.299 rillig 3270: <dt><span class="sect1"><a href="#creating.examples">14.2. Examples</a></span></dt>
3271: <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 3272: </dl></dd>
1.299 rillig 3273: <dt><span class="chapter"><a href="#makefile">15. Programming in <code class="filename">Makefile</code>s</a></span></dt>
1.106 rillig 3274: <dd><dl>
1.299 rillig 3275: <dt><span class="sect1"><a href="#makefile.style">15.1. Caveats</a></span></dt>
3276: <dt><span class="sect1"><a href="#makefile.variables">15.2. <code class="filename">Makefile</code> variables</a></span></dt>
3277: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">15.2.1. Naming conventions</a></span></dt></dl></dd>
3278: <dt><span class="sect1"><a href="#makefile.code">15.3. Code snippets</a></span></dt>
1.106 rillig 3279: <dd><dl>
1.299 rillig 3280: <dt><span class="sect2"><a href="#adding-to-list">15.3.1. Adding things to a list</a></span></dt>
3281: <dt><span class="sect2"><a href="#echo-literal">15.3.2. Echoing a string exactly as-is</a></span></dt>
3282: <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>
3283: <dt><span class="sect2"><a href="#empty-variables">15.3.4. Handling possibly empty variables</a></span></dt>
1.344 gutterid 3284: <dt><span class="sect2"><a href="#makefile.yesno">15.3.5. Testing yes/no variables in conditions</a></span></dt>
1.106 rillig 3285: </dl></dd>
3286: </dl></dd>
1.299 rillig 3287: <dt><span class="chapter"><a href="#options">16. Options handling</a></span></dt>
1.106 rillig 3288: <dd><dl>
1.299 rillig 3289: <dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
3290: <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>
3291: <dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
3292: <dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
1.106 rillig 3293: </dl></dd>
1.299 rillig 3294: <dt><span class="chapter"><a href="#tools">17. Tools needed for building or running</a></span></dt>
1.106 rillig 3295: <dd><dl>
1.299 rillig 3296: <dt><span class="sect1"><a href="#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
3297: <dt><span class="sect1"><a href="#package-tools">17.2. Tools needed by packages</a></span></dt>
3298: <dt><span class="sect1"><a href="#platform-tools">17.3. Tools provided by platforms</a></span></dt>
3299: </dl></dd>
3300: <dt><span class="chapter"><a href="#buildlink">18. Buildlink methodology</a></span></dt>
3301: <dd><dl>
3302: <dt><span class="sect1"><a href="#converting-to-buildlink3">18.1. Converting packages to use buildlink3</a></span></dt>
3303: <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 3304: <dd><dl>
1.299 rillig 3305: <dt><span class="sect2"><a href="#anatomy-of-bl3">18.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
3306: <dt><span class="sect2"><a href="#updating-buildlink-depends">18.2.2. Updating
1.133 wiz 3307: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
3308: and
3309: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
3310: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
1.106 rillig 3311: </dl></dd>
1.299 rillig 3312: <dt><span class="sect1"><a href="#writing-builtin.mk">18.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.355 ! rillig 3313: <dd><dl><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></dl></dd>
1.299 rillig 3314: </dl></dd>
3315: <dt><span class="chapter"><a href="#plist">19. PLIST issues</a></span></dt>
1.106 rillig 3316: <dd><dl>
1.299 rillig 3317: <dt><span class="sect1"><a href="#rcs-id">19.1. RCS ID</a></span></dt>
3318: <dt><span class="sect1"><a href="#automatic-plist-generation">19.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
3319: <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>
3320: <dt><span class="sect1"><a href="#plist.misc">19.4. Variable substitution in PLIST</a></span></dt>
3321: <dt><span class="sect1"><a href="#manpage-compression">19.5. Man page compression</a></span></dt>
3322: <dt><span class="sect1"><a href="#using-PLIST_SRC">19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
3323: <dt><span class="sect1"><a href="#platform-specific-plist">19.7. Platform-specific and differing PLISTs</a></span></dt>
3324: <dt><span class="sect1"><a href="#build-plist">19.8. Build-specific PLISTs</a></span></dt>
3325: <dt><span class="sect1"><a href="#faq.common-dirs">19.9. Sharing directories between packages</a></span></dt>
1.106 rillig 3326: </dl></dd>
1.299 rillig 3327: <dt><span class="chapter"><a href="#pkginstall">20. The pkginstall framework</a></span></dt>
3328: <dd><dl>
3329: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">20.1. Files and directories outside the installation prefix</a></span></dt>
3330: <dd><dl>
3331: <dt><span class="sect2"><a href="#dirs-outside-prefix">20.1.1. Directory manipulation</a></span></dt>
3332: <dt><span class="sect2"><a href="#files-outside-prefix">20.1.2. File manipulation</a></span></dt>
1.106 rillig 3333: </dl></dd>
1.299 rillig 3334: <dt><span class="sect1"><a href="#conf-files">20.2. Configuration files</a></span></dt>
1.106 rillig 3335: <dd><dl>
1.299 rillig 3336: <dt><span class="sect2"><a href="#conf-files-sysconfdir">20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
3337: <dt><span class="sect2"><a href="#conf-files-configure">20.2.2. Telling the software where configuration files are</a></span></dt>
1.353 dholland 3338: <dt><span class="sect2"><a href="#conf-files-patching">20.2.3. Patching installation</a></span></dt>
3339: <dt><span class="sect2"><a href="#conf-files-declare">20.2.4. Declaring configuration files</a></span></dt>
3340: <dt><span class="sect2"><a href="#conf-files-disable">20.2.5. Disabling handling of configuration files</a></span></dt>
1.299 rillig 3341: </dl></dd>
3342: <dt><span class="sect1"><a href="#rcd-scripts">20.3. System startup scripts</a></span></dt>
3343: <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>
3344: <dt><span class="sect1"><a href="#users-and-groups">20.4. System users and groups</a></span></dt>
3345: <dt><span class="sect1"><a href="#shells">20.5. System shells</a></span></dt>
3346: <dd><dl><dt><span class="sect2"><a href="#shells-disable">20.5.1. Disabling shell registration</a></span></dt></dl></dd>
3347: <dt><span class="sect1"><a href="#fonts">20.6. Fonts</a></span></dt>
3348: <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 3349: </dl></dd>
3350: <dt><span class="chapter"><a href="#fixes">21. Making your package work</a></span></dt>
3351: <dd><dl>
3352: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
3353: <dd><dl>
3354: <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>
3355: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
3356: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
3357: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
3358: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
3359: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
3360: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
3361: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
3362: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
3363: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
3364: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
3365: </dl></dd>
3366: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
3367: <dd><dl>
3368: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
3369: <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>
3370: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
3371: </dl></dd>
3372: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
3373: <dd><dl>
3374: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
3375: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
3376: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
1.338 nia 3377: <dt><span class="sect2"><a href="#meson">21.3.4. Meson / ninja</a></span></dt>
1.267 rillig 3378: </dl></dd>
3379: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
3380: <dd><dl>
3381: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
3382: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
1.320 wiz 3383: <dt><span class="sect2"><a href="#go-programming-language">21.4.3. Go</a></span></dt>
1.338 nia 3384: <dt><span class="sect2"><a href="#rust-programming-language">21.4.4. Rust</a></span></dt>
3385: <dt><span class="sect2"><a href="#perl-scripts">21.4.5. Packages containing Perl scripts</a></span></dt>
3386: <dt><span class="sect2"><a href="#shell-scripts">21.4.6. Packages containing shell scripts</a></span></dt>
3387: <dt><span class="sect2"><a href="#other-programming-languages">21.4.7. Other programming languages</a></span></dt>
1.267 rillig 3388: </dl></dd>
3389: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
3390: <dd><dl>
3391: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
3392: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.287 rillig 3393: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
3394: <dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span></a></span></dt>
3395: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.267 rillig 3396: </dl></dd>
3397: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
3398: <dd><dl>
3399: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
3400: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
3401: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
3402: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
3403: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
1.318 nia 3404: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing Perl modules</a></span></dt>
1.267 rillig 3405: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
3406: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
1.318 nia 3407: <dt><span class="sect2"><a href="#x11-fonts">21.6.9. Packages installing X11 fonts</a></span></dt>
3408: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.10. Packages installing SGML or XML data</a></span></dt>
3409: <dt><span class="sect2"><a href="#mime-database">21.6.11. Packages installing extensions to the MIME database</a></span></dt>
3410: <dt><span class="sect2"><a href="#intltool">21.6.12. Packages using intltool</a></span></dt>
3411: <dt><span class="sect2"><a href="#startup-scripts">21.6.13. Packages installing startup scripts</a></span></dt>
3412: <dt><span class="sect2"><a href="#tex-packages">21.6.14. Packages installing TeX modules</a></span></dt>
3413: <dt><span class="sect2"><a href="#emulation-packages">21.6.15. Packages supporting running binaries in
1.87 wiz 3414: emulation</a></span></dt>
1.318 nia 3415: <dt><span class="sect2"><a href="#hicolor-theme">21.6.16. Packages installing hicolor icons</a></span></dt>
3416: <dt><span class="sect2"><a href="#desktop-files">21.6.17. Packages installing desktop files</a></span></dt>
1.77 rillig 3417: </dl></dd>
1.267 rillig 3418: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.77 rillig 3419: </dl></dd>
1.299 rillig 3420: <dt><span class="chapter"><a href="#gnome">22. GNOME packaging and porting</a></span></dt>
3421: <dd><dl>
3422: <dt><span class="sect1"><a href="#meta-packages">22.1. Meta packages</a></span></dt>
3423: <dt><span class="sect1"><a href="#new-package">22.2. Packaging a GNOME application</a></span></dt>
3424: <dt><span class="sect1"><a href="#full-update">22.3. Updating GNOME to a newer version</a></span></dt>
3425: <dt><span class="sect1"><a href="#patching">22.4. Patching guidelines</a></span></dt>
3426: </dl></dd>
1.267 rillig 3427: <dt><span class="chapter"><a href="#submit">23. Submitting and Committing</a></span></dt>
1.77 rillig 3428: <dd><dl>
1.267 rillig 3429: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
3430: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
3431: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
3432: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
3433: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
3434: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
3435: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
3436: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
3437: </dl></dd>
3438: <dt><span class="chapter"><a href="#devfaq">24. Frequently Asked Questions</a></span></dt>
1.75 rillig 3439: </dl>
3440: </div>
1.77 rillig 3441: </div>
1.148 asau 3442: <div class="chapter">
1.77 rillig 3443: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 3444: <a name="help-devel"></a>Chapter 11. Getting help</h2></div></div></div>
3445: <p>
3446: To get help when developing pkgsrc, the definitive source is this
3447: document, the pkgsrc guide. If you don't find anything here,
3448: there are alternatives:
3449: </p>
3450: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3451: <li class="listitem">
3452: <p>
3453: The built-in pkgsrc help, which is available after bootstrapping
3454: pkgsrc. Run <span class="command"><strong>bmake help topic=…</strong></span> to get
3455: help for any topic, such as a variable name like
3456: <code class="varname">BUILD_DEFS</code>, a make target like
3457: <span class="command"><strong>do-build</strong></span>, a missing C or C++ function like
3458: <span class="command"><strong>strcasecmp</strong></span> or any other topic.</p>
1.322 leot 3459: <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 3460: </li>
3461: <li class="listitem"><p>
1.278 rillig 3462: To see the value of a single variable, run <span class="command"><strong>bmake
3463: show-var VARNAME=<em class="replaceable"><code>X</code></em></strong></span>.
3464: </p></li>
3465: <li class="listitem"><p>
3466: To see the values of the most common variables, run
3467: <span class="command"><strong>bmake show-all</strong></span>. These variables are grouped by
3468: topic. To see the variables for a single topic, run
3469: <span class="command"><strong>bmake
3470: show-all-<em class="replaceable"><code>topic</code></em></strong></span>, for example
3471: <span class="command"><strong>bmake show-all-fetch</strong></span>.
3472: </p></li>
3473: <li class="listitem"><p>
1.267 rillig 3474: The tech-pkg mailing list, to which
3475: <a class="ulink" href="https://www.NetBSD.org/mailinglists/#tech-pkg" target="_top">you
3476: can subscribe</a> and then <a class="ulink" href="mailto:tech-pkg@NetBSD.org" target="_top">ask your
3477: questions</a>.</p></li>
3478: <li class="listitem"><p>The #pkgsrc IRC channel, which is accessible
3479: <a class="ulink" href="https://webchat.freenode.net/" target="_top">via a web browser</a>
3480: or by using a specialized chat program such as
3481: <a class="ulink" href="http://xchat.org/" target="_top">XChat</a>.
3482: Pick any user name and join the channel #pkgsrc.</p></li>
3483: </ul></div>
3484: </div>
3485: <div class="chapter">
3486: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 3487: <a name="components"></a>Chapter 12. Package components - files, directories and contents</h2></div></div></div>
1.91 rillig 3488: <div class="toc">
3489: <p><b>Table of Contents</b></p>
1.210 leot 3490: <dl class="toc">
1.299 rillig 3491: <dt><span class="sect1"><a href="#components.Makefile">12.1. <code class="filename">Makefile</code></a></span></dt>
3492: <dt><span class="sect1"><a href="#components.distinfo">12.2. <code class="filename">distinfo</code></a></span></dt>
3493: <dt><span class="sect1"><a href="#components.patches">12.3. <code class="filename">patches/*</code></a></span></dt>
3494: <dd><dl>
3495: <dt><span class="sect2"><a href="#components.patch.structure">12.3.1. Structure of a single patch file</a></span></dt>
3496: <dt><span class="sect2"><a href="#components.patches.caveats">12.3.2. Creating patch files</a></span></dt>
3497: <dt><span class="sect2"><a href="#components.patches.sources">12.3.3. Sources where the patch files come from</a></span></dt>
3498: <dt><span class="sect2"><a href="#components.patches.guidelines">12.3.4. Patching guidelines</a></span></dt>
3499: <dt><span class="sect2"><a href="#components.patches.feedback">12.3.5. Feedback to the author</a></span></dt>
3500: </dl></dd>
3501: <dt><span class="sect1"><a href="#other-mandatory-files">12.4. Other mandatory files</a></span></dt>
3502: <dt><span class="sect1"><a href="#components.optional">12.5. Optional files</a></span></dt>
3503: <dd><dl>
3504: <dt><span class="sect2"><a href="#components.optional.bin">12.5.1. Files affecting the binary package</a></span></dt>
3505: <dt><span class="sect2"><a href="#components.optional.build">12.5.2. Files affecting the build process</a></span></dt>
3506: <dt><span class="sect2"><a href="#components.optional.none">12.5.3. Files affecting nothing at all</a></span></dt>
1.91 rillig 3507: </dl></dd>
1.299 rillig 3508: <dt><span class="sect1"><a href="#work-dir">12.6. <code class="filename">work*</code></a></span></dt>
3509: <dt><span class="sect1"><a href="#files-dir">12.7. <code class="filename">files/*</code></a></span></dt>
1.91 rillig 3510: </dl>
3511: </div>
1.299 rillig 3512: <p>Whenever you're preparing a package, there are a number of
3513: files involved which are described in the following
3514: sections.</p>
3515: <div class="sect1">
3516: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
3517: <a name="components.Makefile"></a>12.1. <code class="filename">Makefile</code>
3518: </h2></div></div></div>
3519: <p>Building, installation and creation of a binary package are all
3520: controlled by the package's <code class="filename">Makefile</code>.
3521: The <code class="filename">Makefile</code> describes various things about
3522: a package, for example from where to get it, how to configure,
3523: build, and install it.</p>
3524: <p>A package <code class="filename">Makefile</code> contains several
3525: sections that describe the package.</p>
3526: <p>In the first section there are the following variables, which
3527: should appear exactly in the order given here. The order and
3528: grouping of the variables is mostly historical and has no further
3529: meaning.</p>
3530: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3531: <li class="listitem"><p><code class="varname">DISTNAME</code> is the basename of the
3532: distribution file to be downloaded from the package's
3533: website.</p></li>
3534: <li class="listitem"><p><code class="varname">PKGNAME</code> is the name of the
3535: package, as used by pkgsrc. You need to provide it if
3536: <code class="varname">DISTNAME</code> (which is the default) is not a good
3537: name for the package in pkgsrc or <code class="varname">DISTNAME</code> is not
3538: provided (no distribution file is required). Usually it is the pkgsrc
3539: directory name together with the version number. It must match the
3540: regular expression
3541: <code class="varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>, that is, it
3542: starts with a letter or digit, and contains only letters, digits,
1.319 nia 3543: dashes, underscores, dots and plus signs.
3544: New packages should have entirely lower-case names, with the exception
3545: of some that must follow pre-existing conventions
3546: (e.g. R packages begin with <code class="varname">R-</code>).
3547: You can use the <code class="code">:tl</code> variable modifier to lower-case
3548: the package name.</p></li>
1.299 rillig 3549: <li class="listitem">
3550: <p><code class="varname">CATEGORIES</code> is a list of categories
3551: which the package fits in. You can choose any of the top-level
3552: directories of pkgsrc for it.</p>
3553: <p>Currently the following values are available for
3554: <code class="varname">CATEGORIES</code>. If more than
3555: one is used, they need to be separated by spaces:</p>
1.77 rillig 3556: <pre class="programlisting">
1.299 rillig 3557: archivers cross geography meta-pkgs security
3558: audio databases graphics misc shells
3559: benchmarks devel ham multimedia sysutils
3560: biology editors inputmethod net textproc
3561: cad emulators lang news time
3562: chat finance mail parallel wm
3563: comms fonts math pkgtools www
3564: converters games mbone print x11
1.77 rillig 3565: </pre>
3566: </li>
1.299 rillig 3567: <li class="listitem"><p><code class="varname">MASTER_SITES</code>,
3568: <code class="varname">DYNAMIC_MASTER_SITES</code>,
3569: <code class="varname">DIST_SUBDIR</code>, <code class="varname">EXTRACT_SUFX</code>
3570: and <code class="varname">DISTFILES</code> are discussed in detail in
3571: <a class="xref" href="#build.fetch" title="13.5. The fetch phase">Section 13.5, “The <span class="emphasis"><em>fetch</em></span> phase”</a>.</p></li>
3572: </ul></div>
3573: <p>The second section contains information about separately
3574: downloaded patches, if any.
3575: </p>
3576: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3577: <li class="listitem"><p><code class="varname">PATCHFILES</code>:
3578: Name(s) of additional files that contain distribution patches.
3579: There is no default. pkgsrc will look for them at
3580: <code class="varname">PATCH_SITES</code>.
3581: They will automatically be uncompressed before patching if
3582: the names end with <code class="filename">.gz</code> or
3583: <code class="filename">.Z</code>.</p></li>
3584: <li class="listitem"><p><code class="varname">PATCH_SITES</code>:
3585: Primary location(s) for distribution patch files (see
3586: <code class="varname">PATCHFILES</code> above) if not found locally.</p></li>
3587: <li class="listitem"><p><code class="varname">PATCH_DIST_STRIP</code>:
1.322 leot 3588: 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 3589: help find the correct files to patch. It defaults to
3590: <span class="command"><strong>-p0</strong></span>.</p></li>
3591: </ul></div>
3592: <p>The third section contains the following variables.
3593: </p>
3594: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3595: <li class="listitem"><p><code class="varname">MAINTAINER</code> is the email
3596: address of the person who feels responsible for this package,
3597: and who is most likely to look at problems or questions regarding
1.322 leot 3598: 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 3599: Other developers may contact the <code class="varname">MAINTAINER</code>
3600: before making changes to the package, but are not required to
3601: do so. When packaging a new program, set <code class="varname">MAINTAINER</code>
3602: to yourself. If you really can't maintain the package for future
3603: updates, set it to
3604: <code class="email"><<a class="email" href="mailto:pkgsrc-users@NetBSD.org">pkgsrc-users@NetBSD.org</a>></code>.</p></li>
3605: <li class="listitem"><p><code class="varname">OWNER</code> should be used instead
3606: of <code class="varname">MAINTAINER</code> when you do not want other
3607: developers to update or change the package without contacting
3608: you first. A package Makefile should contain one of
3609: <code class="varname">MAINTAINER</code> or <code class="varname">OWNER</code>, but
3610: not both. </p></li>
3611: <li class="listitem"><p><code class="varname">HOMEPAGE</code> is a URL where users can
3612: find more information about the package.</p></li>
3613: <li class="listitem"><p><code class="varname">COMMENT</code> is a one-line
3614: description of the package (should not include the package
3615: name).</p></li>
3616: <li class="listitem"><p><code class="varname">LICENSE</code> indicates the license(s)
3617: applicable for the package. See <a class="xref" href="#handling-licenses" title="21.1.3. Handling licenses">Section 21.1.3, “Handling licenses”</a> for further details.</p></li>
3618: </ul></div>
3619: <p>Other variables that affect the build:
3620: </p>
3621: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
3622: <p><code class="varname">WRKSRC</code>: The directory where the
3623: interesting distribution files of the package are found. The
3624: default is <code class="filename">${WRKDIR}/${DISTNAME}</code>, which
3625: works for most packages.</p>
3626: <p>If a package doesn't create a subdirectory for itself
3627: (most GNU software does, for instance), but extracts itself in
3628: the current directory, you should set
3629: <code class="varname">WRKSRC=${WRKDIR}</code>.</p>
3630: <p>If a package doesn't create a subdirectory with the
3631: name of <code class="varname">DISTNAME</code> but some different name,
3632: set <code class="varname">WRKSRC</code> to point to the proper name in
3633: <code class="filename">${WRKDIR}</code>, for example
3634: <code class="varname">WRKSRC=${WRKDIR}/${DISTNAME}/unix</code>. See
1.322 leot 3635: <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 3636: <p>The name of the working directory created by pkgsrc is
3637: taken from the <code class="varname">WRKDIR_BASENAME</code>
3638: variable. By default, its value is
3639: <code class="filename">work</code>. If you want to use the same
3640: pkgsrc tree for building different kinds of binary packages,
3641: you can change the variable according to your needs. Two
3642: other variables handle common cases of setting
3643: <code class="varname">WRKDIR_BASENAME</code> individually. If
3644: <code class="varname">OBJHOSTNAME</code> is defined in
3645: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the first component of
3646: the host's name is attached to the directory name. If
3647: <code class="varname">OBJMACHINE</code> is defined, the platform name
3648: is attached, which might look like
3649: <code class="filename">work.i386</code> or
3650: <code class="filename">work.sparc</code>.</p>
3651: </li></ul></div>
3652: <p>Please pay attention to the following gotchas:</p>
3653: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3654: <li class="listitem"><p>Add <code class="varname">MANCOMPRESSED</code> if man pages are
3655: installed in compressed form by the package. For packages using
3656: BSD-style makefiles which honor MANZ, there is
3657: <code class="varname">MANCOMPRESSED_IF_MANZ</code>.</p></li>
3658: <li class="listitem"><p>Replace <code class="filename">/usr/local</code> with
3659: <span class="quote">“<span class="quote">${PREFIX}</span>”</span> in all files (see patches,
3660: below).</p></li>
3661: <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, “Packages installing info files”</a>.</p></li>
3662: </ul></div>
3663: </div>
1.148 asau 3664: <div class="sect1">
1.91 rillig 3665: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 3666: <a name="components.distinfo"></a>12.2. <code class="filename">distinfo</code>
3667: </h2></div></div></div>
3668: <p>The <code class="filename">distinfo</code> file contains the message
3669: digest, or checksum, of each distfile needed for the package. This
3670: ensures that the distfiles retrieved from the Internet have not been
3671: corrupted during transfer or altered by a malign force to introduce
3672: a security hole. To provide maximum security, all distfiles are
3673: protected using three different message digest algorithms (SHA1,
3674: RMD160, SHA512), as well as the file size.</p>
3675: <p>The <code class="filename">distinfo</code> file also contains the
3676: checksums for all the patches found in the
3677: <code class="filename">patches</code> directory (see <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, “<code class="filename">patches/*</code>”</a>). These checksums ensure that patches
3678: are only applied intentionally and that they don't accidentally change,
3679: e.g. when merging different changes together. They also make sure that
3680: new patches are actually added to CVS and old ones are removed.
3681: Too see whether the patches and the <code class="filename">distinfo</code> file
3682: match, run <span class="command"><strong>pkglint</strong></span> after changing the patches.</p>
3683: <p>To regenerate the <code class="filename">distinfo</code> file, use the
3684: <span class="command"><strong>make distinfo</strong></span> command.</p>
3685: <p>Some packages have different sets of distfiles depending on
1.322 leot 3686: 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 3687: <code class="filename">distinfo</code> file and care should be taken when
3688: upgrading such a package to ensure distfile information is not
3689: lost.</p>
3690: </div>
3691: <div class="sect1">
3692: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
3693: <a name="components.patches"></a>12.3. <code class="filename">patches/*</code>
3694: </h2></div></div></div>
3695: <p>Some packages don't work out-of-the box on the various
3696: platforms that are supported by pkgsrc. These packages need
3697: to be patched to make them work. The patch files can be
3698: found in the <code class="filename">patches/</code> directory.</p>
3699: <p>In the <span class="emphasis"><em>patch</em></span> phase, these patches are
3700: applied to the files in <code class="varname">WRKSRC</code> directory after
3701: extracting them, in alphabetic order.</p>
1.148 asau 3702: <div class="sect2">
1.91 rillig 3703: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 3704: <a name="components.patch.structure"></a>12.3.1. Structure of a single patch file</h3></div></div></div>
3705: <p>The <code class="filename">patch-*</code> files should be in
3706: <span class="command"><strong>diff -bu</strong></span> format, and apply without a fuzz to avoid
3707: problems. (To force patches to apply with fuzz you can set
3708: <code class="varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, each patch
3709: should contain only changes for a single file, and no file should be
3710: patched by more than one patch file. This helps to keep future
3711: modifications simple.</p>
3712: <p>Each patch file is structured as follows: In the first line,
3713: there is the RCS Id of the patch itself. The second line should be
3714: empty for aesthetic reasons. After that, there should be a comment for
3715: each change that the patch does. There are a number of standard
3716: cases:</p>
3717: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
3718: <li class="listitem"><p>Patches for commonly known vulnerabilities should
3719: mention the vulnerability ID (CAN, CVE).</p></li>
3720: <li class="listitem"><p>Patches that change source code should mention the
3721: platform and other environment (for example, the compiler) that the
3722: patch is needed for.</p></li>
3723: </ul></div>
3724: <p>The patch should be commented so that any
3725: developer who knows the code of the application can make some use of
3726: the patch. Special care should be taken for the upstream developers,
3727: since we generally want that they accept our patches, so we have less
3728: work in the future.</p>
1.91 rillig 3729: </div>
1.148 asau 3730: <div class="sect2">
1.91 rillig 3731: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 3732: <a name="components.patches.caveats"></a>12.3.2. Creating patch files</h3></div></div></div>
3733: <p>One important thing to mention is to pay attention that no RCS
3734: IDs get stored in the patch files, as these will cause problems when
3735: later checked into the NetBSD CVS tree. Use the
1.322 leot 3736: <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 3737: problems.</p>
3738: <p>For even more automation, we recommend using
3739: <span class="command"><strong>mkpatches</strong></span> from the same package to make a
1.337 gutterid 3740: whole set of patches. You just have to back up files before you
3741: edit them to <code class="filename">filename.orig</code>, e.g., with
1.299 rillig 3742: <span class="command"><strong>cp -p filename filename.orig</strong></span> or, easier, by
3743: using <span class="command"><strong>pkgvi</strong></span> again from the same package. If
3744: you upgrade a package this way, you can easily compare the new
3745: set of patches with the previously existing one with
3746: <span class="command"><strong>patchdiff</strong></span>. The files in <code class="filename">patches</code>
3747: are replaced by new files, so carefully check if you want to take all
3748: the changes.</p>
3749: <p>When you have finished a package, remember to generate
3750: the checksums for the patch files by using the <span class="command"><strong>make
3751: makepatchsum</strong></span> command, see <a class="xref" href="#components.distinfo" title="12.2. distinfo">Section 12.2, “<code class="filename">distinfo</code>”</a>.</p>
3752: <p>When adding a patch that corrects a problem in the
3753: distfile (rather than e.g. enforcing pkgsrc's view of where
3754: man pages should go), send the patch as a bug report to the
3755: maintainer. This benefits non-pkgsrc users of the package,
3756: and usually makes it possible to remove the patch in future
3757: version.</p>
3758: <p>The file names of the patch files are usually of the form
3759: <code class="filename">patch-<em class="replaceable"><code>path_to_file__with__underscores.c</code></em></code>.
3760: Many packages still use the previous convention
3761: <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>,
3762: but new patches should be of the form containing the filename.
1.322 leot 3763: <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 3764: automatically.</p>
1.337 gutterid 3765: <p>When updating pre-existing patch files, if a file uses the old
3766: <code class="filename">patch-<em class="replaceable"><code>[a-z][a-z]</code></em></code>
3767: convention, it's best not to change it to the new form, as that will
3768: just cause churn that makes it harder to track changes to patching
3769: over time. Similarly, if a patch now applies at different line offsets,
3770: but still applies cleanly as-is, there's no need to update it, as that
3771: also unnecessarily complicates the patch history.</p>
1.118 imil 3772: </div>
1.275 brook 3773: <div class="sect2">
3774: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 3775: <a name="components.patches.sources"></a>12.3.3. Sources where the patch files come from</h3></div></div></div>
3776: <p>If you want to share patches between multiple packages
3777: in pkgsrc, e.g. because they use the same distfiles, set
3778: <code class="varname">PATCHDIR</code> to the path where the patch files
3779: can be found, e.g.:</p>
3780: <pre class="programlisting">
3781: PATCHDIR= ../../editors/xemacs/patches
3782: </pre>
3783: <p>Patch files that are distributed by the author or other
3784: maintainers can be listed in
3785: <code class="varname">PATCHFILES</code>.</p>
3786: <p>If it is desired to store any patches that should not be
3787: committed into pkgsrc, they can be kept outside the pkgsrc
3788: tree in the <code class="filename">$LOCALPATCHES</code> directory. The
3789: directory tree there is expected to have the same
3790: <span class="quote">“<span class="quote">category/package</span>”</span> structure as pkgsrc, and
3791: patches are expected to be stored inside these dirs (also
3792: known as <code class="filename">$LOCALPATCHES/$PKGPATH</code>). For
3793: example, if you want to keep a private patch for
3794: <code class="filename">pkgsrc/graphics/png</code>, keep it in
3795: <code class="filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
3796: files in the named directory are expected to be patch files,
3797: and <span class="emphasis"><em>they are applied after pkgsrc patches are
3798: applied</em></span>.</p>
1.275 brook 3799: </div>
3800: <div class="sect2">
3801: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 3802: <a name="components.patches.guidelines"></a>12.3.4. Patching guidelines</h3></div></div></div>
3803: <p>When fixing a portability issue in the code do not use
3804: preprocessor magic to check for the current operating system nor
3805: platform. Doing so hurts portability to other platforms because
3806: the OS-specific details are not abstracted appropriately.</p>
3807: <p>The general rule to follow is: instead of checking for the
3808: operating system the application is being built on, check for the
3809: specific <span class="emphasis"><em>features</em></span> you need. For example,
3810: instead of assuming that kqueue is available under NetBSD and
3811: using the <code class="varname">__NetBSD__</code> macro to conditionalize
3812: kqueue support, add a check that detects kqueue itself —
3813: yes, this generally involves patching the
3814: <span class="command"><strong>configure</strong></span> script. There is absolutely nothing
3815: that prevents some OSes from adopting interfaces from other OSes
3816: (e.g. Linux implementing kqueue), something that the above checks
3817: cannot take into account.</p>
3818: <p>Of course, checking for features generally involves more
3819: work on the developer's side, but the resulting changes are
3820: cleaner and there are chances they will work on many other
3821: platforms. Not to mention that there are higher chances of being
3822: later integrated into the mainstream sources. Remember:
3823: <span class="emphasis"><em>It doesn't work unless it is right!</em></span></p>
3824: <p>Some typical examples:</p>
3825: <div class="table">
3826: <a name="patch-examples"></a><p class="title"><b>Table 12.1. Patching examples</b></p>
3827: <div class="table-contents"><table class="table" summary="Patching examples" border="1">
3828: <colgroup>
3829: <col>
3830: <col>
3831: <col>
3832: </colgroup>
3833: <thead><tr>
3834: <th>Where</th>
3835: <th>Incorrect</th>
3836: <th>Correct</th>
3837: </tr></thead>
3838: <tbody>
3839: <tr>
3840: <td>configure script</td>
3841: <td>
1.275 brook 3842: <pre class="programlisting">
1.299 rillig 3843: case ${target_os} in
3844: netbsd*) have_kvm=yes ;;
3845: *) have_kvm=no ;;
3846: esac
1.275 brook 3847: </pre>
1.299 rillig 3848: </td>
3849: <td>
1.275 brook 3850: <pre class="programlisting">
1.299 rillig 3851: AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)
1.275 brook 3852: </pre>
1.299 rillig 3853: </td>
3854: </tr>
3855: <tr>
3856: <td>C source file</td>
3857: <td>
1.91 rillig 3858: <pre class="programlisting">
1.299 rillig 3859: #if defined(__NetBSD__)
3860: # include <sys/event.h>
3861: #endif
1.91 rillig 3862: </pre>
1.299 rillig 3863: </td>
3864: <td>
1.91 rillig 3865: <pre class="programlisting">
1.299 rillig 3866: #if defined(HAVE_SYS_EVENT_H)
3867: # include <sys/event.h>
3868: #endif
1.91 rillig 3869: </pre>
1.299 rillig 3870: </td>
3871: </tr>
3872: <tr>
3873: <td>C source file</td>
3874: <td>
1.91 rillig 3875: <pre class="programlisting">
1.299 rillig 3876: int
3877: monitor_file(...)
3878: {
3879: #if defined(__NetBSD__)
3880: int fd = kqueue();
3881: ...
3882: #else
3883: ...
3884: #endif
3885: }
1.91 rillig 3886: </pre>
1.299 rillig 3887: </td>
3888: <td>
1.91 rillig 3889: <pre class="programlisting">
1.299 rillig 3890: int
3891: monitor_file(...)
3892: {
3893: #if defined(HAVE_KQUEUE)
3894: int fd = kqueue();
3895: ...
3896: #else
3897: ...
3898: #endif
3899: }
1.91 rillig 3900: </pre>
1.299 rillig 3901: </td>
3902: </tr>
3903: </tbody>
3904: </table></div>
3905: </div>
3906: <br class="table-break">
3907: </div>
3908: <div class="sect2">
3909: <div class="titlepage"><div><div><h3 class="title">
3910: <a name="components.patches.feedback"></a>12.3.5. Feedback to the author</h3></div></div></div>
3911: <p>Always, always, <span class="strong"><strong>always</strong></span>
3912: feed back any <span class="emphasis"><em>portability fixes</em></span> or
3913: improvements you do to a package to the mainstream developers.
3914: This is the only way to get their attention on portability issues
3915: and to ensure that future versions can be built out-of-the box on
3916: NetBSD. Furthermore, any user that gets newer distfiles will get
3917: the fixes straight from the packaged code.</p>
3918: <p>This generally involves cleaning up the patches
3919: (because sometimes the patches that are
3920: added to pkgsrc are quick hacks), filing bug reports in the
3921: appropriate trackers for the projects and working with the
3922: mainstream authors to accept your changes. It is
3923: <span class="emphasis"><em>extremely important</em></span> that you do it so that
3924: the packages in pkgsrc are kept simple and thus further changes
3925: can be done without much hassle.</p>
3926: <p>When you have done this, please add a URL to the upstream
3927: bug report to the patch comment.</p>
3928: <p>Support the idea of free software!</p>
3929: </div>
1.91 rillig 3930: </div>
1.299 rillig 3931: <div class="sect1">
3932: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
3933: <a name="other-mandatory-files"></a>12.4. Other mandatory files</h2></div></div></div>
3934: <div class="variablelist"><dl class="variablelist">
3935: <dt><span class="term"><code class="filename">DESCR</code></span></dt>
3936: <dd><p>A multi-line description of the piece of software. This should include
3937: any credits where they are due. Please bear in mind that others do not
3938: share your sense of humour (or spelling idiosyncrasies), and that others
3939: will read everything that you write here.</p></dd>
3940: <dt><span class="term"><code class="filename">PLIST</code></span></dt>
3941: <dd><p>This file governs the files that are installed on your
3942: system: all the binaries, manual pages, etc. There are other
3943: directives which may be entered in this file, to control the
3944: creation and deletion of directories, and the location of
3945: inserted files. See <a class="xref" href="#plist" title="Chapter 19. PLIST issues">Chapter 19, <i>PLIST issues</i></a> for more
3946: information.</p></dd>
3947: </dl></div>
3948: </div>
3949: <div class="sect1">
3950: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
3951: <a name="components.optional"></a>12.5. Optional files</h2></div></div></div>
3952: <div class="sect2">
3953: <div class="titlepage"><div><div><h3 class="title">
3954: <a name="components.optional.bin"></a>12.5.1. Files affecting the binary package</h3></div></div></div>
3955: <div class="variablelist"><dl class="variablelist">
3956: <dt><span class="term"><code class="filename">INSTALL</code></span></dt>
3957: <dd>
1.322 leot 3958: <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 3959: First time after package extraction and before files are
3960: moved in place, the second time after the files to install
3961: are moved in place. This can be used to do any custom
3962: procedures not possible with @exec commands in
1.322 leot 3963: <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
3964: <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, “Files and directories outside the installation prefix”</a>.
1.299 rillig 3965: Please note that you can modify variables in it easily by using
3966: <code class="varname">FILES_SUBST</code> in the package's
3967: <code class="filename">Makefile</code>:</p>
1.91 rillig 3968: <pre class="programlisting">
1.299 rillig 3969: FILES_SUBST+= SOMEVAR="somevalue"
1.91 rillig 3970: </pre>
1.299 rillig 3971: <p>replaces "@SOMEVAR@" with <span class="quote">“<span class="quote">somevalue</span>”</span> in the
3972: <code class="filename">INSTALL</code>. By default, substitution is
3973: performed for <code class="varname">PREFIX</code>,
3974: <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
3975: <code class="varname">VARBASE</code>, and a few others, type
3976: <span class="command"><strong>make help topic=FILES_SUBST</strong></span> for a
3977: complete list.</p>
3978: </dd>
3979: <dt><span class="term"><code class="filename">DEINSTALL</code></span></dt>
3980: <dd><p>This script is executed before and after any files are removed. It is
3981: this script's responsibility to clean up any additional messy details
3982: around the package's installation, since all pkg_delete knows is how to
3983: delete the files created in the original distribution.
1.322 leot 3984: 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>
3985: 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 3986: The same methods to replace variables can be used as for
3987: the <code class="filename">INSTALL</code> file.</p></dd>
3988: <dt><span class="term"><code class="filename">MESSAGE</code></span></dt>
3989: <dd>
3990: <p>This file is displayed after installation of the package.
1.312 gdt 3991: While this was used often in the past, it has two
3992: problems: the display will be missed if many packages are
3993: intalled at once, and the person installing the package
3994: and the one using or configuring it may be different. It
3995: should therefore be used only in exceptional circumstances
3996: where lasting negative consequences would result from
3997: someone not reading it.</p>
3998: <p>MESSAGE should not be used for:</p>
3999: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
4000: <li class="listitem"><p>exhortations to read the documentation</p></li>
4001: <li class="listitem"><p>reminders to install rc.d files and set variables</p></li>
4002: <li class="listitem"><p>anything that should be explained in the
4003: installation/configuration documentation that should
4004: come with the package</p></li>
4005: </ul></div>
4006: <p>If the documentation provided by upstream needs
1.313 leot 4007: enhancing, create e.g. files/README.pkgsrc and install it
4008: in the package's documentation directory.
1.312 gdt 4009: </p>
4010: <p>Note that MESSAGE is shown for all operating
4011: systems and all init systems. If a MESSAGE is necessary,
1.313 leot 4012: it should be narrowed to only those operating systems and
1.312 gdt 4013: init systems to which it applies.</p>
4014: <p>Note that you can modify variables in it easily by using
1.299 rillig 4015: <code class="varname">MESSAGE_SUBST</code> in the package's
4016: <code class="filename">Makefile</code>:</p>
1.91 rillig 4017: <pre class="programlisting">
1.299 rillig 4018: MESSAGE_SUBST+= SOMEVAR="somevalue"
1.91 rillig 4019: </pre>
1.299 rillig 4020: <p>replaces "${SOMEVAR}" with <span class="quote">“<span class="quote">somevalue</span>”</span> in
4021: <code class="filename">MESSAGE</code>. By default, substitution is
4022: performed for <code class="varname">PKGNAME</code>,
4023: <code class="varname">PKGBASE</code>, <code class="varname">PREFIX</code>,
4024: <code class="varname">LOCALBASE</code>, <code class="varname">X11BASE</code>,
4025: <code class="varname">PKG_SYSCONFDIR</code>,
4026: <code class="varname">ROOT_GROUP</code>, and
4027: <code class="varname">ROOT_USER</code>.</p>
4028: <p>You can display a different or additional files by
4029: setting the <code class="varname">MESSAGE_SRC</code> variable. Its
4030: default is <code class="filename">MESSAGE</code>, if the file
4031: exists.</p>
4032: </dd>
4033: <dt><span class="term"><code class="filename">ALTERNATIVES</code></span></dt>
4034: <dd>
4035: <p>This file is used by the alternatives framework.
4036: It creates, configures, and destroys generic wrappers used to
4037: run programs with similar interfaces.
4038: See pkg_alternatives(8) from pkgtools/pkg_alternatives
4039: for more information.</p>
4040: <p>Each line of the file contains two filenames, first
4041: the wrapper and then the alternative provided by the package.
4042: Both paths are relative to <code class="varname">PREFIX</code>.</p>
4043: </dd>
4044: </dl></div>
4045: </div>
4046: <div class="sect2">
4047: <div class="titlepage"><div><div><h3 class="title">
4048: <a name="components.optional.build"></a>12.5.2. Files affecting the build process</h3></div></div></div>
4049: <div class="variablelist"><dl class="variablelist">
4050: <dt><span class="term"><code class="filename">Makefile.common</code></span></dt>
4051: <dd><p>This file contains arbitrary things that could
4052: also go into a <code class="filename">Makefile</code>, but its purpose is
4053: to be used by more than one package. This file should only be
4054: used when the packages that will use the file are known in
4055: advance. For other purposes it is often better to write a
4056: <code class="filename">*.mk</code> file and give it a good name that
4057: describes what it does.</p></dd>
4058: <dt><span class="term"><code class="filename">buildlink3.mk</code></span></dt>
4059: <dd><p>This file contains the dependency information
4060: for the buildlink3 framework (see <a class="xref" href="#buildlink" title="Chapter 18. Buildlink methodology">Chapter 18, <i>Buildlink methodology</i></a>).</p></dd>
4061: <dt><span class="term"><code class="filename">hacks.mk</code></span></dt>
4062: <dd><p>This file contains workarounds for compiler bugs
4063: and similar things. It is included automatically by the pkgsrc
4064: infrastructure, so you don't need an extra
4065: <code class="literal">.include</code> line for
4066: it.</p></dd>
4067: <dt><span class="term"><code class="filename">options.mk</code></span></dt>
4068: <dd><p>This file contains the code for the
4069: package-specific options (see <a class="xref" href="#options" title="Chapter 16. Options handling">Chapter 16, <i>Options handling</i></a>) that can be
4070: selected by the user. If a package has only one or two options,
4071: it is equally acceptable to put the code directly into the
4072: <code class="filename">Makefile</code>.</p></dd>
4073: </dl></div>
4074: </div>
4075: <div class="sect2">
4076: <div class="titlepage"><div><div><h3 class="title">
4077: <a name="components.optional.none"></a>12.5.3. Files affecting nothing at all</h3></div></div></div>
4078: <div class="variablelist"><dl class="variablelist">
4079: <dt><span class="term"><code class="filename">README*</code></span></dt>
4080: <dd><p>These files do not take place in the creation of
4081: a package and thus are purely informative to the package
4082: developer.</p></dd>
4083: <dt><span class="term"><code class="filename">TODO</code></span></dt>
4084: <dd><p>This file contains things that need to be done
4085: to make the package even
4086: better.</p></dd>
4087: </dl></div>
4088: </div>
4089: </div>
4090: <div class="sect1">
4091: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
4092: <a name="work-dir"></a>12.6. <code class="filename">work*</code>
4093: </h2></div></div></div>
4094: <p>When you type <span class="command"><strong>make</strong></span>, the distribution files are
4095: unpacked into the directory denoted by
4096: <code class="varname">WRKDIR</code>. It can be removed by running
4097: <span class="command"><strong>make clean</strong></span>. Besides the sources, this
4098: directory is also used to keep various timestamp files.
4099: The directory gets <span class="emphasis"><em>removed completely</em></span> on clean.
4100: The default is <code class="filename">${.CURDIR}/work</code>
4101: or <code class="filename">${.CURDIR}/work.${MACHINE_ARCH}</code>
4102: if <code class="varname">OBJMACHINE</code> is set.</p>
1.91 rillig 4103: </div>
1.299 rillig 4104: <div class="sect1">
4105: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
4106: <a name="files-dir"></a>12.7. <code class="filename">files/*</code>
4107: </h2></div></div></div>
4108: <p>If you have any files that you wish to be placed in the package
4109: prior to configuration or building, you can place these files here
4110: and use a <span class="command"><strong>${CP}</strong></span> command in the
4111: <span class="quote">“<span class="quote">post-extract</span>”</span> target to achieve this.</p>
4112: <p>If you want to share files in this way with other
4113: packages, set the <code class="varname">FILESDIR</code> variable to point
4114: to the other package's <code class="filename">files</code> directory,
4115: e.g.:</p>
1.91 rillig 4116: <pre class="programlisting">
1.299 rillig 4117: FILESDIR= ../../editors/xemacs/files
1.91 rillig 4118: </pre>
4119: </div>
4120: </div>
1.148 asau 4121: <div class="chapter">
1.75 rillig 4122: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 4123: <a name="build"></a>Chapter 13. The build process</h2></div></div></div>
1.75 rillig 4124: <div class="toc">
4125: <p><b>Table of Contents</b></p>
1.210 leot 4126: <dl class="toc">
1.299 rillig 4127: <dt><span class="sect1"><a href="#build.intro">13.1. Introduction</a></span></dt>
4128: <dt><span class="sect1"><a href="#build.prefix">13.2. Program location</a></span></dt>
4129: <dt><span class="sect1"><a href="#build.builddirs">13.3. Directories used during the build process</a></span></dt>
4130: <dt><span class="sect1"><a href="#build.running">13.4. Running a phase</a></span></dt>
4131: <dt><span class="sect1"><a href="#build.fetch">13.5. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
4132: <dd><dl>
4133: <dt><span class="sect2"><a href="#build.fetch.what">13.5.1. What to fetch and where to get it from</a></span></dt>
4134: <dt><span class="sect2"><a href="#build.fetch.how">13.5.2. How are the files fetched?</a></span></dt>
4135: </dl></dd>
4136: <dt><span class="sect1"><a href="#build.checksum">13.6. The <span class="emphasis"><em>checksum</em></span> phase</a></span></dt>
4137: <dt><span class="sect1"><a href="#build.extract">13.7. The <span class="emphasis"><em>extract</em></span> phase</a></span></dt>
4138: <dt><span class="sect1"><a href="#build.patch">13.8. The <span class="emphasis"><em>patch</em></span> phase</a></span></dt>
4139: <dt><span class="sect1"><a href="#build.tools">13.9. The <span class="emphasis"><em>tools</em></span> phase</a></span></dt>
4140: <dt><span class="sect1"><a href="#build.wrapper">13.10. The <span class="emphasis"><em>wrapper</em></span> phase</a></span></dt>
4141: <dt><span class="sect1"><a href="#build.configure">13.11. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
4142: <dt><span class="sect1"><a href="#build.build">13.12. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
4143: <dt><span class="sect1"><a href="#build.test">13.13. The <span class="emphasis"><em>test</em></span> phase</a></span></dt>
4144: <dt><span class="sect1"><a href="#build.install">13.14. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
4145: <dt><span class="sect1"><a href="#build.package">13.15. The <span class="emphasis"><em>package</em></span> phase</a></span></dt>
4146: <dt><span class="sect1"><a href="#build.clean">13.16. Cleaning up</a></span></dt>
4147: <dt><span class="sect1"><a href="#build.helpful-targets">13.17. Other helpful targets</a></span></dt>
1.75 rillig 4148: </dl>
4149: </div>
1.148 asau 4150: <div class="sect1">
1.75 rillig 4151: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4152: <a name="build.intro"></a>13.1. Introduction</h2></div></div></div>
4153: <p>This chapter gives a detailed description on how a package is
4154: built. Building a package is separated into different
4155: <span class="emphasis"><em>phases</em></span> (for example <code class="varname">fetch</code>,
4156: <code class="varname">build</code>, <code class="varname">install</code>), all of which are
4157: described in the following sections. Each phase is split into
4158: so-called <span class="emphasis"><em>stages</em></span>, which take the name of the
4159: containing phase, prefixed by one of <code class="varname">pre-</code>,
4160: <code class="varname">do-</code> or <code class="varname">post-</code>. (Examples are
4161: <code class="varname">pre-configure</code>, <code class="varname">post-build</code>.) Most
4162: of the actual work is done in the <code class="varname">do-*</code> stages.</p>
4163: <p>Never override the regular targets (like
4164: <code class="varname">fetch</code>), if you have to, override the
4165: <code class="varname">do-*</code> ones instead.</p>
4166: <p>The basic steps for building a program are always the same. First
4167: the program's source (<span class="emphasis"><em>distfile</em></span>) must be brought to
4168: the local system and then extracted. After any pkgsrc-specific patches
4169: to compile properly are applied, the software can be configured, then
4170: built (usually by compiling), and finally the generated binaries, etc.
4171: can be put into place on the system.</p>
4172: <p>To get more details about what is happening at each step,
4173: you can set the <code class="varname">PKG_VERBOSE</code> variable, or the
4174: <code class="varname">PATCH_DEBUG</code> variable if you are just interested
4175: in more details about the <span class="emphasis"><em>patch</em></span> step.</p>
4176: </div>
4177: <div class="sect1">
4178: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
4179: <a name="build.prefix"></a>13.2. Program location</h2></div></div></div>
4180: <p>Before outlining the process performed by the NetBSD package system in
4181: the next section, here's a brief discussion on where programs are
4182: installed, and which variables influence this.</p>
4183: <p>The automatic variable <code class="varname">PREFIX</code> indicates
4184: where all files of the final program shall be installed. It is
4185: usually set to <code class="varname">LOCALBASE</code>
4186: (<code class="filename">/usr/pkg</code>), or <code class="varname">CROSSBASE</code>
4187: for pkgs in the <code class="filename">cross</code> category. The value of
4188: <code class="varname">PREFIX</code> needs to be put
4189: into the various places in the program's source where paths to
4190: these files are encoded. See <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, “<code class="filename">patches/*</code>”</a> and <a class="xref" href="#fixes.libtool" title="21.3.1. Shared libraries - libtool">Section 21.3.1, “Shared libraries - libtool”</a> for more details.</p>
4191: <p>When choosing which of these variables to use,
4192: follow the following rules:</p>
1.148 asau 4193: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.299 rillig 4194: <li class="listitem"><p><code class="varname">PREFIX</code> always points to the location
4195: where the current pkg will be installed. When referring to a
4196: pkg's own installation path, use
4197: <span class="quote">“<span class="quote">${PREFIX}</span>”</span>.</p></li>
1.338 nia 4198: <li class="listitem"><p><code class="varname">LOCALBASE</code> is where all pkgs
1.299 rillig 4199: are installed. If you need to construct a -I or -L argument
4200: to the compiler to find includes and libraries installed by
1.338 nia 4201: another pkg, use <span class="quote">“<span class="quote">${LOCALBASE}</span>”</span>. The name
1.299 rillig 4202: <code class="varname">LOCALBASE</code> stems from FreeBSD, which
4203: installed all packages in <code class="filename">/usr/local</code>. As
4204: pkgsrc leaves <code class="filename">/usr/local</code> for the system
4205: administrator, this variable is a misnomer.</p></li>
4206: <li class="listitem"><p><code class="varname">X11BASE</code> is where the actual X11
4207: distribution (from xsrc, etc.) is installed. When looking for
4208: <span class="emphasis"><em>standard</em></span> X11 includes (not those
4209: installed by a package), use <span class="quote">“<span class="quote">${X11BASE}</span>”</span>.</p></li>
4210: <li class="listitem"><p>X11-based packages using imake must set
4211: <code class="varname">USE_IMAKE</code> to be installed correctly under
4212: <code class="varname">LOCALBASE</code>.</p></li>
4213: <li class="listitem"><p>Within <code class="filename">${PREFIX}</code>, packages should
1.322 leot 4214: 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 4215: manual pages go into <code class="filename">${PREFIX}/man</code>, not
4216: <code class="filename">${PREFIX}/share/man</code>.</p></li>
4217: </ul></div>
4218: </div>
4219: <div class="sect1">
4220: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
4221: <a name="build.builddirs"></a>13.3. Directories used during the build process</h2></div></div></div>
4222: <p>When building a package, various directories are used to store
4223: source files, temporary files, pkgsrc-internal files, and so on. These
4224: directories are explained here.</p>
4225: <p>Some of the directory variables contain relative pathnames. There
4226: are two common base directories for these relative directories:
4227: <code class="varname">PKGSRCDIR/PKGPATH</code> is used for directories that are
4228: pkgsrc-specific. <code class="varname">WRKSRC</code> is used for directories
4229: inside the package itself.</p>
4230: <div class="variablelist"><dl class="variablelist">
4231: <dt><span class="term"><code class="varname">PKGSRCDIR</code></span></dt>
4232: <dd><p>This is an absolute pathname that points to the pkgsrc
4233: root directory. Generally, you don't need
4234: it.</p></dd>
4235: <dt><span class="term"><code class="varname">PKGDIR</code></span></dt>
4236: <dd><p>This is an absolute pathname that points to the
4237: current package.</p></dd>
4238: <dt><span class="term"><code class="varname">PKGPATH</code></span></dt>
1.343 gutterid 4239: <dd>
4240: <p>This is a pathname relative to
4241: <code class="varname">PKGSRCDIR</code> that points to the current package.
4242: It is defined after including <code class="filename">bsd.prefs.mk</code>
4243: and can be used in makefile fragments that are used by several
4244: packages to distinguish between these packages. Other variables
4245: that would serve the same purpose are <code class="varname">PKGBASE</code>
4246: and <code class="varname">PKGNAME</code>, but these are only defined after
4247: including <code class="filename">bsd.pkg.mk</code>, which is too
4248: late.</p>
4249: <p>In <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>, the pkgsrc user can use
4250: <code class="varname">PKGPATH</code> to tweak variables like
4251: <code class="varname">MAKE_JOBS</code> and
4252: <code class="varname">CFLAGS</code>.</p>
4253: </dd>
1.299 rillig 4254: <dt><span class="term"><code class="varname">WRKDIR</code></span></dt>
4255: <dd><p>This is an absolute pathname pointing to the directory
4256: where all work takes place. The distfiles are extracted to this
4257: directory. It also contains temporary directories and log files used by
4258: the various pkgsrc frameworks, like <span class="emphasis"><em>buildlink</em></span> or
4259: the <span class="emphasis"><em>wrappers</em></span>.</p></dd>
4260: <dt><span class="term"><code class="varname">WRKSRC</code></span></dt>
4261: <dd><p>This is an absolute pathname pointing to the directory
4262: where the distfiles are extracted. It is usually a direct subdirectory
4263: of <code class="varname">WRKDIR</code>, and often it's the only directory entry
4264: that isn't hidden. This variable may be changed by a package
4265: <code class="filename">Makefile</code>.</p></dd>
4266: </dl></div>
4267: <p>The <code class="varname">CREATE_WRKDIR_SYMLINK</code> definition takes either
4268: the value <span class="emphasis"><em>yes</em></span> or <span class="emphasis"><em>no</em></span> and defaults
4269: to <span class="emphasis"><em>no</em></span>. It indicates whether a symbolic link to the
4270: <code class="varname">WRKDIR</code> is to be created in the pkgsrc entry's directory.
4271: If users would like to have their pkgsrc trees behave in a
4272: read-only manner, then the value of
4273: <code class="varname">CREATE_WRKDIR_SYMLINK</code> should be set to
4274: <span class="emphasis"><em>no</em></span>.</p>
1.75 rillig 4275: </div>
1.148 asau 4276: <div class="sect1">
1.75 rillig 4277: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4278: <a name="build.running"></a>13.4. Running a phase</h2></div></div></div>
4279: <p>You can run a particular phase by typing <span class="command"><strong>make
1.343 gutterid 4280: <em class="replaceable"><code>phase</code></em></strong></span>, where
4281: <em class="replaceable"><code>phase</code></em> is the name of the phase. This will
4282: automatically run all phases that are required for this phase. The
4283: default phase is <code class="varname">build</code>, that is, when you run
4284: <span class="command"><strong>make</strong></span> without parameters in a package directory,
1.299 rillig 4285: the package will be built, but not installed.</p>
1.75 rillig 4286: </div>
1.148 asau 4287: <div class="sect1">
1.75 rillig 4288: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4289: <a name="build.fetch"></a>13.5. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
4290: <p>The first step in building a package is to fetch the
4291: distribution files (distfiles) from the sites that are providing
4292: them. This is the task of the <span class="emphasis"><em>fetch</em></span>
4293: phase.</p>
1.148 asau 4294: <div class="sect2">
1.93 rillig 4295: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 4296: <a name="build.fetch.what"></a>13.5.1. What to fetch and where to get it from</h3></div></div></div>
4297: <p>In simple cases, <code class="varname">MASTER_SITES</code>
4298: defines all URLs from where the distfile, whose name is
4299: derived from the <code class="varname">DISTNAME</code> variable, is
4300: fetched. The more complicated cases are described
4301: below.</p>
4302: <p>The variable <code class="varname">DISTFILES</code> specifies
4303: the list of distfiles that have to be fetched. Its value
4304: defaults to <code class="literal">${DEFAULT_DISTFILES}</code> and
4305: its value is <code class="literal">${DISTNAME}${EXTRACT_SUFX}</code>,
4306: so that most packages don't need to define it at all.
4307: <code class="varname">EXTRACT_SUFX</code> is
4308: <code class="literal">.tar.gz</code> by default, but can be changed
4309: freely. Note that if your package requires additional
4310: distfiles to the default one, you cannot just append the
4311: additional filenames using the <code class="literal">+=</code>
4312: operator, but you have write for example:</p>
4313: <pre class="programlisting">
4314: DISTFILES= ${DEFAULT_DISTFILES} additional-files.tar.gz
4315: </pre>
4316: <p>Each distfile is fetched from a list of sites, usually
4317: <code class="varname">MASTER_SITES</code>. If the package has multiple
4318: <code class="varname">DISTFILES</code> or multiple
4319: <code class="varname">PATCHFILES</code> from different sites, you can
4320: set
4321: <code class="varname">SITES.<em class="replaceable"><code>distfile</code></em></code>
4322: to the list of URLs where the file
4323: <code class="filename"><em class="replaceable"><code>distfile</code></em></code>
4324: (including the suffix) can be found.</p>
4325: <pre class="programlisting">
4326: DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
4327: DISTFILES+= foo-file.tar.gz
4328: SITES.foo-file.tar.gz= \
4329: https://www.somewhere.com/somehow/ \
4330: https://www.somewhereelse.com/mirror/somehow/
4331: </pre>
4332: <p>When actually fetching the distfiles, each item from
4333: <code class="varname">MASTER_SITES</code> or
4334: <code class="varname">SITES.*</code> gets the name of each distfile
4335: appended to it, without an intermediate slash. Therefore,
4336: all site values have to end with a slash or other separator
4337: character. This allows for example to set
4338: <code class="varname">MASTER_SITES</code> to a URL of a CGI script
4339: that gets the name of the distfile as a parameter. In this
4340: case, the definition would look like:</p>
4341: <pre class="programlisting">
4342: MASTER_SITES= https://www.example.com/download.cgi?file=
4343: </pre>
4344: <p> The exception to this rule are URLs starting with a dash.
4345: In that case the URL is taken as is, fetched and the result
4346: stored under the name of the distfile. You can use this style
4347: for the case when the download URL style does not match the
4348: above common case. For example, if permanent download URL is a
4349: redirector to the real download URL, or the download file name
4350: is offered by an HTTP Content-Disposition header. In the
4351: following example, <code class="filename">foo-1.0.0.tar.gz</code> will be
4352: created instead of the default
4353: <code class="filename">v1.0.0.tar.gz</code>.</p>
4354: <pre class="programlisting">
4355: DISTNAME= foo-1.0.0
4356: MASTER_SITES= -https://www.example.com/archive/v1.0.0.tar.gz
4357: </pre>
4358: <p>There are some predefined values for
4359: <code class="varname">MASTER_SITES</code>, which can be used in
4360: packages. The names of the variables should speak for
4361: themselves.</p>
4362: <table border="0" summary="Simple list" class="simplelist">
4363: <tr>
4364: <td>MASTER_SITE_APACHE</td>
4365: <td>MASTER_SITE_BACKUP</td>
4366: </tr>
4367: <tr>
4368: <td>MASTER_SITE_CRATESIO</td>
4369: <td>MASTER_SITE_CYGWIN</td>
4370: </tr>
4371: <tr>
4372: <td>MASTER_SITE_DEBIAN</td>
4373: <td>MASTER_SITE_FREEBSD</td>
4374: </tr>
4375: <tr>
4376: <td>MASTER_SITE_FREEBSD_LOCAL</td>
4377: <td>MASTER_SITE_GENTOO</td>
4378: </tr>
4379: <tr>
4380: <td>MASTER_SITE_GITHUB</td>
1.340 gutterid 4381: <td>MASTER_SITE_GITLAB</td>
4382: </tr>
4383: <tr>
1.299 rillig 4384: <td>MASTER_SITE_GNOME</td>
1.340 gutterid 4385: <td>MASTER_SITE_GNU</td>
1.299 rillig 4386: </tr>
4387: <tr>
4388: <td>MASTER_SITE_GNUSTEP</td>
1.340 gutterid 4389: <td>MASTER_SITE_HASKELL_HACKAGE</td>
1.299 rillig 4390: </tr>
4391: <tr>
4392: <td>MASTER_SITE_IFARCHIVE</td>
1.340 gutterid 4393: <td>MASTER_SITE_KDE</td>
1.299 rillig 4394: </tr>
4395: <tr>
4396: <td>MASTER_SITE_MOZILLA</td>
1.340 gutterid 4397: <td>MASTER_SITE_MOZILLA_ALL</td>
1.299 rillig 4398: </tr>
4399: <tr>
4400: <td>MASTER_SITE_MYSQL</td>
1.340 gutterid 4401: <td>MASTER_SITE_NETLIB</td>
1.299 rillig 4402: </tr>
4403: <tr>
4404: <td>MASTER_SITE_OPENBSD</td>
1.340 gutterid 4405: <td>MASTER_SITE_OPENOFFICE</td>
1.299 rillig 4406: </tr>
4407: <tr>
4408: <td>MASTER_SITE_OSDN</td>
1.340 gutterid 4409: <td>MASTER_SITE_PERL_CPAN</td>
1.299 rillig 4410: </tr>
4411: <tr>
4412: <td>MASTER_SITE_PGSQL</td>
1.340 gutterid 4413: <td>MASTER_SITE_PYPI</td>
1.299 rillig 4414: </tr>
4415: <tr>
4416: <td>MASTER_SITE_RUBYGEMS</td>
1.340 gutterid 4417: <td>MASTER_SITE_R_CRAN</td>
1.299 rillig 4418: </tr>
4419: <tr>
4420: <td>MASTER_SITE_SOURCEFORGE</td>
1.340 gutterid 4421: <td>MASTER_SITE_SUNSITE</td>
1.299 rillig 4422: </tr>
1.85 jmmv 4423: <tr>
1.299 rillig 4424: <td>MASTER_SITE_SUSE</td>
1.340 gutterid 4425: <td>MASTER_SITE_TEX_CTAN</td>
1.85 jmmv 4426: </tr>
4427: <tr>
1.299 rillig 4428: <td>MASTER_SITE_XCONTRIB</td>
1.340 gutterid 4429: <td>MASTER_SITE_XEMACS</td>
1.85 jmmv 4430: </tr>
4431: <tr>
1.299 rillig 4432: <td>MASTER_SITE_XORG</td>
1.340 gutterid 4433: <td> </td>
1.299 rillig 4434: </tr>
4435: </table>
4436: <p>Some explanations for the less self-explaining ones:
4437: <code class="varname">MASTER_SITE_BACKUP</code> contains backup sites
4438: 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
4439: 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>
4440: <p>If you choose one of these predefined sites, you may
4441: want to specify a subdirectory of that site. Since these
4442: macros may expand to more than one actual site, you
4443: <span class="emphasis"><em>must</em></span> use the following construct to
4444: specify a subdirectory:</p>
1.100 rillig 4445: <pre class="programlisting">
1.299 rillig 4446: MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/}
4447: MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/}
1.100 rillig 4448: </pre>
1.299 rillig 4449: <p>Note the trailing slash after the subdirectory
4450: name.</p>
4451: </div>
4452: <div class="sect2">
4453: <div class="titlepage"><div><div><h3 class="title">
4454: <a name="build.fetch.how"></a>13.5.2. How are the files fetched?</h3></div></div></div>
4455: <p>The <span class="emphasis"><em>fetch</em></span> phase makes sure that
4456: all the distfiles exist in a local directory
4457: (<code class="varname">DISTDIR</code>, which can be set by the pkgsrc
4458: user). If the files do not exist, they are fetched using
4459: commands of the form</p>
1.100 rillig 4460: <pre class="programlisting">
1.299 rillig 4461: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
4462: </pre>
4463: <p>where <code class="literal">${site}</code> varies through
4464: several possibilities in turn: first,
4465: <code class="varname">MASTER_SITE_OVERRIDE</code> is tried, then the
4466: sites specified in either <code class="varname">SITES.file</code> if
4467: defined, else <code class="varname">MASTER_SITES</code> or
4468: <code class="varname">PATCH_SITES</code>, as applies, then finally the
4469: value of <code class="varname">MASTER_SITE_BACKUP</code>. The order of
4470: all except the first and the last can be optionally sorted
4471: by the user, via setting either
4472: <code class="varname">MASTER_SORT_RANDOM</code>, and
4473: <code class="varname">MASTER_SORT_AWK</code> or
4474: <code class="varname">MASTER_SORT_REGEX</code>.</p>
4475: <p> The specific command and arguments used depend on the
4476: <code class="varname">FETCH_USING</code> parameter. The example above is
4477: for <code class="literal">FETCH_USING=custom</code>.</p>
4478: <p>The distfiles mirror run by the NetBSD Foundation uses the
4479: <span class="emphasis"><em>mirror-distfiles</em></span> target to mirror the
4480: distfiles, if they are freely distributable. Packages setting
4481: <code class="varname">NO_SRC_ON_FTP</code> (usually to
4482: <span class="quote">“<span class="quote">${RESTRICTED}</span>”</span>) will not have their distfiles
4483: mirrored.</p>
1.85 jmmv 4484: </div>
4485: </div>
1.299 rillig 4486: <div class="sect1">
4487: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
4488: <a name="build.checksum"></a>13.6. The <span class="emphasis"><em>checksum</em></span> phase</h2></div></div></div>
4489: <p>After the distfile(s) are fetched, their checksum is
4490: generated and compared with the checksums stored in the
4491: distinfo file. If the checksums don't match, the build is
4492: aborted. This is to ensure the same distfile is used for
4493: building, and that the distfile wasn't changed, e.g. by some
4494: malign force, deliberately changed distfiles on the master
4495: distribution site or network lossage.</p>
1.75 rillig 4496: </div>
1.148 asau 4497: <div class="sect1">
1.75 rillig 4498: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4499: <a name="build.extract"></a>13.7. The <span class="emphasis"><em>extract</em></span> phase</h2></div></div></div>
4500: <p>When the distfiles are present on the local system, they
4501: need to be extracted, as they usually come in the form of some
4502: compressed archive format.</p>
4503: <p>By default, all <code class="varname">DISTFILES</code> are
4504: extracted. If you only need some of them, you can set the
4505: <code class="varname">EXTRACT_ONLY</code> variable to the list of those
4506: files.</p>
4507: <p>Extracting the files is usually done by a little
4508: program, <code class="filename">mk/extract/extract</code>, which
4509: already knows how to extract various archive formats, so most
4510: likely you will not need to change anything here. But if you
4511: need, the following variables may help you:</p>
1.148 asau 4512: <div class="variablelist"><dl class="variablelist">
1.299 rillig 4513: <dt><span class="term"><code class="varname">EXTRACT_OPTS_{BIN,LHA,PAX,RAR,TAR,ZIP,ZOO}</code></span></dt>
4514: <dd><p>Use these variables to override the default
4515: options for an extract command, which are defined in
4516: <code class="filename">mk/extract/extract</code>.</p></dd>
4517: <dt><span class="term"><code class="varname">EXTRACT_USING</code></span></dt>
4518: <dd><p>This variable can be set to
4519: <code class="literal">bsdtar</code>, <code class="literal">gtar</code>, <code class="literal">nbtar</code>
4520: (which is the default value), <code class="literal">pax</code>, or an
4521: absolute pathname pointing to the command with which tar
4522: archives should be extracted. It is preferred to choose bsdtar over gtar
4523: if NetBSD's pax-as-tar is not good enough.</p></dd>
1.75 rillig 4524: </dl></div>
1.299 rillig 4525: <p>If the <code class="filename">extract</code> program doesn't
4526: serve your needs, you can also override the
4527: <code class="varname">EXTRACT_CMD</code> variable, which holds the
4528: command used for extracting the files. This command is
4529: executed in the <code class="filename">${WRKSRC}</code>
4530: directory. During execution of this command, the shell
4531: variable <code class="varname">extract_file</code> holds the absolute
4532: pathname of the file that is going to be extracted.</p>
4533: <p>And if that still does not suffice, you can override the
4534: <code class="varname">do-extract</code> target in the package
4535: Makefile.</p>
1.75 rillig 4536: </div>
1.148 asau 4537: <div class="sect1">
1.75 rillig 4538: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4539: <a name="build.patch"></a>13.8. The <span class="emphasis"><em>patch</em></span> phase</h2></div></div></div>
4540: <p>After extraction, all the patches named by the
4541: <code class="varname">PATCHFILES</code>, those present in the patches
4542: subdirectory of the package as well as in
4543: $LOCALPATCHES/$PKGPATH (e.g.
4544: <code class="filename">/usr/local/patches/graphics/png</code>) are
4545: applied. Patchfiles ending in <code class="filename">.Z</code> or
4546: <code class="filename">.gz</code> are uncompressed before they are
4547: applied, files ending in <code class="filename">.orig</code> or
4548: <code class="filename">.rej</code> are ignored. Any special options to
1.322 leot 4549: <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 4550: <code class="varname">PATCH_DIST_ARGS</code>. See <a class="xref" href="#components.patches" title="12.3. patches/*">Section 12.3, “<code class="filename">patches/*</code>”</a> for more details.</p>
1.322 leot 4551: <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 4552: fail if the expected text from the patch context is not found in the
4553: patched file. If that happens, fix the patch file by comparing it
4554: with the actual text in the file to be patched.</p>
1.78 rillig 4555: </div>
1.148 asau 4556: <div class="sect1">
1.75 rillig 4557: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4558: <a name="build.tools"></a>13.9. The <span class="emphasis"><em>tools</em></span> phase</h2></div></div></div>
4559: <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>.
4560: </p>
1.75 rillig 4561: </div>
1.148 asau 4562: <div class="sect1">
1.75 rillig 4563: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4564: <a name="build.wrapper"></a>13.10. The <span class="emphasis"><em>wrapper</em></span> phase</h2></div></div></div>
4565: <p>This phase creates wrapper programs for the compilers and
4566: linkers. The following variables can be used to tweak the
4567: wrappers.</p>
4568: <div class="variablelist"><dl class="variablelist">
4569: <dt><span class="term"><code class="varname">ECHO_WRAPPER_MSG</code></span></dt>
4570: <dd><p>The command used to print progress
4571: messages. Does nothing by default. Set to
4572: <code class="literal">${ECHO}</code> to see the progress
4573: messages.</p></dd>
4574: <dt><span class="term"><code class="varname">WRAPPER_DEBUG</code></span></dt>
4575: <dd><p>This variable can be set to
4576: <code class="literal">yes</code> (default) or <code class="literal">no</code>,
4577: depending on whether you want additional information in the
4578: wrapper log file.</p></dd>
4579: <dt><span class="term"><code class="varname">WRAPPER_UPDATE_CACHE</code></span></dt>
4580: <dd><p>This variable can be set to
4581: <code class="literal">yes</code> or <code class="literal">no</code>, depending
4582: on whether the wrapper should use its cache, which will
4583: improve the speed. The default value is
4584: <code class="literal">yes</code>, but is forced to
4585: <code class="literal">no</code> if the platform does not support
4586: it.</p></dd>
4587: <dt><span class="term"><code class="varname">WRAPPER_REORDER_CMDS</code></span></dt>
4588: <dd><p>A list of reordering commands. A reordering
4589: command has the form
4590: <code class="literal">reorder:l:<em class="replaceable"><code>lib1</code></em>:<em class="replaceable"><code>lib2</code></em></code>.
4591: It ensures that that
4592: <code class="literal">-l<em class="replaceable"><code>lib1</code></em></code> occurs
4593: before <code class="literal">-l<em class="replaceable"><code>lib2</code></em></code>.
4594: </p></dd>
4595: </dl></div>
4596: </div>
4597: <div class="sect1">
4598: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
4599: <a name="build.configure"></a>13.11. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
4600: <p>Most pieces of software need information on the header
4601: files, system calls, and library routines which are available
4602: on the platform they run on. The process of determining this
4603: information is known as configuration, and is usually
4604: automated. In most cases, a script is supplied with the
4605: distfiles, and its invocation results in generation of header
4606: files, Makefiles, etc.</p>
4607: <p>If the package contains a configure script, this can be
4608: invoked by setting <code class="varname">HAS_CONFIGURE</code> to
4609: <span class="quote">“<span class="quote">yes</span>”</span>. If the configure script is a GNU autoconf
4610: script, you should set <code class="varname">GNU_CONFIGURE</code> to
1.301 rillig 4611: <span class="quote">“<span class="quote">yes</span>”</span> instead.</p>
4612: <p>In the <code class="literal">do-configure</code> stage, a rough
4613: equivalent of the following command is run. See
4614: <code class="filename">mk/configure/configure.mk</code>, target
4615: <code class="literal">do-configure-script</code> for the exact
4616: definition.</p>
4617: <pre class="programlisting">
4618: .for dir in ${CONFIGURE_DIRS}
4619: cd ${WRKSRC} && cd ${dir} \
4620: && env ${CONFIGURE_ENV} \
4621: ${CONFIG_SHELL} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
1.299 rillig 4622: .endfor
1.100 rillig 4623: </pre>
1.299 rillig 4624: <p><code class="varname">CONFIGURE_DIRS</code> (default:
4625: <span class="quote">“<span class="quote">.</span>”</span>) is a list of pathnames relative to
4626: <code class="varname">WRKSRC</code>. In each of these directories, the
4627: configure script is run with the environment
4628: <code class="varname">CONFIGURE_ENV</code> and arguments
4629: <code class="varname">CONFIGURE_ARGS</code>. The variables
4630: <code class="varname">CONFIGURE_ENV</code>,
4631: <code class="varname">CONFIGURE_SCRIPT</code> (default:
4632: <span class="quote">“<span class="quote">./configure</span>”</span>) and
4633: <code class="varname">CONFIGURE_ARGS</code> may all be changed by the
4634: package.</p>
4635: <p>If the program uses the Perl way of configuration (mainly Perl
4636: modules, but not only), i.e. a file called
4637: <code class="filename">Makefile.PL</code>, it should include
4638: <code class="filename">../../lang/perl5/module.mk</code>. To set any parameter for
4639: <code class="filename">Makefile.PL</code> use the <code class="varname">MAKE_PARAMS</code>
4640: variable (e.g., <code class="literal">MAKE_PARAMS+=foo=bar</code></p>
4641: <p>If the program uses an <code class="filename">Imakefile</code>
4642: for configuration, the appropriate steps can be invoked by
4643: setting <code class="varname">USE_IMAKE</code> to
4644: <span class="quote">“<span class="quote">yes</span>”</span>. If you only need xmkmf, add it to <code class="varname">USE_TOOLS</code>.
4645: You can add variables to xmkmf's environment by adding them to the
4646: <code class="varname">SCRIPTS_ENV</code> variable.</p>
4647: <p>If the program uses <code class="filename">cmake</code>
4648: for configuration, the appropriate steps can be invoked by
1.348 wiz 4649: including <code class="filename">../../devel/cmake/build.mk</code>.
1.299 rillig 4650: You can add variables to cmake's environment by adding them to the
4651: <code class="varname">CONFIGURE_ENV</code> variable and arguments to cmake
4652: by adding them to the <code class="varname">CMAKE_ARGS</code> variable.
1.348 wiz 4653: If you want to add arguments only for particular stages, you can use the
4654: <code class="varname">CMAKE_CONFIGURE_ARGS</code>,
4655: <code class="varname">CMAKE_BUILD_ARGS</code>, and
4656: <code class="varname">CMAKE_INSTALL_ARGS</code> variables.
4657: You can set the <code class="varname">CONFIGURE_DIRS</code> variable to the
4658: directories in which CMake should be run, relative to
4659: <code class="varname">WRKSRC</code>. This defaults to to <span class="quote">“<span class="quote">.</span>”</span>.
4660: </p>
1.299 rillig 4661: <p>If there is no configure step at all, set
4662: <code class="varname">NO_CONFIGURE</code> to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
1.75 rillig 4663: </div>
1.148 asau 4664: <div class="sect1">
1.75 rillig 4665: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4666: <a name="build.build"></a>13.12. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.301 rillig 4667: <p>For building a package, a rough equivalent of the following
4668: code is executed; see <code class="filename">mk/build/build.mk</code>, target
4669: <code class="literal">do-build</code> for the exact definition.</p>
1.97 rillig 4670: <pre class="programlisting">
1.301 rillig 4671: .for dir in ${BUILD_DIRS}
4672: cd ${WRKSRC} && cd ${dir} \
1.299 rillig 4673: && env ${MAKE_ENV} \
1.301 rillig 4674: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${BUILD_MAKE_FLAGS} \
1.299 rillig 4675: -f ${MAKE_FILE} \
4676: ${BUILD_TARGET}
4677: .endfor
1.97 rillig 4678: </pre>
1.299 rillig 4679: <p><code class="varname">BUILD_DIRS</code> (default:
4680: <span class="quote">“<span class="quote">.</span>”</span>) is a list of pathnames relative to
4681: <code class="varname">WRKSRC</code>. In each of these directories,
4682: <code class="varname">MAKE_PROGRAM</code> is run with the environment
4683: <code class="varname">MAKE_ENV</code> and arguments
4684: <code class="varname">BUILD_MAKE_FLAGS</code>. The variables
4685: <code class="varname">MAKE_ENV</code>,
4686: <code class="varname">BUILD_MAKE_FLAGS</code>,
4687: <code class="varname">MAKE_FILE</code> and
4688: <code class="varname">BUILD_TARGET</code> may all be changed by the
4689: package.</p>
4690: <p>The default value of <code class="varname">MAKE_PROGRAM</code> is
4691: <span class="quote">“<span class="quote">gmake</span>”</span> if <code class="varname">USE_TOOLS</code> contains
4692: <span class="quote">“<span class="quote">gmake</span>”</span>, <span class="quote">“<span class="quote">make</span>”</span> otherwise. The
4693: default value of <code class="varname">MAKE_FILE</code> is
4694: <span class="quote">“<span class="quote">Makefile</span>”</span>, and <code class="varname">BUILD_TARGET</code>
4695: defaults to <span class="quote">“<span class="quote">all</span>”</span>.</p>
4696: <p>If there is no build step at all, set
4697: <code class="varname">NO_BUILD</code> to <span class="quote">“<span class="quote">yes</span>”</span>.</p>
1.97 rillig 4698: </div>
1.148 asau 4699: <div class="sect1">
1.97 rillig 4700: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4701: <a name="build.test"></a>13.13. The <span class="emphasis"><em>test</em></span> phase</h2></div></div></div>
4702: <p>[TODO]</p>
1.75 rillig 4703: </div>
1.148 asau 4704: <div class="sect1">
1.75 rillig 4705: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4706: <a name="build.install"></a>13.14. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
4707: <p>Once the build stage has completed, the final step is to
4708: install the software in public directories, so users can
4709: access the programs and files.</p>
1.301 rillig 4710: <p>In the <span class="emphasis"><em>install</em></span> phase, a rough equivalent
4711: of the following code is executed; see
4712: <code class="filename">mk/install/install.mk</code>, target
4713: <code class="literal">do-install</code> for the exact definition. Additionally,
4714: before and after this code, several consistency checks are run
4715: against the files-to-be-installed, see
4716: <code class="filename">mk/check/*.mk</code> for details.</p>
4717: <pre class="programlisting">
4718: .for dir in ${INSTALL_DIRS}
4719: cd ${WRKSRC} && cd ${dir} \
4720: && env ${INSTALL_ENV} ${MAKE_ENV} \
4721: ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
4722: -f ${MAKE_FILE} ${INSTALL_TARGET}
1.299 rillig 4723: .endfor
1.220 wiz 4724: </pre>
1.299 rillig 4725: <p>The variable's meanings are analogous to the ones in the
4726: <span class="emphasis"><em>build</em></span> phase.
4727: <code class="varname">INSTALL_DIRS</code> defaults to
4728: <code class="varname">BUILD_DIRS</code>. <code class="varname">INSTALL_TARGET</code>
4729: is <span class="quote">“<span class="quote">install</span>”</span> by default, plus
4730: <span class="quote">“<span class="quote">install.man</span>”</span> if <code class="varname">USE_IMAKE</code> is
4731: defined and <code class="varname">NO_INSTALL_MANPAGES</code> is not
4732: defined.</p>
4733: <p>In the <span class="emphasis"><em>install</em></span> phase, the following
4734: variables are useful. They are all variations of the
1.322 leot 4735: <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 4736: permissions preset. <code class="varname">INSTALL</code> is the plain
4737: install command. The specialized variants, together with their
4738: intended use, are:</p>
4739: <div class="variablelist"><dl class="variablelist">
4740: <dt><span class="term"><code class="varname">INSTALL_PROGRAM_DIR</code></span></dt>
4741: <dd><p>directories that contain
4742: binaries</p></dd>
4743: <dt><span class="term"><code class="varname">INSTALL_SCRIPT_DIR</code></span></dt>
4744: <dd><p>directories that contain
4745: scripts</p></dd>
4746: <dt><span class="term"><code class="varname">INSTALL_LIB_DIR</code></span></dt>
4747: <dd><p>directories that contain shared and static
4748: libraries</p></dd>
4749: <dt><span class="term"><code class="varname">INSTALL_DATA_DIR</code></span></dt>
4750: <dd><p>directories that contain data
4751: files</p></dd>
4752: <dt><span class="term"><code class="varname">INSTALL_MAN_DIR</code></span></dt>
4753: <dd><p>directories that contain man
4754: pages</p></dd>
4755: <dt><span class="term"><code class="varname">INSTALL_GAME_DIR</code></span></dt>
4756: <dd><p>directories that contain data files for games
4757: </p></dd>
4758: <dt><span class="term"><code class="varname">INSTALL_PROGRAM</code></span></dt>
4759: <dd><p>binaries that can be stripped from debugging
4760: symbols</p></dd>
4761: <dt><span class="term"><code class="varname">INSTALL_SCRIPT</code></span></dt>
4762: <dd><p>binaries that cannot be
4763: stripped</p></dd>
4764: <dt><span class="term"><code class="varname">INSTALL_GAME</code></span></dt>
4765: <dd><p>game
4766: binaries</p></dd>
4767: <dt><span class="term"><code class="varname">INSTALL_LIB</code></span></dt>
4768: <dd><p>shared and static
4769: libraries</p></dd>
4770: <dt><span class="term"><code class="varname">INSTALL_DATA</code></span></dt>
4771: <dd><p>data files</p></dd>
4772: <dt><span class="term"><code class="varname">INSTALL_GAME_DATA</code></span></dt>
4773: <dd><p>data files for
4774: games</p></dd>
4775: <dt><span class="term"><code class="varname">INSTALL_MAN</code></span></dt>
4776: <dd><p>man pages</p></dd>
4777: </dl></div>
4778: <p>Some other variables are:</p>
4779: <div class="variablelist"><dl class="variablelist">
4780: <dt><span class="term"><code class="varname">INSTALL_UNSTRIPPED</code></span></dt>
1.322 leot 4781: <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 4782: when installing binaries. Any debugging sections and symbols present in
4783: binaries will be preserved.
4784: </p></dd>
4785: <dt><span class="term"><code class="varname">INSTALLATION_DIRS</code></span></dt>
4786: <dd><p>A list of directories relative to
4787: <code class="varname">PREFIX</code> that are created by pkgsrc at the
4788: beginning of the <span class="emphasis"><em>install</em></span> phase.
4789: The package is supposed to create all needed directories itself
4790: before installing files to it and list all other directories here.
4791: </p></dd>
4792: </dl></div>
4793: <p>In the rare cases that a package shouldn't install anything,
4794: set <code class="varname">NO_INSTALL</code> to <span class="quote">“<span class="quote">yes</span>”</span>. This is
4795: mostly relevant for packages in the <code class="filename">regress</code>
4796: category.</p>
1.75 rillig 4797: </div>
1.148 asau 4798: <div class="sect1">
1.75 rillig 4799: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4800: <a name="build.package"></a>13.15. The <span class="emphasis"><em>package</em></span> phase</h2></div></div></div>
4801: <p>Once the install stage has completed, a binary package of
4802: the installed files can be built. These binary packages can be
4803: used for quick installation without previous compilation, e.g. by
4804: the <span class="command"><strong>make bin-install</strong></span> or by using
4805: <span class="command"><strong>pkg_add</strong></span>.</p>
4806: <p>By default, the binary packages are created in
4807: <code class="filename">${PACKAGES}/All</code> and symlinks are created in
4808: <code class="filename">${PACKAGES}/<em class="replaceable"><code>category</code></em></code>,
4809: one for each category in the <code class="varname">CATEGORIES</code>
4810: variable. <code class="varname">PACKAGES</code> defaults to
4811: <code class="filename">pkgsrc/packages</code>.</p>
1.75 rillig 4812: </div>
1.148 asau 4813: <div class="sect1">
1.75 rillig 4814: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4815: <a name="build.clean"></a>13.16. Cleaning up</h2></div></div></div>
4816: <p>Once you're finished with a package, you can clean the work
4817: directory by running <span class="command"><strong>make clean</strong></span>. If you want
4818: to clean the work directories of all dependencies too, use
4819: <span class="command"><strong>make clean-depends</strong></span>.</p>
1.75 rillig 4820: </div>
1.148 asau 4821: <div class="sect1">
1.75 rillig 4822: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 4823: <a name="build.helpful-targets"></a>13.17. Other helpful targets</h2></div></div></div>
1.148 asau 4824: <div class="variablelist"><dl class="variablelist">
1.299 rillig 4825: <dt><span class="term">pre/post-*</span></dt>
4826: <dd>
4827: <p>For any of the main targets described in the previous
4828: section (configure, build, install, etc.), two auxiliary
4829: targets exist with
4830: <span class="quote">“<span class="quote">pre-</span>”</span> and <span class="quote">“<span class="quote">post-</span>”</span> used as a
4831: prefix for the main target's name. These targets are
4832: invoked before and after the main target is called,
4833: allowing extra configuration or installation steps be
4834: performed from a package's Makefile, for example, which
4835: a program's configure script or install target
4836: omitted.</p>
4837: <p>About 5% of the pkgsrc packages define their custom
4838: post-extract target, another 5% define pre-configure, and 10%
4839: define post-install. The other pre/post-* targets are defined
4840: even less often.</p>
4841: </dd>
4842: <dt><span class="term">do-*</span></dt>
1.75 rillig 4843: <dd>
1.299 rillig 4844: <p>Should one of the main targets do the wrong thing,
4845: and should there be no variable to fix this, you can
4846: redefine it with the do-* target. (Note that redefining
4847: the target itself instead of the do-* target is a bad
4848: idea, as the pre-* and post-* targets won't be called
4849: anymore, etc.)</p>
4850: <p>About 15% of the pkgsrc packages override the default
4851: do-install, the other do-* targets are overridden even less
4852: often.</p>
1.75 rillig 4853: </dd>
1.299 rillig 4854: <dt><span class="term">reinstall</span></dt>
1.75 rillig 4855: <dd>
1.299 rillig 4856: <p>If you did a <span class="command"><strong>make install</strong></span> and
4857: you noticed some file was not installed properly, you
4858: can repeat the installation with this target, which will
4859: ignore the <span class="quote">“<span class="quote">already installed</span>”</span> flag.</p>
4860: <p>This is the default value of
4861: <code class="varname">DEPENDS_TARGET</code> except in the case of
4862: <span class="command"><strong>make update</strong></span> and <span class="command"><strong>make
4863: package</strong></span>, where the defaults are
4864: <span class="quote">“<span class="quote">package</span>”</span> and <span class="quote">“<span class="quote">update</span>”</span>,
4865: respectively.</p>
1.75 rillig 4866: </dd>
1.299 rillig 4867: <dt><span class="term">deinstall</span></dt>
4868: <dd>
1.322 leot 4869: <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 4870: current directory, effectively de-installing the
4871: package. The following variables can be used to tune the
4872: behaviour:</p>
4873: <div class="variablelist"><dl class="variablelist">
4874: <dt><span class="term"><code class="varname">PKG_VERBOSE</code></span></dt>
1.322 leot 4875: <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 4876: <dt><span class="term"><code class="varname">DEINSTALLDEPENDS</code></span></dt>
4877: <dd><p>Remove all packages that require (depend on)
4878: the given package. This can be used to remove any
4879: packages that may have been pulled in by a given
4880: package, e.g. if <span class="command"><strong>make deinstall
4881: DEINSTALLDEPENDS=1</strong></span> is done in
4882: <code class="filename">pkgsrc/x11/kde</code>, this is
4883: likely to remove whole KDE. Works by adding
1.322 leot 4884: <span class="quote">“<span class="quote">-R</span>”</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 4885: command line.</p></dd>
4886: </dl></div>
4887: </dd>
4888: <dt><span class="term">bin-install</span></dt>
4889: <dd><p>Install a binary package from local disk and via FTP
4890: from a list of sites (see the
4891: <code class="varname">BINPKG_SITES</code> variable), and do a
4892: <span class="command"><strong>make package</strong></span> if no binary package is
4893: available anywhere. The arguments given to
4894: <span class="command"><strong>pkg_add</strong></span> can be set via
4895: <code class="varname">BIN_INSTALL_FLAGS</code> e.g., to do verbose
4896: operation, etc.</p></dd>
4897: <dt><span class="term">install-clean</span></dt>
4898: <dd><p>This target removes the state files for the "install" and later
4899: phases so that the "install" target may be re-invoked. This can be
4900: used after editing the PLIST to install the package without
4901: rebuilding it.</p></dd>
4902: <dt><span class="term">build-clean</span></dt>
4903: <dd><p>This target removes the state files for the "build" and later
4904: phases so that the "build" target may be re-invoked.</p></dd>
4905: <dt><span class="term">update</span></dt>
4906: <dd>
4907: <p>This target causes the current package to be
4908: updated to the latest version. The package and all
4909: depending packages first get de-installed, then current
4910: versions of the corresponding packages get compiled and
4911: installed. This is similar to manually noting which
4912: packages are currently installed, then performing a
4913: series of <span class="command"><strong>make deinstall</strong></span> and
4914: <span class="command"><strong>make install</strong></span> (or whatever
4915: <code class="varname">UPDATE_TARGET</code> is set to) for these
4916: packages.</p>
4917: <p>You can use the <span class="quote">“<span class="quote">update</span>”</span> target to
4918: resume package updating in case a previous <span class="command"><strong>make
4919: update</strong></span> was interrupted for some reason.
4920: However, in this case, make sure you don't call
4921: <span class="command"><strong>make clean</strong></span> or otherwise remove the
4922: list of dependent packages in <code class="varname">WRKDIR</code>.
4923: Otherwise, you lose the ability to automatically update
4924: the current package along with the dependent packages
4925: you have installed.</p>
4926: <p>Resuming an interrupted <span class="command"><strong>make
4927: update</strong></span> will only work as long as the package
4928: tree remains unchanged. If the source code for one of
4929: the packages to be updated has been changed, resuming
4930: <span class="command"><strong>make update</strong></span> will most certainly
4931: fail!</p>
4932: <p>The following variables can be used either on the
4933: command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
4934: alter the behaviour of <span class="command"><strong>make
4935: update</strong></span>:</p>
4936: <div class="variablelist"><dl class="variablelist">
4937: <dt><span class="term"><code class="varname">UPDATE_TARGET</code></span></dt>
4938: <dd><p>Install target to recursively use for the
4939: updated package and the dependent packages.
4940: Defaults to <code class="varname">DEPENDS_TARGET</code> if
4941: set, <span class="quote">“<span class="quote">install</span>”</span> otherwise for
4942: <span class="command"><strong>make update</strong></span>. Other good
4943: targets are <span class="quote">“<span class="quote">package</span>”</span> or
4944: <span class="quote">“<span class="quote">bin-install</span>”</span>. Do not set this to
4945: <span class="quote">“<span class="quote">update</span>”</span> or you will get stuck in an
4946: endless loop!</p></dd>
4947: <dt><span class="term"><code class="varname">NOCLEAN</code></span></dt>
4948: <dd><p>Don't clean up after updating. Useful if
4949: you want to leave the work sources of the updated
4950: packages around for inspection or other purposes.
4951: Be sure you eventually clean up the source tree
4952: (see the <span class="quote">“<span class="quote">clean-update</span>”</span> target below)
4953: or you may run into troubles with old source code
4954: still lying around on your next
4955: <span class="command"><strong>make</strong></span> or <span class="command"><strong>make
4956: update</strong></span>.</p></dd>
4957: <dt><span class="term"><code class="varname">REINSTALL</code></span></dt>
4958: <dd><p>Deinstall each package before installing
4959: (making <code class="varname">DEPENDS_TARGET</code>). This
4960: may be necessary if the
4961: <span class="quote">“<span class="quote">clean-update</span>”</span> target (see below) was
4962: called after interrupting a running <span class="command"><strong>make
4963: update</strong></span>.</p></dd>
4964: <dt><span class="term"><code class="varname">DEPENDS_TARGET</code></span></dt>
4965: <dd><p>Allows you to disable recursion and hardcode
4966: the target for packages. The default is
4967: <span class="quote">“<span class="quote">update</span>”</span> for the update target,
4968: facilitating a recursive update of prerequisite
4969: packages. Only set
4970: <code class="varname">DEPENDS_TARGET</code> if you want to
4971: disable recursive updates. Use
4972: <code class="varname">UPDATE_TARGET</code> instead to just
4973: set a specific target for each package to be
4974: installed during <span class="command"><strong>make update</strong></span>
4975: (see above).</p></dd>
4976: </dl></div>
4977: </dd>
4978: <dt><span class="term">clean-update</span></dt>
4979: <dd>
4980: <p>Clean the source tree for all packages that would
4981: get updated if <span class="command"><strong>make update</strong></span> was called
4982: from the current directory. This target should not be
4983: used if the current package (or any of its depending
4984: packages) have already been de-installed (e.g., after
4985: calling <span class="command"><strong>make update</strong></span>) or you may lose
4986: some packages you intended to update. As a rule of
4987: thumb: only use this target <span class="emphasis"><em>before</em></span>
4988: the first time you run <span class="command"><strong>make update</strong></span>
4989: and only if you have a dirty package tree (e.g., if you
4990: used <code class="varname">NOCLEAN</code>).</p>
4991: <p>If you are unsure about whether your tree is
4992: clean, you can either perform a <span class="command"><strong>make
4993: clean</strong></span> at the top of the tree, or use the
4994: following sequence of commands from the directory of the
4995: package you want to update (<span class="emphasis"><em>before</em></span>
4996: running <span class="command"><strong>make update</strong></span> for the first
4997: time, otherwise you lose all the packages you wanted to
4998: update!):</p>
4999: <pre class="screen">
5000: <code class="prompt">#</code> <strong class="userinput"><code>make clean-update</code></strong>
5001: <code class="prompt">#</code> <strong class="userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
5002: <code class="prompt">#</code> <strong class="userinput"><code>make update</code></strong>
5003: </pre>
5004: <p>The following variables can be used either on the
5005: command line or in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to alter the behaviour of
5006: <span class="command"><strong>make clean-update</strong></span>:</p>
5007: <div class="variablelist"><dl class="variablelist">
5008: <dt><span class="term"><code class="varname">CLEAR_DIRLIST</code></span></dt>
5009: <dd><p>After <span class="command"><strong>make clean</strong></span>, do not
5010: reconstruct the list of directories to update for
5011: this package. Only use this if <span class="command"><strong>make
5012: update</strong></span> successfully installed all
5013: packages you wanted to update. Normally, this is
5014: done automatically on <span class="command"><strong>make
5015: update</strong></span>, but may have been suppressed by
5016: the <code class="varname">NOCLEAN</code> variable (see
5017: above).</p></dd>
5018: </dl></div>
5019: </dd>
5020: <dt><span class="term">replace</span></dt>
5021: <dd>
5022: <p>Update the installation of the current package. This
5023: differs from update in that it does not replace dependent
1.322 leot 5024: 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 5025: target to work.</p>
5026: <p><span class="emphasis"><em>Be careful when using this
5027: target!</em></span> There are no guarantees that dependent
5028: packages will still work, in particular they will most
5029: certainly break if you <span class="command"><strong>make replace</strong></span> a
5030: library package whose shared library major version changed
5031: between your installed version and the new one. For this
5032: reason, this target is not officially supported and only
5033: recommended for advanced users.</p>
5034: </dd>
5035: <dt><span class="term">info</span></dt>
1.322 leot 5036: <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 5037: package. You can use this to check which version of a
5038: package is installed.</p></dd>
5039: <dt><span class="term">index</span></dt>
5040: <dd>
5041: <p>This is a top-level command, i.e. it should be used in
5042: the <code class="filename">pkgsrc</code> directory. It creates a
5043: database of all packages in the local pkgsrc tree, including
5044: dependencies, comment, maintainer, and some other useful
5045: information. Individual entries are created by running
5046: <span class="command"><strong>make describe</strong></span> in the packages'
5047: directories. This index file is saved as
5048: <code class="filename">pkgsrc/INDEX</code>. It can be displayed in
5049: verbose format by running <span class="command"><strong>make
5050: print-index</strong></span>. You can search in it with
5051: <span class="command"><strong>make search
5052: key=<em class="replaceable"><code>something</code></em></strong></span>. You can
5053: extract a list of all packages that depend on a particular
5054: one by running <span class="command"><strong>make show-deps
5055: PKG=<em class="replaceable"><code>somepackage</code></em></strong></span>.</p>
5056: <p>Running this command takes a very long time, some
5057: hours even on fast machines!</p>
5058: </dd>
5059: <dt><span class="term">readme</span></dt>
5060: <dd>
5061: <p>This target generates a
1.314 nia 5062: <code class="filename">index.html</code> file, which can be
1.322 leot 5063: 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 5064: contain references to any packages which are in the
5065: <code class="varname">PACKAGES</code> directory on the local
5066: host. The generated files can be made to refer to URLs
5067: based on <code class="varname">FTP_PKG_URL_HOST</code> and
5068: <code class="varname">FTP_PKG_URL_DIR</code>. For example, if I
1.314 nia 5069: wanted to generate <code class="filename">index.html</code>
1.299 rillig 5070: files which pointed to binary packages on the local
5071: machine, in the directory
5072: <code class="filename">/usr/packages</code>, set
5073: <code class="varname">FTP_PKG_URL_HOST=file://localhost</code> and
5074: <code class="varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
5075: <code class="varname">${PACKAGES}</code> directory and its
5076: subdirectories will be searched for all the binary
5077: packages.</p>
5078: <p>The target can be run at the toplevel or in category
5079: directories, in which case it descends recursively.</p>
5080: </dd>
5081: <dt><span class="term">readme-all</span></dt>
5082: <dd><p>This is a top-level command, run it in
5083: <code class="filename">pkgsrc</code>. Use this target to create a
5084: file <code class="filename">README-all.html</code> which contains a
5085: list of all packages currently available in the NetBSD
5086: Packages Collection, together with the category they belong
5087: to and a short description. This file is compiled from the
1.314 nia 5088: <code class="filename">pkgsrc/*/index.html</code> files, so be sure
1.299 rillig 5089: to run this <span class="emphasis"><em>after</em></span> a <span class="command"><strong>make
5090: readme</strong></span>.</p></dd>
5091: <dt><span class="term">cdrom-readme</span></dt>
5092: <dd><p>This is very much the same as the
5093: <span class="quote">“<span class="quote">readme</span>”</span> target (see above), but is to be
5094: used when generating a pkgsrc tree to be written to a
5095: CD-ROM. This target also produces
1.314 nia 5096: <code class="filename">index.html</code> files, and can be made
1.299 rillig 5097: to refer to URLs based on
5098: <code class="varname">CDROM_PKG_URL_HOST</code> and
5099: <code class="varname">CDROM_PKG_URL_DIR</code>.</p></dd>
5100: <dt><span class="term">show-distfiles</span></dt>
5101: <dd><p>This target shows which distfiles and patchfiles
5102: are needed to build the package
5103: (<code class="varname">ALLFILES</code>, which contains all
5104: <code class="varname">DISTFILES</code> and
5105: <code class="varname">PATCHFILES</code>, but not
5106: <code class="filename">patches/*</code>).</p></dd>
5107: <dt><span class="term">show-downlevel</span></dt>
5108: <dd><p>This target shows nothing if the package is not
5109: installed. If a version of this package is installed,
5110: but is not the version provided in this version of
5111: pkgsrc, then a warning message is displayed. This target
5112: can be used to show which of your installed packages are
5113: downlevel, and so the old versions can be deleted, and
5114: the current ones added.</p></dd>
5115: <dt><span class="term">show-pkgsrc-dir</span></dt>
5116: <dd><p>This target shows the directory in the pkgsrc
5117: hierarchy from which the package can be built and
5118: installed. This may not be the same directory as the one
5119: from which the package was installed. This target is
5120: intended to be used by people who may wish to upgrade
5121: many packages on a single host, and can be invoked from
5122: the top-level pkgsrc Makefile by using the
5123: <span class="quote">“<span class="quote">show-host-specific-pkgs</span>”</span> target.</p></dd>
5124: <dt><span class="term">show-installed-depends</span></dt>
5125: <dd><p>This target shows which installed packages match
5126: the current package's <code class="varname">DEPENDS</code>. Useful
5127: if out of date dependencies are causing build
5128: problems.</p></dd>
5129: <dt><span class="term">print-build-depends-list</span></dt>
5130: <dd><p>This target shows the list of packages that the current package
5131: depends on for building.</p></dd>
5132: <dt><span class="term">print-run-depends-list</span></dt>
5133: <dd><p>This target shows the list of packages that the current package
5134: depends on for running.</p></dd>
5135: <dt><span class="term">check-shlibs</span></dt>
5136: <dd><p>After a package is installed, check all its
5137: binaries and (on ELF platforms) shared libraries to see
5138: if they find the shared libs they need. Run by default
5139: 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>
5140: <dt><span class="term">print-PLIST</span></dt>
5141: <dd>
5142: <p>After a <span class="quote">“<span class="quote">make install</span>”</span> from a new or
5143: upgraded pkg, this prints out an attempt to generate a
5144: new <code class="filename">PLIST</code> from a <span class="command"><strong>find
5145: -newer work/.extract_done</strong></span>. An attempt is made
5146: to care for shared libs etc., but it is
5147: <span class="emphasis"><em>strongly</em></span> recommended to review the
5148: result before putting it into
5149: <code class="filename">PLIST</code>. On upgrades, it's useful to
5150: diff the output of this command against an already
5151: existing <code class="filename">PLIST</code> file.</p>
1.322 leot 5152: <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 5153: other methods that don't update file access times, be
5154: sure to add these files manually to your
5155: <code class="filename">PLIST</code>, as the <span class="quote">“<span class="quote">find
5156: -newer</span>”</span> command used by this target won't catch
5157: them!</p>
5158: <p>See <a class="xref" href="#print-PLIST" title="19.3. Tweaking output of make print-PLIST">Section 19.3, “Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>”</a> for more
5159: information on this target.</p>
5160: </dd>
5161: </dl></div>
5162: </div>
5163: </div>
5164: <div class="chapter">
5165: <div class="titlepage"><div><div><h2 class="title">
5166: <a name="creating"></a>Chapter 14. Creating a new pkgsrc package from scratch</h2></div></div></div>
5167: <div class="toc">
5168: <p><b>Table of Contents</b></p>
5169: <dl class="toc">
5170: <dt><span class="sect1"><a href="#creating.common">14.1. Common types of packages</a></span></dt>
5171: <dd><dl>
1.334 nia 5172: <dt><span class="sect2"><a href="#creating.python-module">14.1.1. Python modules and programs</a></span></dt>
5173: <dt><span class="sect2"><a href="#creating.R-package">14.1.2. R packages</a></span></dt>
5174: <dt><span class="sect2"><a href="#creating.TeX-package">14.1.3. TeXlive packages</a></span></dt>
1.299 rillig 5175: </dl></dd>
5176: <dt><span class="sect1"><a href="#creating.examples">14.2. Examples</a></span></dt>
5177: <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>
5178: </dl>
5179: </div>
5180: <p>When you find a package that is not yet in pkgsrc, you
5181: most likely have a URL from where you can download the source
5182: code. Starting with this URL, creating a package involves only a
5183: few steps.</p>
5184: <div class="procedure"><ol class="procedure" type="1">
5185: <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
5186: enable the basic quality checks.</p></li>
5187: <li class="step">
1.322 leot 5188: <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 5189: install the utilities <span class="command"><strong>url2pkg</strong></span>,
5190: <span class="command"><strong>pkglint</strong></span>, <span class="command"><strong>pkgvi</strong></span> and
5191: <span class="command"><strong>mkpatches</strong></span>:</p>
5192: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
5193: <code class="prompt">$</code> <strong class="userinput"><code>(cd meta-pkgs/pkg_developer && bmake update)</code></strong></pre>
5194: </li>
5195: <li class="step">
5196: <p>Choose one of the top-level directories as the category in
5197: which you want to place your package. You can also create a directory of
1.334 nia 5198: your own (maybe called <code class="filename">local</code>). Change into that
5199: category directory:</p>
5200: <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 5201: </li>
5202: <li class="step">
1.334 nia 5203: <p>Run the program <span class="command"><strong>url2pkg</strong></span>, passing as
5204: argument the URL of the distribution file (in most cases a
5205: <code class="filename">.tar.gz</code> file). This will download the distribution
5206: file and create the necessary files of the package, based on what's in
5207: the distribution file:</p>
1.299 rillig 5208: <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>
5209: </li>
5210: <li class="step">
5211: <p>Examine the extracted files to determine the dependencies of
5212: your package. Ideally, this is mentioned in some
5213: <code class="filename">README</code> file, but things may differ. For each of
5214: these dependencies, look where it exists in pkgsrc, and if there is a
5215: file called <code class="filename">buildlink3.mk</code> in that directory, add a
5216: line to your package <code class="filename">Makefile</code> which includes that
5217: file just before the last line. If the
5218: <code class="filename">buildlink3.mk</code> file does not exist, it must be
5219: created first. The <code class="filename">buildlink3.mk</code> file makes sure
5220: that the package's include files and libraries are provided.</p>
1.334 nia 5221: <p>If you just need binaries from a dependent package, add a
1.299 rillig 5222: <code class="varname">DEPENDS</code> line to the Makefile, which specifies the
5223: version of the dependency and where it can be found in pkgsrc. This line
5224: should be placed in the third paragraph. If the dependency is only
5225: needed for building the package, but not when using it, use
5226: <code class="varname">TOOL_DEPENDS</code> or <code class="varname">BUILD_DEPENDS</code>
5227: instead of <code class="varname">DEPENDS</code>.
5228: The difference between <code class="varname">TOOL_DEPENDS</code> and
5229: <code class="varname">BUILD_DEPENDS</code> occurs when cross-compiling:
5230: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
1.334 nia 5231: packages, i.e. packages for the platform where the package is built;
1.299 rillig 5232: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
1.334 nia 5233: packages, i.e. packages for the platform for which the package
5234: is built. There is also <code class="varname">TEST_DEPENDS</code>, which
5235: specifies a dependency used only for testing the resulting package
5236: built, using the upstream project's included test suite, on the native
5237: platform.
1.299 rillig 5238: Your package may then look like this:</p>
5239: <pre class="programlisting">
5240: [...]
5241:
5242: TOOL_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
5243: DEPENDS+= screen-[0-9]*:../../misc/screen
5244: DEPENDS+= screen>=4.0:../../misc/screen
5245:
5246: [...]
5247:
5248: .include "../../<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>package</code></em>/buildlink3.mk"
5249: .include "../../devel/glib2/buildlink3.mk"
5250: .include "../../mk/bsd.pkg.mk"
5251: </pre>
5252: </li>
5253: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see what things still need
5254: to be done to make your package a <span class="quote">“<span class="quote">good</span>”</span> one. If you don't
5255: know what pkglint's warnings want to tell you, try <span class="command"><strong>pkglint
5256: --explain</strong></span> or <span class="command"><strong>pkglint -e</strong></span>, which outputs
5257: additional explanations.</p></li>
5258: <li class="step"><p>In many cases the package is not yet ready to build. You can
5259: 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, “Common types of packages”</a>. After you have followed the instructions
5260: over there, you can hopefully continue here.</p></li>
5261: <li class="step"><p>Run <span class="command"><strong>bmake clean</strong></span> to clean the working
5262: directory from the extracted files. Besides these files, a lot of cache
1.334 nia 5263: files and other system information have been saved in the working
5264: directory, which may have become outdated after you edited the
1.299 rillig 5265: <code class="filename">Makefile</code>.</p></li>
5266: <li class="step">
5267: <p>Now, run <span class="command"><strong>bmake</strong></span> to build the package. For
5268: 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 5269: <p>If the extracted files from the package need to be fixed, run
5270: multiple rounds of these commands:</p>
5271: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>bmake</code></strong>
1.299 rillig 5272: <code class="prompt">$</code> <strong class="userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
5273: <code class="prompt">$</code> <strong class="userinput"><code>mkpatches</code></strong>
1.334 nia 5274: <code class="prompt">$</code> <strong class="userinput"><code>bmake mps</code></strong>
5275: <code class="prompt">$</code> <strong class="userinput"><code>bmake clean</code></strong></pre>
1.299 rillig 5276: </li>
5277: <li class="step"><p>When the package builds fine, the next step is to install
5278: the package. Run <span class="command"><strong>bmake install</strong></span> and hope that
5279: everything works.</p></li>
5280: <li class="step"><p>Up to now, the file <code class="filename">PLIST</code>, which
5281: contains a list of the files that are installed by the package, is
5282: nearly empty. Run <span class="command"><strong>bmake print-PLIST
5283: >PLIST</strong></span> to generate a probably correct list. Check
5284: the file using your preferred text editor to see if the list of
5285: files looks plausible.</p></li>
5286: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> again to see if the generated
5287: <code class="filename">PLIST</code> contains garbage or not.</p></li>
5288: <li class="step"><p>When you ran <span class="command"><strong>bmake install</strong></span>, the package
5289: had been registered in the database of installed files, but with an
5290: empty list of files. To fix this, run <span class="command"><strong>bmake deinstall</strong></span>
5291: and <span class="command"><strong>bmake install</strong></span> again. Now the package is
5292: registered with the list of files from
5293: <code class="filename">PLIST</code>.</p></li>
5294: <li class="step"><p>Run <span class="command"><strong>bmake clean update</strong></span> to run everything
5295: from above again in a single step, making sure that the PLIST is correct
5296: and the whole package is created as intended.</p></li>
1.334 nia 5297: <li class="step"><p>Run <span class="command"><strong>pkglint</strong></span> to see if there's anything
5298: left to do.</p></li>
1.299 rillig 5299: <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>
5300: </ol></div>
5301: <div class="sect1">
5302: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
5303: <a name="creating.common"></a>14.1. Common types of packages</h2></div></div></div>
5304: <div class="sect2">
5305: <div class="titlepage"><div><div><h3 class="title">
1.334 nia 5306: <a name="creating.python-module"></a>14.1.1. Python modules and programs</h3></div></div></div>
1.299 rillig 5307: <p>Python modules and programs packages are easily created using a
5308: set of predefined variables.</p>
5309: <p>
5310: If some Python versions are not supported by the software, set the
5311: <code class="varname">PYTHON_VERSIONS_INCOMPATIBLE</code> variable to the Python versions
5312: that are not supported, e.g.
5313: </p>
5314: <pre class="programlisting">
5315: PYTHON_VERSIONS_INCOMPATIBLE= 27
5316: </pre>
5317: <p>
5318: If the packaged software is a Python module, include one of
1.330 wiz 5319: <code class="filename">../../lang/python/egg.mk</code> or
1.299 rillig 5320: <code class="filename">../../lang/python/extension.mk</code>.</p>
1.330 wiz 5321: <p>Most Python packages use setuptools (<span class="quote">“<span class="quote">eggs</span>”</span>).
1.299 rillig 5322: If the packaged software is using setuptools, you only need
5323: to include <span class="quote">“<span class="quote"><code class="filename">../../lang/python/egg.mk</code></span>”</span>.
1.330 wiz 5324: </p>
1.299 rillig 5325: <p>Either way, the package directory should be called
5326: <span class="quote">“<span class="quote">py-software</span>”</span> and <code class="varname">PKGNAME</code> should be set to
5327: <span class="quote">“<span class="quote">${PYPKGPREFIX}-${DISTNAME}</span>”</span>, e.g.
5328: </p>
5329: <pre class="programlisting">
5330: DISTNAME= foopymodule-1.2.10
5331: PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
5332: </pre>
1.341 gutterid 5333: <p>
5334: For software in PyPi, the name should match what PyPi specifies for
5335: "pip install software".
5336: </p>
1.299 rillig 5337: <p>If it is an application, include
5338: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/application.mk</code></span>”</span>.
5339: In order to correctly set the path to the Python interpreter, use the
5340: <code class="varname">REPLACE_PYTHON</code> variable and set it to the list of files
5341: (paths relative to <code class="varname">WRKSRC</code>) that must be corrected.
5342: For example:
5343: </p>
5344: <pre class="programlisting">
5345: REPLACE_PYTHON= *.py
5346: </pre>
5347: <p>Some Python modules have separate distributions for Python-2.x
5348: and Python-3.x support. In pkgsrc this is handled by the
5349: <code class="filename">versioned_dependencies.mk</code> file. Set
5350: <code class="varname">PYTHON_VERSIONED_DEPENDENCIES</code> to the list of
5351: packages that should be depended upon and include
5352: <span class="quote">“<span class="quote"><code class="filename">../../lang/python/versioned_dependencies.mk</code></span>”</span>,
5353: then the pkgsrc infrastructure will depend on the appropriate package
5354: version. For example:
5355: </p>
5356: <pre class="programlisting">
5357: PYTHON_VERSIONED_DEPENDENCIES=dialog
5358: </pre>
5359: <p>
5360: Look inside <code class="filename">versioned_dependencies.mk</code> for a list
5361: of supported packages.</p>
5362: </div>
5363: <div class="sect2">
5364: <div class="titlepage"><div><div><h3 class="title">
1.334 nia 5365: <a name="creating.R-package"></a>14.1.2. R packages</h3></div></div></div>
1.299 rillig 5366: <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>
5367: are handled automatically by <span class="command"><strong>R2pkg</strong></span>, which is
1.322 leot 5368: 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 5369: Individual packages (and optionally their dependencies) may be created
5370: and updated. R packages generally follow the same form, and most of
5371: the relevant information needed is contained in a
5372: <code class="filename">DESCRIPTION</code> file as part of each R package on
5373: <a class="ulink" href="https://cran.r-project.org/web/packages/available_packages_by_name.html" target="_top">CRAN</a>.
5374: Consequently, <span class="command"><strong>R2pkg</strong></span> downloads that information and
5375: creates or updates a package in the canonical form. The resulting
5376: package should be reviewed for correctness.</p>
5377: </div>
5378: <div class="sect2">
5379: <div class="titlepage"><div><div><h3 class="title">
1.334 nia 5380: <a name="creating.TeX-package"></a>14.1.3. TeXlive packages</h3></div></div></div>
1.299 rillig 5381: <p>TeXlive packages from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> are handled automatically by
1.322 leot 5382: <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 5383: <p>If the TeXlive package name is not known, it may be useful to
5384: search <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>. A
5385: <span class="quote">“<span class="quote">Contained in</span>”</span> field on the package page typically
5386: 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
5387: archive</a>.</p>
5388: <p>If the TeXlive package name is known, download the files from
5389: the <a class="ulink" href="https://www.ctan.org/tex-archive/systems/texlive/tlnet/archive" target="_top">TeXlive
5390: archive</a>. For package <code class="filename">foo</code>, you will need
5391: to download <code class="filename">foo.tar.xz</code>. Most TeXlive packages
5392: also have associated documentation packages, so download
5393: <code class="filename">foo.doc.tar.xz</code> at the same time. These files
5394: should be placed in the appropriate category directory, which is often
5395: but not always <code class="filename">print</code>. Then run the following
5396: command in the category directory.</p>
5397: <pre class="programlisting">
5398: texlive2pkg foo.tar.xz foo.doc.tar.xz
5399: </pre>
5400: <p>This will create two packages, <code class="filename">tex-foo</code> and
5401: <code class="filename">tex-foo-doc</code>. Be sure to check that both packages
5402: are correct.</p>
5403: <p>Finally, <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a>
5404: currently does not include version information in package filenames
5405: and changes their contents periodically when updates occur.
5406: Consequently, pkgsrc avoids downloading distfiles directly from <a class="ulink" href="https://www.ctan.org/" target="_top">CTAN</a> and instead relies on the
5407: pkgsrc archives. For each new or updated TeXlive package, e.g., the
5408: main one and the corresponding documentation, upload the distfiles
5409: with the following command in each package directory.</p>
5410: <pre class="programlisting">
5411: make upload-distfiles
5412: </pre>
5413: </div>
5414: </div>
5415: <div class="sect1">
5416: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
5417: <a name="creating.examples"></a>14.2. Examples</h2></div></div></div>
5418: <div class="sect2">
5419: <div class="titlepage"><div><div><h3 class="title">
5420: <a name="creating.nvu"></a>14.2.1. How the www/nvu package came into pkgsrc</h3></div></div></div>
5421: <div class="sect3">
5422: <div class="titlepage"><div><div><h4 class="title">
5423: <a name="creating.nvu.init"></a>14.2.1.1. The initial package</h4></div></div></div>
5424: <p>Looking at the file <code class="filename">pkgsrc/doc/TODO</code>, I saw
5425: that the <span class="quote">“<span class="quote">nvu</span>”</span> package has not yet been imported into
5426: pkgsrc. As the description says it has to do with the web, the obvious
5427: choice for the category is <span class="quote">“<span class="quote">www</span>”</span>.</p>
5428: <pre class="programlisting">
5429: <code class="prompt">$</code> mkdir www/nvu
5430: <code class="prompt">$</code> cd www/nvu
5431: </pre>
5432: <p>The web site says that the sources are available as a tar file, so
5433: I fed that URL to the <span class="command"><strong>url2pkg</strong></span> program:</p>
5434: <pre class="programlisting">
5435: <code class="prompt">$</code> url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
5436: </pre>
5437: <p>My editor popped up, and I added a <code class="varname">PKGNAME</code> line
5438: below the <code class="varname">DISTNAME</code> line, as the package name should
5439: not have the word <span class="quote">“<span class="quote">sources</span>”</span> in it. I also filled in the
5440: <code class="varname">MAINTAINER</code>, <code class="varname">HOMEPAGE</code> and
5441: <code class="varname">COMMENT</code> fields. Then the package
5442: <code class="filename">Makefile</code> looked like that:</p>
5443: <pre class="programlisting">
5444: # $NetBSD $
5445: #
5446:
5447: DISTNAME= nvu-1.0-sources
5448: PKGNAME= nvu-1.0
5449: CATEGORIES= www
5450: MASTER_SITES= http://cvs.nvu.com/download/
5451: EXTRACT_SUFX= .tar.bz2
5452:
5453: MAINTAINER= rillig@NetBSD.org
5454: HOMEPAGE= http://cvs.nvu.com/
5455: COMMENT= Web Authoring System
5456:
5457: # url2pkg-marker (please do not remove this line.)
5458: .include "../../mk/bsd.pkg.mk"
5459: </pre>
5460: <p>On the first line of output above, an artificial space has been added between NetBSD and $,
5461: this is a workaround to prevent CVS expanding to the filename of the
5462: guide.</p>
5463: <p>Then, I quit the editor and watched pkgsrc downloading a large
5464: source archive:</p>
5465: <pre class="programlisting">
5466: url2pkg> Running "make makesum" ...
5467: => Required installed package digest>=20010302: digest-20060826 found
5468: => Fetching nvu-1.0-sources.tar.bz2
5469: Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
5470: 100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
5471: 29687976 bytes retrieved in 03:12 (150.77 KB/s)
5472: url2pkg> Running "make extract" ...
5473: => Required installed package digest>=20010302: digest-20060826 found
5474: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
5475: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
5476: work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
5477: ===> Installing dependencies for nvu-1.0
5478: ===> Overriding tools for nvu-1.0
5479: ===> Extracting for nvu-1.0
5480: url2pkg> Adjusting the Makefile.
5481:
5482: Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
5483:
5484: Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
5485: </pre>
5486: </div>
5487: <div class="sect3">
5488: <div class="titlepage"><div><div><h4 class="title">
5489: <a name="creating.nvu.problems"></a>14.2.1.2. Fixing all kinds of problems to make the package work</h4></div></div></div>
5490: <p>Now that the package has been extracted, let's see what's inside
5491: it. The package has a <code class="filename">README.txt</code>, but that only
5492: says something about mozilla, so it's probably useless for seeing what
5493: dependencies this package has. But since there is a GNU configure script
5494: in the package, let's hope that it will complain about everything it
5495: needs.</p>
5496: <pre class="programlisting">
5497: <code class="prompt">$</code> bmake
5498: => Required installed package digest>=20010302: digest-20060826 found
5499: => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
5500: => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
5501: ===> Patching for nvu-1.0
5502: ===> Creating toolchain wrappers for nvu-1.0
5503: ===> Configuring for nvu-1.0
5504: [...]
5505: configure: error: Perl 5.004 or higher is required.
5506: [...]
5507: WARNING: Please add USE_TOOLS+=perl to the package Makefile.
5508: [...]
5509: </pre>
5510: <p>That worked quite well. So I opened the package Makefile in my
5511: editor, and since it already has a <code class="varname">USE_TOOLS</code> line, I
5512: just appended <span class="quote">“<span class="quote">perl</span>”</span> to it. Since the dependencies of the
5513: package have changed now, and since a perl wrapper is automatically
5514: installed in the <span class="quote">“<span class="quote">tools</span>”</span> phase, I need to build the package
5515: from scratch.</p>
5516: <pre class="programlisting">
5517: <code class="prompt">$</code> bmake clean
5518: ===> Cleaning for nvu-1.0
5519: <code class="prompt">$</code> bmake
5520: [...]
5521: *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
5522: GNU Make. You will not be able to build Mozilla without GNU Make.
5523: [...]
5524: </pre>
5525: <p>So I added <span class="quote">“<span class="quote">gmake</span>”</span> to the
5526: <code class="varname">USE_TOOLS</code> line and tried again (from scratch).</p>
5527: <pre class="programlisting">
5528: [...]
5529: checking for GTK - version >= 1.2.0... no
5530: *** Could not run GTK test program, checking why...
5531: [...]
5532: </pre>
5533: <p>Now to the other dependencies. The first question is: Where is the
5534: GTK package hidden in pkgsrc?</p>
5535: <pre class="programlisting">
5536: <code class="prompt">$</code> echo ../../*/gtk*
5537: [many packages ...]
5538: <code class="prompt">$</code> echo ../../*/gtk
5539: ../../x11/gtk
5540: <code class="prompt">$</code> echo ../../*/gtk2
5541: ../../x11/gtk2
5542: <code class="prompt">$</code> echo ../../*/gtk2/bui*
5543: ../../x11/gtk2/buildlink3.mk
5544: </pre>
5545: <p>The first try was definitely too broad. The second one had exactly
5546: one result, which is very good. But there is one pitfall with GNOME
5547: packages. Before GNOME 2 had been released, there were already many
5548: GNOME 1 packages in pkgsrc. To be able to continue to use these
5549: packages, the GNOME 2 packages were imported as separate packages, and
5550: their names usually have a <span class="quote">“<span class="quote">2</span>”</span> appended. So I checked
5551: whether this was the case here, and indeed it was.</p>
5552: <p>Since the GTK2 package has a <code class="filename">buildlink3.mk</code>
5553: file, adding the dependency is very easy. I just inserted an
5554: <code class="literal">.include</code> line before the last line of the package
5555: <code class="filename">Makefile</code>, so that it now looks like this:</p>
5556: <pre class="programlisting">
5557: [...]
5558: .include "../../x11/gtk2/buildlink3.mk"
5559: .include "../../mk/bsd.pkg.mk
5560: </pre>
5561: <p>After another <span class="command"><strong>bmake clean && bmake</strong></span>, the answer
5562: was:</p>
1.75 rillig 5563: <pre class="programlisting">
1.299 rillig 5564: [...]
5565: checking for gtk-config... /home/roland/pkg/bin/gtk-config
5566: checking for GTK - version >= 1.2.0... no
5567: *** Could not run GTK test program, checking why...
5568: *** The test program failed to compile or link. See the file config.log for the
5569: *** exact error that occured. This usually means GTK was incorrectly installed
5570: *** or that you have moved GTK since it was installed. In the latter case, you
5571: *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
5572: configure: error: Test for GTK failed.
5573: [...]
1.222 sevan 5574: </pre>
1.299 rillig 5575: <p>In this particular case, the assumption that <span class="quote">“<span class="quote">every package
5576: prefers GNOME 2</span>”</span> had been wrong. The first of the lines above
5577: told me that this package really wanted to have the GNOME 1 version of
5578: GTK. If the package had looked for GTK2, it would have looked for
5579: <span class="command"><strong>pkg-config</strong></span> instead of <span class="command"><strong>gtk-config</strong></span>.
5580: So I changed the <code class="literal">x11/gtk2</code> to
5581: <code class="literal">x11/gtk</code> in the package <code class="filename">Makefile</code>,
5582: and tried again.</p>
1.119 mishka 5583: <pre class="programlisting">
1.299 rillig 5584: [...]
5585: cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" [...]
5586: In file included from xpidl.c:42:
5587: xpidl.h:53:24: libIDL/IDL.h: No such file or directory
5588: In file included from xpidl.c:42:
5589: xpidl.h:132: error: parse error before "IDL_ns"
5590: [...]
1.222 sevan 5591: </pre>
1.299 rillig 5592: <p>The package still does not find all of its dependencies. Now the
5593: question is: Which package provides the
5594: <code class="filename">libIDL/IDL.h</code> header file?</p>
1.119 mishka 5595: <pre class="programlisting">
1.299 rillig 5596: <code class="prompt">$</code> echo ../../*/*idl*
5597: ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
5598: <code class="prompt">$</code> echo ../../*/*IDL*
5599: ../../net/libIDL
1.222 sevan 5600: </pre>
1.299 rillig 5601: <p>Let's take the one from the second try. So I included the
5602: <code class="filename">../../net/libIDL/buildlink3.mk</code> file and tried
5603: again. But the error didn't change. After digging through some of the
5604: code, I concluded that the build process of the package was broken and
5605: couldn't have ever worked, but since the Mozilla source tree is quite
5606: large, I didn't want to fix it. So I added the following to the package
5607: <code class="filename">Makefile</code> and tried again:</p>
1.197 wiz 5608: <pre class="programlisting">
1.299 rillig 5609: CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
5610: BUILDLINK_TRANSFORM+= l:IDL:IDL-2
1.222 sevan 5611: </pre>
1.299 rillig 5612: <p>The latter line is needed because the package expects the library
5613: <code class="filename">libIDL.so</code>, but only
5614: <code class="filename">libIDL-2.so</code> is available. So I told the compiler
5615: wrapper to rewrite that on the fly.</p>
5616: <p>The next problem was related to a recent change of the FreeType
1.322 leot 5617: 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 5618: which patch files were relevant for this issue and copied them to the
5619: <code class="filename">patches</code> directory. Then I retried, fixed the
5620: patches so that they applied cleanly and retried again. This time,
5621: everything worked.</p>
1.197 wiz 5622: </div>
1.299 rillig 5623: <div class="sect3">
5624: <div class="titlepage"><div><div><h4 class="title">
5625: <a name="creating.nvu.inst"></a>14.2.1.3. Installing the package</h4></div></div></div>
1.87 wiz 5626: <pre class="programlisting">
1.299 rillig 5627: <code class="prompt">$</code> bmake CHECK_FILES=no install
5628: [...]
5629: <code class="prompt">$</code> bmake print-PLIST >PLIST
5630: <code class="prompt">$</code> bmake deinstall
5631: <code class="prompt">$</code> bmake install
1.222 sevan 5632: </pre>
1.299 rillig 5633: </div>
5634: </div>
1.75 rillig 5635: </div>
5636: </div>
1.148 asau 5637: <div class="chapter">
1.75 rillig 5638: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 5639: <a name="makefile"></a>Chapter 15. Programming in <code class="filename">Makefile</code>s</h2></div></div></div>
1.75 rillig 5640: <div class="toc">
5641: <p><b>Table of Contents</b></p>
1.210 leot 5642: <dl class="toc">
1.299 rillig 5643: <dt><span class="sect1"><a href="#makefile.style">15.1. Caveats</a></span></dt>
5644: <dt><span class="sect1"><a href="#makefile.variables">15.2. <code class="filename">Makefile</code> variables</a></span></dt>
5645: <dd><dl><dt><span class="sect2"><a href="#makefile.variables.names">15.2.1. Naming conventions</a></span></dt></dl></dd>
5646: <dt><span class="sect1"><a href="#makefile.code">15.3. Code snippets</a></span></dt>
5647: <dd><dl>
5648: <dt><span class="sect2"><a href="#adding-to-list">15.3.1. Adding things to a list</a></span></dt>
5649: <dt><span class="sect2"><a href="#echo-literal">15.3.2. Echoing a string exactly as-is</a></span></dt>
5650: <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>
5651: <dt><span class="sect2"><a href="#empty-variables">15.3.4. Handling possibly empty variables</a></span></dt>
1.344 gutterid 5652: <dt><span class="sect2"><a href="#makefile.yesno">15.3.5. Testing yes/no variables in conditions</a></span></dt>
1.75 rillig 5653: </dl></dd>
5654: </dl>
5655: </div>
1.299 rillig 5656: <p>Pkgsrc consists of many <code class="filename">Makefile</code> fragments,
5657: each of which forms a well-defined part of the pkgsrc system. Using
1.322 leot 5658: 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 5659: like pkgsrc requires some discipline to keep the code correct and
5660: understandable.</p>
5661: <p>The basic ingredients for <code class="filename">Makefile</code>
5662: programming are variables and shell
5663: commands. Among these shell commands may even be more complex ones
1.322 leot 5664: 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 5665: as intended it is necessary to quote all variables correctly when they
5666: are used.</p>
5667: <p>This chapter describes some patterns that appear quite often in
5668: <code class="filename">Makefile</code>s, including the pitfalls that come along
5669: with them.</p>
1.148 asau 5670: <div class="sect1">
1.75 rillig 5671: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 5672: <a name="makefile.style"></a>15.1. Caveats</h2></div></div></div>
5673: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
5674: <p>When you are creating a file as a
5675: target of a rule, always write the data to a temporary file first
5676: and finally rename that file. Otherwise there might occur an error
5677: in the middle of generating the file, and when the user runs
1.322 leot 5678: <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 5679: regenerated properly. Example:</p>
1.75 rillig 5680: <pre class="programlisting">
1.299 rillig 5681: wrong:
5682: @echo "line 1" > ${.TARGET}
5683: @echo "line 2" >> ${.TARGET}
5684: @false
5685:
5686: correct:
5687: @echo "line 1" > ${.TARGET}.tmp
5688: @echo "line 2" >> ${.TARGET}.tmp
5689: @false
5690: @mv ${.TARGET}.tmp ${.TARGET}
1.100 rillig 5691: </pre>
1.299 rillig 5692: <p>When you run <span class="command"><strong>make wrong</strong></span> twice, the file
5693: <code class="filename">wrong</code> will exist, although there was an error
5694: message in the first run. On the other hand, running <span class="command"><strong>make
5695: correct</strong></span> gives an error message twice, as expected.</p>
1.322 leot 5696: <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 5697: <code class="literal">${.TARGET}</code> in case of error, but this only
5698: happens when it is interrupted, for example by pressing
5699: <code class="literal">Ctrl+C</code>. This does <span class="emphasis"><em>not</em></span> happen
1.322 leot 5700: 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 5701: </li></ul></div>
5702: </div>
5703: <div class="sect1">
5704: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
5705: <a name="makefile.variables"></a>15.2. <code class="filename">Makefile</code> variables</h2></div></div></div>
5706: <p><code class="filename">Makefile</code> variables contain strings that
5707: can be processed using the five operators <code class="code">=</code>,
5708: <code class="code">+=</code>, <code class="code">?=</code>, <code class="code">:=</code> and
1.322 leot 5709: <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 5710: page.</p>
5711: <p>When a variable's value is parsed from a
5712: <code class="filename">Makefile</code>, the hash character <code class="code">#</code> and
5713: the backslash character <code class="code">\</code> are handled specially. If a
5714: backslash is the last character in a line, that backslash is removed
5715: from the line and the line continues with the next line of the file.</p>
5716: <p>The <code class="code">#</code> character starts a comment that reaches
5717: until the end of the line. To get an actual <code class="code">#</code> character,
5718: such as in a URL, write <code class="code">\#</code> instead.</p>
5719: <p>The evaluation of variables either happens immediately or lazy.
5720: It happens immediately when the variable occurs on the right-hand
5721: side of the <code class="code">:=</code> or the <code class="code">!=</code> operator, in a
5722: <code class="varname">.if</code> condition or a <code class="varname">.for</code> loop.
5723: In the other cases, it is evaluated lazily.</p>
5724: <p>Some of the modifiers split the string into words and then
5725: operate on the words, others operate on the string as a whole. When a
5726: string is split into words, double quotes and single quotes are
1.322 leot 5727: 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 5728: <div class="sect2">
5729: <div class="titlepage"><div><div><h3 class="title">
5730: <a name="makefile.variables.names"></a>15.2.1. Naming conventions</h3></div></div></div>
5731: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
5732: <li class="listitem"><p>All variable names starting with an underscore
5733: are reserved for use by the pkgsrc infrastructure. They shall
5734: not be used by packages.</p></li>
5735: <li class="listitem"><p>In <span class="command"><strong>.for</strong></span> loops you should use
5736: lowercase variable names for the iteration
5737: variables.</p></li>
5738: <li class="listitem"><p>All list variables should have a plural name,
5739: such as <code class="varname">PKG_OPTIONS</code> or
5740: <code class="varname">DISTFILES</code>.</p></li>
5741: </ul></div>
5742: </div>
5743: </div>
5744: <div class="sect1">
5745: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
5746: <a name="makefile.code"></a>15.3. Code snippets</h2></div></div></div>
5747: <div class="sect2">
5748: <div class="titlepage"><div><div><h3 class="title">
5749: <a name="adding-to-list"></a>15.3.1. Adding things to a list</h3></div></div></div>
5750: <p>When adding a string that possibly contains whitespace or quotes to
5751: a list (example 1), it must be quoted using the <code class="code">:Q</code>
5752: modifier.</p>
5753: <p>When adding another list to a list (example 2), it must not be
5754: quoted, since its elements are already quoted.</p>
1.75 rillig 5755: <pre class="programlisting">
1.299 rillig 5756: STRING= foo * bar `date`
5757: LIST= # empty
5758: ANOTHER_LIST= a=b c=d
5759:
5760: LIST+= ${STRING:Q} # 1
5761: LIST+= ${ANOTHER_LIST} # 2
1.100 rillig 5762: </pre>
1.299 rillig 5763: </div>
5764: <div class="sect2">
5765: <div class="titlepage"><div><div><h3 class="title">
5766: <a name="echo-literal"></a>15.3.2. Echoing a string exactly as-is</h3></div></div></div>
5767: <p>Echoing a string containing special characters needs special
5768: work.</p>
1.75 rillig 5769: <pre class="programlisting">
1.299 rillig 5770: STRING= foo bar < > * `date` $$HOME ' "
5771: EXAMPLE_ENV= string=${STRING:Q} x=multiple\ quoted\ words
5772:
5773: all:
5774: echo ${STRING} # 1
5775: echo ${STRING:Q} # 2
5776: printf '%s\n' ${STRING:Q}'' # 3
5777: env ${EXAMPLE_ENV} sh -c 'echo "$$string"; echo "$$x"' # 4
1.100 rillig 5778: </pre>
1.299 rillig 5779: <p>Example 1 leads to a syntax error in the shell, as the characters
5780: are just copied.</p>
5781: <p>Example 2 quotes the string so that the shell interprets it
5782: correctly. But the echo command may additionally interpret strings with a
5783: leading dash or those containing backslashes.</p>
1.322 leot 5784: <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 5785: interprets the format string, but not the next argument. The trailing
5786: single quotes handle the case when the string is empty. In that case, the
5787: :Q modifier would result in an empty string too, which would then be
1.322 leot 5788: 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 5789: but other programs may care.</p>
5790: <p>In example 4, the <code class="varname">EXAMPLE_ENV</code> does not
5791: need to be quoted because the quoting has already been done
5792: when adding elements to the list.</p>
1.75 rillig 5793: </div>
1.148 asau 5794: <div class="sect2">
1.75 rillig 5795: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 5796: <a name="cflags-gnu-configure"></a>15.3.3. Passing <code class="varname">CFLAGS</code> to GNU configure scripts</h3></div></div></div>
5797: <p>When passing <code class="varname">CFLAGS</code> or similar variables to a
5798: GNU-style configure script (especially those that call other configure
5799: scripts), it must not have leading or trailing whitespace, since
5800: otherwise the configure script gets confused. To trim leading and
5801: trailing whitespace, use the <code class="code">:M</code> modifier, as in the
5802: following example:</p>
1.75 rillig 5803: <pre class="programlisting">
1.299 rillig 5804: CPPFLAGS= # empty
5805: CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX}\"
5806: CPPFLAGS+= ${MY_CPPFLAGS}
1.1 grant 5807:
1.299 rillig 5808: CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q}
1.1 grant 5809:
1.299 rillig 5810: all:
5811: echo x${CPPFLAGS:Q}x # leading and trailing whitespace
5812: echo x${CONFIGURE_ARGS:Q}x # properly trimmed
5813: </pre>
5814: <p>In this example, <code class="varname">CPPFLAGS</code> has both leading and
5815: trailing whitespace because the <code class="code">+=</code> operator always adds a
5816: space.</p>
5817: </div>
5818: <div class="sect2">
5819: <div class="titlepage"><div><div><h3 class="title">
5820: <a name="empty-variables"></a>15.3.4. Handling possibly empty variables</h3></div></div></div>
5821: <p>When a possibly empty variable is used in a shell program, it may
5822: lead to a syntax error.</p>
5823: <pre class="programlisting">
5824: EGFILES= # empty
1.87 wiz 5825:
1.299 rillig 5826: install-examples: # produces a syntax error in the shell
5827: for egfile in ${EGFILES}; do \
5828: echo "Installing $$egfile"; \
5829: done
5830: </pre>
5831: <p>The shell only sees the text <code class="code">for egfile in ; do</code>, since
1.322 leot 5832: <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 5833: To fix this syntax error, use one of the snippets below.</p>
5834: <pre class="programlisting">
1.344 gutterid 5835: EGFILES= # empty
1.87 wiz 5836:
1.299 rillig 5837: install-examples:
5838: for egfile in ${EGFILES} ""; do \
5839: [ -n "$$egfile" ] || continue; \
5840: echo "Installing $$egfile"; \
5841: done
5842: </pre>
5843: <p>In this case, an empty string is appended to the iteration list (to
5844: prevent the syntax error) and filtered out later.</p>
5845: <pre class="programlisting">
5846: EGFILES= # empty
1.87 wiz 5847:
1.299 rillig 5848: install-examples:
5849: .for egfile in ${EGFILES}
5850: echo "Installing ${egfile}"
5851: .endfor
1.100 rillig 5852: </pre>
1.299 rillig 5853: <p>If one of the filenames contains special characters, it should be
5854: enclosed in single or double quotes.</p>
5855: <p>To have a shell command test whether a make variable is empty, use
5856: the following code: <code class="code">${TEST} -z ${POSSIBLY_EMPTY:Q}""</code>.</p>
5857: </div>
1.344 gutterid 5858: <div class="sect2">
5859: <div class="titlepage"><div><div><h3 class="title">
5860: <a name="makefile.yesno"></a>15.3.5. Testing yes/no variables in conditions</h3></div></div></div>
5861: <p>When a variable can have the values <code class="literal">yes</code> or
5862: <code class="literal">no</code>, use the following pattern to test the variable:</p>
5863: <pre class="programlisting">
5864: .if ${VAR:U:tl} == "yes"
5865: # do something
5866: .endif
5867: </pre>
5868: <p>The <code class="literal">:U</code> modifier is only necessary if the variable
5869: can be undefined. If the variable is guaranteed to be defined, the
5870: <code class="literal">:U</code> can be omitted.</p>
5871: <p>The <code class="literal">:tl</code> modifier converts the variable value to
5872: lowercase, allowing for the values <code class="literal">yes</code>,
5873: <code class="literal">Yes</code>, <code class="literal">YES</code>.</p>
5874: </div>
1.299 rillig 5875: </div>
5876: </div>
5877: <div class="chapter">
5878: <div class="titlepage"><div><div><h2 class="title">
5879: <a name="options"></a>Chapter 16. Options handling</h2></div></div></div>
5880: <div class="toc">
5881: <p><b>Table of Contents</b></p>
5882: <dl class="toc">
5883: <dt><span class="sect1"><a href="#global-default-options">16.1. Global default options</a></span></dt>
5884: <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>
5885: <dt><span class="sect1"><a href="#option-names">16.3. Option Names</a></span></dt>
5886: <dt><span class="sect1"><a href="#option-build">16.4. Determining the options of dependencies</a></span></dt>
5887: </dl>
1.75 rillig 5888: </div>
1.299 rillig 5889: <p>Many packages have the ability to be built to support different
5890: sets of features. <code class="filename">bsd.options.mk</code> is a framework
5891: in pkgsrc that provides generic handling of those options that
5892: determine different ways in which the packages can be built. It's
5893: possible for the user to specify exactly which sets of options will be
5894: built into a package or to allow a set of global default options
5895: apply.</p>
5896: <p>There are two broad classes of behaviors that one might want to
5897: control via options. One is whether some particular feature is
5898: enabled in a program that will be built anyway, often by including or
5899: not including a dependency on some other package. The other is
5900: whether or not an additional program will be built as part of the
5901: package. Generally, it is better to make a split package for such
5902: additional programs instead of using options, because it enables
5903: binary packages to be built which can then be added separately. For
5904: example, the foo package might have minimal dependencies (those
5905: packages without which foo doesn't make sense), and then the foo-gfoo
5906: package might include the GTK frontend program gfoo. This is better
5907: than including a gtk option to foo that adds gfoo, because either that
5908: option is default, in which case binary users can't get foo without
5909: gfoo, or not default, in which case they can't get gfoo. With split
5910: packages, they can install foo without having GTK, and later decide to
5911: install gfoo (pulling in GTK at that time). This is an advantage to
5912: source users too, avoiding the need for rebuilds.</p>
5913: <p>Plugins with widely varying dependencies should usually be split
5914: instead of options.</p>
5915: <p>It is often more work to maintain split packages, especially if
5916: the upstream package does not support this. The decision of split
5917: vs. option should be made based on the likelihood that users will want
5918: or object to the various pieces, the size of the dependencies that are
5919: included, and the amount of work.</p>
5920: <p>A further consideration is licensing. Non-free parts, or parts
5921: that depend on non-free dependencies (especially plugins) should
5922: almost always be split if feasible.</p>
5923: <div class="sect1">
5924: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
5925: <a name="global-default-options"></a>16.1. Global default options</h2></div></div></div>
5926: <p>Global default options are listed in
5927: <code class="varname">PKG_DEFAULT_OPTIONS</code>, which is a list of the options
5928: that should be built into every package if that option is supported.
5929: This variable should be set in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>.</p>
1.75 rillig 5930: </div>
1.148 asau 5931: <div class="sect1">
1.75 rillig 5932: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 5933: <a name="converting-to-options"></a>16.2. Converting packages to use <code class="filename">bsd.options.mk</code>
5934: </h2></div></div></div>
5935: <p>The following example shows how
5936: <code class="filename">bsd.options.mk</code> should be used
5937: by the hypothetical ``wibble'' package, either in the package
5938: <code class="filename">Makefile</code>, or in a file,
5939: e.g. <code class="filename">options.mk</code>, that is included by the
5940: main package <code class="filename">Makefile</code>.</p>
1.75 rillig 5941: <pre class="programlisting">
1.299 rillig 5942: PKG_OPTIONS_VAR= PKG_OPTIONS.wibble
5943: PKG_SUPPORTED_OPTIONS= wibble-foo ldap
5944: PKG_OPTIONS_OPTIONAL_GROUPS= database
5945: PKG_OPTIONS_GROUP.database= mysql pgsql
5946: PKG_SUGGESTED_OPTIONS= wibble-foo
5947: PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap
5948: PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo
5949:
5950: .include "../../mk/bsd.prefs.mk"
5951:
5952: # this package was previously named wibble2
5953: .if defined(PKG_OPTIONS.wibble2)
5954: PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2}
5955: PKG_OPTIONS_DEPRECATED_WARNINGS+= \
5956: "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead."
5957: .endif
5958:
5959: .include "../../mk/bsd.options.mk"
5960:
5961: # Package-specific option-handling
1.100 rillig 5962:
1.299 rillig 5963: ###
5964: ### FOO support
5965: ###
5966: .if !empty(PKG_OPTIONS:Mwibble-foo)
5967: CONFIGURE_ARGS+= --enable-foo
5968: .endif
1.100 rillig 5969:
1.299 rillig 5970: ###
5971: ### LDAP support
5972: ###
5973: .if !empty(PKG_OPTIONS:Mldap)
5974: . include "../../databases/openldap-client/buildlink3.mk"
5975: CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client}
5976: .endif
1.100 rillig 5977:
1.299 rillig 5978: ###
5979: ### database support
5980: ###
5981: .if !empty(PKG_OPTIONS:Mmysql)
5982: . include "../../mk/mysql.buildlink3.mk"
5983: .endif
5984: .if !empty(PKG_OPTIONS:Mpgsql)
5985: . include "../../mk/pgsql.buildlink3.mk"
5986: .endif
5987: </pre>
5988: <p>The first section contains the information about which build
5989: options are supported by the package, and any default options settings
5990: if needed.</p>
5991: <div class="orderedlist"><ol class="orderedlist" type="1">
5992: <li class="listitem"><p><code class="varname">PKG_OPTIONS_VAR</code> is the name of the
1.322 leot 5993: <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 5994: options. It should be set to
5995: PKG_OPTIONS.<em class="replaceable"><code>pkgbase</code></em>. Do not set it to
5996: PKG_OPTIONS.${PKGBASE}, since <code class="varname">PKGBASE</code> is not defined
5997: at the point where the options are processed.</p></li>
5998: <li class="listitem"><p><code class="varname">PKG_SUPPORTED_OPTIONS</code> is a list of
5999: build options supported by the package.</p></li>
6000: <li class="listitem"><p><code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code> is a
6001: list of names of groups of mutually exclusive options. The options in
6002: each group are listed in
6003: <code class="varname">PKG_OPTIONS_GROUP.<em class="replaceable"><code>groupname</code></em></code>.
6004: The most specific setting of any option from the group takes
6005: precedence over all other options in the group. Options from the
6006: groups will be automatically added to
6007: <code class="varname">PKG_SUPPORTED_OPTIONS</code>.</p></li>
6008: <li class="listitem"><p><code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> is like
6009: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, but building the
6010: packages will fail if no option from the group is
6011: selected.</p></li>
6012: <li class="listitem"><p><code class="varname">PKG_OPTIONS_NONEMPTY_SETS</code> is a list
6013: of names of sets of options. At least one option from each set must
6014: be selected. The options in each set are listed in
6015: <code class="varname">PKG_OPTIONS_SET.<em class="replaceable"><code>setname</code></em></code>.
6016: Options from the sets will be automatically added to
6017: <code class="varname">PKG_SUPPORTED_OPTIONS</code>. Building the package will
6018: fail if no option from the set is selected.</p></li>
6019: <li class="listitem"><p><code class="varname">PKG_SUGGESTED_OPTIONS</code> is a list of
6020: build options which are enabled by default.</p></li>
6021: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_VARS</code> is a list
6022: of
6023: <span class="quote">“<span class="quote"><em class="replaceable"><code>USE_VARIABLE</code></em>:<em class="replaceable"><code>option</code></em></span>”</span>
6024: pairs that map legacy <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> variables to
6025: their option counterparts. Pairs should be added with
6026: <span class="quote">“<span class="quote">+=</span>”</span> to keep the listing of global legacy variables. A
6027: warning will be issued if the user uses a legacy
6028: variable.</p></li>
6029: <li class="listitem"><p><code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> is a list
6030: of
6031: <span class="quote">“<span class="quote"><em class="replaceable"><code>old-option</code></em>:<em class="replaceable"><code>new-option</code></em></span>”</span>
6032: pairs that map options that have been renamed to their new
6033: counterparts. Pairs should be added with <span class="quote">“<span class="quote">+=</span>”</span> to keep
6034: the listing of global legacy options. A warning will be issued if
6035: the user uses a legacy option.</p></li>
6036: <li class="listitem"><p><code class="varname">PKG_LEGACY_OPTIONS</code> is a list of
6037: options implied by deprecated variables used. This can be used for
6038: cases that neither <code class="varname">PKG_OPTIONS_LEGACY_VARS</code> nor
6039: <code class="varname">PKG_OPTIONS_LEGACY_OPTS</code> can handle, e. g. when
6040: <code class="varname">PKG_OPTIONS_VAR</code> is renamed.</p></li>
6041: <li class="listitem"><p><code class="varname">PKG_OPTIONS_DEPRECATED_WARNINGS</code> is
6042: a list of warnings about deprecated variables or options used, and
6043: what to use instead.</p></li>
6044: </ol></div>
6045: <p>A package should never modify
6046: <code class="varname">PKG_DEFAULT_OPTIONS</code> or the variable named in
6047: <code class="varname">PKG_OPTIONS_VAR</code>. These are strictly user-settable.
6048: To suggest a default set of options, use
6049: <code class="varname">PKG_SUGGESTED_OPTIONS</code>.</p>
6050: <p><code class="varname">PKG_OPTIONS_VAR</code> must be defined before
6051: including <code class="filename">bsd.options.mk</code>. If none of
6052: <code class="varname">PKG_SUPPORTED_OPTIONS</code>,
6053: <code class="varname">PKG_OPTIONS_OPTIONAL_GROUPS</code>, and
6054: <code class="varname">PKG_OPTIONS_REQUIRED_GROUPS</code> are defined (as can
6055: happen with platform-specific options if none of them is supported on
6056: the current platform), <code class="varname">PKG_OPTIONS</code> is set to the
6057: empty list and the package is otherwise treated as not using the
6058: options framework.</p>
6059: <p>After the inclusion of <code class="filename">bsd.options.mk</code>, the
6060: variable <code class="varname">PKG_OPTIONS</code> contains the list of selected
6061: build options, properly filtered to remove unsupported and duplicate
6062: options.</p>
6063: <p>The remaining sections contain the logic that is specific to
6064: each option. The correct way to check for an option is to check
6065: whether it is listed in <code class="varname">PKG_OPTIONS</code>:</p>
6066: <pre class="programlisting">
6067: .if !empty(PKG_OPTIONS:M<em class="replaceable"><code>option</code></em>)
1.100 rillig 6068: </pre>
1.75 rillig 6069: </div>
1.299 rillig 6070: <div class="sect1">
6071: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
6072: <a name="option-names"></a>16.3. Option Names</h2></div></div></div>
6073: <p>Options that enable similar features in different packages (like
6074: optional support for a library) should use a common name in all
6075: packages that support it (like the name of the library). If another
6076: package already has an option with the same meaning, use the same
6077: name.</p>
6078: <p>Options that enable features specific to one package, where it's
6079: unlikely that another (unrelated) package has the same (or a similar)
6080: optional feature, should use a name prefixed with
6081: <code class="varname"><em class="replaceable"><code>pkgname</code></em>-</code>.</p>
6082: <p>If a group of related packages share an optional feature
6083: specific to that group, prefix it with the name of the
6084: <span class="quote">“<span class="quote">main</span>”</span> package
6085: (e. g. <code class="varname">djbware-errno-hack</code>).</p>
6086: <p>For new options, add a line to
6087: <code class="filename">mk/defaults/options.description</code>. Lines have two
6088: fields, separated by tab. The first field is the option name, the
6089: second its description. The description should be a whole sentence
6090: (starting with an uppercase letter and ending with a period) that
6091: describes what enabling the option does. E. g. <span class="quote">“<span class="quote">Enable ispell
6092: support.</span>”</span> The file is sorted by option names.</p>
6093: </div>
6094: <div class="sect1">
6095: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
6096: <a name="option-build"></a>16.4. Determining the options of dependencies</h2></div></div></div>
6097: <p>When writing <a class="link" href="#buildlink3.mk"><code class="filename">buildlink3.mk</code></a> files, it is often necessary to list
6098: different dependencies based on the options with which the package was
6099: built. For querying these options, the file
6100: <code class="filename">pkgsrc/mk/pkg-build-options.mk</code> should be used. A
6101: typical example looks like this:</p>
1.87 wiz 6102: <pre class="programlisting">
1.299 rillig 6103: pkgbase := libpurple
6104: .include "../../mk/pkg-build-options.mk"
6105:
6106: .if !empty(PKG_BUILD_OPTIONS.libpurple:Mdbus)
6107: ...
6108: .endif
1.229 sevan 6109: </pre>
1.299 rillig 6110: <p>Including <code class="filename">pkg-build-options.mk</code> here will set
6111: the variable <code class="varname">PKG_BUILD_OPTIONS.libpurple</code> to the build
6112: options of the libpurple package, which can then be queried like
6113: <code class="varname">PKG_OPTIONS</code> in the <code class="filename">options.mk</code>
6114: file. See the file <code class="filename">pkg-build-options.mk</code> for more
6115: details.</p>
1.75 rillig 6116: </div>
6117: </div>
1.148 asau 6118: <div class="chapter">
1.75 rillig 6119: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 6120: <a name="tools"></a>Chapter 17. Tools needed for building or running</h2></div></div></div>
1.75 rillig 6121: <div class="toc">
6122: <p><b>Table of Contents</b></p>
1.210 leot 6123: <dl class="toc">
1.299 rillig 6124: <dt><span class="sect1"><a href="#pkgsrc-tools">17.1. Tools for pkgsrc builds</a></span></dt>
6125: <dt><span class="sect1"><a href="#package-tools">17.2. Tools needed by packages</a></span></dt>
6126: <dt><span class="sect1"><a href="#platform-tools">17.3. Tools provided by platforms</a></span></dt>
1.75 rillig 6127: </dl>
6128: </div>
1.299 rillig 6129: <p>The <code class="varname">USE_TOOLS</code> definition is used both internally
6130: by pkgsrc and also for individual packages to define what commands
6131: are needed for building a package (like <code class="varname">TOOL_DEPENDS</code>)
6132: or for later run-time of an installed packaged (such as
6133: <code class="varname">DEPENDS</code>).
6134: If the native system provides an adequate tool, then in many cases, a pkgsrc
6135: package will not be used.</p>
6136: <p>When building a package, the replacement tools are
6137: made available in a directory (as symlinks or wrapper scripts)
6138: that is early in the executable search path. Just like the buildlink
6139: system, this helps with consistent builds.</p>
6140: <p>A tool may be needed to help build a specific package. For example,
6141: perl, GNU make (gmake) or yacc may be needed.</p>
6142: <p>Also a tool may be needed, for example, because the native system's supplied
6143: tool may be inefficient for building a package with pkgsrc.
6144: For example, a package may need GNU awk, bison (instead of
6145: yacc) or a better sed.</p>
6146: <p>The tools used by a package can be listed by running
6147: <span class="command"><strong>make show-tools</strong></span>.</p>
1.148 asau 6148: <div class="sect1">
1.75 rillig 6149: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6150: <a name="pkgsrc-tools"></a>17.1. Tools for pkgsrc builds</h2></div></div></div>
6151: <p>The default set of tools used by pkgsrc is defined in
6152: <code class="filename">bsd.pkg.mk</code>. This includes standard Unix tools,
6153: such as: <span class="command"><strong>cat</strong></span>, <span class="command"><strong>awk</strong></span>,
6154: <span class="command"><strong>chmod</strong></span>, <span class="command"><strong>test</strong></span>, and so on.
6155: These can be seen by running:
6156: <span class="command"><strong>make show-var VARNAME=USE_TOOLS</strong></span>.</p>
6157: <p>If a package needs a specific program to build
6158: then the <code class="varname">USE_TOOLS</code> variable can be used
6159: to define the tools needed.</p>
1.75 rillig 6160: </div>
1.299 rillig 6161: <div class="sect1">
6162: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
6163: <a name="package-tools"></a>17.2. Tools needed by packages</h2></div></div></div>
6164: <p>In the following examples, the :run means that it is needed at
6165: run-time (and becomes a DEPENDS).
6166: The default is a build dependency which can be set with
6167: :build. (So in this example, it is the same as gmake:build
6168: and pkg-config:build.)</p>
1.75 rillig 6169: <pre class="programlisting">
1.299 rillig 6170: USE_TOOLS+= gmake perl:run pkg-config
1.1 grant 6171: </pre>
1.299 rillig 6172: <p>When using the tools framework, a
6173: <code class="varname">TOOLS_PATH.foo</code> variable is defined
6174: which contains the full path to the appropriate tool. For example,
6175: <code class="varname">TOOLS_PATH.bash</code> could be <span class="quote">“<span class="quote">/bin/bash</span>”</span>
6176: on Linux systems.</p>
6177: <p>If you always need a pkgsrc version of the
6178: tool at run-time, then just use <code class="varname">DEPENDS</code> instead.
6179: </p>
1.75 rillig 6180: </div>
1.299 rillig 6181: <div class="sect1">
6182: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
6183: <a name="platform-tools"></a>17.3. Tools provided by platforms</h2></div></div></div>
6184: <p>When improving or porting pkgsrc to a new platform, have a look
6185: at (or create) the corresponding platform specific make file fragment under
6186: <code class="filename">pkgsrc/mk/tools/tools.${OPSYS}.mk</code> which defines
6187: the name of the common tools. For example:</p>
1.75 rillig 6188: <pre class="programlisting">
1.299 rillig 6189: .if exists(/usr/bin/bzcat)
6190: TOOLS_PLATFORM.bzcat?= /usr/bin/bzcat
6191: .elif exists(/usr/bin/bzip2)
6192: TOOLS_PLATFORM.bzcat?= /usr/bin/bzip2 -cd
6193: .endif
6194:
6195: TOOLS_PLATFORM.true?= true # shell builtin
1.1 grant 6196: </pre>
1.75 rillig 6197: </div>
6198: </div>
1.299 rillig 6199: <div class="chapter">
6200: <div class="titlepage"><div><div><h2 class="title">
6201: <a name="buildlink"></a>Chapter 18. Buildlink methodology</h2></div></div></div>
6202: <div class="toc">
6203: <p><b>Table of Contents</b></p>
6204: <dl class="toc">
6205: <dt><span class="sect1"><a href="#converting-to-buildlink3">18.1. Converting packages to use buildlink3</a></span></dt>
6206: <dt><span class="sect1"><a href="#creating-buildlink3.mk">18.2. Writing <code class="filename">buildlink3.mk</code> files</a></span></dt>
6207: <dd><dl>
6208: <dt><span class="sect2"><a href="#anatomy-of-bl3">18.2.1. Anatomy of a buildlink3.mk file</a></span></dt>
6209: <dt><span class="sect2"><a href="#updating-buildlink-depends">18.2.2. Updating
6210: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6211: and
6212: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6213: in <code class="filename">buildlink3.mk</code> files</a></span></dt>
6214: </dl></dd>
6215: <dt><span class="sect1"><a href="#writing-builtin.mk">18.3. Writing <code class="filename">builtin.mk</code> files</a></span></dt>
1.355 ! rillig 6216: <dd><dl><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></dl></dd>
1.299 rillig 6217: </dl>
1.75 rillig 6218: </div>
1.299 rillig 6219: <p>Buildlink is a framework in pkgsrc that controls what headers and libraries
6220: are seen by a package's configure and build processes. This is implemented
6221: in a two step process:</p>
6222: <div class="orderedlist"><ol class="orderedlist" type="1">
6223: <li class="listitem"><p>Symlink headers and libraries for dependencies into
6224: <code class="varname">BUILDLINK_DIR</code>, which by default is a subdirectory
6225: of <code class="varname">WRKDIR</code>.</p></li>
6226: <li class="listitem"><p>Create wrapper scripts that are used in place of the normal compiler
6227: tools that translate <code class="option">-I${LOCALBASE}/include</code> and
6228: <code class="option">-L${LOCALBASE}/lib</code> into references to
6229: <code class="varname">BUILDLINK_DIR</code>. The wrapper scripts also make
6230: native compiler on some operating systems look like GCC, so that
6231: packages that expect GCC won't require modifications to build with
6232: those native compilers.</p></li>
6233: </ol></div>
6234: <p>This normalizes the environment in which a package is built so that the
6235: package may be built consistently despite what other software may be
6236: installed. Please note that the normal system header and library paths,
6237: e.g. <code class="filename">/usr/include</code>,
6238: <code class="filename">/usr/lib</code>, etc., are always searched -- buildlink3 is
6239: designed to insulate the package build from non-system-supplied
6240: software.</p>
1.148 asau 6241: <div class="sect1">
1.75 rillig 6242: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6243: <a name="converting-to-buildlink3"></a>18.1. Converting packages to use buildlink3</h2></div></div></div>
6244: <p>The process of converting packages to use the buildlink3
6245: framework (<span class="quote">“<span class="quote">bl3ifying</span>”</span>) is fairly straightforward.
6246: The things to keep in mind are:</p>
1.128 wiz 6247: <div class="orderedlist"><ol class="orderedlist" type="1">
1.299 rillig 6248: <li class="listitem"><p>Ensure that the build always calls the wrapper scripts
6249: instead of the actual toolchain. Some packages are tricky,
6250: and the only way to know for sure is the check
6251: <code class="filename">${WRKDIR}/.work.log</code> to see if the
6252: wrappers are being invoked.</p></li>
6253: <li class="listitem"><p>Don't override <code class="varname">PREFIX</code> from within
6254: the package Makefile, e.g. Java VMs, standalone shells,
6255: etc., because the code to symlink files into
6256: <code class="filename">${BUILDLINK_DIR}</code> looks for files
6257: relative to <span class="quote">“<span class="quote">pkg_info -qp <em class="replaceable"><code>pkgname</code></em></span>”</span>.
6258: </p></li>
6259: <li class="listitem"><p>Remember that <span class="emphasis"><em>only</em></span> the
6260: <code class="filename">buildlink3.mk</code> files that you list in a
6261: package's Makefile are added as dependencies for that package.
6262: </p></li>
6263: </ol></div>
6264: <p>If a dependency on a particular package is required for its libraries and
6265: headers, then we replace:</p>
6266: <pre class="programlisting">
6267: DEPENDS+= foo>=1.1.0:../../category/foo
6268: </pre>
6269: <p>with</p>
6270: <pre class="programlisting">
6271: .include "../../category/foo/buildlink3.mk"
6272: </pre>
6273: <p>The buildlink3.mk files usually define the required dependencies.
6274: If you need a newer version of the dependency when using buildlink3.mk
6275: files, then you can define it in your Makefile; for example:</p>
1.75 rillig 6276: <pre class="programlisting">
1.299 rillig 6277: BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0
6278: .include "../../category/foo/buildlink3.mk"
1.1 grant 6279: </pre>
1.299 rillig 6280: <p>There are several <code class="filename">buildlink3.mk</code>
6281: files in <code class="filename">pkgsrc/mk</code>
6282: that handle special package issues:</p>
6283: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6284: <li class="listitem"><p><code class="filename">bdb.buildlink3.mk</code> chooses either
6285: the native or a pkgsrc Berkeley DB implementation based on
6286: the values of <code class="varname">BDB_ACCEPTED</code> and
6287: <code class="varname">BDB_DEFAULT</code>.</p></li>
6288: <li class="listitem"><p><code class="filename">curses.buildlink3.mk</code>: If the system
6289: comes with neither Curses nor NCurses, this will take care
1.322 leot 6290: 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 6291: <li class="listitem"><p><code class="filename">krb5.buildlink3.mk</code> uses the value
6292: of <code class="varname">KRB5_ACCEPTED</code> to choose between
6293: adding a dependency on Heimdal or MIT-krb5 for packages that
6294: require a Kerberos 5 implementation.</p></li>
6295: <li class="listitem"><p><code class="filename">motif.buildlink3.mk</code> checks for a
6296: system-provided Motif installation or adds a dependency on
1.322 leot 6297: <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 6298: <code class="varname">MOTIF_TYPE</code> to <span class="quote">“<span class="quote">dt</span>”</span>,
6299: <span class="quote">“<span class="quote">lesstif</span>”</span> or <span class="quote">“<span class="quote">motif</span>”</span>
6300: to choose which Motif version will be used.</p></li>
6301: <li class="listitem"><p><code class="filename">readline.buildlink3.mk</code> checks for a
6302: system-provided GNU readline or editline (libedit) installation,
1.322 leot 6303: 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>,
6304: <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 6305: <code class="varname">READLINE_DEFAULT</code> to choose readline implementation.
6306: If your package really needs GNU readline library, its Makefile
6307: should include <code class="filename">devel/readline/buildlink3.mk</code>
6308: instead of <code class="filename">readline.buildlink3.mk</code>.</p></li>
6309: <li class="listitem"><p><code class="filename">oss.buildlink3.mk</code> defines several
6310: variables that may be used by packages that use the
6311: Open Sound System (OSS) API.</p></li>
6312: <li class="listitem"><p><code class="filename">pgsql.buildlink3.mk</code> will accept
6313: any of the Postgres versions in the variable
6314: <code class="varname">PGSQL_VERSIONS_ACCEPTED</code> and default to
6315: the version <code class="varname">PGSQL_VERSION_DEFAULT</code>. See
6316: the file for more information.</p></li>
6317: <li class="listitem"><p><code class="filename">pthread.buildlink3.mk</code> uses the value of
6318: <code class="varname">PTHREAD_OPTS</code> and checks for native pthreads or adds
1.322 leot 6319: 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 6320: <li class="listitem"><p><code class="filename">xaw.buildlink3.mk</code> uses the value of
6321: <code class="varname">XAW_TYPE</code> to choose a particular Athena widgets
6322: library.</p></li>
6323: </ul></div>
6324: <p>The comments in those <code class="filename">buildlink3.mk</code>
6325: files provide a more complete
6326: description of how to use them properly.</p>
1.75 rillig 6327: </div>
1.148 asau 6328: <div class="sect1">
1.75 rillig 6329: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6330: <a name="creating-buildlink3.mk"></a>18.2. Writing <code class="filename">buildlink3.mk</code> files</h2></div></div></div>
6331: <a name="buildlink3.mk"></a><p>A package's <code class="filename">buildlink3.mk</code> file is
6332: included by Makefiles to indicate the need to compile and link
6333: against header files and libraries provided by the package. A
6334: <code class="filename">buildlink3.mk</code> file should always provide
6335: enough information to add the correct type of dependency
6336: relationship and include any other
6337: <code class="filename">buildlink3.mk</code> files that it needs to find
6338: headers and libraries that it needs in turn.</p>
6339: <p>To generate an initial <code class="filename">buildlink3.mk</code>
1.322 leot 6340: 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 6341: package is highly recommended. For most packages, the following
6342: command will generate a good starting point for
6343: <code class="filename">buildlink3.mk</code> files:</p>
6344: <pre class="screen">
6345: <code class="prompt">%</code> <strong class="userinput"><code>cd pkgsrc/<em class="replaceable"><code>category</code></em>/<em class="replaceable"><code>pkgdir</code></em>
6346: <code class="prompt">%</code> createbuildlink >buildlink3.mk</code></strong>
6347: </pre>
1.148 asau 6348: <div class="sect2">
1.75 rillig 6349: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 6350: <a name="anatomy-of-bl3"></a>18.2.1. Anatomy of a buildlink3.mk file</h3></div></div></div>
6351: <p>The following real-life example
6352: <code class="filename">buildlink3.mk</code> is taken
6353: from <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.75 rillig 6354: <pre class="programlisting">
1.299 rillig 6355: BUILDLINK_TREE+= tiff
6356:
6357: .if !defined(TIFF_BUILDLINK3_MK)
6358: TIFF_BUILDLINK3_MK:=
6359:
6360: BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1
6361: BUILDLINK_ABI_DEPENDS.tiff+= tiff>=3.7.2nb1
6362: BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
6363:
6364: .include "../../devel/zlib/buildlink3.mk"
6365: .include "../../graphics/jpeg/buildlink3.mk"
6366: .endif # TIFF_BUILDLINK3_MK
6367:
6368: BUILDLINK_TREE+= -tiff
1.1 grant 6369: </pre>
1.299 rillig 6370: <p>The header and footer manipulate
6371: <code class="varname">BUILDLINK_TREE</code>, which is common across all
6372: <code class="filename">buildlink3.mk</code> files and is used to track
6373: the dependency tree.</p>
6374: <p>The main section is protected from multiple inclusion
6375: and controls how the dependency on <em class="replaceable"><code>pkg</code></em> is
6376: added. Several important variables are set in the section:</p>
6377: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6378: <li class="listitem"><p><code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300 wiz 6379: is the dependency version recorded in the installed
1.299 rillig 6380: package; this should always be set using
6381: <span class="command"><strong>+=</strong></span> to ensure that
6382: we're appending to any pre-existing list of values. This
1.300 wiz 6383: variable should be set to the last version of the
1.299 rillig 6384: package that had an backwards-incompatible API change.
6385: </p></li>
6386: <li class="listitem"><p><code class="varname">BUILDLINK_PKGSRCDIR.<em class="replaceable"><code>pkg</code></em></code>
6387: is the location of the <em class="replaceable"><code>pkg</code></em>
6388: pkgsrc directory.</p></li>
6389: <li class="listitem"><p><code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
6390: (not shown above) controls whether we use
1.350 gutterid 6391: <code class="varname">BUILD_DEPENDS</code> or
1.299 rillig 6392: <code class="varname">DEPENDS</code> to add the dependency on
6393: <em class="replaceable"><code>pkg</code></em>. The build dependency is
6394: selected by setting
6395: <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>pkg</code></em></code>
1.350 gutterid 6396: to <span class="quote">“<span class="quote">build</span>”</span>. By default, the full dependency is
1.299 rillig 6397: used.</p></li>
6398: <li class="listitem"><p><code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code>
6399: and
6400: <code class="varname">BUILDLINK_LIBDIRS.<em class="replaceable"><code>pkg</code></em></code>
6401: (not shown above) are lists of subdirectories of
6402: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
6403: to add to the header and library search paths. These
6404: default to <span class="quote">“<span class="quote">include</span>”</span> and <span class="quote">“<span class="quote">lib</span>”</span>
6405: respectively.</p></li>
6406: <li class="listitem"><p><code class="varname">BUILDLINK_CPPFLAGS.<em class="replaceable"><code>pkg</code></em></code>
6407: (not shown above) is the list of preprocessor flags to add
6408: to <code class="varname">CPPFLAGS</code>, which are passed on to the
6409: configure and build phases. The <span class="quote">“<span class="quote">-I</span>”</span> option
6410: should be avoided and instead be handled using
6411: <code class="varname">BUILDLINK_INCDIRS.<em class="replaceable"><code>pkg</code></em></code> as
6412: above.</p></li>
6413: </ul></div>
6414: <p>The following variables are all optionally defined within
6415: this second section (protected against multiple inclusion) and
6416: control which package files are symlinked into
6417: <code class="filename">${BUILDLINK_DIR}</code> and how their names are
6418: transformed during the symlinking:</p>
6419: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6420: <li class="listitem"><p><code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>
6421: (not shown above) is a shell glob pattern relative to
6422: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
6423: to be symlinked into
6424: <code class="filename">${BUILDLINK_DIR}</code>,
6425: e.g. <code class="filename">include/*.h</code>.</p></li>
6426: <li class="listitem"><p><code class="varname">BUILDLINK_FILES_CMD.<em class="replaceable"><code>pkg</code></em></code>
6427: (not shown above) is a shell pipeline that
6428: outputs to stdout a list of files relative to
6429: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>.
6430: The resulting files are to be symlinked
6431: into <code class="filename">${BUILDLINK_DIR}</code>. By default,
6432: this takes the <code class="filename">+CONTENTS</code> of a
6433: <em class="replaceable"><code>pkg</code></em> and filters it through
6434: <code class="varname">${BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em>}</code>.</p></li>
6435: <li class="listitem"><p><code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
6436: (not shown above) is a filter command that filters
6437: <code class="filename">+CONTENTS</code> input into a list of files
6438: relative to
6439: <code class="filename">${BUILDLINK_PREFIX.<em class="replaceable"><code>pkg</code></em>}</code>
6440: on stdout. By default,
6441: <code class="varname">BUILDLINK_CONTENTS_FILTER.<em class="replaceable"><code>pkg</code></em></code>
6442: outputs the contents of the <code class="filename">include</code>
6443: and <code class="filename">lib</code> directories in the package
6444: <code class="filename">+CONTENTS</code>.</p></li>
6445: <li class="listitem"><p><code class="varname">BUILDLINK_FNAME_TRANSFORM.<em class="replaceable"><code>pkg</code></em></code>
6446: (not shown above) is a list of sed arguments used to
6447: transform the name of the source filename into a
6448: destination filename, e.g. <span class="command"><strong>-e
6449: "s|/curses.h|/ncurses.h|g"</strong></span>.</p></li>
6450: </ul></div>
6451: <p>This section can additionally include any
6452: <code class="filename">buildlink3.mk</code> needed for
6453: <em class="replaceable"><code>pkg</code></em>'s library dependencies.
6454: Including these <code class="filename">buildlink3.mk</code> files
6455: means that the headers and libraries for these
6456: dependencies are also symlinked into
6457: <code class="filename">${BUILDLINK_DIR}</code>
6458: whenever the <em class="replaceable"><code>pkg</code></em>
6459: <code class="filename">buildlink3.mk</code>
6460: file is included. Dependencies are only added for directly
6461: include <code class="filename">buildlink3.mk</code> files.</p>
6462: <p>When providing a <code class="filename">buildlink3.mk</code> and
6463: including other <code class="filename">buildlink3.mk</code> files in it,
6464: please only add necessary ones, i.e., those whose libraries or
6465: header files are automatically exposed when the package is
6466: use.</p>
6467: <p>In particular, if only an executable
6468: (<code class="filename">bin/foo</code>) is linked against a library, that
6469: library does not need to be propagated in the
6470: <code class="filename">buildlink3.mk</code> file.</p>
6471: <p>The following steps should help you decide if a
6472: <code class="filename">buildlink3.mk</code> file needs to be included:
6473: </p>
6474: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6475: <li class="listitem"><p>Look at the installed header files: What
6476: headers do they include? The packages providing these files
6477: must be buildlinked.</p></li>
6478: <li class="listitem"><p>Run <code class="filename">ldd</code> on all installed
6479: libraries and look against what other libraries they link.
6480: Some of the packages providing these probably need to be
6481: buildlinked; however, it's not automatic, since e.g. GTK on
6482: some systems pulls in the X libraries, so they will show up in
6483: the <code class="filename">ldd</code> output, while on others (like OS
6484: X) it won't. <code class="filename">ldd</code> output can thus only be
6485: used as a hint.</p></li>
6486: </ul></div>
6487: <p>
6488: </p>
6489: </div>
1.148 asau 6490: <div class="sect2">
1.75 rillig 6491: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 6492: <a name="updating-buildlink-depends"></a>18.2.2. Updating
6493: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6494: and
6495: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6496: in <code class="filename">buildlink3.mk</code> files</h3></div></div></div>
1.300 wiz 6497: <p>Both variables set lower bounds for a version of this package.
6498: The two variables differ in that one describes source
1.299 rillig 6499: compatibility (API) and the other binary compatibility (ABI).
6500: The difference is that a change in the API breaks compilation of
6501: programs while changes in the ABI stop compiled programs from
6502: running.</p>
1.300 wiz 6503: <p>The
6504: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6505: variable in a <code class="filename">buildlink3.mk</code> should be
6506: changed very rarely. (One possible scenario: If all packages
6507: using this package need a higher version than defined in the
6508: <code class="filename">buildlink3.mk</code>,
1.299 rillig 6509: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300 wiz 6510: could be updated to that higher version.)</p>
6511: <p>On the other hand, changes to
1.299 rillig 6512: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300 wiz 6513: are more common. The variable will need to be updated every
6514: time the major version of one of its shared libraries is changed,
6515: or any other change where a binary built against the previous
6516: version of the package will not run against the new version any
6517: longer.</p>
6518: <p>In such a case, the package's
1.299 rillig 6519: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300 wiz 6520: must be increased to require the new package version. Then the
6521: <code class="varname">PKGREVISION</code> of all packages
6522: <em class="replaceable"><code>foo</code></em> that depend on this package need
6523: to be increased, and if they have
6524: <code class="filename">buildlink3.mk</code> files,
6525: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>foo</code></em></code>
6526: in their <code class="filename">buildlink3.mk</code> files must be
6527: increased to the new version as well. This is required so that a
6528: package will pull in the versions of the packages that use the
6529: new ABI and that the packages' <code class="varname">PKGREVISION</code>s
6530: uniquely identify the packages built against the new ABI. The
1.322 leot 6531: <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 6532: help with these updates.</p>
6533: <p>See <a class="xref" href="#dependencies" title="21.1.5. Handling dependencies">Section 21.1.5, “Handling dependencies”</a> for more information
6534: about dependencies on other packages, including the
6535: <code class="varname">BUILDLINK_API_DEPENDS</code> definitions.</p>
1.299 rillig 6536: <p>Please take careful consideration before adjusting
6537: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6538: or
6539: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
1.300 wiz 6540: in a <code class="filename">buildlink3.mk</code> file as we don't want to
6541: cause unneeded package deletions and rebuilds. In many cases,
6542: new versions of packages work just fine with older
6543: dependencies.</p>
1.326 gutterid 6544: <p>Also, it is not needed to set
1.299 rillig 6545: <code class="varname">BUILDLINK_ABI_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
6546: when it is identical to
1.326 gutterid 6547: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.</p>
6548: <p>Note there is also the distinction that users are able to disable
6549: enforcement of ABI dependencies using the <code class="varname">USE_ABI_DEPENDS</code>
6550: variable, but there is no equivalent option for API dependencies.</p>
1.75 rillig 6551: </div>
6552: </div>
1.148 asau 6553: <div class="sect1">
1.75 rillig 6554: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6555: <a name="writing-builtin.mk"></a>18.3. Writing <code class="filename">builtin.mk</code> files</h2></div></div></div>
6556: <p>Some packages in pkgsrc install headers and libraries that
6557: coincide with headers and libraries present in the base system.
6558: Aside from a <code class="filename">buildlink3.mk</code> file, these
6559: packages should also include a <code class="filename">builtin.mk</code>
6560: file that includes the necessary checks to decide whether using
6561: the built-in software or the pkgsrc software is
6562: appropriate.</p>
6563: <p>The only requirements of a builtin.mk file for
6564: <em class="replaceable"><code>pkg</code></em> are:</p>
6565: <div class="orderedlist"><ol class="orderedlist" type="1">
6566: <li class="listitem"><p>It should set
6567: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6568: to either <span class="quote">“<span class="quote">yes</span>”</span> or <span class="quote">“<span class="quote">no</span>”</span>
6569: after it is included.</p></li>
6570: <li class="listitem"><p>It should <span class="emphasis"><em>not</em></span> override any
6571: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6572: which is already set before the
6573: <code class="filename">builtin.mk</code> file is included.</p></li>
6574: <li class="listitem"><p>It should be written to allow multiple inclusion. This
6575: is <span class="emphasis"><em>very</em></span> important and takes careful
6576: attention to <code class="filename">Makefile</code> coding.</p></li>
6577: </ol></div>
6578: <div class="sect2">
6579: <div class="titlepage"><div><div><h3 class="title">
6580: <a name="anatomy-of-builtin.mk"></a>18.3.1. Anatomy of a <code class="filename">builtin.mk</code> file</h3></div></div></div>
6581: <p>The following is the recommended template for builtin.mk
6582: files:</p>
1.75 rillig 6583: <pre class="programlisting">
1.299 rillig 6584: .if !defined(IS_BUILTIN.foo)
6585: #
6586: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
6587: # genuinely exists in the system or not.
6588: #
6589: IS_BUILTIN.foo?= no
1.100 rillig 6590:
1.299 rillig 6591: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
6592: # version can be determined.
6593: #
6594: . if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
6595: BUILTIN_PKG.foo?= foo-1.0
6596: . endif
6597: .endif # IS_BUILTIN.foo
1.100 rillig 6598:
1.299 rillig 6599: .if !defined(USE_BUILTIN.foo)
6600: USE_BUILTIN.foo?= ${IS_BUILTIN.foo}
6601: . if defined(BUILTIN_PKG.foo)
6602: . for _depend_ in ${BUILDLINK_API_DEPENDS.foo}
6603: . if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
6604: USE_BUILTIN.foo!= \
6605: ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \
6606: && ${ECHO} "yes" || ${ECHO} "no"
6607: . endif
6608: . endfor
6609: . endif
6610: .endif # USE_BUILTIN.foo
1.100 rillig 6611:
1.299 rillig 6612: CHECK_BUILTIN.foo?= no
6613: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
6614: #
6615: # Here we place code that depends on whether USE_BUILTIN.foo is set to
6616: # "yes" or "no".
6617: #
6618: .endif # CHECK_BUILTIN.foo
1.75 rillig 6619: </pre>
1.299 rillig 6620: <p>The first section sets
6621: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6622: depending on if <em class="replaceable"><code>pkg</code></em> really exists
6623: in the base system. This should not be a base system software
6624: with similar functionality to <em class="replaceable"><code>pkg</code></em>;
6625: it should only be <span class="quote">“<span class="quote">yes</span>”</span> if the actual package is
6626: included as part of the base system. This variable is only
6627: used internally within the <code class="filename">builtin.mk</code>
6628: file.</p>
6629: <p>The second section sets
6630: <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
6631: to the version of <em class="replaceable"><code>pkg</code></em> in the base
6632: system if it exists (if
6633: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6634: is <span class="quote">“<span class="quote">yes</span>”</span>). This variable is only used internally
6635: within the <code class="filename">builtin.mk</code> file.</p>
6636: <p>The third section sets
6637: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6638: and is <span class="emphasis"><em>required</em></span> in all
6639: <code class="filename">builtin.mk</code> files. The code in this
6640: section must make the determination whether the built-in
6641: software is adequate to satisfy the dependencies listed in
6642: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
6643: This is typically done by comparing
6644: <code class="varname">BUILTIN_PKG.<em class="replaceable"><code>pkg</code></em></code>
6645: against each of the dependencies in
6646: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>.
6647: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6648: <span class="emphasis"><em>must</em></span> be set to the correct value by the
6649: end of the <code class="filename">builtin.mk</code> file. Note that
6650: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6651: may be <span class="quote">“<span class="quote">yes</span>”</span> even if
6652: <code class="varname">IS_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6653: is <span class="quote">“<span class="quote">no</span>”</span> because we may make the determination
6654: that the built-in version of the software is similar enough to
6655: be used as a replacement.</p>
6656: <p>The last section is guarded by
6657: <code class="varname">CHECK_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>,
6658: and includes code that uses the value of
6659: <code class="varname">USE_BUILTIN.<em class="replaceable"><code>pkg</code></em></code>
6660: set in the previous section. This typically includes, e.g.,
6661: adding additional dependency restrictions and listing additional
6662: files to symlink into <code class="filename">${BUILDLINK_DIR}</code> (via
6663: <code class="varname">BUILDLINK_FILES.<em class="replaceable"><code>pkg</code></em></code>).</p>
6664: </div>
1.107 rillig 6665: </div>
1.75 rillig 6666: </div>
1.148 asau 6667: <div class="chapter">
1.75 rillig 6668: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 6669: <a name="plist"></a>Chapter 19. PLIST issues</h2></div></div></div>
1.75 rillig 6670: <div class="toc">
6671: <p><b>Table of Contents</b></p>
1.210 leot 6672: <dl class="toc">
1.299 rillig 6673: <dt><span class="sect1"><a href="#rcs-id">19.1. RCS ID</a></span></dt>
6674: <dt><span class="sect1"><a href="#automatic-plist-generation">19.2. Semi-automatic <code class="filename">PLIST</code> generation</a></span></dt>
6675: <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>
6676: <dt><span class="sect1"><a href="#plist.misc">19.4. Variable substitution in PLIST</a></span></dt>
6677: <dt><span class="sect1"><a href="#manpage-compression">19.5. Man page compression</a></span></dt>
6678: <dt><span class="sect1"><a href="#using-PLIST_SRC">19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code></a></span></dt>
6679: <dt><span class="sect1"><a href="#platform-specific-plist">19.7. Platform-specific and differing PLISTs</a></span></dt>
6680: <dt><span class="sect1"><a href="#build-plist">19.8. Build-specific PLISTs</a></span></dt>
6681: <dt><span class="sect1"><a href="#faq.common-dirs">19.9. Sharing directories between packages</a></span></dt>
1.75 rillig 6682: </dl>
6683: </div>
1.299 rillig 6684: <p>The <code class="filename">PLIST</code> file contains a package's
6685: <span class="quote">“<span class="quote">packing list</span>”</span>, i.e. a list of files that belong to
6686: the package (relative to the <code class="filename">${PREFIX}</code>
6687: directory it's been installed in) plus some additional statements
1.322 leot 6688: - 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 6689: This chapter addresses some issues that need attention when
6690: dealing with the <code class="filename">PLIST</code> file (or files, see
6691: below!).</p>
1.148 asau 6692: <div class="sect1">
1.75 rillig 6693: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6694: <a name="rcs-id"></a>19.1. RCS ID</h2></div></div></div>
6695: <p>Be sure to add a RCS ID line as the first thing in any
6696: <code class="filename">PLIST</code> file you write:</p>
6697: <pre class="programlisting">
6698: @comment $NetBSD $
6699: </pre>
6700: <p>An artificial space has been added between NetBSD and $, this is a
6701: workaround here to prevent CVS expanding to the filename of the guide. When
6702: adding the RCS ID the space should be omitted.</p>
1.75 rillig 6703: </div>
1.148 asau 6704: <div class="sect1">
1.75 rillig 6705: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6706: <a name="automatic-plist-generation"></a>19.2. Semi-automatic <code class="filename">PLIST</code> generation</h2></div></div></div>
6707: <p>You can use the <span class="command"><strong>make print-PLIST</strong></span> command
6708: to output a PLIST that matches any new files since the package
6709: was extracted. See <a class="xref" href="#build.helpful-targets" title="13.17. Other helpful targets">Section 13.17, “Other helpful targets”</a> for
6710: more information on this target.</p>
1.75 rillig 6711: </div>
1.148 asau 6712: <div class="sect1">
1.75 rillig 6713: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6714: <a name="print-PLIST"></a>19.3. Tweaking output of <span class="command"><strong>make print-PLIST</strong></span>
6715: </h2></div></div></div>
6716: <p>The <code class="varname">PRINT_PLIST_AWK</code> variable takes a set
6717: of AWK patterns and actions that are used to filter the output of
6718: print-PLIST. You can <span class="emphasis"><em>append</em></span> any chunk of AWK
6719: scripting you like to it, but be careful with quoting.</p>
6720: <p>For example, to get all files inside the
6721: <code class="filename">libdata/foo</code> directory removed from the
6722: resulting PLIST:</p>
1.88 wiz 6723: <pre class="programlisting">
1.299 rillig 6724: PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
1.100 rillig 6725: </pre>
1.300 wiz 6726: <p>The <code class="varname">PRINT_PLIST_AWK</code> transformations are
6727: evaluated after the file list and directory list are sorted.
6728: <code class="varname">EARLY_PRINT_PLIST_AWK</code> is like
6729: <code class="varname">PRINT_PLIST_AWK</code> except it operates before the file
6730: list and directory list are sorted.</p>
1.299 rillig 6731: </div>
6732: <div class="sect1">
6733: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
6734: <a name="plist.misc"></a>19.4. Variable substitution in PLIST</h2></div></div></div>
6735: <p>A number of variables are substituted automatically in
6736: PLISTs when a package is installed on a system. This includes the
6737: following variables:</p>
6738: <div class="variablelist"><dl class="variablelist">
6739: <dt><span class="term"><code class="varname">${MACHINE_ARCH}</code>, <code class="varname">${MACHINE_GNU_ARCH}</code></span></dt>
6740: <dd>
6741: <p>Some packages like emacs and perl embed information
6742: about which architecture they were built on into the
6743: pathnames where they install their files. To handle this
6744: case, PLIST will be preprocessed before actually used, and
6745: the symbol
6746: <span class="quote">“<span class="quote"><code class="varname">${MACHINE_ARCH}</code></span>”</span> will be
6747: replaced by what <span class="command"><strong>uname -p</strong></span> gives. The
6748: same is done if the string
6749: <code class="varname">${MACHINE_GNU_ARCH}</code> is embedded in
6750: PLIST somewhere - use this on packages that have GNU
6751: autoconf-created configure scripts.</p>
6752: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
6753: <h3 class="title">Legacy note</h3>
6754: <p>There used to be a symbol
6755: <span class="quote">“<span class="quote"><code class="varname">$ARCH</code></span>”</span> that
6756: was replaced by the output of <span class="command"><strong>uname
6757: -m</strong></span>, but that's no longer supported and has
6758: been removed.</p>
6759: </div>
6760: </dd>
6761: <dt><span class="term"><code class="varname">${OPSYS}</code>, <code class="varname">${LOWER_OPSYS}</code>, <code class="varname">${OS_VERSION}</code></span></dt>
6762: <dd>
6763: <p>Some packages want to embed the OS name and version
6764: into some paths. To do this, use these variables in the
6765: <code class="filename">PLIST</code>:
6766: </p>
6767: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6768: <li class="listitem"><p><code class="varname">${OPSYS}</code> - output of <span class="quote">“<span class="quote"><span class="command"><strong>uname -s</strong></span></span>”</span></p></li>
6769: <li class="listitem"><p><code class="varname">${LOWER_OPSYS}</code> - lowercase common name (eg. <span class="quote">“<span class="quote">solaris</span>”</span>)</p></li>
6770: <li class="listitem"><p><code class="varname">${OS_VERSION}</code> - <span class="quote">“<span class="quote"><span class="command"><strong>uname -r</strong></span></span>”</span></p></li>
6771: </ul></div>
6772: </dd>
6773: </dl></div>
6774: <p>For a list of values which are replaced by
6775: default, the output of <span class="command"><strong>make help topic=PLIST_SUBST</strong></span> as
6776: well as searching the <code class="filename">pkgsrc/mk</code> directory with <span class="command"><strong>grep</strong></span> for
6777: <code class="varname">PLIST_SUBST</code> should help.</p>
6778: <p>If you want to change other variables not listed above, you
6779: can add variables and their expansions to this variable in the
6780: 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, “Optional files”</a>):</p>
1.81 rillig 6781: <pre class="programlisting">
1.299 rillig 6782: PLIST_SUBST+= SOMEVAR="somevalue"
1.100 rillig 6783: </pre>
1.299 rillig 6784: <p>This replaces all occurrences of <span class="quote">“<span class="quote">${SOMEVAR}</span>”</span>
6785: in the <code class="filename">PLIST</code> with
6786: <span class="quote">“<span class="quote">somevalue</span>”</span>.</p>
6787: <p>The <code class="varname">PLIST_VARS</code> variable can be used to simplify
6788: the common case of conditionally including some
6789: <code class="filename">PLIST</code> entries. It can be done by adding
6790: <code class="literal"><code class="varname">PLIST_VARS</code>+=foo</code> and
6791: setting the corresponding <code class="varname">PLIST.foo</code> variable
6792: to <code class="literal">yes</code> if the entry should be included.
6793: This will substitute <span class="quote">“<span class="quote"><code class="varname">${PLIST.foo}</code></span>”</span>
6794: in the <code class="filename">PLIST</code> with either
6795: <span class="quote">“<span class="quote"><code class="literal">""</code></span>”</span> or
6796: <span class="quote">“<span class="quote"><code class="literal">"@comment "</code></span>”</span>.
6797: For example, in <code class="filename">Makefile</code>:</p>
1.174 asau 6798: <pre class="programlisting">
1.299 rillig 6799: PLIST_VARS+= foo
6800: .if <em class="replaceable"><code>condition</code></em>
6801: PLIST.foo= yes
6802: .else
1.174 asau 6803: </pre>
1.299 rillig 6804: <p>And then in <code class="filename">PLIST</code>:</p>
1.81 rillig 6805: <pre class="programlisting">
1.299 rillig 6806: @comment $NetBSD $
6807: bin/bar
6808: man/man1/bar.1
6809: ${PLIST.foo}bin/foo
6810: ${PLIST.foo}man/man1/foo.1
6811: ${PLIST.foo}share/bar/foo.data
1.100 rillig 6812: </pre>
1.299 rillig 6813: <p>An artificial space has been added between NetBSD and $, this is a
6814: workaround here to prevent CVS expanding to the filename of the guide. When
1.309 gutterid 6815: adding the RCS ID the space should be omitted.</p>
1.81 rillig 6816: </div>
1.299 rillig 6817: <div class="sect1">
6818: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
6819: <a name="manpage-compression"></a>19.5. Man page compression</h2></div></div></div>
6820: <p>Man pages should be installed in compressed form if
6821: <code class="varname">MANZ</code> is set (in <code class="filename">bsd.own.mk</code>),
6822: and uncompressed otherwise. To handle this in the
6823: <code class="filename">PLIST</code> file, the suffix <span class="quote">“<span class="quote">.gz</span>”</span> is
6824: appended/removed automatically for man pages according to
6825: <code class="varname">MANZ</code> and <code class="varname">MANCOMPRESSED</code> being set
6826: or not, see above for details. This modification of the
6827: <code class="filename">PLIST</code> file is done on a copy of it, not
6828: <code class="filename">PLIST</code> itself.</p>
1.75 rillig 6829: </div>
1.148 asau 6830: <div class="sect1">
1.75 rillig 6831: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6832: <a name="using-PLIST_SRC"></a>19.6. Changing PLIST source with <code class="varname">PLIST_SRC</code>
6833: </h2></div></div></div>
6834: <p>To use one or more files as source for the <code class="filename">PLIST</code> used
6835: in generating the binary package, set the variable
6836: <code class="varname">PLIST_SRC</code> to the names of that file(s).
1.322 leot 6837: 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 6838: important. The default for <code class="varname">PLIST_SRC</code> is
6839: <code class="filename">${PKGDIR}/PLIST</code>.</p>
1.75 rillig 6840: </div>
1.148 asau 6841: <div class="sect1">
1.75 rillig 6842: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6843: <a name="platform-specific-plist"></a>19.7. Platform-specific and differing PLISTs</h2></div></div></div>
6844: <p>Some packages decide to install a different set of files based on
6845: the operating system being used. These differences can be
6846: automatically handled by using the following files:</p>
6847: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6848: <li class="listitem"><p><code class="filename">PLIST.common</code></p></li>
6849: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}</code></p></li>
6850: <li class="listitem"><p><code class="filename">PLIST.${MACHINE_ARCH}</code></p></li>
6851: <li class="listitem"><p><code class="filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p></li>
6852: <li class="listitem"><p><code class="filename">PLIST.common_end</code></p></li>
6853: </ul></div>
1.75 rillig 6854: </div>
1.148 asau 6855: <div class="sect1">
1.75 rillig 6856: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6857: <a name="build-plist"></a>19.8. Build-specific PLISTs</h2></div></div></div>
6858: <p>Some packages decide to generate hard-to-guess file names
6859: during installation that are hard to wire down.</p>
6860: <p>In such cases, you can set the
6861: <code class="varname">GENERATE_PLIST</code> variable to shell code
6862: terminated (with a semicolon) that will output PLIST entries which
6863: will be appended to the PLIST</p>
6864: <p>You can find one example in editors/xemacs:</p>
6865: <pre class="programlisting">
6866: GENERATE_PLIST+= ${ECHO} bin/${DISTNAME}-`${WRKSRC}/src/xemacs -sd`.dmp ;
6867: </pre>
6868: <p>which will append something like
6869: <code class="filename">bin/xemacs-21.4.23-54e8ea71.dmp</code> to the
6870: <code class="filename">PLIST</code>.
6871: </p>
1.75 rillig 6872: </div>
1.148 asau 6873: <div class="sect1">
1.75 rillig 6874: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6875: <a name="faq.common-dirs"></a>19.9. Sharing directories between packages</h2></div></div></div>
6876: <p>A <span class="quote">“<span class="quote">shared directory</span>”</span> is a directory where
6877: multiple (and unrelated) packages install files. These
6878: directories were problematic because you had to add special
6879: tricks in the PLIST to conditionally remove them, or have some
6880: centralized package handle them.</p>
6881: <p>In pkgsrc, it is now easy: Each package should create
6882: directories and install files as needed; <span class="command"><strong>pkg_delete</strong></span>
6883: will remove any directories left empty after uninstalling a
6884: package.</p>
6885: <p>If a package needs an empty directory to work, create
6886: the directory during installation as usual, and also add an
6887: entry to the PLIST:
6888:
6889: </p>
6890: <pre class="programlisting">
6891: @pkgdir path/to/empty/directory
6892: </pre>
6893: <p>
6894:
6895: or take a look at <code class="varname">MAKE_DIRS</code> and
6896: <code class="varname">OWN_DIRS</code>.
1.88 wiz 6897: </p>
1.75 rillig 6898: </div>
1.299 rillig 6899: </div>
6900: <div class="chapter">
6901: <div class="titlepage"><div><div><h2 class="title">
6902: <a name="pkginstall"></a>Chapter 20. The pkginstall framework</h2></div></div></div>
6903: <div class="toc">
6904: <p><b>Table of Contents</b></p>
6905: <dl class="toc">
6906: <dt><span class="sect1"><a href="#files-and-dirs-outside-prefix">20.1. Files and directories outside the installation prefix</a></span></dt>
6907: <dd><dl>
6908: <dt><span class="sect2"><a href="#dirs-outside-prefix">20.1.1. Directory manipulation</a></span></dt>
6909: <dt><span class="sect2"><a href="#files-outside-prefix">20.1.2. File manipulation</a></span></dt>
6910: </dl></dd>
6911: <dt><span class="sect1"><a href="#conf-files">20.2. Configuration files</a></span></dt>
6912: <dd><dl>
6913: <dt><span class="sect2"><a href="#conf-files-sysconfdir">20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</a></span></dt>
6914: <dt><span class="sect2"><a href="#conf-files-configure">20.2.2. Telling the software where configuration files are</a></span></dt>
1.353 dholland 6915: <dt><span class="sect2"><a href="#conf-files-patching">20.2.3. Patching installation</a></span></dt>
6916: <dt><span class="sect2"><a href="#conf-files-declare">20.2.4. Declaring configuration files</a></span></dt>
6917: <dt><span class="sect2"><a href="#conf-files-disable">20.2.5. Disabling handling of configuration files</a></span></dt>
1.299 rillig 6918: </dl></dd>
6919: <dt><span class="sect1"><a href="#rcd-scripts">20.3. System startup scripts</a></span></dt>
6920: <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>
6921: <dt><span class="sect1"><a href="#users-and-groups">20.4. System users and groups</a></span></dt>
6922: <dt><span class="sect1"><a href="#shells">20.5. System shells</a></span></dt>
6923: <dd><dl><dt><span class="sect2"><a href="#shells-disable">20.5.1. Disabling shell registration</a></span></dt></dl></dd>
6924: <dt><span class="sect1"><a href="#fonts">20.6. Fonts</a></span></dt>
6925: <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>
6926: </dl>
6927: </div>
6928: <p>This chapter describes the framework known as
6929: <code class="literal">pkginstall</code>, whose key features are:</p>
6930: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6931: <li class="listitem"><p>Generic installation and manipulation of directories and files
6932: outside the pkgsrc-handled tree, <code class="varname">LOCALBASE</code>.</p></li>
6933: <li class="listitem"><p>Automatic handling of configuration files during installation,
6934: provided that packages are correctly designed.</p></li>
6935: <li class="listitem"><p>Generation and installation of system startup scripts.</p></li>
6936: <li class="listitem"><p>Registration of system users and groups.</p></li>
6937: <li class="listitem"><p>Registration of system shells.</p></li>
6938: <li class="listitem"><p>Automatic updating of fonts databases.</p></li>
6939: </ul></div>
6940: <p>The following sections inspect each of the above points in detail.</p>
6941: <p>You may be thinking that many of the things described here could be
6942: easily done with simple code in the package's post-installation target
6943: (<code class="literal">post-install</code>). <span class="emphasis"><em>This is incorrect</em></span>,
6944: as the code in them is only executed when building from source. Machines
6945: using binary packages could not benefit from it at all (as the code itself
6946: could be unavailable). Therefore, the only way to achieve any of the items
6947: described above is by means of the installation scripts, which are
6948: automatically generated by pkginstall.</p>
1.148 asau 6949: <div class="sect1">
1.75 rillig 6950: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 6951: <a name="files-and-dirs-outside-prefix"></a>20.1. Files and directories outside the installation prefix</h2></div></div></div>
6952: <p>As you already know, the <code class="filename">PLIST</code> file holds a list
6953: of files and directories that belong to a package. The names used in it
6954: are relative to the installation prefix (<code class="filename">${PREFIX}</code>),
6955: which means that it cannot register files outside this directory (absolute
6956: path names are not allowed). Despite this restriction, some packages need
6957: to install files outside this location; e.g., under
6958: <code class="filename">${VARBASE}</code> or
6959: <code class="filename">${PKG_SYSCONFDIR}</code>. The only way to achieve this
6960: is to create such files during installation time by using
6961: installation scripts.</p>
6962: <p>The generic installation scripts are shell scripts that can
6963: contain arbitrary code. The list of scripts to execute is taken from
6964: the <code class="varname">INSTALL_FILE</code> variable, which defaults to
6965: <code class="filename">INSTALL</code>. A similar variable exists for package
6966: removal (<code class="varname">DEINSTALL_FILE</code>, whose default is
6967: <code class="filename">DEINSTALL</code>). These scripts can run arbitrary
6968: commands, so they have the potential to create and manage files
6969: anywhere in the file system.</p>
6970: <p>Using these general installation files is not recommended, but
6971: may be needed in some special cases. One reason for avoiding them is
6972: that the user has to trust the packager that there is no unwanted or
6973: simply erroneous code included in the installation script. Also,
6974: previously there were many similar scripts for the same functionality,
6975: and fixing a common error involved finding and changing all of
6976: them.</p>
6977: <p>The pkginstall framework offers another, standardized way. It
6978: provides generic scripts to abstract the manipulation of such files
6979: and directories based on variables set in the package's
6980: <code class="filename">Makefile</code>. The rest of this section describes
6981: these variables.</p>
6982: <div class="sect2">
6983: <div class="titlepage"><div><div><h3 class="title">
6984: <a name="dirs-outside-prefix"></a>20.1.1. Directory manipulation</h3></div></div></div>
6985: <p>The following variables can be set to request the creation of
6986: directories anywhere in the file system:</p>
6987: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
6988: <li class="listitem">
6989: <p><code class="varname">MAKE_DIRS</code> and <code class="varname">OWN_DIRS</code>
6990: contain a list of directories that should be created and should attempt
6991: to be destroyed by the installation scripts. The difference between
6992: the two is that the latter prompts the administrator to remove any
6993: directories that may be left after deinstallation (because they were
6994: not empty), while the former does not. Example:</p>
6995: <pre class="programlisting">
6996: MAKE_DIRS+= ${VARBASE}/foo/private
6997: </pre>
6998: </li>
6999: <li class="listitem">
7000: <p><code class="varname">MAKE_DIRS_PERMS</code> and
7001: <code class="varname">OWN_DIRS_PERMS</code> contain a list of tuples describing
7002: which directories should be created and should attempt to be destroyed
7003: by the installation scripts. Each tuple holds the following values,
7004: separated by spaces: the directory name, its owner, its group and its
7005: numerical mode. For example:</p>
7006: <pre class="programlisting">
7007: MAKE_DIRS_PERMS+= ${VARBASE}/foo/private \
7008: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
7009: </pre>
7010: <p>The difference between the two is exactly the same as their
7011: non-<code class="varname">PERMS</code> counterparts.</p>
7012: </li>
7013: </ul></div>
1.75 rillig 7014: </div>
1.299 rillig 7015: <div class="sect2">
7016: <div class="titlepage"><div><div><h3 class="title">
7017: <a name="files-outside-prefix"></a>20.1.2. File manipulation</h3></div></div></div>
7018: <p>Creating non-empty files outside the installation prefix is tricky
7019: because the <code class="filename">PLIST</code> forces all files to be inside it.
1.353 dholland 7020: To overcome this problem, the only solution is to extract the file in a
1.299 rillig 7021: known place (i.e., inside the installation prefix) and copy it to the
7022: appropriate location during installation (done by the installation scripts
1.353 dholland 7023: generated by pkginstall). We will call the former the <span class="emphasis"><em>reference
1.299 rillig 7024: file</em></span> in the following paragraphs, which describe the variables
7025: that can be used to automatically and consistently handle files outside the
7026: installation prefix:</p>
7027: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.353 dholland 7028: <li class="listitem"><p><code class="varname">REQD_FILES</code> is a list of pairs of reference
7029: and target files. At installation time, the reference file is copied
7030: to the target if and only if the latter does not exist. Upon
7031: deinstallation, the reference file is removed provided that it was
7032: not modified by the installation.</p></li>
1.299 rillig 7033: <li class="listitem">
1.353 dholland 7034: <p><code class="varname">REQD_FILES_PERMS</code> contains tuples describing
7035: reference files and targets, including owner, group, and numeric
7036: permissions that should be set. For example:</p>
1.88 wiz 7037: <pre class="programlisting">
1.299 rillig 7038: REQD_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile \
7039: ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0700
1.100 rillig 7040: </pre>
1.299 rillig 7041: </li>
1.353 dholland 7042: <li class="listitem"><p><code class="varname">CONF_FILES</code> and
7043: <code class="varname">CONF_FILES_PERMS</code> have the same syntax as
7044: <code class="varname">REQD_FILES</code> and
7045: <code class="varname">REQD_FILES_PERMS</code> respectively. The difference
7046: is that these variables are specifically intended for handling
7047: configuration files, for which additional conventions and
7048: constraints apply. See <a class="xref" href="#conf-files" title="20.2. Configuration files">Section 20.2, “Configuration files”</a> for further
7049: discussion. Note in particular that while handling of
7050: configuration files can be disabled by the user (see <a class="xref" href="#conf-files-disable" title="20.2.5. Disabling handling of configuration files">Section 20.2.5, “Disabling handling of configuration files”</a>), this setting does not affect
7051: <code class="varname">REQD_FILES</code> and
7052: <code class="varname">REQD_FILES_PERMS</code>.</p></li>
1.299 rillig 7053: </ul></div>
1.353 dholland 7054: <p>To install an empty file, one can use these macros and
7055: <code class="filename">/dev/null</code> as the reference file.</p>
1.299 rillig 7056: </div>
1.75 rillig 7057: </div>
1.148 asau 7058: <div class="sect1">
1.75 rillig 7059: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 7060: <a name="conf-files"></a>20.2. Configuration files</h2></div></div></div>
1.353 dholland 7061: <p>There are two principles that govern the handling of
7062: configuration files in pkgsrc: first, the user's configuration must
7063: not be lost or overwritten by upgrades or reinstallations; and second,
7064: the default configuration should always be available for reference.
7065: To that end, pkgsrc has a framework specifically for handling
7066: configuration files. In general, configuration files are installed
7067: into <code class="filename">${PREFIX}/share/examples</code>, and copied from
7068: there to the pertinent <code class="filename">etc</code> directory as a
7069: separate step and only as needed.</p>
7070: <p>To make this work, there are three things that need to happen,
7071: any of which may require patching. First, the package must be told to
7072: read its configuration from the correct place at runtime; this place
7073: is <code class="filename">${PKG_SYSCONFDIR}</code> (or possibly a subdirectory
7074: of it) which is often but not always
7075: <code class="filename">${PREFIX}/etc</code>. Second, the package must be
7076: taught to install its default configuration files in
7077: <code class="filename">${PREFIX}/share/examples/${PKGBASE}</code>; this is the
7078: point at which patching often becomes required because it is not the
7079: same place as the runtime location. Third, the configuration files
7080: need to be declared in the package makefile; this is the easy part.
7081: </p>
7082: <p>With those elements in place, the right things will happen: the
7083: package install phase and resulting binary package will not touch
7084: <code class="filename">${PKG_SYSCONFDIR}</code>, and the default configuration
7085: will be copied into place by the pkgsrc framework only if not already
7086: present. Similarly, upon deinstall the configuration will not be
7087: removed if it has been modified. (This means that in the case of
7088: reinstallation and upgrades, unmodified configuration files are
7089: updated but modifications are never discarded.)</p>
7090: <p>The following sections describe how to make these things happen
7091: and document other relevant knobs available in the pkgsrc
7092: infrastructure.</p>
1.299 rillig 7093: <div class="sect2">
7094: <div class="titlepage"><div><div><h3 class="title">
7095: <a name="conf-files-sysconfdir"></a>20.2.1. How <code class="varname">PKG_SYSCONFDIR</code> is set</h3></div></div></div>
7096: <p>As said before, the <code class="varname">PKG_SYSCONFDIR</code> variable
7097: specifies where configuration files shall be installed. Its contents are
7098: set based upon the following variables:</p>
7099: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
7100: <li class="listitem"><p><code class="varname">PKG_SYSCONFBASE</code>: The configuration's root
7101: directory. Defaults to <code class="filename">${PREFIX}/etc</code> although it may
1.353 dholland 7102: be overridden by the user to point to their preferred location (e.g.,
1.299 rillig 7103: <code class="filename">/etc</code>, <code class="filename">/etc/pkg</code>, etc.).
7104: Packages must not use it directly.</p></li>
7105: <li class="listitem">
7106: <p><code class="varname">PKG_SYSCONFSUBDIR</code>: A subdirectory of
7107: <code class="varname">PKG_SYSCONFBASE</code> under which the configuration files
7108: for the package being built shall be installed. The definition of this
7109: variable only makes sense in the package's
7110: <code class="filename">Makefile</code> (i.e., it is not user-customizable).</p>
7111: <p>As an example, consider the Apache package,
1.322 leot 7112: <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 7113: configuration files under the
7114: <code class="filename">httpd/</code> subdirectory of
7115: <code class="varname">PKG_SYSCONFBASE</code>. This should be set in the package
7116: Makefile.</p>
7117: </li>
7118: <li class="listitem"><p><code class="varname">PKG_SYSCONFVAR</code>: Specifies the name of the
7119: variable that holds this package's configuration directory (if
7120: different from <code class="varname">PKG_SYSCONFBASE</code>). It defaults to
7121: <code class="varname">PKGBASE</code>'s value, and is always prefixed with
7122: <code class="literal">PKG_SYSCONFDIR</code>.</p></li>
7123: <li class="listitem"><p><code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>: Holds the
7124: directory where the configuration files for the package identified by
7125: <code class="varname">PKG_SYSCONFVAR</code>'s shall be placed.</p></li>
7126: </ul></div>
7127: <p>Based on the above variables, pkginstall determines the value of
7128: <code class="varname">PKG_SYSCONFDIR</code>, which is the <span class="emphasis"><em>only</em></span>
1.353 dholland 7129: variable that may be used within a package to refer to its configuration
1.299 rillig 7130: directory. The algorithm used to set its value is basically the
7131: following:</p>
7132: <div class="orderedlist"><ol class="orderedlist" type="1">
7133: <li class="listitem"><p>If <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code> is set,
7134: its value is used.</p></li>
7135: <li class="listitem"><p>If the previous variable is not defined but
7136: <code class="varname">PKG_SYSCONFSUBDIR</code> is set in the package's
7137: <code class="filename">Makefile</code>, the resulting value is
7138: <code class="filename">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>.</p></li>
7139: <li class="listitem"><p>Otherwise, it is set to
7140: <code class="filename">${PKG_SYSCONFBASE}</code>.</p></li>
7141: </ol></div>
7142: <p>It is worth mentioning that <code class="filename">${PKG_SYSCONFDIR}</code> is
1.353 dholland 7143: automatically added to <code class="filename">OWN_DIRS</code>. This causes it
7144: to be automatically created if needed. See <a class="xref" href="#dirs-outside-prefix" title="20.1.1. Directory manipulation">Section 20.1.1, “Directory manipulation”</a> for further details. This does not apply to
7145: subdirectories of <code class="filename">${PKG_SYSCONFDIR}</code>; they must be manually
7146: created with <code class="varname">OWN_DIRS</code> or
7147: <code class="varname">MAKE_DIRS</code>.</p>
1.299 rillig 7148: </div>
7149: <div class="sect2">
7150: <div class="titlepage"><div><div><h3 class="title">
7151: <a name="conf-files-configure"></a>20.2.2. Telling the software where configuration files are</h3></div></div></div>
7152: <p>Given that pkgsrc (and users!) expect configuration files to be in a
1.353 dholland 7153: known place, you need to teach each package where to install its files. In
7154: some cases you will have to patch the package Makefiles to achieve it. If
7155: you are lucky, though, it may be as easy as passing an extra flag to the
7156: configuration script. This is the case for packages using GNU
7157: autoconf:</p>
1.75 rillig 7158: <pre class="programlisting">
1.299 rillig 7159: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
1.100 rillig 7160: </pre>
1.299 rillig 7161: <p>Note that this specifies where the package has to <span class="emphasis"><em>look
1.353 dholland 7162: for</em></span> its configuration files, not where they will be installed.
7163: Fortunately, there is a different way to specify the latter, as seen
1.354 gutterid 7164: in the next section, although the combination is rather confusing at
1.353 dholland 7165: first glance.</p>
1.75 rillig 7166: </div>
1.299 rillig 7167: <div class="sect2">
7168: <div class="titlepage"><div><div><h3 class="title">
1.353 dholland 7169: <a name="conf-files-patching"></a>20.2.3. Patching installation</h3></div></div></div>
7170: <p>As discussed above, <span class="strong"><strong>packages themselves must not
1.299 rillig 7171: touch the contents of <code class="filename">${PKG_SYSCONFDIR}</code>
7172: directly</strong></span>. Bad news is that many software installation scripts
7173: will, out of the box, mess with the contents of that directory. So what is
7174: the correct procedure to fix this issue?</p>
7175: <p>You must teach the package (usually by manually patching it) to
7176: install any configuration files under the examples hierarchy,
7177: <code class="filename">share/examples/${PKGBASE}/</code>. This way, the
7178: <code class="filename">PLIST</code> registers them and the administrator always
7179: has the original copies available.</p>
1.353 dholland 7180: <p>It turns out that for packages using GNU autoconf it is possible
7181: to create the desired effect by setting <code class="varname">sysconfdir</code>
7182: on the make command line at install time. Consider this example taken
7183: from <a href="https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/mail/mutt/index.html" target="_top"><code class="filename">mail/mutt</code></a>:</p>
7184: <pre class="programlisting">
7185: EGDIR= ${PREFIX}/share/examples/mutt
7186: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
7187: </pre>
7188: <p>Note that the <code class="varname">EGDIR</code> variable, though commonly
7189: used for this purpose, is local to that package and has no meaning
7190: outside it.</p>
7191: </div>
7192: <div class="sect2">
7193: <div class="titlepage"><div><div><h3 class="title">
7194: <a name="conf-files-declare"></a>20.2.4. Declaring configuration files</h3></div></div></div>
1.299 rillig 7195: <p>Once the required configuration files are in place (i.e., under the
1.353 dholland 7196: examples hierarchy), the pkginstall framework can use them as reference copies
1.299 rillig 7197: during the package installation to update what is in
7198: <code class="filename">${PKG_SYSCONFDIR}</code>. To achieve this, the variables
7199: <code class="varname">CONF_FILES</code> and <code class="varname">CONF_FILES_PERMS</code> are
1.353 dholland 7200: used. Check out <a class="xref" href="#files-outside-prefix" title="20.1.2. File manipulation">Section 20.1.2, “File manipulation”</a> for further
7201: information about their syntax and their purpose. Here is an example,
7202: taken from the <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>
7203: <pre class="programlisting">
7204: EGDIR= ${PREFIX}/share/examples/mutt
7205: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
7206: </pre>
7207: <p>Note that (as in the previous section's example) the
7208: <code class="varname">EGDIR</code> variable is specific to the package and has
7209: no meaning outside it.</p>
7210: <p>For reference, the complete example from Mutt is as follows:</p>
1.88 wiz 7211: <pre class="programlisting">
1.353 dholland 7212: CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
7213: EGDIR= ${PREFIX}/share/examples/mutt
7214: CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
7215: INSTALLATION_DIRS+= ${EGDIR}
7216: INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} sysconfdir=${EGDIR}
1.100 rillig 7217: </pre>
1.75 rillig 7218: </div>
1.299 rillig 7219: <div class="sect2">
7220: <div class="titlepage"><div><div><h3 class="title">
1.353 dholland 7221: <a name="conf-files-disable"></a>20.2.5. Disabling handling of configuration files</h3></div></div></div>
1.299 rillig 7222: <p>The automatic copying of config files can be toggled by setting the
7223: environment variable <code class="varname">PKG_CONFIG</code> prior to package
7224: installation.</p>
1.88 wiz 7225: </div>
1.75 rillig 7226: </div>
1.148 asau 7227: <div class="sect1">
1.75 rillig 7228: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 7229: <a name="rcd-scripts"></a>20.3. System startup scripts</h2></div></div></div>
7230: <p>System startup scripts are special files because they must be
7231: installed in a place known by the underlying OS, usually outside the
7232: 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, “Files and directories outside the installation prefix”</a> apply, and the same solutions
7233: can be used. However, pkginstall provides a special mechanism to handle
7234: these files.</p>
7235: <p>In order to provide system startup scripts, the package has
7236: to:</p>
7237: <div class="orderedlist"><ol class="orderedlist" type="1">
7238: <li class="listitem"><p>Store the script inside <code class="filename">${FILESDIR}</code>, with
7239: the <code class="literal">.sh</code> suffix appended. Considering the
1.338 nia 7240: <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
7241: has a <code class="filename">cupsd.sh</code> in its files directory.</p></li>
1.299 rillig 7242: <li class="listitem">
7243: <p>Tell pkginstall to handle it, appending the name of the script,
7244: without its extension, to the <code class="varname">RCD_SCRIPTS</code> variable.
7245: Continuing the previous example:</p>
7246: <pre class="programlisting">
7247: RCD_SCRIPTS+= cupsd
7248: </pre>
7249: </li>
7250: </ol></div>
7251: <p>Once this is done, pkginstall will do the following steps for each
7252: script in an automated fashion:</p>
7253: <div class="orderedlist"><ol class="orderedlist" type="1">
7254: <li class="listitem"><p>Process the file found in the files directory applying all the
7255: substitutions described in the <code class="filename">FILES_SUBST</code>
7256: variable.</p></li>
7257: <li class="listitem"><p>Copy the script from the files directory to the examples
7258: hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>. Note
1.353 dholland 7259: that this reference file must be explicitly registered in the
1.299 rillig 7260: <code class="filename">PLIST</code>.</p></li>
7261: <li class="listitem"><p>Add code to the installation scripts to copy the startup script
7262: from the examples hierarchy into the system-wide startup scripts
7263: directory.</p></li>
7264: </ol></div>
7265: <div class="sect2">
7266: <div class="titlepage"><div><div><h3 class="title">
7267: <a name="rcd-scripts-disable"></a>20.3.1. Disabling handling of system startup scripts</h3></div></div></div>
7268: <p>The automatic copying of config files can be toggled by setting the
7269: environment variable <code class="varname">PKG_RCD_SCRIPTS</code> prior to package
7270: installation. Note that the scripts will be always copied inside the
7271: examples hierarchy, <code class="filename">${PREFIX}/share/examples/rc.d/</code>, no
7272: matter what the value of this variable is.</p>
1.75 rillig 7273: </div>
7274: </div>
1.299 rillig 7275: <div class="sect1">
7276: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
7277: <a name="users-and-groups"></a>20.4. System users and groups</h2></div></div></div>
7278: <p>If a package needs to create special users and/or groups during
7279: installation, it can do so by using the pkginstall framework.</p>
7280: <p>Users can be created by adding entries to the
7281: <code class="varname">PKG_USERS</code> variable. Each entry has the following
7282: syntax:</p>
7283: <pre class="programlisting">
7284: user:group
7285: </pre>
7286: <p>Further specification of user details may be done by setting
7287: per-user variables.
7288: <code class="varname">PKG_UID.<em class="replaceable"><code>user</code></em></code> is the
7289: numeric UID for the user.
7290: <code class="varname">PKG_GECOS.<em class="replaceable"><code>user</code></em></code> is the
7291: user's description or comment.
7292: <code class="varname">PKG_HOME.<em class="replaceable"><code>user</code></em></code> is the
7293: user's home directory, and defaults to
7294: <code class="filename">/nonexistent</code> if not specified.
7295: <code class="varname">PKG_SHELL.<em class="replaceable"><code>user</code></em></code> is the
7296: user's shell, and defaults to <code class="filename">/sbin/nologin</code> if
7297: not specified.</p>
7298: <p>Similarly, groups can be created by adding entries to the
7299: <code class="varname">PKG_GROUPS</code> variable, whose syntax is:</p>
7300: <pre class="programlisting">
7301: group
7302: </pre>
7303: <p>The numeric GID of the group may be set by defining
7304: <code class="varname">PKG_GID.<em class="replaceable"><code>group</code></em></code>.</p>
7305: <p>If a package needs to create the users and groups at an earlier
7306: stage, then it can set <code class="varname">USERGROUP_PHASE</code> to either
7307: <code class="literal">configure</code>,<code class="literal">build</code>, or
7308: <code class="literal">pre-install</code> to indicate the phase before which the
7309: users and groups are created. In this case, the numeric UIDs and GIDs
7310: of the created users and groups are automatically hardcoded into the
7311: final installation scripts.</p>
1.75 rillig 7312: </div>
1.148 asau 7313: <div class="sect1">
1.75 rillig 7314: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 7315: <a name="shells"></a>20.5. System shells</h2></div></div></div>
7316: <p>Packages that install system shells should register them in the shell
7317: database, <code class="filename">/etc/shells</code>, to make things easier to the
7318: administrator. This must be done from the installation scripts to keep
7319: binary packages working on any system. pkginstall provides an easy way to
7320: accomplish this task.</p>
7321: <p>When a package provides a shell interpreter, it has to set the
7322: <code class="varname">PKG_SHELL</code> variable to its absolute file name. This will
7323: add some hooks to the installation scripts to handle it. Consider the
1.322 leot 7324: 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 7325: <pre class="programlisting">
7326: PKG_SHELL= ${PREFIX}/bin/zsh
7327: </pre>
7328: <div class="sect2">
7329: <div class="titlepage"><div><div><h3 class="title">
7330: <a name="shells-disable"></a>20.5.1. Disabling shell registration</h3></div></div></div>
7331: <p>The automatic registration of shell interpreters can be disabled by
7332: the administrator by setting the <code class="filename">PKG_REGISTER_SHELLS</code>
7333: environment variable to <code class="literal">NO</code>.</p>
7334: </div>
1.75 rillig 7335: </div>
1.148 asau 7336: <div class="sect1">
1.75 rillig 7337: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 7338: <a name="fonts"></a>20.6. Fonts</h2></div></div></div>
7339: <p>Packages that install X11 fonts should update the database files
7340: that index the fonts within each fonts directory. This can easily be
7341: accomplished within the pkginstall framework.</p>
7342: <p>When a package installs X11 fonts, it must list the directories in
7343: which fonts are installed in the
7344: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code> variables,
7345: where <em class="replaceable"><code>type</code></em> can be one of <span class="quote">“<span class="quote">ttf</span>”</span>,
7346: <span class="quote">“<span class="quote">type1</span>”</span> or <span class="quote">“<span class="quote">x11</span>”</span>. This will add hooks to the
7347: installation scripts to run the appropriate commands to update the fonts
7348: database files within each of those directories. For convenience, if the
7349: directory path is relative, it is taken to be relative to the package's
1.322 leot 7350: 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 7351: <pre class="programlisting">
1.299 rillig 7352: FONTS_DIRS.ttf= ${PREFIX}/share/fonts/X11/TTF
1.75 rillig 7353: </pre>
1.299 rillig 7354: <div class="sect2">
7355: <div class="titlepage"><div><div><h3 class="title">
7356: <a name="fonts-disable"></a>20.6.1. Disabling automatic update of the fonts databases</h3></div></div></div>
7357: <p>The automatic update of fonts databases can be disabled by
7358: the administrator by setting the <code class="filename">PKG_UPDATE_FONTS_DB</code>
7359: environment variable to <code class="literal">NO</code>.</p>
1.75 rillig 7360: </div>
7361: </div>
7362: </div>
1.148 asau 7363: <div class="chapter">
1.75 rillig 7364: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 7365: <a name="fixes"></a>Chapter 21. Making your package work</h2></div></div></div>
1.75 rillig 7366: <div class="toc">
7367: <p><b>Table of Contents</b></p>
1.210 leot 7368: <dl class="toc">
1.267 rillig 7369: <dt><span class="sect1"><a href="#general-operation">21.1. General operation</a></span></dt>
1.75 rillig 7370: <dd><dl>
1.267 rillig 7371: <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>
7372: <dt><span class="sect2"><a href="#user-interaction">21.1.2. User interaction</a></span></dt>
7373: <dt><span class="sect2"><a href="#handling-licenses">21.1.3. Handling licenses</a></span></dt>
7374: <dt><span class="sect2"><a href="#restricted-packages">21.1.4. Restricted packages</a></span></dt>
7375: <dt><span class="sect2"><a href="#dependencies">21.1.5. Handling dependencies</a></span></dt>
7376: <dt><span class="sect2"><a href="#conflicts">21.1.6. Handling conflicts with other packages</a></span></dt>
7377: <dt><span class="sect2"><a href="#not-building-packages">21.1.7. Packages that cannot or should not be built</a></span></dt>
7378: <dt><span class="sect2"><a href="#undeletable-packages">21.1.8. Packages which should not be deleted, once installed</a></span></dt>
7379: <dt><span class="sect2"><a href="#security-handling">21.1.9. Handling packages with security problems</a></span></dt>
7380: <dt><span class="sect2"><a href="#bumping-pkgrevision">21.1.10. How to handle incrementing versions when fixing an existing package</a></span></dt>
7381: <dt><span class="sect2"><a href="#fixes.subst">21.1.11. Substituting variable text in the package files (the SUBST framework)</a></span></dt>
7382: </dl></dd>
7383: <dt><span class="sect1"><a href="#fixes.fetch">21.2. The <span class="emphasis"><em>fetch</em></span> phase</a></span></dt>
7384: <dd><dl>
7385: <dt><span class="sect2"><a href="#no-plain-download">21.2.1. Packages whose distfiles aren't available for plain downloading</a></span></dt>
7386: <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>
7387: <dt><span class="sect2"><a href="#build.fetch.github">21.2.3. Packages hosted on github.com</a></span></dt>
7388: </dl></dd>
7389: <dt><span class="sect1"><a href="#fixes.configure">21.3. The <span class="emphasis"><em>configure</em></span> phase</a></span></dt>
7390: <dd><dl>
7391: <dt><span class="sect2"><a href="#fixes.libtool">21.3.1. Shared libraries - libtool</a></span></dt>
7392: <dt><span class="sect2"><a href="#using-libtool">21.3.2. Using libtool on GNU packages that already support libtool</a></span></dt>
7393: <dt><span class="sect2"><a href="#autoconf-automake">21.3.3. GNU Autoconf/Automake</a></span></dt>
1.338 nia 7394: <dt><span class="sect2"><a href="#meson">21.3.4. Meson / ninja</a></span></dt>
1.267 rillig 7395: </dl></dd>
7396: <dt><span class="sect1"><a href="#programming-languages">21.4. Programming languages</a></span></dt>
7397: <dd><dl>
7398: <dt><span class="sect2"><a href="#basic-programming-languages">21.4.1. C, C++, and Fortran</a></span></dt>
7399: <dt><span class="sect2"><a href="#java-programming-language">21.4.2. Java</a></span></dt>
1.320 wiz 7400: <dt><span class="sect2"><a href="#go-programming-language">21.4.3. Go</a></span></dt>
1.338 nia 7401: <dt><span class="sect2"><a href="#rust-programming-language">21.4.4. Rust</a></span></dt>
7402: <dt><span class="sect2"><a href="#perl-scripts">21.4.5. Packages containing Perl scripts</a></span></dt>
7403: <dt><span class="sect2"><a href="#shell-scripts">21.4.6. Packages containing shell scripts</a></span></dt>
7404: <dt><span class="sect2"><a href="#other-programming-languages">21.4.7. Other programming languages</a></span></dt>
1.267 rillig 7405: </dl></dd>
7406: <dt><span class="sect1"><a href="#fixes.build">21.5. The <span class="emphasis"><em>build</em></span> phase</a></span></dt>
7407: <dd><dl>
7408: <dt><span class="sect2"><a href="#fixes.build.cpp">21.5.1. Compiling C and C++ code conditionally</a></span></dt>
7409: <dt><span class="sect2"><a href="#compiler-bugs">21.5.2. How to handle compiler bugs</a></span></dt>
1.287 rillig 7410: <dt><span class="sect2"><a href="#fixes.build.header">21.5.3. No such file or directory</a></span></dt>
7411: <dt><span class="sect2"><a href="#undefined-reference">21.5.4. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span></a></span></dt>
7412: <dt><span class="sect2"><a href="#out-of-memory">21.5.5. Running out of memory</a></span></dt>
1.267 rillig 7413: </dl></dd>
7414: <dt><span class="sect1"><a href="#fixes.install">21.6. The <span class="emphasis"><em>install</em></span> phase</a></span></dt>
7415: <dd><dl>
7416: <dt><span class="sect2"><a href="#install-scripts">21.6.1. Creating needed directories</a></span></dt>
7417: <dt><span class="sect2"><a href="#where-to-install-documentation">21.6.2. Where to install documentation</a></span></dt>
7418: <dt><span class="sect2"><a href="#installing-score-files">21.6.3. Installing highscore files</a></span></dt>
7419: <dt><span class="sect2"><a href="#destdir-support">21.6.4. Adding DESTDIR support to packages</a></span></dt>
7420: <dt><span class="sect2"><a href="#hardcoded-paths">21.6.5. Packages with hardcoded paths to other interpreters</a></span></dt>
1.318 nia 7421: <dt><span class="sect2"><a href="#perl-modules">21.6.6. Packages installing Perl modules</a></span></dt>
1.267 rillig 7422: <dt><span class="sect2"><a href="#faq.info-files">21.6.7. Packages installing info files</a></span></dt>
7423: <dt><span class="sect2"><a href="#manpages">21.6.8. Packages installing man pages</a></span></dt>
1.318 nia 7424: <dt><span class="sect2"><a href="#x11-fonts">21.6.9. Packages installing X11 fonts</a></span></dt>
7425: <dt><span class="sect2"><a href="#sgml-xml-data">21.6.10. Packages installing SGML or XML data</a></span></dt>
7426: <dt><span class="sect2"><a href="#mime-database">21.6.11. Packages installing extensions to the MIME database</a></span></dt>
7427: <dt><span class="sect2"><a href="#intltool">21.6.12. Packages using intltool</a></span></dt>
7428: <dt><span class="sect2"><a href="#startup-scripts">21.6.13. Packages installing startup scripts</a></span></dt>
7429: <dt><span class="sect2"><a href="#tex-packages">21.6.14. Packages installing TeX modules</a></span></dt>
7430: <dt><span class="sect2"><a href="#emulation-packages">21.6.15. Packages supporting running binaries in
1.87 wiz 7431: emulation</a></span></dt>
1.318 nia 7432: <dt><span class="sect2"><a href="#hicolor-theme">21.6.16. Packages installing hicolor icons</a></span></dt>
7433: <dt><span class="sect2"><a href="#desktop-files">21.6.17. Packages installing desktop files</a></span></dt>
1.75 rillig 7434: </dl></dd>
1.267 rillig 7435: <dt><span class="sect1"><a href="#punting">21.7. Marking packages as having problems</a></span></dt>
1.75 rillig 7436: </dl>
7437: </div>
1.148 asau 7438: <div class="sect1">
1.75 rillig 7439: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 7440: <a name="general-operation"></a>21.1. General operation</h2></div></div></div>
1.78 rillig 7441: <p>One appealing feature of pkgsrc is that it runs on many
1.218 rillig 7442: different platforms. As a result, it is important to ensure,
7443: where possible, that packages in pkgsrc are portable. This
7444: chapter mentions some particular details you should pay
7445: attention to while working on pkgsrc.</p>
1.148 asau 7446: <div class="sect2">
1.78 rillig 7447: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7448: <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 7449: </h3></div></div></div>
1.78 rillig 7450: <p>The pkgsrc user can configure pkgsrc by overriding several
1.87 wiz 7451: variables in the file pointed to by <code class="varname">MAKECONF</code>,
1.110 hubertf 7452: which is <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> by default. When you
1.87 wiz 7453: want to use those variables in the preprocessor directives of
1.322 leot 7454: <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 7455: <code class="literal">.for</code>), you need to include the file
7456: <code class="filename">../../mk/bsd.prefs.mk</code> before, which in turn
7457: loads the user preferences.</p>
1.78 rillig 7458: <p>But note that some variables may not be completely defined
1.219 rillig 7459: after <code class="filename">../../mk/bsd.prefs.mk</code> has been
7460: included, as they may contain references to variables that are
7461: not yet defined. In shell commands (the lines in
7462: <code class="filename">Makefile</code> that are indented with a tab) this
7463: is no problem, since variables are only expanded when they are
7464: used. But in the preprocessor directives mentioned above and in
7465: dependency lines (of the form <code class="literal">target:
7466: dependencies</code>) the variables are expanded at load
7467: time.</p>
1.148 asau 7468: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.78 rillig 7469: <h3 class="title">Note</h3>
1.218 rillig 7470: <p>To check whether a variable can be used at load time,
7471: run <span class="command"><strong>pkglint -Wall</strong></span> on your package.</p>
1.78 rillig 7472: </div>
7473: </div>
1.148 asau 7474: <div class="sect2">
1.78 rillig 7475: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7476: <a name="user-interaction"></a>21.1.2. User interaction</h3></div></div></div>
1.88 wiz 7477: <p>Occasionally, packages require interaction from the user,
7478: and this can be in a number of ways:</p>
1.148 asau 7479: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7480: <li class="listitem"><p>When fetching the distfiles, some packages require user
1.87 wiz 7481: interaction such as entering username/password or accepting a
7482: license on a web page.</p></li>
1.128 wiz 7483: <li class="listitem"><p>When extracting the distfiles, some packages may ask for
1.88 wiz 7484: passwords.</p></li>
1.128 wiz 7485: <li class="listitem"><p>help to configure the package before it is built</p></li>
7486: <li class="listitem"><p>help during the build process</p></li>
7487: <li class="listitem"><p>help during the installation of a package</p></li>
1.78 rillig 7488: </ul></div>
1.218 rillig 7489: <p>A package can set the <code class="varname">INTERACTIVE_STAGE</code>
7490: variable to define which stages need interaction. This should be
7491: done in the package's <code class="filename">Makefile</code>, e.g.:</p>
1.75 rillig 7492: <pre class="programlisting">
1.100 rillig 7493: INTERACTIVE_STAGE= configure install
1.222 sevan 7494: </pre>
1.88 wiz 7495: <p>The user can then decide to skip this package by setting the
1.218 rillig 7496: <code class="varname">BATCH</code> variable. Packages that require interaction
7497: are also excluded from bulk builds.</p>
1.75 rillig 7498: </div>
1.148 asau 7499: <div class="sect2">
1.75 rillig 7500: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7501: <a name="handling-licenses"></a>21.1.3. Handling licenses</h3></div></div></div>
1.222 sevan 7502: <p>Authors of software can choose the licence under which software
7503: can be copied. The Free Software Foundation has declared some
7504: licenses "Free", and the Open Source Initiative has a definition of
7505: "Open Source".</p>
7506: <p>By default, pkgsrc allows packages with Free or Open Source
7507: licenses to be built. To allow packages with other licenses to be
7508: built as well, the pkgsrc user needs to add these licenses to the
7509: <code class="varname">ACCEPTABLE_LICENSES</code> variable in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. Note
7510: that this variable only affects which packages may be
7511: <span class="emphasis"><em>built</em></span>, while the license terms often also
7512: restrict the actual use of the package and its redistribution.</p>
1.98 wiz 7513: <p>One might want to only install packages with a BSD license,
1.218 rillig 7514: or the GPL, and not the other. The free licenses are added to the
1.222 sevan 7515: default <code class="varname">ACCEPTABLE_LICENSES</code> variable. The pkgsrc
1.121 jnemeth 7516: user can override the default by setting the
7517: <code class="varname">ACCEPTABLE_LICENSES</code> variable with "=" instead
1.222 sevan 7518: of "+=". The licenses accepted by default are defined in the
7519: <code class="varname">DEFAULT_ACCEPTABLE_LICENSES</code> variable in the file
7520: <code class="filename">pkgsrc/mk/license.mk</code>.</p>
1.78 rillig 7521: <p>The license tag mechanism is intended to address
1.87 wiz 7522: copyright-related issues surrounding building, installing and
7523: using a package, and not to address redistribution issues (see
7524: <code class="varname">RESTRICTED</code> and
1.222 sevan 7525: <code class="varname">NO_SRC_ON_FTP</code>, etc.).
1.121 jnemeth 7526: Packages with redistribution restrictions should set these
7527: tags.</p>
1.98 wiz 7528: <p>Denoting that a package may be copied according to a
7529: particular license is done by placing the license in
1.87 wiz 7530: <code class="filename">pkgsrc/licenses</code> and setting the
7531: <code class="varname">LICENSE</code> variable to a string identifying the
1.322 leot 7532: 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 7533: <pre class="programlisting">
1.100 rillig 7534: LICENSE= xv-license
1.222 sevan 7535: </pre>
1.87 wiz 7536: <p>When trying to build, the user will get a notice that the
1.98 wiz 7537: package is covered by a license which has not been placed in the
7538: <code class="varname">ACCEPTABLE_LICENSES</code> variable:</p>
1.87 wiz 7539: <pre class="programlisting">
1.100 rillig 7540: <code class="prompt">%</code> <strong class="userinput"><code>make</code></strong>
7541: ===> xv-3.10anb9 has an unacceptable license: xv-license.
7542: ===> To view the license, enter "/usr/bin/make show-license".
7543: ===> To indicate acceptance, add this line to your /etc/mk.conf:
7544: ===> ACCEPTABLE_LICENSES+=xv-license
7545: *** Error code 1
1.222 sevan 7546: </pre>
1.110 hubertf 7547: <p>The license can be viewed with <span class="command"><strong>make
1.98 wiz 7548: show-license</strong></span>, and if the user so chooses, the line
1.110 hubertf 7549: printed above can be added to <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> to
1.98 wiz 7550: convey to pkgsrc that it should not in the future fail because of
7551: that license:</p>
1.78 rillig 7552: <pre class="programlisting">
1.100 rillig 7553: ACCEPTABLE_LICENSES+=xv-license
1.222 sevan 7554: </pre>
7555: <p>The use of <code class="varname">LICENSE=shareware</code>,
7556: <code class="varname">LICENSE=no-commercial-use</code>, and similar language
7557: is deprecated because it does not crisply refer to a particular
7558: license text. Another problem with such usage is that it does not
7559: enable a user to tell pkgsrc to proceed for a single package
7560: without also telling pkgsrc to proceed for all packages with that
7561: tag.</p>
7562: <div class="sect3">
7563: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7564: <a name="new-license"></a>21.1.3.1. Adding a package with a new license</h4></div></div></div>
1.154 rodent 7565: <p>When adding a package with a new license, the following steps
7566: are required:</p>
7567: <div class="orderedlist"><ol class="orderedlist" type="1">
7568: <li class="listitem">
1.284 rillig 7569: <p>Check whether the license qualifies as Free or Open Source by
7570: referencing <a class="ulink" href="https://www.gnu.org/licenses/license-list.en.html" target="_top">Various
7571: Licenses and Comments about Them</a> and <a class="ulink" href="https://opensource.org/licenses/alphabetical" target="_top">Licenses by Name |
1.222 sevan 7572: Open Source Initiative</a>. If this is the case, the filename in
7573: <code class="filename">pkgsrc/licenses/</code> does not need the
7574: <code class="filename">-license</code> suffix, and the license name should be
7575: added to:</p>
1.154 rodent 7576: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.284 rillig 7577: <li class="listitem"><p>DEFAULT_ACCEPTABLE_LICENSES in
7578: <code class="filename">pkgsrc/mk/license.mk</code></p></li>
7579: <li class="listitem"><p>default_acceptable_licenses in
7580: <code class="filename">pkgsrc/pkgtools/pkg_install/files/lib/license.c</code></p></li>
1.154 rodent 7581: </ul></div>
7582: </li>
1.284 rillig 7583: <li class="listitem"><p>The license text should be added to
7584: <code class="filename">pkgsrc/licenses</code> for displaying. A list of known
7585: licenses can be seen in this directory.</p></li>
1.154 rodent 7586: </ol></div>
1.222 sevan 7587: </div>
7588: <div class="sect3">
7589: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 7590: <a name="change-license"></a>21.1.3.2. Change to the license</h4></div></div></div>
1.98 wiz 7591: <p>When the license changes (in a way other than formatting),
1.222 sevan 7592: make sure that the new license has a different name (e.g.,
1.98 wiz 7593: append the version number if it exists, or the date). Just
7594: because a user told pkgsrc to build programs under a previous
7595: version of a license does not mean that pkgsrc should build
1.99 rillig 7596: programs under the new licenses. The higher-level point is that
1.98 wiz 7597: pkgsrc does not evaluate licenses for reasonableness; the only
7598: test is a mechanistic test of whether a particular text has been
1.222 sevan 7599: approved by either of two bodies (FSF or OSI).</p>
7600: </div>
1.75 rillig 7601: </div>
1.148 asau 7602: <div class="sect2">
1.75 rillig 7603: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7604: <a name="restricted-packages"></a>21.1.4. Restricted packages</h3></div></div></div>
1.75 rillig 7605: <p>Some licenses restrict how software may be re-distributed.
1.222 sevan 7606: By declaring the restrictions, package tools can
1.98 wiz 7607: automatically refrain from e.g. placing binary packages on FTP
7608: sites.</p>
1.222 sevan 7609: <p>There are four possible restrictions, which are
1.98 wiz 7610: the cross product of sources (distfiles) and binaries not being
7611: placed on FTP sites and CD-ROMs. Because this is rarely the exact
7612: language in any license, and because non-Free licenses tend to be
7613: different from each other, pkgsrc adopts a definition of FTP and
1.222 sevan 7614: CD-ROM.
7615:
7616: "FTP" means making the source or binary file available over the
7617: Internet at no charge.
7618:
7619: "CD-ROM" means making the source or binary available on some kind of
7620: media, together with other source and binary packages, which is sold
7621: for a distribution charge.
1.98 wiz 7622: </p>
7623: <p>In order to encode these restrictions, the package system
1.87 wiz 7624: defines five make variables that can be set to note these
7625: restrictions:</p>
1.148 asau 7626: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7627: <li class="listitem">
1.75 rillig 7628: <p><code class="varname">RESTRICTED</code></p>
7629: <p>This variable should be set whenever a restriction
1.87 wiz 7630: exists (regardless of its kind). Set this variable to a
1.98 wiz 7631: string containing the reason for the restriction. It should
7632: be understood that those wanting to understand the restriction
7633: will have to read the license, and perhaps seek advice of
7634: counsel.</p>
1.75 rillig 7635: </li>
1.128 wiz 7636: <li class="listitem">
1.75 rillig 7637: <p><code class="varname">NO_BIN_ON_CDROM</code></p>
1.98 wiz 7638: <p>Binaries may not be placed on CD-ROM containing other
7639: binary packages, for which a distribution charge may be made.
7640: In this case, set this variable to
7641: <code class="varname">${RESTRICTED}</code>.</p>
1.75 rillig 7642: </li>
1.128 wiz 7643: <li class="listitem">
1.75 rillig 7644: <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.98 wiz 7645: <p>Binaries may not made available on the Internet without
7646: charge. In this case, set this variable to
7647: <code class="varname">${RESTRICTED}</code>. If this variable is set,
7648: binary packages will not be included on ftp.NetBSD.org.</p>
1.75 rillig 7649: </li>
1.128 wiz 7650: <li class="listitem">
1.75 rillig 7651: <p><code class="varname">NO_SRC_ON_CDROM</code></p>
1.98 wiz 7652: <p>Distfiles may not be placed on CD-ROM, together with
7653: other distfiles, for which a fee may be charged. In this
7654: case, set this variable to <code class="varname">${RESTRICTED}</code>.
7655: </p>
1.75 rillig 7656: </li>
1.128 wiz 7657: <li class="listitem">
1.75 rillig 7658: <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.98 wiz 7659: <p>Distfiles may not made available via FTP at no charge.
7660: In this case, set this variable to
7661: <code class="varname">${RESTRICTED}</code>. If this variable is set,
7662: the distfile(s) will not be mirrored on ftp.NetBSD.org.</p>
1.75 rillig 7663: </li>
7664: </ul></div>
1.222 sevan 7665: <p>Please note that packages will be removed from pkgsrc when the
7666: distfiles are not distributable and cannot be obtained for a period
7667: of one full quarter branch. Packages with manual/interactive fetch
7668: must have a maintainer and it is his/her responsibility to ensure
7669: this.</p>
1.75 rillig 7670: </div>
1.148 asau 7671: <div class="sect2">
1.75 rillig 7672: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7673: <a name="dependencies"></a>21.1.5. Handling dependencies</h3></div></div></div>
1.290 gutterid 7674: <p>Your package may depend on some other package being present,
7675: and there are various ways of expressing this dependency.
7676: pkgsrc supports the <code class="varname">DEPENDS</code>,
7677: <code class="varname">BUILD_DEPENDS</code>,
7678: <code class="varname">TOOL_DEPENDS</code>, and
7679: <code class="varname">TEST_DEPENDS</code> definitions, the
1.88 wiz 7680: <code class="varname">USE_TOOLS</code> definition, as well as dependencies
7681: via <code class="filename">buildlink3.mk</code>, which is the preferred way
7682: to handle dependencies, and which uses the variables named above.
1.299 rillig 7683: 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 7684: <p>The basic difference is that the <code class="varname">DEPENDS</code>
7685: definition registers that pre-requisite in the binary package so it
7686: will be pulled in when the binary package is later installed, whilst
7687: the <code class="varname">BUILD_DEPENDS</code>, <code class="varname">TOOL_DEPENDS</code>,
7688: and <code class="varname">TEST_DEPENDS</code> definitions do not, marking a
7689: dependency that is only needed for building or testing the resulting
1.299 rillig 7690: 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 7691: <p>This means that if you only need a package present whilst
1.290 gutterid 7692: you are building or testing, it should be noted as a
7693: <code class="varname">TOOL_DEPENDS</code>,
7694: <code class="varname">BUILD_DEPENDS</code>, or
7695: <code class="varname">TEST_DEPENDS</code>. When cross-compiling,
1.269 leot 7696: <code class="varname">TOOL_DEPENDS</code> are <span class="emphasis"><em>native</em></span>
7697: packages, i.e. packages for the architecture where the package
7698: is built;
7699: <code class="varname">BUILD_DEPENDS</code> are <span class="emphasis"><em>target</em></span>
1.290 gutterid 7700: packages, i.e., packages for the architecture for which the package
1.269 leot 7701: is built.</p>
1.290 gutterid 7702: <p>The format for a <code class="varname">DEPENDS</code>,
7703: <code class="varname">BUILD_DEPENDS</code>, <code class="varname">TOOL_DEPENDS</code>,
7704: and <code class="varname">TEST_DEPENDS</code> definition is:</p>
1.75 rillig 7705: <pre class="programlisting">
1.100 rillig 7706: <pre-req-package-name>:../../<category>/<pre-req-package>
1.222 sevan 7707: </pre>
1.128 wiz 7708: <p>Please note that the <span class="quote">“<span class="quote">pre-req-package-name</span>”</span>
1.87 wiz 7709: may include any of the wildcard version numbers recognized by
1.322 leot 7710: <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 7711: <div class="orderedlist"><ol class="orderedlist" type="1">
7712: <li class="listitem">
1.75 rillig 7713: <p>If your package needs another package's binaries or
1.160 wiz 7714: libraries to build and run, and if that package has a
1.87 wiz 7715: <code class="filename">buildlink3.mk</code> file available, use it:</p>
1.75 rillig 7716: <pre class="programlisting">
1.100 rillig 7717: .include "../../graphics/jpeg/buildlink3.mk"
1.222 sevan 7718: </pre>
1.75 rillig 7719: </li>
1.128 wiz 7720: <li class="listitem">
1.160 wiz 7721: <p>If your package needs another package's binaries or
7722: libraries only for building, and if that package has a
7723: <code class="filename">buildlink3.mk</code> file available, use it:</p>
7724: <pre class="programlisting">
7725: .include "../../graphics/jpeg/buildlink3.mk"
1.222 sevan 7726: </pre>
1.160 wiz 7727: <p>but set
7728: <code class="varname">BUILDLINK_DEPMETHOD.<em class="replaceable"><code>jpeg</code></em>?=build</code>
7729: to make it a build dependency only. This case is rather
7730: rare.</p>
7731: </li>
7732: <li class="listitem">
1.132 spz 7733: <p>If your package needs binaries from another package to build,
1.269 leot 7734: use the <code class="varname">TOOL_DEPENDS</code> definition:</p>
1.75 rillig 7735: <pre class="programlisting">
1.269 leot 7736: TOOL_DEPENDS+= itstool-[0-9]*:../../textproc/itstool
1.222 sevan 7737: </pre>
1.75 rillig 7738: </li>
1.269 leot 7739: <li class="listitem"><p>If your package needs static libraries to link against, header
7740: files to include, etc. from another package to build,
7741: use the <code class="varname">BUILD_DEPENDS</code> definition.</p></li>
1.132 spz 7742: <li class="listitem"><p>If your package needs a library with which to link and
7743: there is no <code class="filename">buildlink3.mk</code> file
7744: available, create one. Using
7745: <code class="varname">DEPENDS</code> won't be sufficient because the
7746: include files and libraries will be hidden from the compiler.</p></li>
1.128 wiz 7747: <li class="listitem">
1.132 spz 7748: <p>If your package needs some executable to be able to run
7749: correctly and if there's no
7750: <code class="filename">buildlink3.mk</code> file, this is specified
7751: using the <code class="varname">DEPENDS</code> variable. The
1.322 leot 7752: <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 7753: be able to execute the latex binary from the tex-latex-bin package
1.132 spz 7754: when it runs, and that is specified:</p>
1.75 rillig 7755: <pre class="programlisting">
1.242 wiz 7756: DEPENDS+= tex-latex-bin-[0-9]*:../../print/tex-latex-bin
1.222 sevan 7757: </pre>
1.132 spz 7758: </li>
1.290 gutterid 7759: <li class="listitem"><p>If your package includes a test suite that has extra
7760: dependencies only required for this purpose (frequently this
7761: can be run as a <span class="quote">“<span class="quote">make test</span>”</span> target), use the
7762: <code class="varname">TEST_DEPENDS</code> variable.</p></li>
1.132 spz 7763: <li class="listitem">
7764: <p>You can use wildcards in package dependencies. Note that
7765: such wildcard dependencies are retained when creating binary
7766: packages. The dependency is checked when installing the binary
7767: package and any package which matches the pattern will be
7768: used. Wildcard dependencies should be used with care.</p>
1.128 wiz 7769: <p>The <span class="quote">“<span class="quote">-[0-9]*</span>”</span> should be used instead of
7770: <span class="quote">“<span class="quote">-*</span>”</span> to avoid potentially ambiguous matches
7771: such as <span class="quote">“<span class="quote">tk-postgresql</span>”</span> matching a
7772: <span class="quote">“<span class="quote">tk-*</span>”</span> <code class="varname">DEPENDS</code>.</p>
1.75 rillig 7773: <p>Wildcards can also be used to specify that a package
1.87 wiz 7774: will only build against a certain minimum version of a
7775: pre-requisite:</p>
1.75 rillig 7776: <pre class="programlisting">
1.132 spz 7777: DEPENDS+= ImageMagick>=6.0:../../graphics/ImageMagick
1.222 sevan 7778: </pre>
1.132 spz 7779: <p>This means that the package will build using version 6.0
7780: of ImageMagick or newer. Such a dependency may be warranted
7781: if, for example, the command line options of an executable
7782: have changed.</p>
7783: <p>If you need to depend on minimum versions of libraries,
1.298 wiz 7784: set
7785: <code class="varname">BUILDLINK_API_DEPENDS.<em class="replaceable"><code>pkg</code></em></code>
7786: to the appropriate pattern before including its
7787: <code class="filename">buildlink3.mk</code> file, e.g.</p>
7788: <pre class="programlisting">
7789: BUILDLINK_API_DEPENDS.jpeg+= jpeg>=9.0
7790: .include "../../graphics/jpeg/buildlink3.mk"
7791: </pre>
1.75 rillig 7792: <p>For security fixes, please update the package
1.267 rillig 7793: vulnerabilities file. See <a class="xref" href="#security-handling" title="21.1.9. Handling packages with security problems">Section 21.1.9, “Handling packages with security problems”</a> for more
1.87 wiz 7794: information.</p>
1.75 rillig 7795: </li>
7796: </ol></div>
7797: <p>If your package needs files from another package to build,
1.87 wiz 7798: add the relevant distribution files to
7799: <code class="varname">DISTFILES</code>, so they will be extracted
1.322 leot 7800: 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 7801: (It relies on the jpeg sources being present in source form
7802: during the build.)</p>
1.75 rillig 7803: </div>
1.148 asau 7804: <div class="sect2">
1.75 rillig 7805: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7806: <a name="conflicts"></a>21.1.6. Handling conflicts with other packages</h3></div></div></div>
1.341 gutterid 7807: <p>Your package may conflict with other packages users might
7808: already have installed on their system, e.g., if your package
1.88 wiz 7809: installs the same set of files as another package in the pkgsrc
1.342 wiz 7810: tree.</p>
1.322 leot 7811: <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>
7812: 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 7813: install the same shared library, thus you set in
7814: <code class="filename">pkgsrc/x11/libXaw3d/Makefile</code>:</p>
7815: <pre class="programlisting">
7816: CONFLICTS= Xaw-Xpm-[0-9]*
1.352 wiz 7817: </pre>
1.255 leot 7818: <p>and in <code class="filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
7819: <pre class="programlisting">
7820: CONFLICTS= libXaw3d-[0-9]*
1.352 wiz 7821: </pre>
1.322 leot 7822: <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 7823: that conflict with existing packages and abort. However, in many
7824: situations this is too late in the process. Binary package managers
7825: will not know about the conflict until they attempt to install the
7826: package after already downloading it and all its dependencies.
7827: Users may also waste time building a package and its dependencies
7828: only to find out at the end that it conflicts with another package
7829: they have installed.</p>
7830: <p>To avoid these issues <code class="varname">CONFLICTS</code> entries
7831: should be added in all cases where it is known that packages conflict
7832: with each other. These <code class="varname">CONFLICTS</code> entries are
1.322 leot 7833: 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 7834: managers to inform users that packages cannot be installed onto
7835: the target system.</p>
1.75 rillig 7836: </div>
1.148 asau 7837: <div class="sect2">
1.75 rillig 7838: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7839: <a name="not-building-packages"></a>21.1.7. Packages that cannot or should not be built</h3></div></div></div>
1.75 rillig 7840: <p>There are several reasons why a package might be
1.88 wiz 7841: instructed to not build under certain circumstances. If the
1.87 wiz 7842: package builds and runs on most platforms, the exceptions
1.193 dholland 7843: should be noted with <code class="varname">BROKEN_ON_PLATFORM</code>. If
7844: the package builds and runs on a small handful of platforms,
7845: set <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> instead.
7846: Both <code class="varname">BROKEN_ON_PLATFORM</code> and
7847: <code class="varname">BROKEN_EXCEPT_ON_PLATFORM</code> are OS triples
7848: (OS-version-platform) that can use glob-style
7849: wildcards.</p>
7850: <p>If a package is not appropriate for some platforms (as
1.225 maya 7851: opposed to merely broken), a different set of variables should be
1.193 dholland 7852: used as this affects failure reporting and statistics.
7853: If the package is appropriate for most platforms, the exceptions
1.87 wiz 7854: should be noted with <code class="varname">NOT_FOR_PLATFORM</code>. If
1.193 dholland 7855: the package is appropriate for only a small handful of platforms
7856: (often exactly one), set <code class="varname">ONLY_FOR_PLATFORM</code> instead.
1.87 wiz 7857: Both <code class="varname">ONLY_FOR_PLATFORM</code> and
7858: <code class="varname">NOT_FOR_PLATFORM</code> are OS triples
7859: (OS-version-platform) that can use glob-style
7860: wildcards.</p>
1.88 wiz 7861: <p>Some packages are tightly bound to a specific version of an
1.322 leot 7862: 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 7863: backwards compatible with other versions of the OS, and should be
7864: uploaded to a version specific directory on the FTP server. Mark
7865: these packages by setting <code class="varname">OSVERSION_SPECIFIC</code> to
1.128 wiz 7866: <span class="quote">“<span class="quote">yes</span>”</span>. This variable is not currently used by any of
1.88 wiz 7867: the package system internals, but may be used in the
7868: future.</p>
1.75 rillig 7869: <p>If the package should be skipped (for example, because it
1.87 wiz 7870: provides functionality already provided by the system), set
1.88 wiz 7871: <code class="varname">PKG_SKIP_REASON</code> to a descriptive message. If
7872: the package should fail because some preconditions are not met,
7873: set <code class="varname">PKG_FAIL_REASON</code> to a descriptive
1.87 wiz 7874: message.</p>
1.75 rillig 7875: </div>
1.148 asau 7876: <div class="sect2">
1.75 rillig 7877: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7878: <a name="undeletable-packages"></a>21.1.8. Packages which should not be deleted, once installed</h3></div></div></div>
1.75 rillig 7879: <p>To ensure that a package may not be deleted, once it has been
1.87 wiz 7880: installed, the <code class="varname">PKG_PRESERVE</code> definition should
7881: be set in the package Makefile. This will be carried into any
7882: binary package that is made from this pkgsrc entry. A
1.128 wiz 7883: <span class="quote">“<span class="quote">preserved</span>”</span> package will
1.322 leot 7884: 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 7885: <span class="quote">“<span class="quote">-f</span>”</span> option is used.</p>
1.75 rillig 7886: </div>
1.148 asau 7887: <div class="sect2">
1.75 rillig 7888: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7889: <a name="security-handling"></a>21.1.9. Handling packages with security problems</h3></div></div></div>
1.75 rillig 7890: <p>When a vulnerability is found, this should be noted in
1.320 wiz 7891: <code class="filename">localsrc/security/advisories/pkg-vulnerabilities</code>.
7892: Entries in that file consist of three parts:</p>
7893: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
7894: <li class="listitem"><p>package version pattern</p></li>
7895: <li class="listitem"><p>type of vulnerability (please cut'n'paste an existing one where possible)</p></li>
7896: <li class="listitem"><p>URL providing additional information about the issue</p></li>
7897: </ul></div>
7898: <p>For the package version pattern please always use `<' to
7899: mark an upper bound (not `<='!). This will avoid possible
7900: problems due unrelated <code class="varname">PKGREVISION</code> bumps not
7901: related to security fixes. Lower bounds can be added too, using
7902: '>' or '>='. For example,
1.321 wiz 7903: <span class="quote">“<span class="quote"><code class="literal">foo>=1<1.2</code></span>”</span> would mark
1.320 wiz 7904: versions 1.0 (included) to 1.2 (excluded) of
7905: <span class="quote">“<span class="quote"><code class="literal">foo</code></span>”</span> as affected by the security
7906: issue.</p>
7907: <p>Entries should always be added at the bottom of the file.</p>
7908: <p>When fixing packages, please modify the upper bound of the
7909: corresponding entry. To continue the previous example, if a fix
7910: was backported to version 1.1nb2, change the previous pattern to
1.321 wiz 7911: <span class="quote">“<span class="quote"><code class="literal">foo>=1<1.1nb2</code></span>”</span>.</p>
1.320 wiz 7912: <p>To locally test a package version pattern against a
7913: <code class="varname">PKGNAME</code> you can use the <span class="command"><strong>pkg_admin
7914: pmatch</strong></span> command.</p>
7915: <p>The URL should be as permanent as possible and provide as
7916: much information about the issue as possible. CVE entries are
7917: preferred.</p>
7918: <p>After committing that file, ask pkgsrc-security@NetBSD.org to
1.138 wiz 7919: update the file on ftp.NetBSD.org.</p>
1.75 rillig 7920: <p>After fixing the vulnerability by a patch, its
1.138 wiz 7921: <code class="varname">PKGREVISION</code> should be increased (this is of
7922: course not necessary if the problem is fixed by using a newer
7923: release of the software), and the pattern in the
7924: pkg-vulnerabilities file must be updated.</p>
1.75 rillig 7925: <p>Also, if the fix should be applied to the stable pkgsrc
1.87 wiz 7926: branch, be sure to submit a pullup request!</p>
1.75 rillig 7927: <p>Binary packages already on ftp.NetBSD.org will be handled
1.87 wiz 7928: semi-automatically by a weekly cron job.</p>
1.320 wiz 7929: <p>In case a security issue is disputed, please contact
7930: pkgsrc-security@NetBSD.org.</p>
1.75 rillig 7931: </div>
1.148 asau 7932: <div class="sect2">
1.75 rillig 7933: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7934: <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 7935: <p>When making fixes to an existing package it can be useful
1.87 wiz 7936: to change the version number in <code class="varname">PKGNAME</code>. To
7937: avoid conflicting with future versions by the original author, a
1.128 wiz 7938: <span class="quote">“<span class="quote">nb1</span>”</span>, <span class="quote">“<span class="quote">nb2</span>”</span>, ... suffix can be used
1.87 wiz 7939: on package versions by setting <code class="varname">PKGREVISION=1</code>
1.128 wiz 7940: (2, ...). The <span class="quote">“<span class="quote">nb</span>”</span> is treated like a
7941: <span class="quote">“<span class="quote">.</span>”</span> by the package tools. e.g.</p>
1.87 wiz 7942: <pre class="programlisting">
1.100 rillig 7943: DISTNAME= foo-17.42
7944: PKGREVISION= 9
1.222 sevan 7945: </pre>
1.75 rillig 7946: <p>will result in a <code class="varname">PKGNAME</code> of
1.128 wiz 7947: <span class="quote">“<span class="quote">foo-17.42nb9</span>”</span>. If you want to use the original
7948: value of <code class="varname">PKGNAME</code> without the <span class="quote">“<span class="quote">nbX</span>”</span>
1.87 wiz 7949: suffix, e.g. for setting <code class="varname">DIST_SUBDIR</code>, use
7950: <code class="varname">PKGNAME_NOREV</code>.</p>
1.75 rillig 7951: <p>When a new release of the package is released, the
1.87 wiz 7952: <code class="varname">PKGREVISION</code> should be removed, e.g. on a new
7953: minor release of the above package, things should be like:</p>
1.75 rillig 7954: <pre class="programlisting">
1.100 rillig 7955: DISTNAME= foo-17.43
1.222 sevan 7956: </pre>
1.87 wiz 7957: <p><code class="varname">PKGREVISION</code> should be incremented for any
7958: non-trivial change in the resulting binary package. Without a
7959: <code class="varname">PKGREVISION</code> bump, someone with the previous
7960: version installed has no way of knowing that their package is out
7961: of date. Thus, changes without increasing
7962: <code class="varname">PKGREVISION</code> are essentially labeled "this is so
7963: trivial that no reasonable person would want to upgrade", and this
7964: is the rough test for when increasing
7965: <code class="varname">PKGREVISION</code> is appropriate. Examples of
7966: changes that do not merit increasing
7967: <code class="varname">PKGREVISION</code> are:</p>
1.148 asau 7968: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 7969: <li class="listitem"><p>Changing <code class="varname">HOMEPAGE</code>,
1.284 rillig 7970: <code class="varname">MAINTAINER</code>, <code class="varname">OWNER</code>, or
7971: comments in Makefile.</p></li>
7972: <li class="listitem"><p>Changing build variables if the resulting binary
7973: package is the same.</p></li>
7974: <li class="listitem"><p>Changing
7975: <code class="filename">DESCR</code>.</p></li>
7976: <li class="listitem"><p>Adding <code class="varname">PKG_OPTIONS</code> if the
7977: default options don't change.</p></li>
1.100 rillig 7978: </ul></div>
1.87 wiz 7979: <p>Examples of changes that do merit an increase to
7980: <code class="varname">PKGREVISION</code> include:</p>
1.148 asau 7981: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.284 rillig 7982: <li class="listitem"><p>Security fixes</p></li>
7983: <li class="listitem"><p>Changes or additions to a patch
7984: file</p></li>
7985: <li class="listitem"><p>Changes to the
7986: <code class="filename">PLIST</code></p></li>
7987: <li class="listitem"><p>A dependency is changed or
7988: renamed.</p></li>
1.100 rillig 7989: </ul></div>
1.78 rillig 7990: <p>PKGREVISION must also be incremented when dependencies have ABI
7991: changes.</p>
1.75 rillig 7992: </div>
1.148 asau 7993: <div class="sect2">
1.79 rillig 7994: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 7995: <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 7996: <p>When you want to replace the same text in multiple files, or
7997: multiple times in the same file, it is cumbersome to maintain a patch
7998: file for this. This is where the SUBST framework steps in. It provides an
7999: easy-to-use interface for replacing text in files. It just needs the
8000: following information:</p>
8001: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
8002: <li class="listitem"><p>In which phase of the package build cycle should the
8003: replacement happen?</p></li>
8004: <li class="listitem"><p>In which files should the replacement
1.287 rillig 8005: happen?</p></li>
1.295 rillig 8006: <li class="listitem"><p>Which text should be replaced with
8007: what?</p></li>
1.287 rillig 8008: </ul></div>
8009: <p>This information is encoded in a block of <code class="varname">SUBST</code>
1.295 rillig 8010: variables. A minimal example is:</p>
8011: <pre class="programlisting">
8012: SUBST_CLASSES+= paths
8013: SUBST_STAGE.paths= pre-configure
8014: SUBST_FILES.paths= src/*.c
8015: SUBST_SED.paths= -e 's,/usr/local,${PREFIX},g'
8016: </pre>
8017: <p>Translated into English, it means: In the pre-configure stage (that
8018: is, after applying the patches from the patches/ directory and before
8019: running the configure script and the portability check), replace the text
8020: <code class="literal">/usr/local</code> with the content of the variable
8021: <code class="varname">PREFIX</code>.</p>
8022: <p>Each SUBST block starts by appending an identifier to
8023: <code class="varname">SUBST_CLASSES</code> (note the <code class="literal">+=</code>). This
8024: identifier can be chosen freely by the package. If there should ever be
8025: duplicate identifiers, the pkgsrc infrastructure will catch this and fail
8026: early, so don't worry about name collisions.</p>
8027: <p>Except for <code class="varname">SUBST_CLASSES</code>, all variables in a
8028: SUBST block are parameterized using this identifier. In the remainder of
8029: this section, these parameterized variables are written as
8030: <code class="varname">SUBST_STAGE.*</code>.</p>
8031: <pre class="programlisting">
8032: SUBST_CLASSES+= paths
8033: SUBST_STAGE.paths= pre-configure
8034: SUBST_MESSAGE.paths= Fixing absolute paths.
8035: SUBST_FILES.paths= src/*.c
8036: SUBST_FILES.paths+= scripts/*.sh
8037: SUBST_SED.paths= -e 's,"/usr/local,"${PREFIX},g'
8038: SUBST_SED.paths+= -e 's,"/var/log,"${VARBASE}/log,g'
8039: SUBST_VARS.paths= LOCALBASE PREFIX PKGVERSION
8040: </pre>
8041: <p>To get a complete picture about the SUBST substitutions, run
8042: <span class="command"><strong>bmake show-all-subst</strong></span>. If something doesn't work as
8043: expected, run pkglint on the package, which detects several typical
8044: mistakes surrounding the SUBST blocks. For any questions that might
8045: remain after this, have a look at
8046: <code class="filename">mk/subst.mk</code>.</p>
8047: <div class="sect3">
8048: <div class="titlepage"><div><div><h4 class="title">
8049: <a name="fixes.subst.when"></a>21.1.11.1. Choosing the time where the substitutions happen</h4></div></div></div>
8050: <p>The <code class="varname">SUBST_STAGE.*</code> is one of
8051: {pre,do,post}-{extract,patch,configure,build,test,install}. Of these,
8052: <code class="literal">pre-configure</code> is used most often, by far. The most
8053: popular stages are, in chronological order:</p>
8054: <div class="variablelist"><dl class="variablelist">
8055: <dt><span class="term"><code class="literal">post-extract</code></span></dt>
8056: <dd>
8057: <p>The substitutions are applied immediately after the
8058: distfiles are extracted. Running <span class="command"><strong>bmake extract</strong></span> on the
8059: package will leave no traces of the original files.</p>
8060: <p>When the substitution applies to files for which there is also a
8061: patch in the <code class="filename">patches/</code> directory, this means that the
8062: patches will be computed based on the result of the substitution. When
8063: these patches are sent to the upstream maintainer later, to be fixed in
8064: the upstream package, these patches may no longer match what the upstream
8065: author is used to. Because of this, <code class="literal">pre-configure</code> is
8066: often a better choice.</p>
8067: </dd>
8068: <dt><span class="term"><code class="literal">pre-configure</code></span></dt>
8069: <dd>
8070: <p>The substitutions are applied after the patches from the
8071: <code class="filename">patches/</code> directory. This makes it possible to run
8072: <span class="command"><strong>bmake patch</strong></span> on the package, after which the patches
1.322 leot 8073: 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 8074: <p>When updating the patches, it is helpful to explicitly separate the
8075: <span class="command"><strong>bmake patch</strong></span> from the <span class="command"><strong>bmake
8076: configure</strong></span>, and to only edit the patches between these commands.
8077: Otherwise the substitutions from the SUBST block will end up in the patch
8078: file. When this happens in really obvious ways, pkglint will complain
8079: about patches that contain a hard-coded <code class="literal">/usr/pkg</code>
8080: instead of the correct and intended <code class="literal">@PREFIX@</code>, but it
8081: can only detect these really obvious
8082: cases.</p>
8083: </dd>
8084: <dt><span class="term"><code class="literal">do-configure</code></span></dt>
8085: <dd><p>This stage should only be used if the package defines a
8086: <code class="literal">pre-configure</code> action itself, and the substitution must
8087: happen after that. Typical examples are packages that use the
8088: <code class="literal">pre-configure</code> stage to regenerate the GNU configure
8089: script from
8090: <code class="filename">configure.ac</code>.</p></dd>
8091: <dt><span class="term"><code class="literal">post-configure</code></span></dt>
8092: <dd><p>This stage is used to fix up any mistakes by the
8093: configure stage.</p></dd>
8094: <dt><span class="term"><code class="literal">pre-build</code></span></dt>
8095: <dd><p>This stage should only be used for substitutions that are
8096: clearly related to building the package, not for fixing the
8097: configuration. Substitutions for pathnames (such as replacing
8098: <code class="filename">/usr/local</code> with <code class="literal">${PREFIX}</code>) or
8099: user names (such as replacing <code class="literal">@MY_USER@</code> with the
8100: actual username) belong in pre-configure or post-configure
8101: instead.</p></dd>
8102: <dt><span class="term"><code class="literal">post-build</code></span></dt>
8103: <dd>
8104: <p>Just as with pre-build, this stage should only be used
8105: for substitutions that are clearly related to building the package, not
8106: for fixing the configuration. Substitutions for pathnames (such as
8107: replacing <code class="filename">/usr/local</code> with
8108: <code class="literal">${PREFIX}</code>) or user names (such as replacing
8109: <code class="literal">@MY_USER@</code> with the actual username) belong in
8110: pre-configure or post-configure instead.</p>
8111: <p>A typical use is to update pkg-config files to include the rpath
8112: compiler options.</p>
8113: </dd>
8114: <dt><span class="term"><code class="literal">pre-install</code></span></dt>
8115: <dd><p>In general, the install phase should be as simple as
8116: possible. As with the pre-build and post-build stages, it should not be
8117: used to fix pathnames or user names, these belong in pre-configure
8118: instead. There are only few legitimate use cases for applying
8119: substitutions in this stage.</p></dd>
8120: </dl></div>
8121: </div>
8122: <div class="sect3">
8123: <div class="titlepage"><div><div><h4 class="title">
1.296 rillig 8124: <a name="fixes.subst.where"></a>21.1.11.2. Choosing the files where the substitutions happen</h4></div></div></div>
1.295 rillig 8125: <p>The <code class="varname">SUBST_FILES.*</code> variable contains a list of
8126: filename patterns. These patterns are relative to
8127: <code class="varname">WRKSRC</code> since that is where most substitutions happen.
8128: A typical example is:</p>
8129: <pre class="programlisting">
8130: SUBST_FILES.path= Makefile */Makefile */*/Makefile *.[ch]
8131: </pre>
8132: <p>The above patterns, especially the last, are quite broad. The SUBST
8133: implementation checks that each filename pattern that is mentioned here
8134: has an effect. For example, if none of the
8135: <code class="filename">*/*/Makefile</code> files contains the patterns to be found
8136: and substituted, that filename pattern is redundant and should be left
1.296 rillig 8137: out. By default, the SUBST framework will complain with an error message.
8138: If the text to be substituted occurs in some of the files from a single
8139: pattern, but not in all of them, that is totally ok, and the SUBST
1.295 rillig 8140: framework will only print an INFO message for those files.</p>
8141: <p>If there is a good reason for having redundant filename patterns,
1.296 rillig 8142: set <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
1.295 rillig 8143: <p>Another popular way of choosing the files for the substitutions is
8144: via a shell command, like this:</p>
8145: <pre class="programlisting">
1.296 rillig 8146: C_FILES_CMD= cd ${WRKSRC} && ${FIND} . -name '*.c'
1.295 rillig 8147: SUBST_FILES.path= ${C_FILES_CMD:sh}
8148: </pre>
8149: <p>The variable name <code class="varname">C_FILES_CMD</code> in this example is
8150: freely chosen and independent of the SUBST framework.</p>
8151: <p>In this variant, the <code class="varname">SUBST_FILES.*</code> variable
8152: lists each file individually. Thereby chances are higher that there are
8153: filename patterns in which no substitution happens. Since the SUBST
8154: framework cannot know whether the filename patterns in
8155: <code class="varname">SUBST_FILES.*</code> have been explicitly listed in the
8156: Makefile (where any redundant filename pattern would be suspicious) or
8157: been generated by a shell command (in which redundant filename patterns
8158: are more likely and to be expected), it will complain about these
8159: redundant filename patterns. Therefore, SUBST blocks that use a shell
8160: command to generate the list of filename patterns often need to set
8161: <code class="varname">SUBST_NOOP_OK.*</code> to <code class="literal">yes</code>.</p>
8162: </div>
8163: <div class="sect3">
8164: <div class="titlepage"><div><div><h4 class="title">
8165: <a name="fixes.subst.what"></a>21.1.11.3. Choosing what to substitute</h4></div></div></div>
8166: <p>In most cases, the substitutions are given using one or more
1.322 leot 8167: <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 8168: <pre class="programlisting">
8169: SUBST_SED.path= -e 's|/usr/local|${PREFIX}|g'
8170: </pre>
8171: <p>Each of the sed commands needs to be preceded by the
8172: <code class="literal">-e</code> option and should be specified on a line of its
8173: own, to avoid hiding short sed commands at the end of a line.</p>
8174: <p>Since the sed commands often contain shell metacharacters as the
8175: separator (the <code class="literal">|</code> in the above example), it is common
8176: to enclose them in single quotes.</p>
8177: <p>A common substitution is to replace placeholders of the form
8178: <code class="literal">@VARNAME@</code> with their pkgsrc counterpart variable
8179: <code class="literal">${VARNAME}</code>. A typical example is:</p>
8180: <pre class="programlisting">
8181: SUBST_VARS.path= PREFIX
8182: </pre>
8183: <p>This type of substitutions is typically done by the GNU configure
1.296 rillig 8184: scripts during the do-configure stage, but in some cases these need to be
8185: overridden. The same pattern is also used when a package defines patches
8186: that replace previously hard-coded paths like
8187: <code class="literal">/usr/local</code> with a <code class="literal">@PREFIX@</code>
8188: placeholder first, which then gets substituted by the actual
8189: <code class="literal">${PREFIX}</code> in the pre-configure stage. In many of these
8190: cases, it works equally well to just use the SUBST framework to directly
8191: replace <code class="literal">/usr/local</code> with <code class="literal">${PREFIX}</code>,
8192: thereby omitting the intermediate patch file.</p>
1.295 rillig 8193: <p>If the above is not flexible enough, it is possible to not use sed
8194: at all for the substitution but to specify an entirely different command,
8195: like this:</p>
1.87 wiz 8196: <pre class="programlisting">
1.295 rillig 8197: SUBST_FILTER_CMD.path= LC_ALL=C ${TR} -d '\r'
8198: </pre>
8199: <p>This is used for the few remaining packages in which the
8200: distributed files use Windows-style line endings that need to be
8201: converted to UNIX-style line endings.</p>
8202: </div>
8203: <div class="sect3">
8204: <div class="titlepage"><div><div><h4 class="title">
8205: <a name="fixes.subst.other"></a>21.1.11.4. Other SUBST variables</h4></div></div></div>
8206: <p>When a SUBST block is applied during a package build, a message is
8207: logged. The default message is fine for most purposes but can be
8208: overridden by setting <code class="literal">SUBST_MESSAGE.*</code> to an individual
8209: message.</p>
8210: </div>
1.79 rillig 8211: </div>
1.75 rillig 8212: </div>
1.148 asau 8213: <div class="sect1">
1.75 rillig 8214: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8215: <a name="fixes.fetch"></a>21.2. The <span class="emphasis"><em>fetch</em></span> phase</h2></div></div></div>
1.148 asau 8216: <div class="sect2">
1.75 rillig 8217: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8218: <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 8219: <p>If you need to download from a dynamic URL you can set
1.110 hubertf 8220: <code class="varname">DYNAMIC_MASTER_SITES</code> and a <span class="command"><strong>make
1.87 wiz 8221: fetch</strong></span> will call <code class="filename">files/getsite.sh</code>
8222: with the name of each file to download as an argument, expecting
8223: it to output the URL of the directory from which to download
1.322 leot 8224: 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 8225: example of this usage.</p>
1.75 rillig 8226: <p>If the download can't be automated, because the user must
1.87 wiz 8227: submit personal information to apply for a password, or must pay
8228: for the source, or whatever, you can set
8229: <code class="varname">FETCH_MESSAGE</code> to a list of lines that are
8230: displayed to the user before aborting the build. Example:</p>
8231: <pre class="programlisting">
1.100 rillig 8232: FETCH_MESSAGE= "Please download the files"
8233: FETCH_MESSAGE+= " "${DISTFILES:Q}
8234: FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
1.222 sevan 8235: </pre>
1.75 rillig 8236: </div>
1.148 asau 8237: <div class="sect2">
1.75 rillig 8238: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8239: <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 8240: <p>Sometimes authors of a software package make some
1.87 wiz 8241: modifications after the software was released, and they put up a
8242: new distfile without changing the package's version number. If a
8243: package is already in pkgsrc at that time, the checksum will
8244: no longer match. The contents of the new distfile should be
8245: compared against the old one before changing anything, to make
8246: sure the distfile was really updated on purpose, and that
8247: no trojan horse or so crept in.
1.97 rillig 8248: Please mention that the distfiles were compared and what was found
1.159 rodent 8249: in your commit message.</p>
1.220 wiz 8250: <p>Then, the correct way to work around this is to set
8251: <code class="varname">DIST_SUBDIR</code> to a unique directory name, usually
8252: based on <code class="varname">PKGNAME_NOREV</code> (but take care with
8253: python or ruby packages, where <code class="varname">PKGNAME</code> includes
8254: a variable prefix). All <code class="varname">DISTFILES</code> and
1.93 rillig 8255: <code class="varname">PATCHFILES</code> for this package will be put in that
1.267 rillig 8256: 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, “How to handle incrementing versions when fixing an existing package”</a> for more details.) In case this
1.87 wiz 8257: happens more often, <code class="varname">PKGNAME</code> can be used (thus
1.220 wiz 8258: including the <code class="filename">nbX</code> suffix) or a date stamp can
8259: be appended, like
8260: <code class="varname">${PKGNAME_NOREV}-YYYYMMDD</code>.</p>
1.284 rillig 8261: <p><code class="varname">DIST_SUBDIR</code> is also used when a distfile's
8262: name does not contain a version and the distfile is apt to change. In
8263: cases where the likelihood of this is very small,
8264: <code class="varname">DIST_SUBDIR</code> might not be required. Additionally,
8265: <code class="varname">DIST_SUBDIR</code> must not be removed unless the
8266: distfile name changes, even if a package is being moved or
8267: renamed.</p>
1.159 rodent 8268: <p>Do not forget regenerating the <code class="filename">distinfo</code> file
1.87 wiz 8269: after that, since it contains the <code class="varname">DIST_SUBDIR</code>
8270: path in the filenames.
1.159 rodent 8271: Also, increase the PKGREVISION if the installed package is different.
1.87 wiz 8272: Furthermore, a mail to the package's authors seems appropriate
8273: telling them that changing distfiles after releases without
8274: changing the file names is not good practice.</p>
1.75 rillig 8275: </div>
1.199 tnn 8276: <div class="sect2">
8277: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8278: <a name="build.fetch.github"></a>21.2.3. Packages hosted on github.com</h3></div></div></div>
1.284 rillig 8279: <p>Helper methods exist for packages hosted on github.com which
8280: will often have distfile names that clash with other packages, for
8281: example <code class="filename">1.0.tar.gz</code>. Use one of the three recipes
8282: from below:</p>
1.199 tnn 8283: <div class="sect3">
8284: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 8285: <a name="build.fetch.github.tag"></a>21.2.3.1. Fetch based on a tagged 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/archive/v1.0.zip</code>,
1.284 rillig 8288: then you are packaging a tagged release.</p>
1.199 tnn 8289: <pre class="programlisting">
1.303 bacon 8290: DISTNAME= example-1.0
1.200 tnn 8291: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.303 bacon 8292: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.200 tnn 8293: GITHUB_TAG= v${PKGVERSION_NOREV}
1.199 tnn 8294: EXTRACT_SUFX= .zip
8295: </pre>
1.345 gutterid 8296: <p>Here, DISTNAME combined with use of GITHUB_TAG leads the
8297: file fetching infrastructure to save the resulting file locally as
8298: <code class="literal">example-1.0.zip</code>.</p>
1.199 tnn 8299: </div>
8300: <div class="sect3">
8301: <div class="titlepage"><div><div><h4 class="title">
1.303 bacon 8302: <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>
8303: <p>If your distfile looks similar to
8304: <code class="literal">https://github.com/username/example/archive/988881adc9fc3655077dc2d4d757d480b5ea0e11</code> and is from a commit before the first
8305: release, then set the package version to 0.0.0.N, where N is the number
8306: of commits to the repository, and set GITHUB_TAG to the commit hash.
8307: This will (almost) ensure that the first tagged release will have a
8308: version greater than this one so that package upgrades will function
8309: properly.</p>
8310: <pre class="programlisting">
8311: DISTNAME= example-0.0.0.347
8312: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
8313: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
8314: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
8315: </pre>
8316: </div>
8317: <div class="sect3">
8318: <div class="titlepage"><div><div><h4 class="title">
8319: <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>
8320: <p>If your distfile looks similar to
8321: <code class="literal">https://github.com/username/example/archive/988881adc9fc3655077dc2d4d757d480b5ea0e11</code> and is from a commit after a release,
8322: then include the last release version and the commit count since that
8323: release in the package version and set GITHUB_TAG to the commit hash.
8324: The latest release and commit count are shown in the output of
8325: "git describe --tags":
8326: </p>
8327: <pre class="screen">
8328: # git clone https://github.com/username/example
8329: # cd example
8330: # git describe --tags
8331: 1.2.3-5-g988881a
8332: </pre>
1.199 tnn 8333: <pre class="programlisting">
1.303 bacon 8334: DISTNAME= example-1.2.3.5
8335: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
8336: #GITHUB_PROJECT= example # can be omitted if same as DISTNAME
1.200 tnn 8337: GITHUB_TAG= 988881adc9fc3655077dc2d4d757d480b5ea0e11
1.222 sevan 8338: </pre>
1.199 tnn 8339: </div>
8340: <div class="sect3">
8341: <div class="titlepage"><div><div><h4 class="title">
1.303 bacon 8342: <a name="build.fetch.github.release"></a>21.2.3.4. Fetch based on release</h4></div></div></div>
1.284 rillig 8343: <p>If your distfile URL looks similar to
1.303 bacon 8344: <code class="literal">https://github.com/username/example/releases/download/rel-1.6/offensive-1.6.zip</code>,
1.284 rillig 8345: then you are packaging a release.</p>
1.199 tnn 8346: <pre class="programlisting">
8347: DISTNAME= offensive-1.6
1.200 tnn 8348: PKGNAME= ${DISTNAME:S/offensive/proper/}
8349: MASTER_SITES= ${MASTER_SITE_GITHUB:=username/}
1.303 bacon 8350: GITHUB_PROJECT= example
1.200 tnn 8351: GITHUB_RELEASE= rel-${PKGVERSION_NOREV} # usually just set this to ${DISTNAME}
8352: EXTRACT_SUFX= .zip
1.222 sevan 8353: </pre>
1.199 tnn 8354: </div>
8355: </div>
1.75 rillig 8356: </div>
1.148 asau 8357: <div class="sect1">
1.75 rillig 8358: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8359: <a name="fixes.configure"></a>21.3. The <span class="emphasis"><em>configure</em></span> phase</h2></div></div></div>
1.148 asau 8360: <div class="sect2">
1.75 rillig 8361: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8362: <a name="fixes.libtool"></a>21.3.1. Shared libraries - libtool</h3></div></div></div>
1.75 rillig 8363: <p>pkgsrc supports many different machines, with different
1.87 wiz 8364: object formats like a.out and ELF, and varying abilities to do
8365: shared library and dynamic loading at all. To accompany this,
8366: varying commands and options have to be passed to the
8367: compiler, linker, etc. to get the Right Thing, which can be
8368: pretty annoying especially if you don't have all the machines
8369: at your hand to test things. The
1.322 leot 8370: <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 8371: can help here, as it just <span class="quote">“<span class="quote">knows</span>”</span> how to build
1.87 wiz 8372: both static and dynamic libraries from a set of source files,
8373: thus being platform-independent.</p>
8374: <p>Here's how to use libtool in a package in seven simple
8375: steps:</p>
1.128 wiz 8376: <div class="orderedlist"><ol class="orderedlist" type="1">
8377: <li class="listitem"><p>Add <code class="varname">USE_LIBTOOL=yes</code> to the package
1.87 wiz 8378: Makefile.</p></li>
1.128 wiz 8379: <li class="listitem"><p>For library objects, use <span class="quote">“<span class="quote">${LIBTOOL} --mode=compile
8380: ${CC}</span>”</span> in place of <span class="quote">“<span class="quote">${CC}</span>”</span>. You could even
1.87 wiz 8381: add it to the definition of <code class="varname">CC</code>, if only
8382: libraries are being built in a given Makefile. This one command
8383: will build both PIC and non-PIC library objects, so you need not
8384: have separate shared and non-shared library rules.</p></li>
1.128 wiz 8385: <li class="listitem">
1.75 rillig 8386: <p>For the linking of the library, remove any
1.128 wiz 8387: <span class="quote">“<span class="quote">ar</span>”</span>, <span class="quote">“<span class="quote">ranlib</span>”</span>, and <span class="quote">“<span class="quote">ld
8388: -Bshareable</span>”</span> commands, and instead use:</p>
1.75 rillig 8389: <pre class="programlisting">
1.100 rillig 8390: ${LIBTOOL} --mode=link \
8391: ${CC} -o ${.TARGET:.a=.la} \
8392: ${OBJS:.o=.lo} \
8393: -rpath ${PREFIX}/lib \
8394: -version-info major:minor
1.222 sevan 8395: </pre>
1.75 rillig 8396: <p>Note that the library is changed to have a
1.87 wiz 8397: <code class="filename">.la</code> extension, and the objects are
8398: changed to have a <code class="filename">.lo</code>
8399: extension. Change <code class="varname">OBJS</code> as
8400: necessary. This automatically creates all of the
8401: <code class="filename">.a</code>,
8402: <code class="filename">.so.major.minor</code>, and ELF symlinks (if
8403: necessary) in the build directory. Be sure to include
1.128 wiz 8404: <span class="quote">“<span class="quote">-version-info</span>”</span>, especially when major and
1.87 wiz 8405: minor are zero, as libtool will otherwise strip off the
8406: shared library version.</p>
1.75 rillig 8407: <p>From the libtool manual:</p>
8408: <pre class="programlisting">
1.100 rillig 8409: So, libtool library versions are described by three integers:
1.69 rillig 8410:
1.100 rillig 8411: CURRENT
8412: The most recent interface number that this library implements.
1.69 rillig 8413:
1.100 rillig 8414: REVISION
8415: The implementation number of the CURRENT interface.
1.69 rillig 8416:
1.100 rillig 8417: AGE
8418: The difference between the newest and oldest interfaces that
8419: this library implements. In other words, the library implements
8420: all the interface numbers in the range from number `CURRENT -
8421: AGE' to `CURRENT'.
1.1 grant 8422:
1.100 rillig 8423: If two libraries have identical CURRENT and AGE numbers, then the
8424: dynamic linker chooses the library with the greater REVISION number.
1.222 sevan 8425: </pre>
1.128 wiz 8426: <p>The <span class="quote">“<span class="quote">-release</span>”</span> option will produce
1.87 wiz 8427: different results for a.out and ELF (excluding symlinks)
8428: in only one case. An ELF library of the form
1.128 wiz 8429: <span class="quote">“<span class="quote">libfoo-release.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>”</span>
1.87 wiz 8430: will have a symlink of
1.128 wiz 8431: <span class="quote">“<span class="quote">libfoo.so.<span class="emphasis"><em>x</em></span>.<span class="emphasis"><em>y</em></span></span>”</span>
1.87 wiz 8432: on an a.out platform. This is handled
8433: automatically.</p>
1.128 wiz 8434: <p>The <span class="quote">“<span class="quote">-rpath argument</span>”</span> is the install
1.87 wiz 8435: directory of the library being built.</p>
1.76 rillig 8436: <p>In the <code class="filename">PLIST</code>, include only the
1.87 wiz 8437: <code class="filename">.la</code> file, the other files will be
8438: added automatically.</p>
1.75 rillig 8439: </li>
1.128 wiz 8440: <li class="listitem">
1.76 rillig 8441: <p>When linking shared object (<code class="filename">.so</code>)
1.322 leot 8442: 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 8443: shared libraries, use <span class="quote">“<span class="quote">-module
8444: -avoid-version</span>”</span> to prevent them getting version
1.87 wiz 8445: tacked on.</p>
1.76 rillig 8446: <p>The <code class="filename">PLIST</code> file gets the
1.87 wiz 8447: <code class="filename">foo.so</code> entry.</p>
1.75 rillig 8448: </li>
1.128 wiz 8449: <li class="listitem">
1.75 rillig 8450: <p>When linking programs that depend on these libraries
1.87 wiz 8451: <span class="emphasis"><em>before</em></span> they are installed, preface
1.322 leot 8452: 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">“<span class="quote">${LIBTOOL}
1.128 wiz 8453: --mode=link</span>”</span>, and it will find the correct
1.87 wiz 8454: libraries (static or shared), but please be aware that
8455: libtool will not allow you to specify a relative path in
1.128 wiz 8456: -L (such as <span class="quote">“<span class="quote">-L../somelib</span>”</span>), because it
1.87 wiz 8457: expects you to change that argument to be the
8458: <code class="filename">.la</code> file. e.g.</p>
1.75 rillig 8459: <pre class="programlisting">
1.100 rillig 8460: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
1.222 sevan 8461: </pre>
1.75 rillig 8462: <p>should be changed to:</p>
8463: <pre class="programlisting">
1.100 rillig 8464: ${LIBTOOL} --mode=link ${CC} -o <em class="replaceable"><code>someprog</code></em> <em class="replaceable"><code>../somelib/somelib.la</code></em>
1.222 sevan 8465: </pre>
1.75 rillig 8466: <p>and it will do the right thing with the libraries.</p>
8467: </li>
1.128 wiz 8468: <li class="listitem">
1.322 leot 8469: <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>
8470: 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">“<span class="quote">${LIBTOOL}
1.128 wiz 8471: --mode=install</span>”</span>, and change the library name to
1.87 wiz 8472: <code class="filename">.la</code>. e.g.</p>
1.75 rillig 8473: <pre class="programlisting">
1.126 jakllsch 8474: ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} ${SOMELIB:.a=.la} ${PREFIX}/lib
1.222 sevan 8475: </pre>
1.76 rillig 8476: <p>This will install the static <code class="filename">.a</code>,
1.87 wiz 8477: shared library, any needed symlinks, and run
1.322 leot 8478: <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 8479: </li>
1.128 wiz 8480: <li class="listitem"><p>In your <code class="filename">PLIST</code>, include only
1.87 wiz 8481: the <code class="filename">.la</code>
8482: file (this is a change from previous behaviour).</p></li>
1.75 rillig 8483: </ol></div>
8484: </div>
1.148 asau 8485: <div class="sect2">
1.75 rillig 8486: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8487: <a name="using-libtool"></a>21.3.2. Using libtool on GNU packages that already support libtool</h3></div></div></div>
1.75 rillig 8488: <p>Add <code class="varname">USE_LIBTOOL=yes</code> to the
1.87 wiz 8489: package Makefile. This will override the package's own libtool
8490: in most cases. For older libtool using packages, libtool is
8491: made by ltconfig script during the do-configure step; you can
1.110 hubertf 8492: check the libtool script location by doing <span class="command"><strong>make
1.87 wiz 8493: configure; find work*/ -name libtool</strong></span>.</p>
1.75 rillig 8494: <p><code class="varname">LIBTOOL_OVERRIDE</code> specifies which libtool
1.87 wiz 8495: scripts, relative to <code class="varname">WRKSRC</code>, to override. By
1.128 wiz 8496: default, it is set to <span class="quote">“<span class="quote">libtool */libtool
8497: */*/libtool</span>”</span>. If this does not match the location of the
1.87 wiz 8498: package's libtool script(s), set it as appropriate.</p>
1.76 rillig 8499: <p>If you do not need <code class="filename">*.a</code> static
1.87 wiz 8500: libraries built and installed, then use
8501: <code class="varname">SHLIBTOOL_OVERRIDE</code> instead.</p>
1.75 rillig 8502: <p>If your package makes use of the platform-independent library
1.87 wiz 8503: for loading dynamic shared objects, that comes with libtool
8504: (libltdl), you should include devel/libltdl/buildlink3.mk.</p>
8505: <p>Some packages use libtool incorrectly so that the package
8506: may not work or build in some circumstances. Some of the more
8507: common errors are:</p>
1.148 asau 8508: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8509: <li class="listitem">
1.75 rillig 8510: <p>The inclusion of a shared object (-module) as a dependent library in an
1.87 wiz 8511: executable or library. This in itself isn't a problem if one of two things
8512: has been done:</p>
1.128 wiz 8513: <div class="orderedlist"><ol class="orderedlist" type="1">
8514: <li class="listitem"><p>The shared object is named correctly, i.e.
1.87 wiz 8515: <code class="filename">libfoo.la</code>, not
8516: <code class="filename">foo.la</code></p></li>
1.128 wiz 8517: <li class="listitem"><p>The -dlopen option is used when linking an executable.</p></li>
1.75 rillig 8518: </ol></div>
8519: </li>
1.128 wiz 8520: <li class="listitem"><p>The use of libltdl without the correct calls to initialisation routines.
1.87 wiz 8521: The function lt_dlinit() should be called and the macro
8522: <code class="varname">LTDL_SET_PRELOADED_SYMBOLS</code> included in
8523: executables.</p></li>
1.75 rillig 8524: </ul></div>
8525: </div>
1.148 asau 8526: <div class="sect2">
1.75 rillig 8527: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8528: <a name="autoconf-automake"></a>21.3.3. GNU Autoconf/Automake</h3></div></div></div>
1.75 rillig 8529: <p>If a package needs GNU autoconf or automake to be executed
1.338 nia 8530: to regenerate the
8531: <code class="filename">configure</code>
8532: script and <code class="filename">Makefile.in</code> makefile
8533: templates from <code class="filename">configure.ac</code> and
8534: <code class="filename">Makefile.am</code>,
8535: then they should be executed in a pre-configure target:</p>
1.75 rillig 8536: <pre class="programlisting">
1.338 nia 8537: USE_TOOLS+= autoconf automake autoreconf
8538: GNU_CONFIGURE= yes
1.100 rillig 8539: ...
1.1 grant 8540:
1.100 rillig 8541: pre-configure:
1.338 nia 8542: set -e; cd ${WRKSRC} && autoreconf -fi
1.100 rillig 8543: ...
1.222 sevan 8544: </pre>
1.338 nia 8545: <p>Packages which use GNU Automake will sometimes
8546: require GNU Make (<code class="literal">gmake</code> in
8547: <code class="varname">USE_TOOLS</code>),
8548: but not always. Note that autoreconf
8549: only needs to be executed if <code class="filename">configure.ac</code>
8550: or Makefiles are modified, or <code class="filename">configure</code>
8551: is not present.</p>
1.75 rillig 8552: <p>There are times when the configure process makes
1.87 wiz 8553: additional changes to the generated files, which then causes
8554: the build process to try to re-execute the automake sequence.
8555: This is prevented by touching various files in the configure
8556: stage. If this causes problems with your package you can set
8557: <code class="varname">AUTOMAKE_OVERRIDE=NO</code> in the package
8558: Makefile.</p>
1.75 rillig 8559: </div>
1.338 nia 8560: <div class="sect2">
8561: <div class="titlepage"><div><div><h3 class="title">
8562: <a name="meson"></a>21.3.4. Meson / ninja</h3></div></div></div>
8563: <p>Packages using Meson to configure need to include:
8564:
8565: </p>
8566: <pre class="programlisting">
8567: .include "../../devel/meson/build.mk"
8568: </pre>
8569: <p>In nearly all cases (any program with dependencies),
8570: pkg-config needs to be added to
8571: <code class="varname">USE_TOOLS</code>. If the package installs
8572: translation files for non-English languages, also
8573: add msgfmt and xgettext:
8574:
8575: </p>
8576: <pre class="programlisting">
8577: USE_TOOLS+= pkg-config msgfmt xgettext
8578: </pre>
8579: <p>If any options need to be passed to Meson, use
8580: <code class="varname">MESON_ARGS</code> instead of
8581: <code class="varname">CONFIGURE_ARGS</code>:
8582:
8583: </p>
8584: <pre class="programlisting">
8585: MESON_ARGS+= -Dx11=false
8586: </pre>
8587: </div>
1.75 rillig 8588: </div>
1.148 asau 8589: <div class="sect1">
1.75 rillig 8590: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8591: <a name="programming-languages"></a>21.4. Programming languages</h2></div></div></div>
1.148 asau 8592: <div class="sect2">
1.87 wiz 8593: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8594: <a name="basic-programming-languages"></a>21.4.1. C, C++, and Fortran</h3></div></div></div>
1.338 nia 8595: <p>Compilers for the C and C++ languages comes with
1.87 wiz 8596: the NetBSD base system. By default, pkgsrc assumes that a package
8597: is written in C and will hide all other compilers (via the wrapper
1.299 rillig 8598: framework, see <a class="xref" href="#buildlink" title="Chapter 18. Buildlink methodology">Chapter 18, <i>Buildlink methodology</i></a>).</p>
1.87 wiz 8599: <p>To declare which language's compiler a package needs, set
8600: the <code class="varname">USE_LANGUAGES</code> variable. Allowed values
1.327 wiz 8601: currently are:
1.352 wiz 8602: </p>
1.327 wiz 8603: <pre class="programlisting">
1.352 wiz 8604: c99, c++, c++03, gnu++03, c++0x, gnu++0x, c++11, gnu++11,
8605: c++14, gnu++14, c++17, gnu++17, c++20, gnu++20, fortran,
8606: fortran77, java, objc, obj-c++, and ada.
8607: </pre>
1.327 wiz 8608: <p>
8609: (and any combination). The default is
1.128 wiz 8610: <span class="quote">“<span class="quote">c</span>”</span>. Packages using GNU configure scripts, even if
1.87 wiz 8611: written in C++, usually need a C compiler for the configure
8612: phase.</p>
1.338 nia 8613: <p>To express a general requirement on a specific C or C++
8614: version, normally only <code class="varname">GCC_REQD</code> needs to be set.
8615: For example, GCC 7 includes support for C++17, so if the package uses
8616: C++17 it should specify:
8617:
1.352 wiz 8618: </p>
1.338 nia 8619: <pre class="programlisting">
1.352 wiz 8620: GCC_REQD+= 7
8621: </pre>
1.338 nia 8622: <p>Language variants like <code class="literal">c++11</code> for
8623: <code class="varname">USE_LANGUAGES</code> should only be specified
8624: if the package does not explicitly set <code class="literal">-std=...</code>
8625: when compiling (i.e. the package assumes the compiler defaults to
8626: C++11 or some other standard). This is usually a bug in the
8627: upstream build system.</p>
8628: <p>GCC version 5 includes support for C++14, while GCC 4.7 includes
8629: more-or-less complete support for C++11. For more information, consult
8630: <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 8631: </div>
1.148 asau 8632: <div class="sect2">
1.87 wiz 8633: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8634: <a name="java-programming-language"></a>21.4.2. Java</h3></div></div></div>
1.87 wiz 8635: <p>If a program is written in Java, use the Java framework in
8636: pkgsrc. The package must include
8637: <code class="filename">../../mk/java-vm.mk</code>. This Makefile fragment
8638: provides the following variables:</p>
1.148 asau 8639: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 8640: <li class="listitem"><p><code class="varname">USE_JAVA</code> defines if a build
1.87 wiz 8641: dependency on the JDK is added. If
1.128 wiz 8642: <code class="varname">USE_JAVA</code> is set to <span class="quote">“<span class="quote">run</span>”</span>, then
1.87 wiz 8643: there is only a runtime dependency on the JDK. The default is
1.128 wiz 8644: <span class="quote">“<span class="quote">yes</span>”</span>, which also adds a build dependency on the
1.87 wiz 8645: JDK.</p></li>
1.128 wiz 8646: <li class="listitem"><p>Set <code class="varname">USE_JAVA2</code> to declare that
1.87 wiz 8647: a package needs a Java2 implementation. The supported values
1.128 wiz 8648: are <span class="quote">“<span class="quote">yes</span>”</span>, <span class="quote">“<span class="quote">1.4</span>”</span>, and
8649: <span class="quote">“<span class="quote">1.5</span>”</span>. <span class="quote">“<span class="quote">yes</span>”</span> accepts any Java2
8650: implementation, <span class="quote">“<span class="quote">1.4</span>”</span> insists on versions 1.4 or
8651: above, and <span class="quote">“<span class="quote">1.5</span>”</span> only accepts versions 1.5 or
1.87 wiz 8652: above. This variable is not set by default.</p></li>
1.130 wiz 8653: <li class="listitem"><p><code class="varname">PKG_JAVA_HOME</code> is
8654: automatically set to the runtime location of the used Java
8655: implementation dependency. It may be used to set
8656: <code class="varname">JAVA_HOME</code> to a good value if the program
8657: needs this variable to be defined.
8658: </p></li>
1.87 wiz 8659: </ul></div>
8660: </div>
1.148 asau 8661: <div class="sect2">
1.87 wiz 8662: <div class="titlepage"><div><div><h3 class="title">
1.320 wiz 8663: <a name="go-programming-language"></a>21.4.3. Go</h3></div></div></div>
8664: <p>If a program is written in Go and has any dependencies on
8665: other Go modules, have the package include
8666: <code class="filename">../../lang/go/go-module.mk</code>.</p>
8667: <div class="orderedlist"><ol class="orderedlist" type="1">
8668: <li class="listitem"><p>Generate a list of those dependencies with
8669: <span class="command"><strong>make clean && make patch && make show-go-modules >
8670: go-modules.mk</strong></span>.</p></li>
1.338 nia 8671: <li class="listitem"><p>Prepend
8672: <code class="literal">.include "go-modules.mk"</code> to any other
8673: <code class="literal">.include</code>s.</p></li>
8674: <li class="listitem"><p>Incorporate these modules in
8675: <code class="filename">distinfo</code> with <span class="command"><strong>make
8676: makesum</strong></span>.</p></li>
8677: </ol></div>
8678: </div>
8679: <div class="sect2">
8680: <div class="titlepage"><div><div><h3 class="title">
8681: <a name="rust-programming-language"></a>21.4.4. Rust</h3></div></div></div>
8682: <p>If a program is written in Rust and uses Cargo to build,
8683: have the package include
8684: <code class="filename">../../lang/rust/cargo.mk</code>.</p>
8685: <div class="orderedlist"><ol class="orderedlist" type="1">
8686: <li class="listitem"><p>Generate a list of those dependencies with
8687: <span class="command"><strong>make CARGO_ARGS="build --release" build &&
8688: make print-cargo-depends > cargo-depends.mk</strong></span>.</p></li>
8689: <li class="listitem"><p>Prepend
8690: <code class="literal">.include "cargo-depends.mk"</code> to any other
8691: <code class="literal">.include</code>s.</p></li>
1.320 wiz 8692: <li class="listitem"><p>Incorporate these modules in
8693: <code class="filename">distinfo</code> with <span class="command"><strong>make
8694: makesum</strong></span>.</p></li>
8695: </ol></div>
8696: </div>
8697: <div class="sect2">
8698: <div class="titlepage"><div><div><h3 class="title">
1.338 nia 8699: <a name="perl-scripts"></a>21.4.5. Packages containing Perl scripts</h3></div></div></div>
1.318 nia 8700: <p>If your package contains interpreted Perl scripts, add
1.128 wiz 8701: <span class="quote">“<span class="quote">perl</span>”</span> to the <code class="varname">USE_TOOLS</code> variable
1.87 wiz 8702: and set <code class="varname">REPLACE_PERL</code> to ensure that the proper
8703: interpreter path is set. <code class="varname">REPLACE_PERL</code> should
8704: contain a list of scripts, relative to <code class="varname">WRKSRC</code>,
1.183 wiz 8705: that you want adjusted. Every occurrence of
8706: <code class="filename">*/bin/perl</code> in a she-bang line will be
1.325 gutterid 8707: replaced with the full path to the Perl executable.</p>
8708: <p>If a particular version of Perl is needed, set the
1.87 wiz 8709: <code class="varname">PERL5_REQD</code> variable to the version number. The
1.128 wiz 8710: default is <span class="quote">“<span class="quote">5.0</span>”</span>.</p>
1.318 nia 8711: <p>See <a class="xref" href="#perl-modules" title="21.6.6. Packages installing Perl modules">Section 21.6.6, “Packages installing Perl modules”</a> for information
1.325 gutterid 8712: about handling Perl modules.</p>
8713: <p>There is also the <code class="varname">REPLACE_PERL6</code> variable
8714: for the language now known as Raku.</p>
1.87 wiz 8715: </div>
1.148 asau 8716: <div class="sect2">
1.87 wiz 8717: <div class="titlepage"><div><div><h3 class="title">
1.338 nia 8718: <a name="shell-scripts"></a>21.4.6. Packages containing shell scripts</h3></div></div></div>
1.147 wiz 8719: <p><code class="varname">REPLACE_SH</code>,
8720: <code class="varname">REPLACE_BASH</code>, <code class="varname">REPLACE_CSH</code>,
8721: and <code class="varname">REPLACE_KSH</code> can be used to replace shell
1.340 gutterid 8722: she-bangs in files. Please use the appropriate one, preferring
8723: <code class="varname">REPLACE_SH</code> when this shell is sufficient.
1.183 wiz 8724: Each should contain a list of scripts, relative to
8725: <code class="varname">WRKSRC</code>, that you want adjusted. Every
8726: occurrence of the matching shell in a she-bang line will be
8727: replaced with the full path to the shell executable.
1.147 wiz 8728: When using <code class="varname">REPLACE_BASH</code>, don't forget to add
8729: <code class="filename">bash</code> to <code class="varname">USE_TOOLS</code>.</p>
8730: </div>
1.148 asau 8731: <div class="sect2">
1.147 wiz 8732: <div class="titlepage"><div><div><h3 class="title">
1.338 nia 8733: <a name="other-programming-languages"></a>21.4.7. Other programming languages</h3></div></div></div>
1.325 gutterid 8734: <p>There are further similar REPLACE variables available, e.g.,
8735: <code class="varname">REPLACE_AWK</code> for packages containing awk scripts,
8736: and <code class="varname">REPLACE_R</code> for R. These two, like the others
1.326 gutterid 8737: noted above, have their actions defined centrally in
1.325 gutterid 8738: <code class="filename">mk/configure/replace-interpreter.mk</code>. Other
1.326 gutterid 8739: languages define the actions of these variables within their own
8740: dedicated part of the tree, e.g., <code class="varname">REPLACE_PHP</code> is
8741: actioned in <code class="filename">lang/php/phpversion.mk</code>, and
8742: <code class="varname">REPLACE_PYTHON</code> is actioned in
1.325 gutterid 8743: <code class="filename">lang/python/application.mk</code>. For other languages,
8744: consult the mk files found within their specific directories (the
1.331 gutterid 8745: naming convention varies), or check the list found in
8746: <a class="xref" href="#help-topics" title="Appendix E. Help topics">Appendix E, <i>Help topics</i></a>.</p>
1.325 gutterid 8747: <p>Currently, special handling for other languages varies
1.87 wiz 8748: in pkgsrc. If a compiler package provides a
8749: <code class="filename">buildlink3.mk</code> file, include that, otherwise
8750: just add a (build) dependency on the appropriate compiler
8751: package.</p>
8752: </div>
8753: </div>
1.148 asau 8754: <div class="sect1">
1.87 wiz 8755: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 8756: <a name="fixes.build"></a>21.5. The <span class="emphasis"><em>build</em></span> phase</h2></div></div></div>
1.77 rillig 8757: <p>The most common failures when building a package are that
8758: some platforms do not provide certain header files, functions or
8759: libraries, or they provide the functions in a library that the
8760: original package author didn't know. To work around this, you
8761: can rewrite the source code in most cases so that it does not
8762: use the missing functions or provides a replacement function.</p>
1.148 asau 8763: <div class="sect2">
1.77 rillig 8764: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8765: <a name="fixes.build.cpp"></a>21.5.1. Compiling C and C++ code conditionally</h3></div></div></div>
1.77 rillig 8766: <p>If a package already comes with a GNU configure script, the
8767: preferred way to fix the build failure is to change the
8768: configure script, not the code. In the other cases, you can
8769: utilize the C preprocessor, which defines certain macros
8770: depending on the operating system and hardware architecture it
8771: compiles for. These macros can be queried using for example
8772: <code class="varname">#if defined(__i386)</code>. Almost every operating
8773: system, hardware architecture and compiler has its own macro.
8774: For example, if the macros <code class="varname">__GNUC__</code>,
8775: <code class="varname">__i386__</code> and <code class="varname">__NetBSD__</code>
8776: are all defined, you know that you are using NetBSD on an i386
8777: compatible CPU, and your compiler is GCC.</p>
8778: <p>The list of the following macros for hardware and
8779: operating system depends on the compiler that is used. For
8780: example, if you want to conditionally compile code on Solaris,
8781: don't use <code class="varname">__sun__</code>, as the SunPro compiler
8782: does not define it. Use <code class="varname">__sun</code> instead.</p>
1.148 asau 8783: <div class="sect3">
1.75 rillig 8784: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 8785: <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 8786: <p>To distinguish between specific NetBSD versions,
8787: you should use the following code.</p>
8788: <pre class="programlisting">
8789: #ifdef __NetBSD__
8790: #include <sys/param.h>
8791: #if __NetBSD_Prereq__(9,99,17)
8792: /* use a newer feature */
8793: #else
8794: /* older code */
8795: #endif
8796: #endif
8797:
8798: #ifndef _WIN32
8799: /* Unix-like specific code */
8800: #endif
8801: </pre>
1.75 rillig 8802: <p>To distinguish between 4.4 BSD-derived systems and the
8803: rest of the world, you should use the following code.</p>
8804: <pre class="programlisting">
1.100 rillig 8805: #include <sys/param.h>
8806: #if (defined(BSD) && BSD >= 199306)
8807: /* BSD-specific code goes here */
8808: #else
8809: /* non-BSD-specific code goes here */
8810: #endif
1.75 rillig 8811: </pre>
1.338 nia 8812: <p>You can also test for the following macros:</p>
1.75 rillig 8813: <pre class="programlisting">
1.151 obache 8814: Cygwin __CYGWIN__
8815: DragonFly __DragonFly__
1.100 rillig 8816: FreeBSD __FreeBSD__
1.151 obache 8817: Haiku __HAIKU__
1.100 rillig 8818: Interix __INTERIX
8819: IRIX __sgi (TODO: get a definite source for this)
1.338 nia 8820: Linux __linux
1.193 dholland 8821: Mac OS X __APPLE__
1.151 obache 8822: MirBSD __MirBSD__ (__OpenBSD__ is also defined)
8823: Minix3 __minix
1.100 rillig 8824: NetBSD __NetBSD__
8825: OpenBSD __OpenBSD__
8826: Solaris sun, __sun
1.75 rillig 8827: </pre>
8828: </div>
1.148 asau 8829: <div class="sect3">
1.75 rillig 8830: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 8831: <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 8832: <pre class="programlisting">
1.100 rillig 8833: i386 i386, __i386, __i386__
1.338 nia 8834: x86-64 __amd64__, __x86_64__
8835: ARM __arm__
1.100 rillig 8836: MIPS __mips
8837: SPARC sparc, __sparc
1.338 nia 8838: PowerPC __powerpc
1.75 rillig 8839: </pre>
8840: </div>
1.148 asau 8841: <div class="sect3">
1.75 rillig 8842: <div class="titlepage"><div><div><h4 class="title">
1.267 rillig 8843: <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 8844: <pre class="programlisting">
1.100 rillig 8845: GCC __GNUC__ (major version), __GNUC_MINOR__
8846: MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41)
8847: SunPro __SUNPRO_C (0x570 for Sun C 5.7)
8848: SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
1.75 rillig 8849: </pre>
8850: </div>
8851: </div>
1.148 asau 8852: <div class="sect2">
1.78 rillig 8853: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 8854: <a name="compiler-bugs"></a>21.5.2. How to handle compiler bugs</h3></div></div></div>
1.78 rillig 8855: <p>Some source files trigger bugs in the compiler, based on
1.87 wiz 8856: combinations of compiler version and architecture and almost
8857: always relation to optimisation being enabled. Common symptoms
8858: are gcc internal errors or never finishing compiling a
1.78 rillig 8859: file.</p>
8860: <p>Typically, a workaround involves testing the
8861: <code class="varname">MACHINE_ARCH</code> and compiler version, disabling
8862: optimisation for that combination of file,
1.198 tnn 8863: <code class="varname">MACHINE_ARCH</code> and compiler.</p>
8864: <p>This used to be a big problem in the past, but is rarely
8865: needed now as compiler technology has matured. If you still need
8866: to add a compiler specific workaround, please do so in the file
8867: <code class="filename">hacks.mk</code> and describe the symptom and
8868: compiler version as detailed as possible.</p>
1.78 rillig 8869: </div>
1.148 asau 8870: <div class="sect2">
1.78 rillig 8871: <div class="titlepage"><div><div><h3 class="title">
1.287 rillig 8872: <a name="fixes.build.header"></a>21.5.3. No such file or directory</h3></div></div></div>
8873: <p>Compilation sometimes fails with an error message like this:</p>
8874: <pre class="programlisting">
8875: .../x11/gtk3/work/gtk+-3.24.12/gdk/gdktypes.h:35:10:
8876: fatal error: pango/pango.h: No such file or directory
8877: </pre>
8878: <p>The proper way to fix this problem depends on the type of the
8879: header, which is described in the following sections.</p>
8880: <div class="sect3">
8881: <div class="titlepage"><div><div><h4 class="title">
8882: <a name="fixes.build.header.bl3"></a>21.5.3.1. Headers from other packages</h4></div></div></div>
8883: <p>If the header name looks like it comes from a different package,
8884: that other package should be included via the buildlink3
8885: framework.</p>
8886: <p>First, look whether the header is somewhere in the buildlink3
8887: directory below <code class="varname">WRKDIR</code>. In the above case of
8888: the missing Pango header:</p>
8889: <pre class="programlisting">
8890: <code class="prompt">$</code> find work/.buildlink/ -print | grep -F pango/pango.h
8891: </pre>
8892: <p>In the case of Pango, the output is:</p>
8893: <pre class="programlisting">
8894: work/.buildlink/include/pango-1.0/pango/pango.h
8895: </pre>
8896: <p>If the <code class="filename">pango/pango.h</code> file were placed directly
8897: in the <code class="filename">.buildlink</code> directory, it would have been
8898: found automatically. There is an extra <code class="filename">pango-1.0</code>
8899: path component though, which means that the compiler command line must
8900: contain an option of the form
8901: <code class="literal">-I${BUILDLINK3_PREFIX.pango}/include/pango-1.0</code>. In
8902: most cases this option is generated by the configure script, which can be examined using:</p>
8903: <pre class="programlisting">
8904: <code class="prompt">$</code> $ grep -o '[-]I[^[:space:]]*/pango[^[:space:]]*' work/*/Makefile
8905: -I/usr/pkg/include/pango-1.0
8906: -I/usr/pkg/include/pango-1.0
8907: -I/usr/pkg/include/pango-1.0
8908: -I/usr/pkg/include/pango-1.0
8909: -I/usr/pkg/include/pango-1.0
8910: </pre>
8911: <p>This looks good. These options are transformed by the buildlink
8912: wrapper to refer to the correct path inside
8913: <code class="filename">work/.buildlink</code>.</p>
8914: <p>Since the compilation fails though, examine the compiler command
8915: lines in <code class="filename">work/.work.log</code> to see whether the
8916: <code class="literal">-I</code> option is included in the particular command
8917: line.</p>
8918: <p>To further analyze the situation, run <span class="command"><strong>bmake
8919: build-env</strong></span>, which sets up an interactive, realistic environment
8920: including all the pkgsrc wrapper commands and environment variables. From
8921: there, try to compile some simple example programs that use the
8922: header.</p>
8923: </div>
8924: <div class="sect3">
8925: <div class="titlepage"><div><div><h4 class="title">
8926: <a name="fixes.build.header.gen"></a>21.5.3.2. Headers generated during the build</h4></div></div></div>
8927: <p>If the name of the header seems to come from the package itself,
8928: and if the build is run with parallel jobs, the package may have some
8929: undeclared dependencies between the <code class="filename">.c</code> and the
8930: <code class="filename">.h</code> files, and a C file is compiled before its
8931: required header is generated.</p>
8932: <p>To see whether the build runs with parallel jobs, run
8933: <span class="command"><strong>bmake show-all-build | grep JOBS</strong></span>. Its output looks
8934: like this:</p>
8935: <pre class="programlisting">
8936: usr MAKE_JOBS= 7
8937: pkg MAKE_JOBS_SAFE # undefined
8938: def _MAKE_JOBS_N= 7
8939: </pre>
8940: <p>In this case the pkgsrc user has asked pkgsrc to build packages
8941: with 7 jobs in parallel (<code class="varname">MAKE_JOBS</code>). The
8942: package could have disabled parallel builds by setting
8943: <code class="varname">MAKE_JOBS_SAFE</code> to <code class="literal">no</code>, but
8944: in this case it hasn't.</p>
8945: <p>To see whether the build failure is caused by parallel builds,
8946: first save the exact error message and a bit of context, maybe you need
8947: it later for reporting a bug. Next, run:</p>
8948: <pre class="programlisting">
8949: MAKE_JOBS_SAFE=no bmake clean build
8950: </pre>
8951: <p>If that succeeds, <a class="ulink" href="https://www.NetBSD.org/cgi-bin/sendpr.cgi?gndb=netbsd" target="_top">file a bug
8952: report</a> against the pkgsrc package, including the exact error
8953: message and the contents of your <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> file.</p>
8954: </div>
1.288 rillig 8955: <div class="sect3">
8956: <div class="titlepage"><div><div><h4 class="title">
8957: <a name="fixes.build.header.symlink"></a>21.5.3.3. Symlinks</h4></div></div></div>
8958: <p>Pkgsrc does not work reliably if any of
8959: <code class="varname">LOCALBASE</code>, <code class="varname">VARBASE</code> or
8960: <code class="varname">WRKDIR</code> contains a symlink. Since 2019Q2, the pkgsrc
8961: bootstrap program prevents installing pkgsrc in symlink-based
8962: directories. Existing pkgsrc installations are not checked for symlinks
8963: though.</p>
8964: <p>The "No such file or directory" error messages are a typical
8965: symptom of symlinks, and it's quite difficult to find out that this is
8966: the actual cause.</p>
8967: </div>
8968: <div class="sect3">
8969: <div class="titlepage"><div><div><h4 class="title">
8970: <a name="fixes.build.header.stale"></a>21.5.3.4. Stale working directories</h4></div></div></div>
8971: <p>When building a hierarchy of packages, it may happen that one
8972: package is built and then pkgsrc is updated. This situation can provoke
8973: various hard to diagnose build errors. To clean up the situation:</p>
8974: <pre class="programlisting">
1.338 nia 8975: <code class="prompt">$</code> (cd ../../ && cat mk/bsd.pkg.mk >/dev/null && rm -rf */*/work)
1.288 rillig 8976: </pre>
1.338 nia 8977: <p>(The only purpose of the <code class="filename">bsd.pkg.mk</code> is to
8978: prevent running this command in the wrong directory.)</p>
1.288 rillig 8979: <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
8980: that directory as well.</p>
8981: </div>
8982: <div class="sect3">
8983: <div class="titlepage"><div><div><h4 class="title">
8984: <a name="fixes.build.header.misc"></a>21.5.3.5. Other possible reasons</h4></div></div></div>
8985: <p>On platforms other than BSD, third-party packages are installed in
8986: <code class="filename">/usr/include</code>, together with the base system. This
8987: means that pkgsrc cannot distinguish between headers provided by the base
8988: system (which it needs) and headers from third-party packages (which are
8989: often included in pkgsrc as well). This can lead to subtle version
8990: mismatches.</p>
8991: <p>In pkgsrc installations that have been active for several years, it
8992: may happen that some files are manually deleted. To exclude this unlikely
8993: reason, run <span class="command"><strong>pkg_admin check</strong></span>.</p>
8994: <p>It may help to run <span class="command"><strong>pkg_admin rebuild-tree</strong></span> to
8995: check/fix dependencies.</p>
8996: <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>
8997: for contact information. Be prepared to describe what you have tried so
8998: far and what any error messages were.</p>
8999: </div>
1.287 rillig 9000: </div>
9001: <div class="sect2">
9002: <div class="titlepage"><div><div><h3 class="title">
9003: <a name="undefined-reference"></a>21.5.4. Undefined reference to <span class="quote">“<span class="quote">...</span>”</span>
1.128 wiz 9004: </h3></div></div></div>
1.92 rillig 9005: <p>This error message often means that a package did not
1.78 rillig 9006: link to a shared library it needs. The following functions are
9007: known to cause this error message over and over.</p>
9008: <div class="informaltable">
1.216 tnn 9009: <a name="undefined-reference-functions"></a><table class="informaltable" border="1">
1.78 rillig 9010: <colgroup>
9011: <col>
9012: <col>
9013: <col>
9014: </colgroup>
9015: <thead><tr>
9016: <th>Function</th>
9017: <th>Library</th>
9018: <th>Affected platforms</th>
9019: </tr></thead>
9020: <tbody>
9021: <tr>
9022: <td>accept, bind, connect</td>
9023: <td>-lsocket</td>
9024: <td>Solaris</td>
9025: </tr>
9026: <tr>
9027: <td>crypt</td>
9028: <td>-lcrypt</td>
9029: <td>DragonFly, NetBSD</td>
9030: </tr>
9031: <tr>
9032: <td>dlopen, dlsym</td>
9033: <td>-ldl</td>
9034: <td>Linux</td>
9035: </tr>
9036: <tr>
9037: <td>gethost*</td>
9038: <td>-lnsl</td>
9039: <td>Solaris</td>
9040: </tr>
9041: <tr>
9042: <td>inet_aton</td>
9043: <td>-lresolv</td>
9044: <td>Solaris</td>
9045: </tr>
9046: <tr>
9047: <td>nanosleep, sem_*, timer_*</td>
9048: <td>-lrt</td>
9049: <td>Solaris</td>
9050: </tr>
9051: <tr>
9052: <td>openpty</td>
9053: <td>-lutil</td>
9054: <td>Linux</td>
9055: </tr>
9056: </tbody>
9057: </table>
9058: </div>
1.338 nia 9059: <p>To fix these linker errors, it is often sufficient to add
1.87 wiz 9060: <code class="literal">LIBS.<em class="replaceable"><code>OperatingSystem</code></em>+=
9061: -l<em class="replaceable"><code>foo</code></em></code> to the package
1.338 nia 9062: <code class="filename">Makefile</code> and then run <span class="command"><strong>bmake clean;
1.87 wiz 9063: bmake</strong></span>.</p>
1.148 asau 9064: <div class="sect3">
1.92 rillig 9065: <div class="titlepage"><div><div><h4 class="title">
1.338 nia 9066: <a name="undefined-reference-sunpro"></a>21.5.4.1. The SunPro compiler and inline functions</h4></div></div></div>
1.92 rillig 9067: <p>When you are using the SunPro compiler, there is another
9068: possibility. That compiler cannot handle the following code:</p>
9069: <pre class="programlisting">
1.100 rillig 9070: extern int extern_func(int);
1.93 rillig 9071:
1.100 rillig 9072: static inline int
9073: inline_func(int x)
9074: {
1.92 rillig 9075: return extern_func(x);
1.100 rillig 9076: }
1.93 rillig 9077:
1.100 rillig 9078: int main(void)
9079: {
1.92 rillig 9080: return 0;
1.100 rillig 9081: }
1.92 rillig 9082: </pre>
9083: <p>It generates the code for <code class="function">inline_func</code> even if
9084: that function is never used. This code then refers to
9085: <code class="function">extern_func</code>, which can usually not be resolved. To
9086: solve this problem you can try to tell the package to disable inlining
9087: of functions.</p>
9088: </div>
1.343 gutterid 9089: <div class="sect3">
9090: <div class="titlepage"><div><div><h4 class="title">
9091: <a name="undefined-reference-atomic"></a>21.5.4.2. Missing atomic functions</h4></div></div></div>
9092: <p>When building for older machine architectures (e.g., i386, PowerPC),
9093: builds may fail because the package expects modern 64-bit atomic functions
9094: which the underlying hardware either doesn't support, or will only support
9095: with specific compiler flags. This is generally handled via inclusion of
9096: mk/atomic64.mk.</p>
9097: </div>
1.87 wiz 9098: </div>
1.148 asau 9099: <div class="sect2">
1.87 wiz 9100: <div class="titlepage"><div><div><h3 class="title">
1.287 rillig 9101: <a name="out-of-memory"></a>21.5.5. Running out of memory</h3></div></div></div>
1.87 wiz 9102: <p>Sometimes packages fail to build because the compiler runs
9103: into an operating system specific soft limit. With the
9104: <code class="varname">UNLIMIT_RESOURCES</code> variable pkgsrc can be told
1.338 nia 9105: to unlimit the resources. The allowed values are any combination of
9106: <span class="quote">“<span class="quote">cputime</span>”</span>,
9107: <span class="quote">“<span class="quote">datasize</span>”</span>,
9108: <span class="quote">“<span class="quote">memorysize</span>”</span>,
9109: <span class="quote">“<span class="quote">stacksize</span>”</span> and
9110: <span class="quote">“<span class="quote">virtualsize</span>”</span>.
1.87 wiz 9111: Setting this variable is similar to running the shell builtin
1.110 hubertf 9112: <span class="command"><strong>ulimit</strong></span> command to raise the maximum data
1.87 wiz 9113: segment size or maximum stack size of a process, respectively, to
9114: their hard limits.</p>
1.78 rillig 9115: </div>
1.75 rillig 9116: </div>
1.148 asau 9117: <div class="sect1">
1.75 rillig 9118: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9119: <a name="fixes.install"></a>21.6. The <span class="emphasis"><em>install</em></span> phase</h2></div></div></div>
1.148 asau 9120: <div class="sect2">
1.75 rillig 9121: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9122: <a name="install-scripts"></a>21.6.1. Creating needed directories</h3></div></div></div>
1.110 hubertf 9123: <p>The BSD-compatible <span class="command"><strong>install</strong></span> supplied
1.87 wiz 9124: with some operating systems cannot create more than one
9125: directory at a time. As such, you should call
9126: <code class="literal">${INSTALL_*_DIR}</code> like this:</p>
9127: <pre class="programlisting">
1.100 rillig 9128: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
9129: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
1.222 sevan 9130: </pre>
1.338 nia 9131: <p>Instead of running the <span class="command"><strong>install</strong></span> commands
9132: directly, you can also append <span class="quote">“<span class="quote"><code class="literal">dir1
9133: dir2</code></span>”</span> to the <code class="varname">INSTALLATION_DIRS</code>
9134: variable, which will automatically do the right thing.</p>
1.75 rillig 9135: </div>
1.148 asau 9136: <div class="sect2">
1.75 rillig 9137: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9138: <a name="where-to-install-documentation"></a>21.6.2. Where to install documentation</h3></div></div></div>
1.83 wiz 9139: <p>In general, documentation should be installed into
1.87 wiz 9140: <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
1.338 nia 9141: <code class="filename">${PREFIX}/share/doc/${PKGNAME_NOREV}</code> (the latter
1.87 wiz 9142: includes the version number of the package).</p>
1.84 wiz 9143: <p>Many modern packages using GNU autoconf allow to set the
1.87 wiz 9144: directory where HTML documentation is installed with the
1.338 nia 9145: <span class="quote">“<span class="quote">--with-html-dir</span>”</span> option. Sometimes using this flag is
9146: needed because otherwise the documentation ends up in
9147: <code class="filename">${PREFIX}/share/doc/html</code> or other places. In
9148: pkgsrc, the HTML documentation should go into the package-specific
9149: directory, just like any other documentation.</p>
1.87 wiz 9150: <p>An exception to the above is that library API documentation
1.322 leot 9151: 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 9152: browsers (devhelp) should be left at their default location, which
9153: is <code class="filename">${PREFIX}/share/gtk-doc</code>. Such
9154: documentation can be recognized from files ending in
9155: <code class="filename">.devhelp</code> or <code class="filename">.devhelp2</code>.
9156: (It is also acceptable to install such files in
9157: <code class="filename">${PREFIX}/share/doc/${PKGBASE}</code> or
9158: <code class="filename">${PREFIX}/share/doc/${PKGNAME}</code>; the
9159: <code class="filename">.devhelp*</code> file must be directly in that
9160: directory then, no additional subdirectory level is allowed in
9161: this case. This is usually achieved by using
1.128 wiz 9162: <span class="quote">“<span class="quote">--with-html-dir=${PREFIX}/share/doc</span>”</span>.
1.87 wiz 9163: <code class="filename">${PREFIX}/share/gtk-doc</code> is preferred
9164: though.)</p>
1.75 rillig 9165: </div>
1.148 asau 9166: <div class="sect2">
1.75 rillig 9167: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9168: <a name="installing-score-files"></a>21.6.3. Installing highscore files</h3></div></div></div>
1.75 rillig 9169: <p>Certain packages, most of them in the games category, install
1.87 wiz 9170: a score file that allows all users on the system to record their
9171: highscores. In order for this to work, the binaries need to be
9172: installed setgid and the score files owned by the appropriate
1.142 wiz 9173: group and/or owner (traditionally the "games" user/group). Set
9174: <code class="varname">USE_GAMESGROUP</code> to yes to support this. The
1.87 wiz 9175: following variables, documented in more detail in
9176: <code class="filename">mk/defaults/mk.conf</code>, control this
1.142 wiz 9177: behaviour: <code class="varname">GAMEDATAMODE</code>,
9178: <code class="varname">GAMEDIRMODE</code>, <code class="varname">GAMES_GROUP</code>,
1.210 leot 9179: <code class="varname">GAMEMODE</code>, <code class="varname">GAME_USER</code>.
9180: Other useful variables are: <code class="varname">GAMEDIR_PERMS</code>,
9181: <code class="varname">GAMEDATA_PERMS</code> and
9182: <code class="varname">SETGID_GAMES_PERMS</code>.</p>
9183: <p>An example that illustrates some of the variables described above is
9184: <code class="filename">games/moon-buggy</code>. <code class="varname">OWN_DIRS_PERMS</code> is
9185: used to properly set directory permissions of the directory where the
9186: scorefile is saved, <code class="varname">REQD_FILES_PERMS</code> is used to create a
9187: dummy scorefile (<code class="filename">mbscore</code>) with the proper permissions
9188: and <code class="varname">SPECIAL_PERMS</code> is used to install setgid the game
9189: binary:</p>
9190: <pre class="programlisting">
1.223 rillig 9191: USE_GAMESGROUP= yes
1.210 leot 9192:
1.223 rillig 9193: BUILD_DEFS+= VARBASE
1.210 leot 9194:
1.223 rillig 9195: OWN_DIRS_PERMS+= ${VARBASE}/games/moon-buggy ${GAMEDIR_PERMS}
9196: REQD_FILES_PERMS+= /dev/null ${VARBASE}/games/moon-buggy/mbscore ${GAMEDATA_PERMS}
9197: SPECIAL_PERMS+= ${PREFIX}/bin/moon-buggy ${SETGID_GAMES_PERMS}
1.222 sevan 9198: </pre>
1.210 leot 9199: <p>Various <code class="varname">INSTALL_*</code> variables are also available:
9200: <code class="varname">INSTALL_GAME</code> to install setgid game binaries,
9201: <code class="varname">INSTALL_GAME_DIR</code> to install game directories that are
9202: needed to be accessed by setgid games and
9203: <code class="varname">INSTALL_GAME_DATA</code> to install scorefiles.</p>
1.114 jmcneill 9204: <p>A package should therefore never hard code file ownership or
1.210 leot 9205: access permissions but rely on <code class="varname">*_PERMS</code> as described above
9206: or alternatively on <code class="varname">INSTALL_GAME</code>,
9207: <code class="varname">INSTALL_GAME_DATA</code> and
9208: <code class="varname">INSTALL_GAME_DIR</code> to set these correctly.</p>
1.75 rillig 9209: </div>
1.148 asau 9210: <div class="sect2">
1.75 rillig 9211: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9212: <a name="destdir-support"></a>21.6.4. Adding DESTDIR support to packages</h3></div></div></div>
1.114 jmcneill 9213: <p><code class="varname">DESTDIR</code> support means that a package
9214: installs into a staging directory, not the final location of the
9215: files. Then a binary package is created which can be used for
9216: installation as usual. There are two ways: Either the package must
1.128 wiz 9217: install as root (<span class="quote">“<span class="quote">destdir</span>”</span>) or the package can
9218: install as non-root user (<span class="quote">“<span class="quote">user-destdir</span>”</span>).</p>
1.148 asau 9219: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 9220: <li class="listitem"><p><code class="varname">PKG_DESTDIR_SUPPORT</code> has to be
1.224 leot 9221: set to <span class="quote">“<span class="quote">destdir</span>”</span> or <span class="quote">“<span class="quote">user-destdir</span>”</span>.
9222: By default <code class="varname">PKG_DESTDIR_SUPPORT</code>
1.145 wiz 9223: is set to <span class="quote">“<span class="quote">user-destdir</span>”</span> to help catching more
9224: potential packaging problems. If bsd.prefs.mk is included in the Makefile,
1.114 jmcneill 9225: <code class="varname">PKG_DESTDIR_SUPPORT</code> needs to be set before
9226: the inclusion.</p></li>
1.128 wiz 9227: <li class="listitem"><p>All installation operations have to be prefixed with
1.103 wiz 9228: <code class="filename">${DESTDIR}</code>.</p></li>
1.128 wiz 9229: <li class="listitem"><p>automake gets this DESTDIR mostly right
1.103 wiz 9230: automatically. Many manual rules and pre/post-install often are
9231: incorrect; fix them.</p></li>
1.128 wiz 9232: <li class="listitem"><p>If files are installed with special owner/group
1.118 imil 9233: use <code class="varname">SPECIAL_PERMS</code>.</p></li>
1.128 wiz 9234: <li class="listitem"><p>In general, packages should support
1.103 wiz 9235: <code class="varname">UNPRIVILEGED</code> to be able to use
9236: DESTDIR.</p></li>
9237: </ul></div>
9238: </div>
1.148 asau 9239: <div class="sect2">
1.103 wiz 9240: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9241: <a name="hardcoded-paths"></a>21.6.5. Packages with hardcoded paths to other interpreters</h3></div></div></div>
1.87 wiz 9242: <p>Your package may also contain scripts with hardcoded paths to
1.318 nia 9243: other interpreters besides (or as well as) Perl. To correct the
1.87 wiz 9244: full pathname to the script interpreter, you need to set the
9245: following definitions in your <code class="filename">Makefile</code> (we
1.110 hubertf 9246: shall use <span class="command"><strong>tclsh</strong></span> in this example):</p>
1.87 wiz 9247: <pre class="programlisting">
1.100 rillig 9248: REPLACE_INTERPRETER+= tcl
9249: REPLACE.tcl.old= .*/bin/tclsh
9250: REPLACE.tcl.new= ${PREFIX}/bin/tclsh
9251: REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed,
9252: # relative to ${WRKSRC}, just as in REPLACE_PERL
1.222 sevan 9253: </pre>
1.75 rillig 9254: </div>
1.148 asau 9255: <div class="sect2">
1.75 rillig 9256: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9257: <a name="perl-modules"></a>21.6.6. Packages installing Perl modules</h3></div></div></div>
1.75 rillig 9258: <p>Makefiles of packages providing perl5 modules should include
1.87 wiz 9259: the Makefile fragment
9260: <code class="filename">../../lang/perl5/module.mk</code>. It provides a
1.110 hubertf 9261: <span class="command"><strong>do-configure</strong></span> target for the standard perl
1.87 wiz 9262: configuration for such modules as well as various hooks to tune
9263: this configuration. See comments in this file for
9264: details.</p>
1.75 rillig 9265: <p>Perl5 modules will install into different places depending
1.87 wiz 9266: on the version of perl used during the build process. To
9267: address this, pkgsrc will append lines to the
9268: <code class="filename">PLIST</code> corresponding to the files listed in
9269: the installed <code class="filename">.packlist</code> file generated by
9270: most perl5 modules. This is invoked by defining
9271: <code class="varname">PERL5_PACKLIST</code> to a space-separated list of
1.153 wiz 9272: packlist files relative to <code class="varname">PERL5_PACKLIST_DIR</code>
9273: (<code class="varname">PERL5_INSTALLVENDORARCH</code> by default),
9274: e.g.:</p>
1.75 rillig 9275: <pre class="programlisting">
1.153 wiz 9276: PERL5_PACKLIST= auto/Pg/.packlist
1.222 sevan 9277: </pre>
1.153 wiz 9278: <p>The perl5 config variables
9279: <code class="varname">installarchlib</code>,
9280: <code class="varname">installscript</code>,
9281: <code class="varname">installvendorbin</code>,
9282: <code class="varname">installvendorscript</code>,
9283: <code class="varname">installvendorarch</code>,
9284: <code class="varname">installvendorlib</code>,
9285: <code class="varname">installvendorman1dir</code>, and
9286: <code class="varname">installvendorman3dir</code> represent those
9287: locations in which components of perl5 modules may be installed,
9288: provided as variable with uppercase and prefixed with
9289: <code class="varname">PERL5_</code>, e.g. <code class="varname">PERL5_INSTALLARCHLIB</code>
9290: and may be used by perl5 packages that don't have a packlist.
9291: These variables are also substituted for in the
9292: <code class="filename">PLIST</code> as uppercase prefixed with
9293: <code class="varname">PERL5_SUB_</code>.</p>
1.75 rillig 9294: </div>
1.148 asau 9295: <div class="sect2">
1.75 rillig 9296: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9297: <a name="faq.info-files"></a>21.6.7. Packages installing info files</h3></div></div></div>
1.75 rillig 9298: <p>Some packages install info files or use the
1.128 wiz 9299: <span class="quote">“<span class="quote">makeinfo</span>”</span> or <span class="quote">“<span class="quote">install-info</span>”</span>
1.87 wiz 9300: commands. <code class="varname">INFO_FILES</code> should be defined in
9301: the package Makefile so that <code class="filename">INSTALL</code> and
9302: <code class="filename">DEINSTALL</code> scripts will be generated to
9303: handle registration of the info files in the Info directory
1.128 wiz 9304: file. The <span class="quote">“<span class="quote">install-info</span>”</span> command used for the info
1.87 wiz 9305: files registration is either provided by the system, or by a
9306: special purpose package automatically added as dependency if
9307: needed.</p>
1.75 rillig 9308: <p><code class="varname">PKGINFODIR</code> is the directory under
1.87 wiz 9309: <code class="filename">${PREFIX}</code> where info files are primarily
9310: located. <code class="varname">PKGINFODIR</code> defaults to
1.128 wiz 9311: <span class="quote">“<span class="quote">info</span>”</span> and can be overridden by the user.</p>
1.75 rillig 9312: <p>The info files for the package should be listed in the
1.87 wiz 9313: package <code class="filename">PLIST</code>; however any split info files
9314: need not be listed.</p>
1.128 wiz 9315: <p>A package which needs the <span class="quote">“<span class="quote">makeinfo</span>”</span> command
9316: at build time must add <span class="quote">“<span class="quote">makeinfo</span>”</span> to
1.87 wiz 9317: <code class="varname">USE_TOOLS</code> in its Makefile. If a minimum
1.128 wiz 9318: version of the <span class="quote">“<span class="quote">makeinfo</span>”</span> command is needed it
1.87 wiz 9319: should be noted with the <code class="varname">TEXINFO_REQD</code>
9320: variable in the package <code class="filename">Makefile</code>. By
9321: default, a minimum version of 3.12 is required. If the system
1.110 hubertf 9322: does not provide a <span class="command"><strong>makeinfo</strong></span> command or if it
1.87 wiz 9323: does not match the required minimum, a build dependency on the
1.322 leot 9324: <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 9325: be added automatically.</p>
1.75 rillig 9326: <p>The build and installation process of the software provided
1.87 wiz 9327: by the package should not use the
1.110 hubertf 9328: <span class="command"><strong>install-info</strong></span> command as the registration of
1.87 wiz 9329: info files is the task of the package
9330: <code class="filename">INSTALL</code> script, and it must use the
1.110 hubertf 9331: appropriate <span class="command"><strong>makeinfo</strong></span> command.</p>
1.75 rillig 9332: <p>To achieve this goal, the pkgsrc infrastructure creates
1.110 hubertf 9333: overriding scripts for the <span class="command"><strong>install-info</strong></span> and
9334: <span class="command"><strong>makeinfo</strong></span> commands in a directory listed early
1.87 wiz 9335: in <code class="varname">PATH</code>.</p>
1.110 hubertf 9336: <p>The script overriding <span class="command"><strong>install-info</strong></span> has
1.87 wiz 9337: no effect except the logging of a message. The script overriding
1.110 hubertf 9338: <span class="command"><strong>makeinfo</strong></span> logs a message and according to the
1.87 wiz 9339: value of <code class="varname">TEXINFO_REQD</code> either runs the appropriate
1.110 hubertf 9340: <span class="command"><strong>makeinfo</strong></span> command or exit on error.</p>
1.75 rillig 9341: </div>
1.148 asau 9342: <div class="sect2">
1.75 rillig 9343: <div class="titlepage"><div><div><h3 class="title">
1.267 rillig 9344: <a name="manpages"></a>21.6.8. Packages installing man pages</h3></div></div></div>
1.81 rillig 9345: <p>All packages that install manual pages should install them
1.87 wiz 9346: into the same directory, so that there is one common place to look
9347: for them. In pkgsrc, this place is
9348: <code class="literal">${PREFIX}/${PKGMANDIR}</code>, and this expression
9349: should be used in packages. The default for
9350: <code class="varname">PKGMANDIR</code> is
1.128 wiz 9351: <span class="quote">“<span class="quote"><code class="filename">man</code></span>”</span>. Another often-used value
9352: is <span class="quote">“<span class="quote"><code class="filename">share/man</code></span>”</span>.</p>
1.148 asau 9353: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 9354: <h3 class="title">Note</h3>
1.87 wiz 9355: <p>The support for a custom <code class="varname">PKGMANDIR</code>
9356: is far from complete.</p>
1.75 rillig 9357: </div>
1.81 rillig 9358: <p>The <code class="filename">PLIST</code> files can just use
1.87 wiz 9359: <code class="filename">man/</code> as the top level directory for the man
9360: page file entries, and the pkgsrc framework will convert as
9361: needed. In all other places, the correct
9362: <code class="varname">PKGMANDIR</code> must be used.</p>
9363: <p>Packages that are
9364: configured with <code class="varname">GNU_CONFIGURE</code> set as
1.128 wiz 9365: <span class="quote">“<span class="quote">yes</span>”</span>, by default will use the
1.87 wiz 9366: <code class="filename">./configure</code>
9367: --mandir switch to set where the man pages should be installed.
9368: The path is <code class="varname">GNU_CONFIGURE_MANDIR</code> which defaults
9369: to <code class="varname">${PREFIX}/${PKGMANDIR}</code>.</p>
9370: <p>Packages that use <code class="varname">GNU_CONFIGURE</code> but do not
9371: use --mandir, can set <code class="varname">CONFIGURE_HAS_MANDIR</code>
1.128 wiz 9372: to <span class="quote">“<span class="quote">no</span>”</span>.
1.87 wiz 9373: Or if the <code class="filename">./configure</code> script uses
9374: a non-standard use of --mandir, you can set
9375: <code class="varname">GNU_CONFIGURE_MANDIR</code> as needed.</p>
1.299 rillig 9376: <p>See <a class="xref" href="#manpage-compression" title="19.5. Man page compression">Section 19.5, “Man page compression”</a> for
1.87 wiz 9377: information on installation of compressed manual pages.</p>
1.75 rillig 9378: </div>
1.148 asau 9379: <div class="sect2">
1.75 rillig 9380: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9381: <a name="x11-fonts"></a>21.6.9. Packages installing X11 fonts</h3></div></div></div>
1.75 rillig 9382: <p>If a package installs font files, you will need to rebuild
1.87 wiz 9383: the fonts database in the directory where they get installed at
9384: installation and deinstallation time. This can be automatically
9385: done by using the pkginstall framework.</p>
1.75 rillig 9386: <p>You can list the directories where fonts are installed in the
1.87 wiz 9387: <code class="varname">FONTS_DIRS.<em class="replaceable"><code>type</code></em></code>
9388: variables, where <em class="replaceable"><code>type</code></em> can be one of
1.128 wiz 9389: <span class="quote">“<span class="quote">ttf</span>”</span>, <span class="quote">“<span class="quote">type1</span>”</span> or <span class="quote">“<span class="quote">x11</span>”</span>.
1.87 wiz 9390: Also make sure that the database file
9391: <code class="filename">fonts.dir</code> is not listed in the PLIST.</p>
1.75 rillig 9392: <p>Note that you should not create new directories for fonts;
1.87 wiz 9393: instead use the standard ones to avoid that the user needs to
9394: manually configure his X server to find them.</p>
1.75 rillig 9395: </div>
1.148 asau 9396: <div class="sect2">
1.75 rillig 9397: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9398: <a name="sgml-xml-data"></a>21.6.10. Packages installing SGML or XML data</h3></div></div></div>
1.75 rillig 9399: <p>If a package installs SGML or XML data files that need to be
1.87 wiz 9400: registered in system-wide catalogs (like DTDs, sub-catalogs,
9401: etc.), you need to take some extra steps:</p>
1.128 wiz 9402: <div class="orderedlist"><ol class="orderedlist" type="1">
9403: <li class="listitem"><p>Include
1.87 wiz 9404: <code class="filename">../../textproc/xmlcatmgr/catalogs.mk</code> in
9405: your <code class="filename">Makefile</code>, which takes care of
9406: registering those files in system-wide catalogs at
9407: installation and deinstallation time.</p></li>
1.128 wiz 9408: <li class="listitem"><p>Set <code class="varname">SGML_CATALOGS</code> to the full path of
1.87 wiz 9409: any SGML catalogs installed by the package.</p></li>
1.128 wiz 9410: <li class="listitem"><p>Set <code class="varname">XML_CATALOGS</code> to the full path of
1.87 wiz 9411: any XML catalogs installed by the package.</p></li>
1.128 wiz 9412: <li class="listitem"><p>Set <code class="varname">SGML_ENTRIES</code> to individual entries
1.87 wiz 9413: to be added to the SGML catalog. These come in groups of
9414: three strings; see xmlcatmgr(1) for more information
9415: (specifically, arguments recognized by the 'add' action).
9416: Note that you will normally not use this variable.</p></li>
1.128 wiz 9417: <li class="listitem"><p>Set <code class="varname">XML_ENTRIES</code> to individual entries
1.87 wiz 9418: to be added to the XML catalog. These come in groups of three
9419: strings; see xmlcatmgr(1) for more information (specifically,
9420: arguments recognized by the 'add' action). Note that you will
9421: normally not use this variable.</p></li>
1.75 rillig 9422: </ol></div>
9423: </div>
1.148 asau 9424: <div class="sect2">
1.75 rillig 9425: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9426: <a name="mime-database"></a>21.6.11. Packages installing extensions to the MIME database</h3></div></div></div>
1.75 rillig 9427: <p>If a package provides extensions to the MIME database by
1.87 wiz 9428: installing <code class="filename">.xml</code> files inside
9429: <code class="filename">${PREFIX}/share/mime/packages</code>, you
9430: need to take some extra steps to ensure that the database is kept
9431: consistent with respect to these new files:</p>
1.128 wiz 9432: <div class="orderedlist"><ol class="orderedlist" type="1">
9433: <li class="listitem"><p>Include
1.87 wiz 9434: <code class="filename">../../databases/shared-mime-info/mimedb.mk</code>
9435: (avoid using the <code class="filename">buildlink3.mk</code> file from
9436: this same directory, which is reserved for inclusion from
9437: other <code class="filename">buildlink3.mk</code> files). It takes
9438: care of rebuilding the MIME database at installation and
9439: deinstallation time, and disallows any access to it directly
9440: from the package.</p></li>
1.128 wiz 9441: <li class="listitem"><p>Check the PLIST and remove any entries under the
1.87 wiz 9442: <code class="filename">share/mime</code> directory,
9443: <span class="emphasis"><em>except</em></span> for files saved under
9444: <code class="filename">share/mime/packages</code>. The former are
9445: handled automatically by
9446: the update-mime-database program, but the latter are
9447: package-dependent and must be removed by the package that
9448: installed them in the first place.</p></li>
1.128 wiz 9449: <li class="listitem"><p>Remove any <code class="filename">share/mime/*</code> directories
1.87 wiz 9450: from the PLIST. They will be handled by the shared-mime-info
9451: package.</p></li>
1.75 rillig 9452: </ol></div>
9453: </div>
1.148 asau 9454: <div class="sect2">
1.75 rillig 9455: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9456: <a name="intltool"></a>21.6.12. Packages using intltool</h3></div></div></div>
1.93 rillig 9457: <p>If a package uses intltool during its build, add
9458: <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>,
1.87 wiz 9459: which forces it to use the intltool package provided by pkgsrc,
9460: instead of the one bundled with the distribution file.</p>
1.75 rillig 9461: <p>This tracks intltool's build-time dependencies and uses the
1.87 wiz 9462: latest available version; this way, the package benefits of any
9463: bug fixes that may have appeared since it was released.</p>
1.75 rillig 9464: </div>
1.148 asau 9465: <div class="sect2">
1.75 rillig 9466: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9467: <a name="startup-scripts"></a>21.6.13. Packages installing startup scripts</h3></div></div></div>
1.75 rillig 9468: <p>If a package contains a rc.d script, it won't be copied into
1.87 wiz 9469: the startup directory by default, but you can enable it, by adding
9470: the option <code class="varname">PKG_RCD_SCRIPTS=YES</code> in
1.110 hubertf 9471: <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a>. This option will copy the scripts
1.87 wiz 9472: into <code class="filename">/etc/rc.d</code> when a package is installed, and
9473: it will automatically remove the scripts when the package is
9474: deinstalled.</p>
1.75 rillig 9475: </div>
1.148 asau 9476: <div class="sect2">
1.75 rillig 9477: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9478: <a name="tex-packages"></a>21.6.14. Packages installing TeX modules</h3></div></div></div>
1.75 rillig 9479: <p>If a package installs TeX packages into the texmf tree,
1.87 wiz 9480: the <code class="filename">ls-R</code> database of the tree needs to be
9481: updated.</p>
1.148 asau 9482: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.75 rillig 9483: <h3 class="title">Note</h3>
1.125 wiz 9484: <p>Except the main TeX packages such as kpathsea,
1.87 wiz 9485: packages should install files
1.125 wiz 9486: into <code class="filename">${PREFIX}/share/texmf-dist</code>,
9487: not <code class="filename">${PREFIX}/share/texmf</code>.</p>
1.75 rillig 9488: </div>
1.128 wiz 9489: <div class="orderedlist"><ol class="orderedlist" type="1">
9490: <li class="listitem"><p>Include
1.125 wiz 9491: <code class="filename">../../print/kpathsea/texmf.mk</code>. This
1.87 wiz 9492: takes care of rebuilding the <code class="filename">ls-R</code>
9493: database at installation and deinstallation time.</p></li>
1.128 wiz 9494: <li class="listitem">
1.75 rillig 9495: <p>If your package installs files into a texmf
1.87 wiz 9496: tree other than the one
1.125 wiz 9497: at <code class="filename">${PREFIX}/share/texmf-dist</code>,
9498: set <code class="varname">TEX_TEXMF_DIRS</code> to the list of all texmf
1.87 wiz 9499: trees that need database update.</p>
1.75 rillig 9500: <p>If your package also installs font map files that need
1.110 hubertf 9501: to be registered using <span class="command"><strong>updmap</strong></span>,
1.136 dholland 9502: include <code class="filename">../../print/tex-tetex/map.mk</code> and
1.125 wiz 9503: set <code class="varname">TEX_MAP_FILES</code> and/or
9504: <code class="varname">TEX_MIXEDMAP_FILES</code> to the list of all
1.110 hubertf 9505: such font map files. Then <span class="command"><strong>updmap</strong></span> will
1.87 wiz 9506: be run automatically at installation/deinstallation to
9507: enable/disable font map files for TeX output
9508: drivers.</p>
1.75 rillig 9509: </li>
1.128 wiz 9510: <li class="listitem"><p>Make sure that none of <code class="filename">ls-R</code>
1.87 wiz 9511: databases are included in <code class="filename">PLIST</code>, as
1.136 dholland 9512: they will be removed only by the kpathsea package.</p></li>
1.75 rillig 9513: </ol></div>
9514: </div>
1.148 asau 9515: <div class="sect2">
1.85 jmmv 9516: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9517: <a name="emulation-packages"></a>21.6.15. Packages supporting running binaries in
1.87 wiz 9518: emulation</h3></div></div></div>
9519: <p>There are some packages that provide libraries and
9520: executables for running binaries from a one operating system
9521: on a different one (if the latter supports it). One example
9522: is running Linux binaries on NetBSD.</p>
1.322 leot 9523: <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 9524: helps in extracting and packaging Linux rpm packages.</p>
9525: <p>The <code class="varname">CHECK_SHLIBS</code> can be set to no to
1.110 hubertf 9526: avoid the <span class="command"><strong>check-shlibs</strong></span> target, which tests
1.87 wiz 9527: if all libraries for each installed executable can be found by
9528: the dynamic linker. Since the standard dynamic linker is run,
9529: this fails for emulation packages, because the libraries used
9530: by the emulation are not in the standard directories.</p>
9531: </div>
1.299 rillig 9532: <div class="sect2">
9533: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9534: <a name="hicolor-theme"></a>21.6.16. Packages installing hicolor icons</h3></div></div></div>
1.299 rillig 9535: <p>If a package installs images under the
9536: <code class="filename">share/icons/hicolor</code> and/or updates the
9537: <code class="filename">share/icons/hicolor/icon-theme.cache</code>
9538: database, you need to take some extra steps to make sure that the
9539: shared theme directory is handled appropriately and that the cache
9540: database is rebuilt:</p>
9541: <div class="orderedlist"><ol class="orderedlist" type="1">
9542: <li class="listitem"><p>Include
9543: <code class="filename">../../graphics/hicolor-icon-theme/buildlink3.mk</code>.</p></li>
9544: <li class="listitem"><p>Check the <code class="filename">PLIST</code> and remove the
9545: entry that refers to the theme cache.</p></li>
9546: <li class="listitem"><p>Ensure that the PLIST does not remove the shared icon
9547: directories from the <code class="filename">share/icons/hicolor</code>
9548: hierarchy because they will be handled automatically.</p></li>
9549: </ol></div>
9550: <p>The best way to verify that the PLIST is correct with
9551: respect to the last two points is to regenerate it using
9552: <span class="command"><strong>make print-PLIST</strong></span>.</p>
9553: </div>
9554: <div class="sect2">
9555: <div class="titlepage"><div><div><h3 class="title">
1.318 nia 9556: <a name="desktop-files"></a>21.6.17. Packages installing desktop files</h3></div></div></div>
1.299 rillig 9557: <p>If a package installs <code class="filename">.desktop</code> files
9558: under <code class="filename">share/applications</code> and these include
9559: MIME information (MimeType key), you need to take extra steps to
9560: ensure that they are registered into the MIME database:</p>
9561: <div class="orderedlist"><ol class="orderedlist" type="1">
9562: <li class="listitem"><p>Include
9563: <code class="filename">../../sysutils/desktop-file-utils/desktopdb.mk</code>.</p></li>
9564: <li class="listitem"><p>Check the PLIST and remove the entry that refers to the
9565: <code class="filename">share/applications/mimeinfo.cache</code> file.
9566: It will be handled automatically.</p></li>
9567: </ol></div>
9568: <p>The best way to verify that the PLIST is correct with
9569: respect to the last point is to regenerate it using <span class="command"><strong>make
9570: print-PLIST</strong></span>.</p>
9571: </div>
9572: </div>
9573: <div class="sect1">
9574: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
9575: <a name="punting"></a>21.7. Marking packages as having problems</h2></div></div></div>
9576: <p>In some cases one does not have the time to solve a problem
9577: immediately. In this case, one can plainly mark a package as broken. For
9578: this, one just sets the variable <code class="varname">BROKEN</code> to the
9579: reason why the package is broken (similar to the
9580: <code class="varname">PKG_FAIL_REASON</code> variable). A user trying to build
9581: the package will immediately be shown this message, and the build
9582: will not be even tried.</p>
9583: <p><code class="varname">BROKEN</code> packages are removed from pkgsrc in irregular
9584: intervals.</p>
9585: </div>
9586: </div>
9587: <div class="chapter">
9588: <div class="titlepage"><div><div><h2 class="title">
9589: <a name="gnome"></a>Chapter 22. GNOME packaging and porting</h2></div></div></div>
9590: <div class="toc">
9591: <p><b>Table of Contents</b></p>
9592: <dl class="toc">
9593: <dt><span class="sect1"><a href="#meta-packages">22.1. Meta packages</a></span></dt>
9594: <dt><span class="sect1"><a href="#new-package">22.2. Packaging a GNOME application</a></span></dt>
9595: <dt><span class="sect1"><a href="#full-update">22.3. Updating GNOME to a newer version</a></span></dt>
9596: <dt><span class="sect1"><a href="#patching">22.4. Patching guidelines</a></span></dt>
9597: </dl>
9598: </div>
9599: <p>Quoting <a class="ulink" href="https://www.gnome.org/" target="_top">GNOME's web
9600: site</a>:</p>
9601: <div class="blockquote"><blockquote class="blockquote"><p>The GNOME project provides two things: The GNOME desktop
9602: environment, an intuitive and attractive desktop for users, and the
9603: GNOME development platform, an extensive framework for building
9604: applications that integrate into the rest of the desktop.</p></blockquote></div>
9605: <p>pkgsrc provides a seamless way to automatically build and install
9606: a complete GNOME environment <span class="emphasis"><em>under many different
9607: platforms</em></span>. We can say with confidence that pkgsrc is one of
9608: the most advanced build and packaging systems for GNOME due to its
9609: included technologies buildlink3, the wrappers and tools framework and
9610: automatic configuration file management. Lots of efforts are put into
9611: achieving a completely clean deinstallation of installed software
9612: components.</p>
9613: <p>Given that pkgsrc is <a class="ulink" href="https://www.NetBSD.org/" target="_top">NetBSD</a>'s official packaging system,
9614: the above also means that great efforts are put into making GNOME work
1.316 cirnatda 9615: under this operating system.</p>
1.299 rillig 9616: <p>This chapter is aimed at pkgsrc developers and other people
9617: interested in helping our GNOME porting and packaging efforts. It
9618: provides instructions on how to manage the existing packages and some
9619: important information regarding their internals.</p>
9620: <div class="sect1">
9621: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
9622: <a name="meta-packages"></a>22.1. Meta packages</h2></div></div></div>
9623: <p>pkgsrc includes three GNOME-related meta packages:</p>
9624: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.322 leot 9625: <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 9626: the core GNOME desktop environment. It only includes the necessary
9627: bits to get it to boot correctly, although it may lack important
9628: functionality for daily operation. The idea behind this package is
9629: to let end users build their own configurations on top of this one,
9630: first installing this meta package to achieve a functional setup and
9631: then adding individual applications.</p></li>
1.322 leot 9632: <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 9633: complete installation of the GNOME platform and desktop as defined
9634: by the GNOME project; this is based on the components distributed in
9635: the <code class="filename">platform/x.y/x.y.z/sources</code> and
9636: <code class="filename">desktop/x.y/x.y.z/sources</code> directories of the
9637: official FTP server. Developer-only tools found in those
9638: directories are not installed unless required by some other
9639: component to work properly. Similarly, packages from the bindings
9640: set (<code class="filename">bindings/x.y/x.y.z/sources</code>) are not pulled
9641: in unless required as a dependency for an end-user component. This
1.322 leot 9642: 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>
9643: <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 9644: Installs all the tools required to build a GNOME component when
9645: fetched from the CVS repository. These are required to let the
9646: <span class="command"><strong>autogen.sh</strong></span> scripts work appropriately.</p></li>
9647: </ul></div>
9648: <p>In all these packages, the <code class="varname">DEPENDS</code> lines are
9649: sorted in a way that eases updates: a package may depend on other
9650: packages listed before it but not on any listed after it. It is very
9651: important to keep this order to ease updates so... <span class="emphasis"><em>do not
9652: change it to alphabetical sorting!</em></span></p>
9653: </div>
9654: <div class="sect1">
9655: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
9656: <a name="new-package"></a>22.2. Packaging a GNOME application</h2></div></div></div>
9657: <p>Almost all GNOME applications are written in C and use a common
9658: set of tools as their build system. Things get different with the new
9659: bindings to other languages (such as Python), but the following will
9660: give you a general idea on the minimum required tools:</p>
9661: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9662: <li class="listitem">
9663: <p>Almost all GNOME applications use the GNU Autotools as their
9664: build system. As a general rule you will need to tell this to your
9665: package:</p>
9666: <pre class="programlisting">
1.338 nia 9667: GNU_CONFIGURE= yes
9668: USE_LIBTOOL= yes
9669: USE_TOOLS+= gmake
1.299 rillig 9670: </pre>
9671: </li>
9672: <li class="listitem">
9673: <p>If the package uses pkg-config to detect dependencies, add this
9674: tool to the list of required utilities:</p>
9675: <pre class="programlisting">
1.338 nia 9676: USE_TOOLS+= pkg-config
1.299 rillig 9677: </pre>
1.322 leot 9678: <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 9679: the end of the build process to ensure that you did not miss to
9680: specify any dependency in your package and that the version
9681: requirements are all correct.</p>
9682: </li>
9683: <li class="listitem"><p>If the package uses intltool, be sure to add
9684: <code class="literal">intltool</code> to the <code class="varname">USE_TOOLS</code>
9685: to handle dependencies and to force the package to use the latest
9686: available version.</p></li>
9687: <li class="listitem">
9688: <p>If the package uses gtk-doc (a documentation generation
9689: utility), do <span class="emphasis"><em>not</em></span> add a dependency on it. The
9690: tool is rather big and the distfile should come with pregenerated
9691: documentation anyway; if it does not, it is a bug that you ought to
9692: report. For such packages you should disable gtk-doc (unless it is
9693: the default):</p>
9694: <pre class="programlisting">
1.338 nia 9695: CONFIGURE_ARGS+= --disable-gtk-doc
1.299 rillig 9696: </pre>
9697: <p>The default location of installed HTML files
9698: (<code class="filename">share/gtk-doc/<package-name></code>) is correct
9699: and should not be changed unless the package insists on installing
9700: them somewhere else. Otherwise programs as
9701: <span class="command"><strong>devhelp</strong></span> will not be able to open them. You can
9702: do that with an entry similar to:</p>
9703: <pre class="programlisting">
1.338 nia 9704: CONFIGURE_ARGS+= --with-html-dir=${PREFIX}/share/gtk-doc/...
1.299 rillig 9705: </pre>
9706: </li>
9707: </ul></div>
9708: <p>GNOME uses multiple <span class="emphasis"><em>shared</em></span> directories and
9709: files under the installation prefix to maintain databases. In this
9710: context, shared means that those exact same directories and files are
9711: used among several different packages, leading to conflicts in the
9712: <code class="filename">PLIST</code>. pkgsrc currently includes functionality to
9713: handle the most common cases, so you have to forget about using
9714: <code class="literal">@unexec ${RMDIR}</code> lines in your file lists and
9715: omitting shared files from them. If you find yourself doing those,
9716: <span class="emphasis"><em>your package is most likely incorrect</em></span>.</p>
9717: <p>The following table lists the common situations that result in
9718: using shared directories or files. For each of them, the appropriate
9719: solution is given. After applying the solution be sure to
9720: <span class="emphasis"><em>regenerate the package's file list</em></span> with
9721: <span class="command"><strong>make print-PLIST</strong></span> and ensure it is correct.</p>
9722: <div class="table">
9723: <a name="plist-handling"></a><p class="title"><b>Table 22.1. PLIST handling for GNOME packages</b></p>
9724: <div class="table-contents"><table class="table" summary="PLIST handling for GNOME packages" border="1">
9725: <colgroup>
9726: <col>
9727: <col>
9728: </colgroup>
9729: <thead><tr>
9730: <th>If the package...</th>
9731: <th>Then...</th>
9732: </tr></thead>
9733: <tbody>
9734: <tr>
9735: <td>Installs icons under the
9736: <code class="filename">share/icons/hicolor</code> hierarchy or updates
9737: <code class="filename">share/icons/hicolor/icon-theme.cache</code>.</td>
1.318 nia 9738: <td>See <a class="xref" href="#hicolor-theme" title="21.6.16. Packages installing hicolor icons">Section 21.6.16, “Packages installing hicolor icons”</a>.</td>
1.299 rillig 9739: </tr>
9740: <tr>
9741: <td>Installs files under
9742: <code class="filename">share/mime/packages</code>.</td>
1.318 nia 9743: <td>See <a class="xref" href="#mime-database" title="21.6.11. Packages installing extensions to the MIME database">Section 21.6.11, “Packages installing extensions to the MIME database”</a>.</td>
1.299 rillig 9744: </tr>
9745: <tr>
9746: <td>Installs <code class="filename">.desktop</code> files under
9747: <code class="filename">share/applications</code> and these include MIME
9748: information.</td>
1.318 nia 9749: <td>See <a class="xref" href="#desktop-files" title="21.6.17. Packages installing desktop files">Section 21.6.17, “Packages installing desktop files”</a>.</td>
1.299 rillig 9750: </tr>
9751: </tbody>
9752: </table></div>
1.75 rillig 9753: </div>
1.299 rillig 9754: <br class="table-break">
1.75 rillig 9755: </div>
1.148 asau 9756: <div class="sect1">
1.87 wiz 9757: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 9758: <a name="full-update"></a>22.3. Updating GNOME to a newer version</h2></div></div></div>
9759: <p>When seeing GNOME as a whole, there are two kinds of
9760: updates:</p>
9761: <div class="variablelist"><dl class="variablelist">
9762: <dt><span class="term">Major update</span></dt>
9763: <dd>
9764: <p>Given that there is still a very long way for GNOME 3 (if it
9765: ever appears), we consider a major update one that goes from a
9766: <code class="literal">2.X</code> version to a <code class="literal">2.Y</code> one,
9767: where <code class="literal">Y</code> is even and greater than
9768: <code class="literal">X</code>. These are hard to achieve because they
9769: introduce lots of changes in the components' code and almost all
9770: GNOME distfiles are updated to newer versions. Some of them can
9771: even break API and ABI compatibility with the previous major
9772: version series. As a result, the update needs to be done all at
9773: once to minimize breakage.</p>
9774: <p>A major update typically consists of around 80 package
9775: updates and the addition of some new ones.</p>
9776: </dd>
9777: <dt><span class="term">Minor update</span></dt>
9778: <dd>
9779: <p>We consider a minor update one that goes from a
9780: <code class="literal">2.A.X</code> version to a <code class="literal">2.A.Y</code>
9781: one where <code class="literal">Y</code> is greater than
9782: <code class="literal">X</code>. These are easy to achieve because they do
9783: not update all GNOME components, can be done in an incremental way
9784: and do not break API nor ABI compatibility.</p>
9785: <p>A minor update typically consists of around 50 package
9786: updates, although the numbers here may vary a lot.</p>
9787: </dd>
9788: </dl></div>
9789: <p>In order to update the GNOME components in pkgsrc to a new stable
9790: release (either major or minor), the following steps should be
9791: followed:</p>
9792: <div class="orderedlist"><ol class="orderedlist" type="1">
1.128 wiz 9793: <li class="listitem">
1.299 rillig 9794: <p>Get a list of all the tarballs that form the new release by
9795: using the following commands. These will leave the full list of the
9796: components' distfiles into the <code class="filename">list.txt</code>
9797: file:</p>
9798: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
9799: ftp -V ftp://ftp.gnome.org/pub/gnome/platform/x.y/x.y.z/sources/ | \
9800: awk '{ print $9 }' >list.txt</code></strong>
9801: <code class="prompt">%</code> <strong class="userinput"><code>echo ls "*.tar.bz2" | \
9802: ftp -V ftp://ftp.gnome.org/pub/gnome/desktop/x.y/x.y.z/sources/ | \
9803: awk '{ print $9 }' >>list.txt</code></strong></pre>
1.75 rillig 9804: </li>
1.299 rillig 9805: <li class="listitem"><p>Open each meta package's <code class="filename">Makefile</code> and
9806: bump their version to the release you are updating them to. The
9807: three meta packages should be always consistent with versioning.
9808: Obviously remove any <code class="varname">PKGREVISION</code>s that might be
9809: in them.</p></li>
1.128 wiz 9810: <li class="listitem">
1.299 rillig 9811: <p>For each meta package, update all its
9812: <code class="varname">DEPENDS</code> lines to match the latest versions as
9813: shown by the above commands. Do <span class="emphasis"><em>not</em></span> list any
9814: newer version (even if found in the FTP) because the meta packages
9815: are supposed to list the exact versions that form a specific GNOME
9816: release. Exceptions are permitted here if a newer version solves a
9817: serious issue in the overall desktop experience; these typically
9818: come in the form of a revision bump in pkgsrc, not in newer versions
9819: from the developers.</p>
9820: <p>Packages not listed in the <code class="filename">list.txt</code> file
9821: should be updated to the latest version available (if found in
9822: pkgsrc). This is the case, for example, of the dependencies on the
1.322 leot 9823: 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 9824: </li>
1.128 wiz 9825: <li class="listitem">
1.299 rillig 9826: <p>Generate a patch from the modified meta packages and extract the
9827: list of "new" lines. This will provide you an outline on what
9828: packages need to be updated in pkgsrc and in what order:</p>
9829: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cvs diff -u gnome-devel gnome-base gnome | grep '^+D' >todo.txt</code></strong></pre>
1.75 rillig 9830: </li>
1.299 rillig 9831: <li class="listitem"><p>For major desktop updates it is recommended to zap all your
9832: installed packages and start over from scratch at this point.</p></li>
9833: <li class="listitem"><p>Now comes the longest step by far: iterate over the contents
9834: of <code class="filename">todo.txt</code> and update the packages listed in
9835: it in order. For major desktop updates none of these should be
9836: committed until the entire set is completed because there are chances
9837: of breaking not-yet-updated packages.</p></li>
9838: <li class="listitem"><p>Once the packages are up to date and working, commit them to
9839: the tree one by one with appropriate log messages. At the end,
9840: commit the three meta package updates and all the corresponding
9841: changes to the <code class="filename">doc/CHANGES-<YEAR></code> and
9842: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/doc/TODO?rev=HEAD&content-type=text/x-cvsweb-markup" target="_top"><code class="filename">pkgsrc/doc/TODO</code></a> files.</p></li>
9843: </ol></div>
9844: </div>
9845: <div class="sect1">
9846: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
9847: <a name="patching"></a>22.4. Patching guidelines</h2></div></div></div>
9848: <p>GNOME is a very big component in pkgsrc which approaches 100
9849: packages. Please, it is very important that you always, always,
9850: <span class="strong"><strong>always</strong></span> feed back any portability
9851: 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, “Feedback to the author”</a>). This is the only way to get
9852: their attention on portability issues and to ensure that future versions
9853: can be built out-of-the box on NetBSD. The less custom patches in
9854: pkgsrc, the easier further updates are. Those developers in charge of
9855: issuing major GNOME updates will be grateful if you do that.</p>
1.315 cirnatda 9856: <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
9857: GitLab</a>. Not all components use these to track bugs, but most
1.299 rillig 9858: of them do. Do not be short on your reports: always provide detailed
9859: explanations of the current failure, how it can be improved to achieve
1.315 cirnatda 9860: maximum portability and, if at all possible, provide a patch against the
9861: main Git branch. The more verbose you are, the higher chances of your
9862: patch being accepted.</p>
1.299 rillig 9863: <p>Also, please avoid using preprocessor magic to fix portability
9864: issues. While the FreeBSD GNOME people are doing a great job in porting
9865: GNOME to their operating system, the official GNOME sources are now
9866: plagued by conditionals that check for <code class="varname">__FreeBSD__</code>
9867: and similar macros. This hurts portability. Please see our patching
9868: guidelines (<a class="xref" href="#components.patches.guidelines" title="12.3.4. Patching guidelines">Section 12.3.4, “Patching guidelines”</a>) for more
9869: details.</p>
9870: </div>
1.75 rillig 9871: </div>
1.148 asau 9872: <div class="chapter">
1.75 rillig 9873: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 9874: <a name="submit"></a>Chapter 23. Submitting and Committing</h2></div></div></div>
1.75 rillig 9875: <div class="toc">
9876: <p><b>Table of Contents</b></p>
1.210 leot 9877: <dl class="toc">
1.267 rillig 9878: <dt><span class="sect1"><a href="#submitting-binary-packages">23.1. Submitting binary packages</a></span></dt>
9879: <dt><span class="sect1"><a href="#submitting-your-package">23.2. Submitting source packages (for non-NetBSD-developers)</a></span></dt>
9880: <dt><span class="sect1"><a href="#general-notes-for-changes">23.3. General notes when adding, updating, or removing packages</a></span></dt>
9881: <dt><span class="sect1"><a href="#commit-messages">23.4. Commit Messages</a></span></dt>
9882: <dt><span class="sect1"><a href="#committing-importing">23.5. Committing: Adding a package to CVS</a></span></dt>
9883: <dt><span class="sect1"><a href="#updating-package">23.6. Updating a package to a newer version</a></span></dt>
9884: <dt><span class="sect1"><a href="#renaming-package">23.7. Renaming a package in pkgsrc</a></span></dt>
9885: <dt><span class="sect1"><a href="#moving-package">23.8. Moving a package in pkgsrc</a></span></dt>
1.75 rillig 9886: </dl>
9887: </div>
1.148 asau 9888: <div class="sect1">
1.75 rillig 9889: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9890: <a name="submitting-binary-packages"></a>23.1. Submitting binary packages</h2></div></div></div>
1.75 rillig 9891: <p>Our policy is that we accept binaries only from pkgsrc
9892: developers to guarantee that the packages don't contain any
9893: trojan horses etc. This is not to annoy anyone but rather to
9894: protect our users! You're still free to put up your home-made
9895: binary packages and tell the world where to get them. NetBSD
9896: developers doing bulk builds and wanting to upload them please
1.267 rillig 9897: 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 9898: builds)</i></a>.</p>
1.75 rillig 9899: </div>
1.148 asau 9900: <div class="sect1">
1.75 rillig 9901: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9902: <a name="submitting-your-package"></a>23.2. Submitting source packages (for non-NetBSD-developers)</h2></div></div></div>
1.333 nia 9903: <p>Firstly, you can import new packages into
9904: pkgsrc-wip (<span class="quote">“<span class="quote">pkgsrc work-in-progress</span>”</span>); see the
9905: homepage at <a class="ulink" href="https://pkgsrc.org/wip/" target="_top">https://pkgsrc.org/wip/</a>
9906: for details.</p>
9907: <p>Next, check that your package is complete, compiles and
1.299 rillig 9908: 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 9909: 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>
9910: tool and fix any errors that appear.</p>
9911: <p>Finally, send a report to the pkgsrc bug tracking system,
1.322 leot 9912: 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 9913: that, go to the web page
1.289 leot 9914: <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 9915: which contains some instructions and a link to a form where you
9916: can submit packages. The
1.322 leot 9917: <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 9918: also available as a substitute for either of the above two tools.
9919: </p>
1.87 wiz 9920: <p>In the form of the problem report, the category should be
1.128 wiz 9921: <span class="quote">“<span class="quote">pkg</span>”</span>, the synopsis should include the package name
1.87 wiz 9922: and version number, and the description field should contain a
9923: short description of your package (contents of the COMMENT
1.333 nia 9924: variable or DESCR file are OK).</p>
1.75 rillig 9925: </div>
1.148 asau 9926: <div class="sect1">
1.75 rillig 9927: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9928: <a name="general-notes-for-changes"></a>23.3. General notes when adding, updating, or removing packages</h2></div></div></div>
1.75 rillig 9929: <p>Please note all package additions, updates, moves, and
1.93 rillig 9930: removals in <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code>. It's very
1.75 rillig 9931: important to keep this file up to date and conforming to the
9932: existing format, because it will be used by scripts to
1.289 leot 9933: automatically update pages on <a class="ulink" href="https://www.NetBSD.org/" target="_top">www.NetBSD.org</a> and other
1.75 rillig 9934: sites. Additionally, check the
1.76 rillig 9935: <code class="filename">pkgsrc/doc/TODO</code> file and remove the entry
1.75 rillig 9936: for the package you updated or removed, in case it was mentioned
9937: there.</p>
9938: <p>When the <code class="varname">PKGREVISION</code> of a package is
9939: bumped, the change should appear in
1.93 rillig 9940: <code class="filename">pkgsrc/doc/CHANGES-<em class="replaceable"><code>YYYY</code></em></code> if it is security
1.75 rillig 9941: related or otherwise relevant. Mass bumps that result from a
9942: dependency being updated should not be mentioned. In all other
9943: cases it's the developer's decision.</p>
9944: <p>There is a make target that helps in creating proper
1.110 hubertf 9945: <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code> entries: <span class="command"><strong>make
1.75 rillig 9946: changes-entry</strong></span>. It uses the optional <code class="varname">CTYPE</code>
9947: and <code class="varname">NETBSD_LOGIN_NAME</code> variables. The general
1.93 rillig 9948: usage is to first make sure that your <code class="filename">CHANGES-<em class="replaceable"><code>YYYY</code></em></code>
1.75 rillig 9949: file is up-to-date (to avoid having to resolve conflicts later-on)
1.110 hubertf 9950: and then to <span class="command"><strong>cd</strong></span> to the package directory. For
9951: package updates, <span class="command"><strong>make changes-entry</strong></span> is enough.
1.75 rillig 9952: For new packages, or package moves or removals, set the
9953: <code class="varname">CTYPE</code> variable on the command line to "Added",
9954: "Moved", or "Removed". You can set <code class="varname">NETBSD_LOGIN_NAME</code>
1.110 hubertf 9955: in <a class="link" href="#mk.conf"><code class="filename">mk.conf</code></a> if your local login name is
1.125 wiz 9956: not the same as your NetBSD login name. The target also automatically
9957: removes possibly existing entries for the package in the
9958: <code class="filename">TODO</code> file. Don't forget to commit
1.174 asau 9959: the changes, e.g. by using <span class="command"><strong>make commit-changes-entry</strong></span>!
1.126 jakllsch 9960: If you are not using a checkout directly from cvs.NetBSD.org, but e.g.
1.125 wiz 9961: a local copy of the repository, you can set USE_NETBSD_REPO=yes. This
9962: makes the cvs commands use the main repository.
9963: </p>
1.75 rillig 9964: </div>
1.148 asau 9965: <div class="sect1">
1.75 rillig 9966: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 9967: <a name="commit-messages"></a>23.4. Commit Messages</h2></div></div></div>
1.243 wiz 9968: <p>For several years, there have been mirrors of pkgsrc in
9969: fossil, git, and hg. Standard practise when using these tools is to
9970: make the first line of a commit message function as a summary that
9971: can be read without the rest, such as is commonly done with "git log
9972: --oneline". For this reason, we have the following guidelines for
9973: pkgsrc commit messages:</p>
9974: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
9975: <li class="listitem"><p>Start the commit message with a line that explains the
1.244 wiz 9976: big picture in 65 characters or less. When a commit is for one
1.243 wiz 9977: package, include the name of the package. For updates, include the
9978: version to which it is updated.</p></li>
9979: <li class="listitem"><p>Leave the next line empty.</p></li>
9980: <li class="listitem"><p>Then come the details for the commit (changes in that
9981: package, reason for a change) and any relevant PRs. Wrap this
9982: section.</p></li>
9983: </ul></div>
9984: <p>Here is an example:
1.352 wiz 9985: </p>
1.243 wiz 9986: <pre class="programlisting">
1.352 wiz 9987: libxslt: update to 1.0.30
1.243 wiz 9988:
1.352 wiz 9989: Changes since 1.0.29:
9990: ...
9991: </pre>
1.243 wiz 9992: <p>
9993: </p>
9994: <p>Here is another example:
1.352 wiz 9995: </p>
1.243 wiz 9996: <pre class="programlisting">
1.352 wiz 9997: mk/bsd.pkg.mk: enable SSP by default on NetBSD
1.243 wiz 9998:
1.352 wiz 9999: (rationale)
10000: </pre>
1.243 wiz 10001: <p>
10002: </p>
10003: <p>Commit messages are final: no <span class="quote">“<span class="quote">cvs admin</span>”</span> is
10004: allowed on the pkgsrc repository to change commit messages.</p>
10005: </div>
10006: <div class="sect1">
10007: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 10008: <a name="committing-importing"></a>23.5. Committing: Adding a package to CVS</h2></div></div></div>
1.87 wiz 10009: <p>This section is only of interest for pkgsrc developers with write
1.140 wiz 10010: access to the pkgsrc repository.</p>
10011: <p>When the package is finished, <span class="quote">“<span class="quote">cvs add</span>”</span> the files.
10012: Start by adding the directory and then files in the directory. Don't
10013: forget to add the new package to the category's
10014: <code class="filename">Makefile</code>. Make sure you don't forget any files;
10015: you can check by running <span class="quote">“<span class="quote">cvs status</span>”</span>. An example:</p>
10016: <pre class="programlisting">
10017: <code class="prompt">$</code> cd .../pkgsrc/category
10018: <code class="prompt">$</code> cvs add pkgname
10019: <code class="prompt">$</code> cd pkgname
10020: <code class="prompt">$</code> cvs add DESCR Makefile PLIST distinfo buildlink3.mk patches
10021: <code class="prompt">$</code> cvs add patches/p*
10022: <code class="prompt">$</code> cvs status | less
1.141 wiz 10023: <code class="prompt">$</code> cvs commit
1.140 wiz 10024: <code class="prompt">$</code> cd ..
1.350 gutterid 10025: <code class="prompt">$</code> vi Makefile # add SUBDIR+=pkgname line
1.141 wiz 10026: <code class="prompt">$</code> cvs commit Makefile
1.174 asau 10027: <code class="prompt">$</code> cd pkgname
1.182 jnemeth 10028: <code class="prompt">$</code> make CTYPE=Added commit-changes-entry
1.140 wiz 10029: </pre>
1.87 wiz 10030: <p>The commit message of the initial import should include part of the
1.76 rillig 10031: <code class="filename">DESCR</code> file, so people reading the mailing lists know
1.87 wiz 10032: what the package is/does.</p>
1.140 wiz 10033: <p>Also mention the new package in
10034: <code class="filename">pkgsrc/doc/CHANGES-20xx</code>.</p>
10035: <p>Previously, <span class="quote">“<span class="quote">cvs import</span>”</span> was suggested, but it was
10036: much easier to get wrong than <span class="quote">“<span class="quote">cvs add</span>”</span>.</p>
1.75 rillig 10037: </div>
1.148 asau 10038: <div class="sect1">
1.75 rillig 10039: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 10040: <a name="updating-package"></a>23.6. Updating a package to a newer version</h2></div></div></div>
1.87 wiz 10041: <p>Please always put a concise, appropriate and relevant summary of the
1.75 rillig 10042: changes between old and new versions into the commit log when updating
1.87 wiz 10043: a package. There are various reasons for this:</p>
1.148 asau 10044: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 10045: <li class="listitem"><p>A URL is volatile, and can change over time. It may go away completely
1.87 wiz 10046: or its information may be overwritten by newer information.</p></li>
1.128 wiz 10047: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.87 wiz 10048: repository is very useful for people who use either cvs or anoncvs.</p></li>
1.128 wiz 10049: <li class="listitem"><p>Having the change information between old and new versions in our CVS
1.75 rillig 10050: repository is very useful for people who read the pkgsrc-changes mailing
10051: list, so that they can make tactical decisions about when to upgrade
1.87 wiz 10052: the package.</p></li>
1.75 rillig 10053: </ul></div>
1.87 wiz 10054: <p>Please also recognize that, just because a new version of a package
1.75 rillig 10055: has been released, it should not automatically be upgraded in the CVS
10056: repository. We prefer to be conservative in the packages that are
10057: included in pkgsrc - development or beta packages are not really the
10058: best thing for most places in which pkgsrc is used. Please use your
10059: judgement about what should go into pkgsrc, and bear in mind that
1.87 wiz 10060: stability is to be preferred above new and possibly untested features.</p>
1.75 rillig 10061: </div>
1.148 asau 10062: <div class="sect1">
1.75 rillig 10063: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 10064: <a name="renaming-package"></a>23.7. Renaming a package in pkgsrc</h2></div></div></div>
1.122 reed 10065: <p>Renaming packages is not recommended.</p>
1.290 gutterid 10066: <p>When renaming packages, be sure to fix any references to the old name
1.122 reed 10067: in other Makefiles, options, buildlink files, etc.</p>
1.282 leot 10068: <p>
1.290 gutterid 10069: Also, when renaming a package, please add
1.282 leot 10070: the package name and version pattern(s) of the previous package
10071: to <code class="varname">SUPERSEDES</code>.
1.122 reed 10072: This may be repeated for multiple renames.
10073: The new package would be an exact replacement.
1.282 leot 10074: Example:
1.122 reed 10075: </p>
1.282 leot 10076: <pre class="programlisting">
10077: SUPERSEDES+= p5-IO-Compress-Zlib<2.017
10078: SUPERSEDES+= optcomp-[0-9]*
10079: </pre>
1.128 wiz 10080: <p>Note that <span class="quote">“<span class="quote">successor</span>”</span> in the
1.122 reed 10081: CHANGES-<em class="replaceable"><code>YYYY</code></em> file doesn't necessarily
10082: mean that it <span class="emphasis"><em>supersedes</em></span>, as that successor may
10083: not be an exact replacement but is a suggestion for the replaced
10084: functionality.</p>
10085: </div>
1.148 asau 10086: <div class="sect1">
1.122 reed 10087: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.267 rillig 10088: <a name="moving-package"></a>23.8. Moving a package in pkgsrc</h2></div></div></div>
1.122 reed 10089: <p>It is preferred that packages are not renamed or moved, but if needed
10090: please follow these steps.
10091: </p>
1.128 wiz 10092: <div class="orderedlist"><ol class="orderedlist" type="1">
10093: <li class="listitem"><p>Make a copy of the directory somewhere else.</p></li>
10094: <li class="listitem">
1.75 rillig 10095: <p>Remove all CVS dirs.</p>
1.87 wiz 10096: <p>Alternatively to the first two steps you can also do:</p>
1.75 rillig 10097: <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 10098: <p>and use that for further work.</p>
1.75 rillig 10099: </li>
1.128 wiz 10100: <li class="listitem"><p>Fix <code class="varname">CATEGORIES</code> and any
10101: <code class="varname">DEPENDS</code> paths that just did <span class="quote">“<span class="quote">../package</span>”</span>
10102: instead of <span class="quote">“<span class="quote">../../category/package</span>”</span>.</p></li>
10103: <li class="listitem"><p>In the modified package's Makefile, consider setting
1.122 reed 10104: <code class="varname">PREV_PKGPATH</code> to the previous category/package
10105: pathname. The <code class="varname">PREV_PKGPATH</code> can be used by tools
10106: for doing an update using pkgsrc building; for example, it can
1.322 leot 10107: 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 10108: (if no <code class="varname">SUPERSEDES</code>) and then use the corresponding
10109: new <code class="varname">PKGPATH</code> for that moved package. Note that
10110: it may have multiple matches, so the tool should also check on the
10111: <code class="varname">PKGBASE</code> too. The <code class="varname">PREV_PKGPATH</code>
10112: probably has no value unless <code class="varname">SUPERSEDES</code> is not
10113: set, i.e. <code class="varname">PKGBASE</code> stays the same. </p></li>
1.351 gutterid 10114: <li class="listitem"><p><span class="command"><strong>cvs add</strong></span> the modified package in the new
1.75 rillig 10115: place.</p></li>
1.128 wiz 10116: <li class="listitem">
1.75 rillig 10117: <p>Check if any package depends on it:
10118: </p>
10119: <pre class="screen"><code class="prompt">%</code> <strong class="userinput"><code>cd /usr/pkgsrc</code></strong>
10120: <code class="prompt">%</code> <strong class="userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong></pre>
10121: </li>
1.128 wiz 10122: <li class="listitem"><p>Fix paths in packages from step 5 to point to new location.</p></li>
10123: <li class="listitem"><p><span class="command"><strong>cvs rm (-f)</strong></span> the package at the old location.</p></li>
10124: <li class="listitem"><p>Remove from <code class="filename">oldcategory/Makefile</code>.</p></li>
10125: <li class="listitem"><p>Add to <code class="filename">newcategory/Makefile</code>.</p></li>
10126: <li class="listitem">
1.75 rillig 10127: <p>Commit the changed and removed files:</p>
10128: <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 10129: <p>(and any packages from step 5, of course).</p>
1.75 rillig 10130: </li>
10131: </ol></div>
10132: </div>
10133: </div>
1.148 asau 10134: <div class="chapter">
1.75 rillig 10135: <div class="titlepage"><div><div><h2 class="title">
1.267 rillig 10136: <a name="devfaq"></a>Chapter 24. Frequently Asked Questions</h2></div></div></div>
1.75 rillig 10137: <p>This section contains the answers to questions that may
10138: arise when you are writing a package. If you don't find your
10139: question answered here, first have a look in the other chapters,
10140: and if you still don't have the answer, ask on the
10141: <code class="literal">pkgsrc-users</code> mailing list.</p>
1.148 asau 10142: <div class="qandaset">
1.289 leot 10143: <a name="devfaq.qandaset"></a><dl>
1.267 rillig 10144: <dt>24.1. <a href="#devfaq.makeflags">What is the difference between
1.75 rillig 10145: MAKEFLAGS, .MAKEFLAGS and
10146: MAKE_FLAGS?</a>
10147: </dt>
1.267 rillig 10148: <dt>24.2. <a href="#devfaq.make">What is the difference between
1.75 rillig 10149: MAKE, GMAKE and
10150: MAKE_PROGRAM?</a>
10151: </dt>
1.267 rillig 10152: <dt>24.3. <a href="#devfaq.cc">What is the difference between
1.75 rillig 10153: CC, PKG_CC and
10154: PKGSRC_COMPILER?</a>
10155: </dt>
1.338 nia 10156: <dt>24.4. <a href="#devfaq.bl3prefix">Why does make show-var
1.75 rillig 10157: VARNAME=BUILDLINK_PREFIX.foo
10158: say it's empty?</a>
10159: </dt>
1.338 nia 10160: <dt>24.5. <a href="#devfaq.master_sites">What does
1.78 rillig 10161: ${MASTER_SITE_SOURCEFORGE:=package/} mean? I
10162: don't understand the := inside
10163: it.</a>
10164: </dt>
1.338 nia 10165: <dt>24.6. <a href="#devfaq.mailinglists">Which mailing lists are there for package
1.78 rillig 10166: developers?</a>
10167: </dt>
1.338 nia 10168: <dt>24.7. <a href="#devfaq.documentation">Where is the pkgsrc
1.80 rillig 10169: documentation?</a>
10170: </dt>
1.338 nia 10171: <dt>24.8. <a href="#devfaq.too-much-time">I have a little time to kill.
1.289 leot 10172: What shall I do?</a>
1.92 rillig 10173: </dt>
1.75 rillig 10174: </dl>
1.148 asau 10175: <table border="0" style="width: 100%;">
10176: <colgroup>
1.75 rillig 10177: <col align="left" width="1%">
1.128 wiz 10178: <col>
1.148 asau 10179: </colgroup>
1.75 rillig 10180: <tbody>
1.148 asau 10181: <tr class="question">
1.75 rillig 10182: <td align="left" valign="top">
1.289 leot 10183: <a name="devfaq.makeflags"></a><a name="devfaq.makeflags.q"></a><p><b>24.1.</b></p>
1.75 rillig 10184: </td>
10185: <td align="left" valign="top"><p>What is the difference between
10186: <code class="varname">MAKEFLAGS</code>, <code class="varname">.MAKEFLAGS</code> and
10187: <code class="varname">MAKE_FLAGS</code>?</p></td>
10188: </tr>
10189: <tr class="answer">
1.91 rillig 10190: <td align="left" valign="top"></td>
1.338 nia 10191: <td align="left" valign="top">
10192: <p><code class="varname">MAKEFLAGS</code> are the flags passed
10193: 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>
10194: <p><code class="varname">MAKE_FLAGS</code> are the flags that are
10195: passed to the <code class="varname">MAKE_PROGRAM</code> when building the
10196: package.</p>
10197: <p><code class="varname">.MAKEFLAGS</code> is an internal variable of
10198: <span class="command"><strong>bmake</strong></span> and should not be used by
10199: packages.</p>
10200: </td>
1.75 rillig 10201: </tr>
1.148 asau 10202: <tr class="question">
1.75 rillig 10203: <td align="left" valign="top">
1.289 leot 10204: <a name="devfaq.make"></a><a name="devfaq.make.q"></a><p><b>24.2.</b></p>
1.75 rillig 10205: </td>
10206: <td align="left" valign="top"><p>What is the difference between
10207: <code class="varname">MAKE</code>, <code class="varname">GMAKE</code> and
10208: <code class="varname">MAKE_PROGRAM</code>?</p></td>
10209: </tr>
10210: <tr class="answer">
1.91 rillig 10211: <td align="left" valign="top"></td>
1.338 nia 10212: <td align="left" valign="top">
10213: <p><code class="varname">MAKE</code> is the path to the
1.322 leot 10214: <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 10215: infrastructure.</p>
10216: <p><code class="varname">GMAKE</code> is the path to GNU Make, but you
10217: need to say <code class="varname">USE_TOOLS+=gmake</code> to use
10218: that.</p>
10219: <p><code class="varname">MAKE_PROGRAM</code> is the path to the Make
10220: program that is used for building the package.</p>
10221: </td>
1.75 rillig 10222: </tr>
1.148 asau 10223: <tr class="question">
1.75 rillig 10224: <td align="left" valign="top">
1.289 leot 10225: <a name="devfaq.cc"></a><a name="devfaq.cc.q"></a><p><b>24.3.</b></p>
1.75 rillig 10226: </td>
10227: <td align="left" valign="top"><p>What is the difference between
10228: <code class="varname">CC</code>, <code class="varname">PKG_CC</code> and
10229: <code class="varname">PKGSRC_COMPILER</code>?</p></td>
10230: </tr>
10231: <tr class="answer">
1.91 rillig 10232: <td align="left" valign="top"></td>
1.75 rillig 10233: <td align="left" valign="top">
1.338 nia 10234: <p><code class="varname">CC</code> is the path to the real C
10235: compiler, which can be configured by the pkgsrc user.</p>
10236: <p><code class="varname">PKG_CC</code> is the path to the compiler
10237: wrapper.</p>
10238: <p><code class="varname">PKGSRC_COMPILER</code> is
10239: <span class="emphasis"><em>not</em></span> a path to a compiler, but the type of
10240: compiler that should be used. See
10241: <code class="filename">mk/compiler.mk</code> for more information about
10242: the latter variable.</p>
1.75 rillig 10243: </td>
10244: </tr>
1.148 asau 10245: <tr class="question">
1.75 rillig 10246: <td align="left" valign="top">
1.338 nia 10247: <a name="devfaq.bl3prefix"></a><a name="devfaq.bl3prefix.q"></a><p><b>24.4.</b></p>
1.75 rillig 10248: </td>
1.110 hubertf 10249: <td align="left" valign="top"><p>Why does <span class="command"><strong>make show-var
1.75 rillig 10250: VARNAME=BUILDLINK_PREFIX.<em class="replaceable"><code>foo</code></em></strong></span>
10251: say it's empty?</p></td>
10252: </tr>
10253: <tr class="answer">
1.91 rillig 10254: <td align="left" valign="top"></td>
1.75 rillig 10255: <td align="left" valign="top"><p>For optimization reasons, some variables are only
1.128 wiz 10256: available in the <span class="quote">“<span class="quote">wrapper</span>”</span> phase and later. To
10257: <span class="quote">“<span class="quote">simulate</span>”</span> the wrapper phase, append
1.110 hubertf 10258: <span class="command"><strong>PKG_PHASE=wrapper</strong></span> to the above
1.75 rillig 10259: command.</p></td>
10260: </tr>
1.148 asau 10261: <tr class="question">
1.78 rillig 10262: <td align="left" valign="top">
1.338 nia 10263: <a name="devfaq.master_sites"></a><a name="devfaq.master_sites.q"></a><p><b>24.5.</b></p>
1.78 rillig 10264: </td>
10265: <td align="left" valign="top"><p>What does
1.220 wiz 10266: <code class="code">${MASTER_SITE_SOURCEFORGE:=package/}</code> mean? I
10267: don't understand the <code class="code">:=</code> inside
1.78 rillig 10268: it.</p></td>
10269: </tr>
10270: <tr class="answer">
1.91 rillig 10271: <td align="left" valign="top"></td>
1.338 nia 10272: <td align="left" valign="top"><p>The <code class="code">:=</code> is not an
10273: assignment operator, even though it may look like one.
1.78 rillig 10274: Instead, it is a degenerate form of
1.220 wiz 10275: <code class="code">${LIST:<em class="replaceable"><code>old_string</code></em>=<em class="replaceable"><code>new_string</code></em>}</code>,
1.322 leot 10276: 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 10277: commonly used in the form <code class="code">${SRCS:.c=.o}</code>. In the
1.78 rillig 10278: case of <code class="varname">MASTER_SITE_*</code>,
10279: <em class="replaceable"><code>old_string</code></em> is the empty string and
10280: <em class="replaceable"><code>new_string</code></em> is
1.220 wiz 10281: <code class="code">package/</code>. That's where the
10282: <code class="code">:</code> and the <code class="code">=</code> fall
1.78 rillig 10283: together.</p></td>
10284: </tr>
1.148 asau 10285: <tr class="question">
1.78 rillig 10286: <td align="left" valign="top">
1.338 nia 10287: <a name="devfaq.mailinglists"></a><a name="devfaq.mailinglists.q"></a><p><b>24.6.</b></p>
1.78 rillig 10288: </td>
10289: <td align="left" valign="top"><p>Which mailing lists are there for package
10290: developers?</p></td>
10291: </tr>
10292: <tr class="answer">
1.91 rillig 10293: <td align="left" valign="top"></td>
1.148 asau 10294: <td align="left" valign="top"><div class="variablelist"><dl class="variablelist">
1.289 leot 10295: <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 10296: <dd><p>This is a list for technical discussions related
10297: to pkgsrc development, e.g. soliciting feedback for changes to
10298: pkgsrc infrastructure, proposed new features, questions related
10299: to porting pkgsrc to a new platform, advice for maintaining a
10300: package, patches that affect many packages, help requests moved
10301: from pkgsrc-users when an infrastructure bug is found,
10302: etc.</p></dd>
1.289 leot 10303: <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 10304: <dd><p>All bug reports in category "pkg" sent with
1.322 leot 10305: <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 10306: directly; use one of the other mailing
10307: lists.</p></dd>
10308: </dl></div></td>
10309: </tr>
1.148 asau 10310: <tr class="question">
1.80 rillig 10311: <td align="left" valign="top">
1.338 nia 10312: <a name="devfaq.documentation"></a><a name="devfaq.documentation.q"></a><p><b>24.7.</b></p>
1.80 rillig 10313: </td>
10314: <td align="left" valign="top"><p>Where is the pkgsrc
10315: documentation?</p></td>
10316: </tr>
10317: <tr class="answer">
1.91 rillig 10318: <td align="left" valign="top"></td>
1.80 rillig 10319: <td align="left" valign="top">
10320: <p>There are many places where you can find
10321: documentation about pkgsrc:</p>
1.148 asau 10322: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 10323: <li class="listitem"><p>The pkgsrc guide (this document) is a collection
1.80 rillig 10324: of chapters that explain large parts of pkgsrc, but some
10325: chapters tend to be outdated. Which ones they are is hard to
10326: say.</p></li>
1.289 leot 10327: <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 10328: about certain features, announcements of new parts of the pkgsrc
10329: infrastructure and sometimes even announcements that a certain
10330: feature has been marked as obsolete. The benefit here is that
10331: each message has a date appended to it.</p></li>
1.128 wiz 10332: <li class="listitem"><p>Many of the files in the
1.80 rillig 10333: <code class="filename">mk/</code> directory start with a comment that
10334: describes the purpose of the file and how it can be used by the
1.92 rillig 10335: pkgsrc user and package authors. An easy way to find this
1.110 hubertf 10336: documentation is to run <span class="command"><strong>bmake
1.92 rillig 10337: help</strong></span>.</p></li>
1.128 wiz 10338: <li class="listitem"><p>The CVS log messages are a rich source of
1.80 rillig 10339: information, but they tend to be highly abbreviated, especially
10340: for actions that occur often. Some contain a detailed
10341: description of what has changed, but they are geared towards the
10342: other pkgsrc developers, not towards an average pkgsrc user.
10343: They also only document <span class="emphasis"><em>changes</em></span>, so if you
10344: don't know what has been before, these messages may not be worth
10345: too much to you.</p></li>
1.128 wiz 10346: <li class="listitem"><p>Some parts of pkgsrc are only <span class="quote">“<span class="quote">implicitly
10347: documented</span>”</span>, that is the documentation exists only in the
1.80 rillig 10348: mind of the developer who wrote the code. To get this
1.110 hubertf 10349: information, use the <span class="command"><strong>cvs annotate</strong></span> command
1.80 rillig 10350: to see who has written it and ask on the
10351: <code class="literal">tech-pkg</code> mailing list, so that others can
10352: find your questions later (see above). To be sure that the
10353: developer in charge reads the mail, you may CC him or
10354: her.</p></li>
10355: </ul></div>
1.299 rillig 10356: </td>
10357: </tr>
10358: <tr class="question">
10359: <td align="left" valign="top">
1.338 nia 10360: <a name="devfaq.too-much-time"></a><a name="devfaq.too-much-time.q"></a><p><b>24.8.</b></p>
1.299 rillig 10361: </td>
1.338 nia 10362: <td align="left" valign="top"><p>I have a little time to kill.
1.299 rillig 10363: What shall I do?</p></td>
10364: </tr>
10365: <tr class="answer">
10366: <td align="left" valign="top"></td>
10367: <td align="left" valign="top">
10368: <p>This is not really an FAQ yet, but here's the answer
10369: anyway.</p>
1.148 asau 10370: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.299 rillig 10371: <li class="listitem"><p>Run <span class="command"><strong>pkg_chk -N</strong></span> (from the
1.322 leot 10372: <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 10373: will tell you about newer versions of installed packages that are
10374: available, but not yet updated in pkgsrc.</p></li>
10375: <li class="listitem"><p>Browse <code class="filename">pkgsrc/doc/TODO</code>
10376: — it contains a list of suggested new packages and a list of
10377: cleanups and enhancements for pkgsrc that would be nice to
10378: have.</p></li>
10379: <li class="listitem"><p>Review packages for which review was requested on
10380: the <a class="ulink" href="https://www.NetBSD.org/mailinglists/index.html#tech-pkg" target="_top">tech-pkg</a>
10381: mailing list.</p></li>
1.85 jmmv 10382: </ul></div>
1.299 rillig 10383: </td>
1.85 jmmv 10384: </tr>
10385: </tbody>
1.299 rillig 10386: </table>
1.85 jmmv 10387: </div>
10388: </div>
1.75 rillig 10389: </div>
1.148 asau 10390: <div class="part">
1.75 rillig 10391: <div class="titlepage"><div><div><h1 class="title">
10392: <a name="infrastructure"></a>Part III. The pkgsrc infrastructure internals</h1></div></div></div>
1.148 asau 10393: <div class="partintro">
1.75 rillig 10394: <div></div>
10395: <p>This part of the guide deals with everything
10396: from the infrastructure that is behind the interfaces described
10397: in the developer's guide. A casual package maintainer should not
10398: need anything from this part.</p>
10399: <div class="toc">
10400: <p><b>Table of Contents</b></p>
1.210 leot 10401: <dl class="toc">
1.299 rillig 10402: <dt><span class="chapter"><a href="#infr.design">25. Design of the pkgsrc infrastructure</a></span></dt>
1.75 rillig 10403: <dd><dl>
1.299 rillig 10404: <dt><span class="sect1"><a href="#infr.vardef">25.1. The meaning of variable definitions</a></span></dt>
10405: <dt><span class="sect1"><a href="#infr.vardef.problems">25.2. Avoiding problems before they arise</a></span></dt>
10406: <dt><span class="sect1"><a href="#infr.var">25.3. Variable evaluation</a></span></dt>
1.75 rillig 10407: <dd><dl>
1.299 rillig 10408: <dt><span class="sect2"><a href="#infr.var.load">25.3.1. At load time</a></span></dt>
10409: <dt><span class="sect2"><a href="#infr.var.run">25.3.2. At runtime</a></span></dt>
1.75 rillig 10410: </dl></dd>
1.299 rillig 10411: <dt><span class="sect1"><a href="#infr.varspec">25.4. How can variables be specified?</a></span></dt>
10412: <dt><span class="sect1"><a href="#infr.design.intf">25.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 10413: <dd><dl>
1.299 rillig 10414: <dt><span class="sect2"><a href="#infr.design.intf.proc">25.5.1. Procedures with parameters</a></span></dt>
10415: <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 10416: </dl></dd>
1.299 rillig 10417: <dt><span class="sect1"><a href="#infr.order">25.6. The order in which files are loaded</a></span></dt>
1.81 rillig 10418: <dd><dl>
1.299 rillig 10419: <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>
10420: <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 10421: </dl></dd>
10422: </dl></dd>
1.299 rillig 10423: <dt><span class="chapter"><a href="#regression">26. Regression tests</a></span></dt>
1.75 rillig 10424: <dd><dl>
1.299 rillig 10425: <dt><span class="sect1"><a href="#regression.run">26.1. Running the regression tests</a></span></dt>
10426: <dt><span class="sect1"><a href="#regression.new">26.2. Adding a new regression test</a></span></dt>
1.75 rillig 10427: <dd><dl>
1.299 rillig 10428: <dt><span class="sect2"><a href="#regression.fun.override">26.2.1. Overridable functions</a></span></dt>
10429: <dt><span class="sect2"><a href="#regression.fun.helper">26.2.2. Helper functions</a></span></dt>
1.75 rillig 10430: </dl></dd>
10431: </dl></dd>
1.299 rillig 10432: <dt><span class="chapter"><a href="#porting">27. Porting pkgsrc</a></span></dt>
10433: <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 10434: </dl>
10435: </div>
10436: </div>
1.148 asau 10437: <div class="chapter">
1.75 rillig 10438: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 10439: <a name="infr.design"></a>Chapter 25. Design of the pkgsrc infrastructure</h2></div></div></div>
1.75 rillig 10440: <div class="toc">
10441: <p><b>Table of Contents</b></p>
1.210 leot 10442: <dl class="toc">
1.299 rillig 10443: <dt><span class="sect1"><a href="#infr.vardef">25.1. The meaning of variable definitions</a></span></dt>
10444: <dt><span class="sect1"><a href="#infr.vardef.problems">25.2. Avoiding problems before they arise</a></span></dt>
10445: <dt><span class="sect1"><a href="#infr.var">25.3. Variable evaluation</a></span></dt>
1.81 rillig 10446: <dd><dl>
1.299 rillig 10447: <dt><span class="sect2"><a href="#infr.var.load">25.3.1. At load time</a></span></dt>
10448: <dt><span class="sect2"><a href="#infr.var.run">25.3.2. At runtime</a></span></dt>
1.81 rillig 10449: </dl></dd>
1.299 rillig 10450: <dt><span class="sect1"><a href="#infr.varspec">25.4. How can variables be specified?</a></span></dt>
10451: <dt><span class="sect1"><a href="#infr.design.intf">25.5. Designing interfaces for Makefile fragments</a></span></dt>
1.75 rillig 10452: <dd><dl>
1.299 rillig 10453: <dt><span class="sect2"><a href="#infr.design.intf.proc">25.5.1. Procedures with parameters</a></span></dt>
10454: <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 10455: </dl></dd>
1.299 rillig 10456: <dt><span class="sect1"><a href="#infr.order">25.6. The order in which files are loaded</a></span></dt>
1.75 rillig 10457: <dd><dl>
1.299 rillig 10458: <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>
10459: <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 10460: </dl></dd>
10461: </dl>
10462: </div>
10463: <p>The pkgsrc infrastructure consists of many small Makefile
10464: fragments. Each such fragment needs a properly specified
10465: interface. This chapter explains how such an interface looks
10466: like.</p>
1.148 asau 10467: <div class="sect1">
1.75 rillig 10468: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10469: <a name="infr.vardef"></a>25.1. The meaning of variable definitions</h2></div></div></div>
1.81 rillig 10470: <p>Whenever a variable is defined in the pkgsrc
10471: infrastructure, the location and the way of definition provide
10472: much information about the intended use of that variable.
10473: Additionally, more documentation may be found in a header
10474: comment or in this pkgsrc guide.</p>
10475: <p>A special file is
10476: <code class="filename">mk/defaults/mk.conf</code>, which lists all
10477: variables that are intended to be user-defined. They are either
10478: defined using the <code class="literal">?=</code> operator or they are
10479: left undefined because defining them to anything would
1.128 wiz 10480: effectively mean <span class="quote">“<span class="quote">yes</span>”</span>. All these variables may be
1.81 rillig 10481: overridden by the pkgsrc user in the <code class="varname">MAKECONF</code>
10482: file.</p>
10483: <p>Outside this file, the following conventions apply:
10484: Variables that are defined using the <code class="literal">?=</code>
10485: operator may be overridden by a package.</p>
10486: <p>Variables that are defined using the <code class="literal">=</code>
10487: operator may be used read-only at run-time.</p>
10488: <p>Variables whose name starts with an underscore must not be
10489: accessed outside the pkgsrc infrastructure at all. They may
10490: change without further notice.</p>
1.148 asau 10491: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.81 rillig 10492: <h3 class="title">Note</h3>
10493: <p>These conventions are currently not applied
10494: consistently to the complete pkgsrc
10495: infrastructure.</p>
10496: </div>
10497: </div>
1.148 asau 10498: <div class="sect1">
1.81 rillig 10499: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10500: <a name="infr.vardef.problems"></a>25.2. Avoiding problems before they arise</h2></div></div></div>
1.81 rillig 10501: <p>All variables that contain lists of things should default
10502: to being empty. Two examples that do not follow this rule are
10503: <code class="varname">USE_LANGUAGES</code> and
10504: <code class="varname">DISTFILES</code>. These variables cannot simply be
10505: modified using the <code class="literal">+=</code> operator in package
10506: <code class="filename">Makefile</code>s (or other files included by
10507: them), since there is no guarantee whether the variable is
10508: already set or not, and what its value is. In the case of
1.128 wiz 10509: <code class="varname">DISTFILES</code>, the packages <span class="quote">“<span class="quote">know</span>”</span>
1.81 rillig 10510: the default value and just define it as in the following
10511: example.</p>
10512: <pre class="programlisting">
1.100 rillig 10513: DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
1.81 rillig 10514: </pre>
10515: <p>Because of the selection of this default value, the same
10516: value appears in many package Makefiles. Similarly for
10517: <code class="varname">USE_LANGUAGES</code>, but in this case the default
1.128 wiz 10518: value (<span class="quote">“<span class="quote"><code class="literal">c</code></span>”</span>) is so short that it
1.81 rillig 10519: doesn't stand out. Nevertheless it is mentioned in many
10520: files.</p>
10521: </div>
1.148 asau 10522: <div class="sect1">
1.81 rillig 10523: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10524: <a name="infr.var"></a>25.3. Variable evaluation</h2></div></div></div>
1.148 asau 10525: <div class="sect2">
1.75 rillig 10526: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10527: <a name="infr.var.load"></a>25.3.1. At load time</h3></div></div></div>
1.75 rillig 10528: <p>Variable evaluation takes place either at load time or at
10529: runtime, depending on the context in which they occur. The
10530: contexts where variables are evaluated at load time are:</p>
1.148 asau 10531: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 10532: <li class="listitem"><p>The right hand side of the <code class="literal">:=</code>
1.75 rillig 10533: and <code class="literal">!=</code> operators,</p></li>
1.128 wiz 10534: <li class="listitem"><p>Make directives like <code class="literal">.if</code> or
1.75 rillig 10535: <code class="literal">.for</code>,</p></li>
1.128 wiz 10536: <li class="listitem"><p>Dependency lines.</p></li>
1.75 rillig 10537: </ul></div>
10538: <p>A special exception are references to the iteration
10539: variables of <code class="literal">.for</code> loops, which are expanded
10540: inline, no matter in which context they appear.</p>
10541: <p>As the values of variables may change during load time,
10542: care must be taken not to evaluate them by accident. Typical
10543: examples for variables that should not be evaluated at load time
10544: are <code class="varname">DEPENDS</code> and
10545: <code class="varname">CONFIGURE_ARGS</code>. To make the effect more
10546: clear, here is an example:</p>
10547: <pre class="programlisting">
1.100 rillig 10548: CONFIGURE_ARGS= # none
10549: CFLAGS= -O
10550: CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
1.1 grant 10551:
1.100 rillig 10552: CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
1.1 grant 10553:
1.100 rillig 10554: CFLAGS+= -Wall
1.222 sevan 10555: </pre>
1.75 rillig 10556: <p>This code shows how the use of the <code class="literal">:=</code>
10557: operator can quickly lead to unexpected results. The first
10558: paragraph is fairly common code. The second paragraph evaluates
10559: the <code class="varname">CONFIGURE_ARGS</code> variable, which results in
10560: <code class="literal">CFLAGS=-O</code>. In the third paragraph, the
10561: <code class="literal">-Wall</code> is appended to the
10562: <code class="varname">CFLAGS</code>, but this addition will not appear in
10563: <code class="varname">CONFIGURE_ARGS</code>. In actual code, the three
10564: paragraphs from above typically occur in completely unrelated
10565: files.</p>
10566: </div>
1.148 asau 10567: <div class="sect2">
1.75 rillig 10568: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10569: <a name="infr.var.run"></a>25.3.2. At runtime</h3></div></div></div>
1.75 rillig 10570: <p>After all the files have been loaded, the values of the
10571: variables cannot be changed anymore. Variables that are used in
10572: the shell commands are expanded at this point.</p>
10573: </div>
10574: </div>
1.148 asau 10575: <div class="sect1">
1.75 rillig 10576: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10577: <a name="infr.varspec"></a>25.4. How can variables be specified?</h2></div></div></div>
1.78 rillig 10578: <p>There are many ways in which the definition and use of a
1.218 rillig 10579: variable can be restricted in order to detect bugs and violations
10580: of the (mostly unwritten) policies. A package can be checked with
10581: <code class="literal">pkglint -Wall</code> to see whether it meets these
10582: rules.</p>
1.78 rillig 10583: </div>
1.148 asau 10584: <div class="sect1">
1.78 rillig 10585: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10586: <a name="infr.design.intf"></a>25.5. Designing interfaces for Makefile fragments</h2></div></div></div>
1.76 rillig 10587: <p>Most of the <code class="filename">.mk</code> files fall into one
1.75 rillig 10588: of the following classes. Cases where a file falls into more
10589: than one class should be avoided as it often leads to subtle
10590: bugs.</p>
1.148 asau 10591: <div class="sect2">
1.75 rillig 10592: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10593: <a name="infr.design.intf.proc"></a>25.5.1. Procedures with parameters</h3></div></div></div>
1.75 rillig 10594: <p>In a traditional imperative programming language some of
1.76 rillig 10595: the <code class="filename">.mk</code> files could be described as
1.126 jakllsch 10596: procedures. They take some input parameters and—after
10597: inclusion—provide a result in output parameters. Since all
1.76 rillig 10598: variables in <code class="filename">Makefile</code>s have global scope
1.75 rillig 10599: care must be taken not to use parameter names that have already
10600: another meaning. For example, <code class="varname">PKGNAME</code> is a
10601: bad choice for a parameter name.</p>
10602: <p>Procedures are completely evaluated at preprocessing time.
10603: That is, when calling a procedure all input parameters must be
10604: completely resolvable. For example,
10605: <code class="varname">CONFIGURE_ARGS</code> should never be an input
10606: parameter since it is very likely that further text will be
10607: added after calling the procedure, which would effectively apply
10608: the procedure to only a part of the variable. Also, references
1.218 rillig 10609: to other variables will be modified after calling the
1.75 rillig 10610: procedure.</p>
10611: <p>A procedure can declare its output parameters either as
10612: suitable for use in preprocessing directives or as only
10613: available at runtime. The latter alternative is for variables
10614: that contain references to other runtime variables.</p>
10615: <p>Procedures shall be written such that it is possible to
10616: call the procedure more than once. That is, the file must not
10617: contain multiple-inclusion guards.</p>
10618: <p>Examples for procedures are
1.76 rillig 10619: <code class="filename">mk/bsd.options.mk</code> and
10620: <code class="filename">mk/buildlink3/bsd.builtin.mk</code>. To express
1.75 rillig 10621: that the parameters are evaluated at load time, they should be
10622: assigned using the <code class="literal">:=</code> operator, which should
10623: be used only for this purpose.</p>
10624: </div>
1.148 asau 10625: <div class="sect2">
1.75 rillig 10626: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10627: <a name="infr.design.intf.action"></a>25.5.2. Actions taken on behalf of parameters</h3></div></div></div>
1.75 rillig 10628: <p>Action files take some input parameters and may define
10629: runtime variables. They shall not define loadtime variables.
10630: There are action files that are included implicitly by the
10631: pkgsrc infrastructure, while other must be included
10632: explicitly.</p>
10633: <p>An example for action files is
1.76 rillig 10634: <code class="filename">mk/subst.mk</code>.</p>
1.75 rillig 10635: </div>
10636: </div>
1.148 asau 10637: <div class="sect1">
1.81 rillig 10638: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10639: <a name="infr.order"></a>25.6. The order in which files are loaded</h2></div></div></div>
1.81 rillig 10640: <p>Package <code class="filename">Makefile</code>s usually consist of
10641: a set of variable definitions, and include the file
10642: <code class="filename">../../mk/bsd.pkg.mk</code> in the very last line.
10643: Before that, they may also include various other
10644: <code class="filename">*.mk</code> files if they need to query the
10645: availability of certain features like the type of compiler or
10646: the X11 implementation. Due to the heavy use of preprocessor
10647: directives like <code class="literal">.if</code> and
10648: <code class="literal">.for</code>, the order in which the files are loaded
10649: matters.</p>
10650: <p>This section describes at which point the various files
10651: are loaded and gives reasons for that order.</p>
1.148 asau 10652: <div class="sect2">
1.81 rillig 10653: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10654: <a name="infr.order.prefs"></a>25.6.1. The order in <code class="filename">bsd.prefs.mk</code>
1.93 rillig 10655: </h3></div></div></div>
10656: <p>The very first action in <code class="filename">bsd.prefs.mk</code>
1.81 rillig 10657: is to define some essential variables like
10658: <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code> and
10659: <code class="varname">MACHINE_ARCH</code>.</p>
10660: <p>Then, the user settings are loaded from the file specified
1.110 hubertf 10661: 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 10662: After that, those variables
1.81 rillig 10663: that have not been overridden by the user are loaded from
10664: <code class="filename">mk/defaults/mk.conf</code>.</p>
10665: <p>After the user settings, the system settings and platform
10666: settings are loaded, which may override the user
10667: settings.</p>
10668: <p>Then, the tool definitions are loaded. The tool wrappers
10669: are not yet in effect. This only happens when building a
10670: package, so the proper variables must be used instead of the
10671: direct tool names.</p>
10672: <p>As the last steps, some essential variables from the
10673: wrapper and the package system flavor are loaded, as well as the
10674: variables that have been cached in earlier phases of a package
10675: build.</p>
10676: </div>
1.148 asau 10677: <div class="sect2">
1.81 rillig 10678: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10679: <a name="infr.order.pkg"></a>25.6.2. The order in <code class="filename">bsd.pkg.mk</code>
1.93 rillig 10680: </h3></div></div></div>
1.81 rillig 10681: <p>First, <code class="filename">bsd.prefs.mk</code> is loaded.</p>
10682: <p>Then, the various <code class="filename">*-vars.mk</code> files are
10683: loaded, which fill default values for those variables that have
1.93 rillig 10684: not been defined by the package. These variables may later
1.81 rillig 10685: be used even in unrelated files.</p>
10686: <p>Then, the file <code class="filename">bsd.pkg.error.mk</code>
10687: provides the target <code class="literal">error-check</code> that is added
10688: as a special dependency to all other targets that use
10689: <code class="varname">DELAYED_ERROR_MSG</code> or
10690: <code class="varname">DELAYED_WARNING_MSG</code>.</p>
10691: <p>Then, the package-specific hacks from
10692: <code class="filename">hacks.mk</code> are included.</p>
10693: <p>Then, various other files follow. Most of them don't have
10694: any dependencies on what they need to have included before or
10695: after them, though some do.</p>
10696: <p>The code to check <code class="varname">PKG_FAIL_REASON</code> and
10697: <code class="varname">PKG_SKIP_REASON</code> is then executed, which
10698: restricts the use of these variables to all the files that have
10699: been included before. Appearances in later files will be
10700: silently ignored.</p>
10701: <p>Then, the files for the main targets are included, in the
10702: order of later execution, though the actual order should not
10703: matter.</p>
10704: <p>At last, some more files are included that don't set any
10705: interesting variables but rather just define make targets to be
10706: executed.</p>
10707: </div>
10708: </div>
1.75 rillig 10709: </div>
1.148 asau 10710: <div class="chapter">
1.75 rillig 10711: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 10712: <a name="regression"></a>Chapter 26. Regression tests</h2></div></div></div>
1.75 rillig 10713: <div class="toc">
10714: <p><b>Table of Contents</b></p>
1.210 leot 10715: <dl class="toc">
1.299 rillig 10716: <dt><span class="sect1"><a href="#regression.run">26.1. Running the regression tests</a></span></dt>
10717: <dt><span class="sect1"><a href="#regression.new">26.2. Adding a new regression test</a></span></dt>
1.75 rillig 10718: <dd><dl>
1.299 rillig 10719: <dt><span class="sect2"><a href="#regression.fun.override">26.2.1. Overridable functions</a></span></dt>
10720: <dt><span class="sect2"><a href="#regression.fun.helper">26.2.2. Helper functions</a></span></dt>
1.75 rillig 10721: </dl></dd>
10722: </dl>
10723: </div>
10724: <p>The pkgsrc infrastructure consists of a large codebase,
10725: and there are many corners where every little bit of a file is
10726: well thought out, making pkgsrc likely to fail as soon as
10727: anything is changed near those parts. To prevent most changes
10728: from breaking anything, a suite of regression tests should go
10729: along with every important part of the pkgsrc infrastructure.
10730: This chapter describes how regression tests work in pkgsrc and
10731: how you can add new tests.</p>
1.148 asau 10732: <div class="sect1">
1.75 rillig 10733: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10734: <a name="regression.run"></a>26.1. Running the regression tests</h2></div></div></div>
1.322 leot 10735: <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 10736: provides the <span class="command"><strong>pkg_regress</strong></span> command. Then you
1.75 rillig 10737: can simply run that command, which will run all tests in the
1.283 rillig 10738: <code class="filename">regress/</code> directory.</p>
1.75 rillig 10739: </div>
1.148 asau 10740: <div class="sect1">
1.75 rillig 10741: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10742: <a name="regression.new"></a>26.2. Adding a new regression test</h2></div></div></div>
1.283 rillig 10743: <p>Every directory in the <code class="filename">regress/</code>
10744: directory that contains a file called <code class="filename">spec</code>
1.75 rillig 10745: is considered a regression test. This file is a shell program
1.110 hubertf 10746: that is included by the <span class="command"><strong>pkg_regress</strong></span> command.
1.75 rillig 10747: The following functions can be overridden to suit your
10748: needs.</p>
1.148 asau 10749: <div class="sect2">
1.75 rillig 10750: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10751: <a name="regression.fun.override"></a>26.2.1. Overridable functions</h3></div></div></div>
1.218 rillig 10752: <p>These functions do not take any parameters. Although they
10753: are called in <span class="quote">“<span class="quote">set -e</span>”</span> mode, they don't stop at the
1.289 leot 10754: first failing command. See <a class="ulink" href="https://stackoverflow.com/q/4072984" target="_top">this Stack Overflow
1.218 rillig 10755: question</a> for details.</p>
1.148 asau 10756: <div class="variablelist"><dl class="variablelist">
1.218 rillig 10757: <dt><span class="term"><code class="varname">do_setup</code></span></dt>
1.75 rillig 10758: <dd><p>This function prepares the environment for the
10759: test. By default it does nothing.</p></dd>
1.218 rillig 10760: <dt><span class="term"><code class="varname">do_test</code></span></dt>
10761: <dd>
10762: <p>This function runs the actual test. By default,
1.75 rillig 10763: it calls <code class="varname">TEST_MAKE</code> with the arguments
10764: <code class="varname">MAKEARGS_TEST</code> and writes its output including
10765: error messages into the file
1.218 rillig 10766: <code class="varname">TEST_OUTFILE</code>.</p>
10767: <p>When defining this function, make sure that all output that
10768: needs to be checked is written to the correct output file.
10769: Example:</p>
10770: <pre class="programlisting">
10771: do_test() {
1.223 rillig 10772: echo "Example output"
1.218 rillig 10773: } 1>$TEST_OUTFILE 2>&1
10774: </pre>
10775: </dd>
10776: <dt><span class="term"><code class="varname">check_result</code></span></dt>
10777: <dd>
10778: <p>This function is run after the test and is
1.75 rillig 10779: typically used to compare the actual output from the one that is
10780: expected. It can make use of the various helper functions from
1.218 rillig 10781: the next section. Example:</p>
10782: <pre class="programlisting">
10783: check_result() {
1.223 rillig 10784: exit_status 0
10785: output_require "Example"
10786: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
10787: output_prohibit "no such file or directory"
1.283 rillig 10788: regress_fail "expected $expected but got $actual for input $input"
1.218 rillig 10789: }
10790: </pre>
10791: </dd>
10792: <dt><span class="term"><code class="varname">do_cleanup</code></span></dt>
1.75 rillig 10793: <dd><p>This function cleans everything up after the
10794: test has been run. By default it does nothing.</p></dd>
10795: </dl></div>
10796: </div>
1.148 asau 10797: <div class="sect2">
1.75 rillig 10798: <div class="titlepage"><div><div><h3 class="title">
1.299 rillig 10799: <a name="regression.fun.helper"></a>26.2.2. Helper functions</h3></div></div></div>
1.148 asau 10800: <div class="variablelist"><dl class="variablelist">
1.283 rillig 10801: <dt><span class="term"><code class="varname">regress_fail <em class="replaceable"><code>message...</code></em></code></span></dt>
10802: <dd><p>This function makes the test fail with the given error message.</p></dd>
1.218 rillig 10803: <dt><span class="term"><code class="varname">exit_status expected</code></span></dt>
1.75 rillig 10804: <dd><p>This function compares the exitcode of the
1.218 rillig 10805: <span class="command"><strong>do_test</strong></span> function with its first parameter.
1.75 rillig 10806: If they differ, the test will fail.</p></dd>
1.218 rillig 10807: <dt><span class="term"><code class="varname">output_require regex...</code></span></dt>
10808: <dd>
10809: <p>This function checks for each of its parameters
10810: if the output from <span class="command"><strong>do_test</strong></span> matches the
1.75 rillig 10811: extended regular expression. If it does not, the test will
1.218 rillig 10812: fail. Example:</p>
10813: <pre class="programlisting">
1.219 rillig 10814: output_require "looks fine"
10815: output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$"
1.218 rillig 10816: </pre>
10817: </dd>
1.292 leot 10818: <dt><span class="term"><code class="varname">output_prohibit regex...</code></span></dt>
1.75 rillig 10819: <dd><p>This function checks for each of its parameters
1.110 hubertf 10820: if the output from <span class="command"><strong>do_test()</strong></span> does
1.75 rillig 10821: <span class="emphasis"><em>not</em></span> match the extended regular expression.
10822: If any of the regular expressions matches, the test will
10823: fail.</p></dd>
10824: </dl></div>
10825: </div>
10826: </div>
10827: </div>
1.148 asau 10828: <div class="chapter">
1.75 rillig 10829: <div class="titlepage"><div><div><h2 class="title">
1.299 rillig 10830: <a name="porting"></a>Chapter 27. Porting pkgsrc</h2></div></div></div>
1.75 rillig 10831: <div class="toc">
10832: <p><b>Table of Contents</b></p>
1.299 rillig 10833: <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 10834: </div>
10835: <p>The pkgsrc system has already been ported to many
10836: operating systems, hardware architectures and compilers. This
10837: chapter explains the necessary steps to make pkgsrc even more
10838: portable.</p>
1.148 asau 10839: <div class="sect1">
1.75 rillig 10840: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.299 rillig 10841: <a name="porting.opsys"></a>27.1. Porting pkgsrc to a new operating system</h2></div></div></div>
1.75 rillig 10842: <p>To port pkgsrc to a new operating system (called
10843: <code class="literal">MyOS</code> in this example), you need to touch the
10844: following files:</p>
1.148 asau 10845: <div class="variablelist"><dl class="variablelist">
1.93 rillig 10846: <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 10847: <dd><p>This file contains some basic definitions, for
10848: example the name of the C
10849: compiler.</p></dd>
1.76 rillig 10850: <dt><span class="term"><code class="filename">mk/bsd.prefs.mk</code></span></dt>
1.75 rillig 10851: <dd><p>Insert code that defines the variables
10852: <code class="varname">OPSYS</code>, <code class="varname">OS_VERSION</code>,
1.327 wiz 10853: <code class="varname">OPSYS_VERSION</code>, <code class="varname">LOWER_VENDOR</code>,
1.75 rillig 10854: <code class="varname">MACHINE_ARCH</code>, <code class="varname">OBJECT_FMT</code>,
10855: <code class="varname">APPEND_ELF</code>, and the other variables that
10856: appear in this file.</p></dd>
1.93 rillig 10857: <dt><span class="term"><code class="filename">mk/platform/<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75 rillig 10858: <dd><p>This file contains the platform-specific
10859: definitions that are used by pkgsrc. Start by copying one of the
10860: other files and edit it to your
10861: needs.</p></dd>
1.93 rillig 10862: <dt><span class="term"><code class="filename">mk/tools/tools.<em class="replaceable"><code>MyOS</code></em>.mk</code></span></dt>
1.75 rillig 10863: <dd><p>This file defines the paths to all the tools
10864: that are needed by one or the other package in pkgsrc, as well
10865: as by pkgsrc itself. Find out where these tools are on your
10866: platform and add them.</p></dd>
10867: </dl></div>
10868: <p>Now, you should be able to build some basic packages, like
1.322 leot 10869: <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 10870: </div>
10871: </div>
10872: </div>
1.148 asau 10873: <div class="appendix">
10874: <div class="titlepage"><div><div><h1 class="title">
10875: <a name="examples"></a>Appendix A. A simple example package: bison</h1></div></div></div>
1.75 rillig 10876: <div class="toc">
10877: <p><b>Table of Contents</b></p>
1.210 leot 10878: <dl class="toc">
1.75 rillig 10879: <dt><span class="sect1"><a href="#example-files">A.1. files</a></span></dt>
10880: <dd><dl>
10881: <dt><span class="sect2"><a href="#example-Makefile">A.1.1. Makefile</a></span></dt>
10882: <dt><span class="sect2"><a href="#example-descr">A.1.2. DESCR</a></span></dt>
10883: <dt><span class="sect2"><a href="#example-plist">A.1.3. PLIST</a></span></dt>
1.287 rillig 10884: <dt><span class="sect2"><a href="#checking-package-with-pkglint">A.1.4. Checking a package with pkglint</a></span></dt>
1.75 rillig 10885: </dl></dd>
10886: <dt><span class="sect1"><a href="#steps-for-b-i-p">A.2. Steps for building, installing, packaging</a></span></dt>
10887: </dl>
10888: </div>
10889: <p>We checked to find a piece of software that wasn't in the packages
10890: collection, and picked GNU bison. Quite why someone would want to have
1.110 hubertf 10891: <span class="command"><strong>bison</strong></span> when Berkeley <span class="command"><strong>yacc</strong></span> is already
1.75 rillig 10892: present in the tree is beyond us, but it's useful for the purposes of
10893: this exercise.</p>
1.148 asau 10894: <div class="sect1">
1.75 rillig 10895: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10896: <a name="example-files"></a>A.1. files</h2></div></div></div>
1.148 asau 10897: <div class="sect2">
1.75 rillig 10898: <div class="titlepage"><div><div><h3 class="title">
10899: <a name="example-Makefile"></a>A.1.1. Makefile</h3></div></div></div>
10900: <pre class="programlisting">
1.100 rillig 10901: # $NetBSD$
10902: #
1.1 grant 10903:
1.100 rillig 10904: DISTNAME= bison-1.25
10905: CATEGORIES= devel
1.286 rillig 10906: MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
1.1 grant 10907:
1.136 dholland 10908: MAINTAINER= pkgsrc-users@NetBSD.org
1.289 leot 10909: HOMEPAGE= https://www.gnu.org/software/bison/bison.html
1.100 rillig 10910: COMMENT= GNU yacc clone
1.1 grant 10911:
1.100 rillig 10912: GNU_CONFIGURE= yes
1.152 wiz 10913: INFO_FILES= yes
1.1 grant 10914:
1.100 rillig 10915: .include "../../mk/bsd.pkg.mk"
1.1 grant 10916: </pre>
1.75 rillig 10917: </div>
1.148 asau 10918: <div class="sect2">
1.75 rillig 10919: <div class="titlepage"><div><div><h3 class="title">
10920: <a name="example-descr"></a>A.1.2. DESCR</h3></div></div></div>
10921: <pre class="programlisting">
1.100 rillig 10922: GNU version of yacc. Can make re-entrant parsers, and numerous other
1.322 leot 10923: 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 10924: of the NetBSD source tree is beyond me.
1.1 grant 10925: </pre>
1.75 rillig 10926: </div>
1.148 asau 10927: <div class="sect2">
1.75 rillig 10928: <div class="titlepage"><div><div><h3 class="title">
10929: <a name="example-plist"></a>A.1.3. PLIST</h3></div></div></div>
10930: <pre class="programlisting">
1.100 rillig 10931: @comment $NetBSD$
10932: bin/bison
10933: man/man1/bison.1.gz
10934: share/bison.simple
10935: share/bison.hairy
1.1 grant 10936: </pre>
1.75 rillig 10937: </div>
1.148 asau 10938: <div class="sect2">
1.75 rillig 10939: <div class="titlepage"><div><div><h3 class="title">
1.287 rillig 10940: <a name="checking-package-with-pkglint"></a>A.1.4. Checking a package with pkglint</h3></div></div></div>
1.75 rillig 10941: <p>The NetBSD package system comes with
1.322 leot 10942: <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 10943: which helps to check the contents of these
10944: files. After installation it is quite easy to use, just change to the
1.286 rillig 10945: directory of the package you wish to examine and run
1.110 hubertf 10946: <span class="command"><strong>pkglint</strong></span>:</p>
1.75 rillig 10947: <pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pkglint</code></strong>
1.286 rillig 10948: ERROR: Makefile: Each package must define its LICENSE.
10949: WARN: Makefile:9: HOMEPAGE should migrate from http to https.
10950: NOTE: PLIST:3: The .gz extension is unnecessary for manual pages.
10951: WARN: PLIST:5: "share/bison.hairy" should be sorted before "share/bison.simple".
10952: 1 error, 2 warnings and 1 note found.
10953: (Run "pkglint -e" to show explanations.)
10954: (Run "pkglint -fs" to show what can be fixed automatically.)
1.287 rillig 10955: (Run "pkglint -F" to automatically fix some issues.)</pre>
1.75 rillig 10956: <p>Depending on the supplied command line arguments (see pkglint(1)),
1.285 rillig 10957: more checks will be performed. Use e.g. <span class="command"><strong>pkglint
1.75 rillig 10958: -Wall</strong></span> for a very thorough check.</p>
10959: </div>
10960: </div>
1.148 asau 10961: <div class="sect1">
1.75 rillig 10962: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
10963: <a name="steps-for-b-i-p"></a>A.2. Steps for building, installing, packaging</h2></div></div></div>
10964: <p>Create the directory where the package lives,
10965: plus any auxiliary directories:</p>
10966: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>cd /usr/pkgsrc/lang</code></strong>
10967: <code class="prompt">#</code> <strong class="userinput"><code>mkdir bison</code></strong>
10968: <code class="prompt">#</code> <strong class="userinput"><code>cd bison</code></strong>
10969: <code class="prompt">#</code> <strong class="userinput"><code>mkdir patches</code></strong></pre>
1.76 rillig 10970: <p>Create <code class="filename">Makefile</code>, <code class="filename">DESCR</code> and
1.299 rillig 10971: <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 10972: then continue with fetching the distfile:</p>
10973: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make fetch</code></strong>
1.1 grant 10974: >> bison-1.25.tar.gz doesn't seem to exist on this system.
10975: >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
10976: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10977: ftp: Error retrieving file: 500 Internal error
10978:
10979: >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
10980: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
10981: ftp: Error retrieving file: 500 Internal error
10982:
10983: >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
10984: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1.75 rillig 10985: Successfully retrieved file.</pre>
10986: <p>Generate the checksum of the distfile into
1.76 rillig 10987: <code class="filename">distinfo</code>:</p>
1.88 wiz 10988: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make makedistinfo</code></strong></pre>
1.75 rillig 10989: <p>Now compile:</p>
10990: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
1.1 grant 10991: >> Checksum OK for bison-1.25.tar.gz.
10992: ===> Extracting for bison-1.25
10993: ===> Patching for bison-1.25
10994: ===> Ignoring empty patch directory
10995: ===> Configuring for bison-1.25
10996: creating cache ./config.cache
10997: checking for gcc... cc
10998: checking whether we are using GNU C... yes
10999: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
11000: checking how to run the C preprocessor... cc -E
11001: checking for minix/config.h... no
11002: checking for POSIXized ISC... no
11003: checking whether cross-compiling... no
11004: checking for ANSI C header files... yes
11005: checking for string.h... yes
11006: checking for stdlib.h... yes
11007: checking for memory.h... yes
11008: checking for working const... yes
11009: checking for working alloca.h... no
11010: checking for alloca... yes
11011: checking for strerror... yes
11012: updating cache ./config.cache
11013: creating ./config.status
11014: creating Makefile
11015: ===> Building for bison-1.25
11016: 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
11017: 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
11018: 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
11019: 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
11020: 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 11021: 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 11022: 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
11023: 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
11024: 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
11025: 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
11026: 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
11027: 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
11028: 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
11029: 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
11030: 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
11031: 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
11032: 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
11033: 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
11034: 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
11035: 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
11036: 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
11037: 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
11038: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
11039: rm -f bison.s1
1.75 rillig 11040: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1</pre>
11041: <p>Everything seems OK, so install the files:</p>
11042: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
1.1 grant 11043: >> Checksum OK for bison-1.25.tar.gz.
11044: ===> Installing for bison-1.25
11045: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share /usr/pkg/info /usr/pkg/man/man1
11046: rm -f /usr/pkg/bin/bison
11047: cd /usr/pkg/share; rm -f bison.simple bison.hairy
11048: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
11049: install -c -o bin -g bin -m 555 bison /usr/pkg/bin/bison
11050: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
11051: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
11052: cd .; for f in bison.info*; do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
11053: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
1.75 rillig 11054: ===> Registering installation for bison-1.25</pre>
11055: <p>You can now use bison, and also - if you decide so - remove it with
1.110 hubertf 11056: <span class="command"><strong>pkg_delete bison</strong></span>. Should you decide that you want a
1.75 rillig 11057: binary package, do this now:</p>
11058: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
1.1 grant 11059: >> Checksum OK for bison-1.25.tar.gz.
11060: ===> Building package for bison-1.25
11061: Creating package bison-1.25.tgz
11062: Registering depends:.
1.75 rillig 11063: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'</pre>
11064: <p>Now that you don't need the source and object files
11065: any more, clean up:</p>
11066: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make clean</code></strong>
11067: ===> Cleaning for bison-1.25</pre>
11068: </div>
11069: </div>
1.148 asau 11070: <div class="appendix">
11071: <div class="titlepage"><div><div><h1 class="title">
1.322 leot 11072: <a name="hardening"></a>Appendix B. Security hardening</h1></div></div></div>
1.75 rillig 11073: <div class="toc">
11074: <p><b>Table of Contents</b></p>
1.210 leot 11075: <dl class="toc">
1.322 leot 11076: <dt><span class="sect1"><a href="#hardening.mechanisms">B.1. Mechanisms</a></span></dt>
11077: <dd><dl>
11078: <dt><span class="sect2"><a href="#hardening.mechanisms.enabled">B.1.1. Enabled by default</a></span></dt>
11079: <dt><span class="sect2"><a href="#hardening.mechanisms.disabled">B.1.2. Not enabled by default</a></span></dt>
11080: </dl></dd>
11081: <dt><span class="sect1"><a href="#hardening.caveats">B.2. Caveats</a></span></dt>
11082: <dd><dl>
11083: <dt><span class="sect2"><a href="#hardening.caveats.pie">B.2.1. Problems with PKGSRC_MKPIE</a></span></dt>
11084: <dt><span class="sect2"><a href="#hardening.caveats.fortify">B.2.2. Problems with PKGSRC_USE_FORTIFY</a></span></dt>
11085: <dt><span class="sect2"><a href="#hardening.caveats.relro">B.2.3. Problems with PKGSRC_USE_RELRO</a></span></dt>
11086: <dt><span class="sect2"><a href="#hardening.caveats.ssp">B.2.4. Problems with PKGSRC_USE_SSP</a></span></dt>
11087: </dl></dd>
11088: <dt><span class="sect1"><a href="#hardening.audit">B.3. Auditing the system</a></span></dt>
11089: <dd><dl>
11090: <dt><span class="sect2"><a href="#hardening.audit.pie">B.3.1. Checking for PIE</a></span></dt>
11091: <dt><span class="sect2"><a href="#hardening.audit.relropartial">B.3.2. Checking for partial RELRO</a></span></dt>
11092: <dt><span class="sect2"><a href="#hardening.audit.relrofull">B.3.3. Checking for full RELRO</a></span></dt>
11093: <dt><span class="sect2"><a href="#hardening.audit.ssp">B.3.4. Checking for SSP</a></span></dt>
11094: </dl></dd>
1.75 rillig 11095: </dl>
11096: </div>
1.322 leot 11097: <p>
11098: A number of mechanisms are available in pkgsrc to improve the security of the
11099: resulting system. This page describes the mechanisms, and gives hints
11100: about detecting and fixing problems.
11101: </p>
11102: <p>
11103: Mechanisms can be enabled individually in
11104: <code class="filename">mk.conf</code>, and are
11105: individually described below.
11106: </p>
11107: <p>
11108: Typically, a feature will cause some programs to fail to build or work
11109: when first enabled. This can be due to latent problems in the
11110: program, and can be due to other reasons. After enough testing to
11111: have confidence that user problems will be quite rare, individual
11112: mechanisms will be enabled by default.
11113: </p>
11114: <p>
11115: For each mechanism, see the Caveats section below for an explanation
11116: of what might go wrong at compile time and at run time, and how to
11117: notice and address these problems.
11118: </p>
1.148 asau 11119: <div class="sect1">
1.75 rillig 11120: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322 leot 11121: <a name="hardening.mechanisms"></a>B.1. Mechanisms</h2></div></div></div>
11122: <div class="sect2">
11123: <div class="titlepage"><div><div><h3 class="title">
11124: <a name="hardening.mechanisms.enabled"></a>B.1.1. Enabled by default</h3></div></div></div>
11125: <div class="sect3">
11126: <div class="titlepage"><div><div><h4 class="title">
11127: <a name="hardening.mechanisms.enabled.fortify"></a>B.1.1.1. PKGSRC_USE_FORTIFY</h4></div></div></div>
11128: <p>
11129: This allows substitute wrappers to be used for some commonly used
11130: library functions that do not have built-in bounds checking - but
11131: could in some cases.
11132: </p>
11133: <p>
11134: Two mitigation levels are available:
11135: </p>
11136: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
11137: <li class="listitem"><p>"weak" only enables checks at compile-time.</p></li>
11138: <li class="listitem"><p>"strong" enables checks at compile-time and runtime.</p></li>
11139: </ul></div>
11140: <p>
11141: "strong" has been enabled by default since pkgsrc-2017Q3.
11142: </p>
11143: </div>
11144: <div class="sect3">
11145: <div class="titlepage"><div><div><h4 class="title">
11146: <a name="hardening.mechanisms.enabled.ssp"></a>B.1.1.2. PKGSRC_USE_SSP</h4></div></div></div>
11147: <p>
11148: This enables a stack-smashing protection mitigation. It is done by adding a
11149: guard variable to functions with vulnerable objects. The guards are initialized
11150: when a function is entered and then checked when the function exits. The guard
11151: check will fail and the program forcibly exited if the variable was modified in
11152: the meantime. This can happen in case of buffer overflows or memory corruption,
11153: and therefore exposing these bugs.
11154: </p>
11155: <p>
11156: Different mitigation levels are available:
11157: </p>
11158: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
11159: <li class="listitem"><p>"yes", which will only protect functions considered vulnerable
11160: by the compiler;</p></li>
11161: <li class="listitem"><p>"all", which will protect every function;</p></li>
11162: <li class="listitem"><p>"strong", the default, which will apply a better balance between the
11163: two settings above.</p></li>
11164: </ul></div>
11165: <p>
11166: This mitigation is supported by both GCC and clang. It may be supported in
11167: additional compilers, possibly under a different name. It is particularly useful
11168: for unsafe programming languages, such as C/C++.
11169: </p>
11170: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
11171: <li class="listitem"><p>"yes" is enabled by default where known supported since pkgsrc-2017Q3.</p></li>
11172: <li class="listitem"><p>"strong" is enabled by default where known supported since pkgsrc-2021Q4.</p></li>
11173: </ul></div>
11174: <p>More details can be found here:</p>
11175: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
11176: <a class="ulink" href="https://en.wikipedia.org/wiki/Buffer_overflow_protection" target="_top">Buffer overflow protection on Wikipedia</a>
11177: </p></li></ul></div>
11178: </div>
11179: <div class="sect3">
11180: <div class="titlepage"><div><div><h4 class="title">
11181: <a name="hardening.mechanisms.enabled.pie"></a>B.1.1.3. PKGSRC_MKPIE</h4></div></div></div>
11182: <p>
11183: This requests the creation of PIE (Position Independent Executables) for all
11184: executables. The PIE mechanism is normally used for shared libraries, so that
11185: they can be loaded at differing addresses at runtime. PIE itself does not have
11186: useful security properties; however, it is necessary to fully leverage some,
11187: such as ASLR. Some operating systems support Address Space Layout Randomization
11188: (ASLR), which causes different addresses to be used each time a program is run.
11189: This makes it more difficult for an attacker to guess addresses and thus makes
11190: exploits harder to construct. With PIE, ASLR can really be applied to the entire
11191: program, instead of the stack and heap only.
11192: </p>
11193: <p>
11194: PIE executables will only be built for toolchains that are known to support PIE.
11195: Currently, this means NetBSD on x86, ARM, SPARC64, m68k, and MIPS.
11196: </p>
11197: <p>
11198: <code class="varname">PKGSRC_MKPIE</code> was enabled by default after the pkgsrc-2021Q3 branch.
11199: </p>
1.75 rillig 11200: </div>
1.325 gutterid 11201: <div class="sect3">
11202: <div class="titlepage"><div><div><h4 class="title">
1.334 nia 11203: <a name="hardening.mechanisms.enabled.relro"></a>B.1.1.4. PKGSRC_USE_RELRO</h4></div></div></div>
1.322 leot 11204: <p>
11205: This also makes the exploitation of some security vulnerabilities more
11206: difficult in some cases.
11207: </p>
11208: <p>Two different mitigation levels are available:</p>
11209: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
11210: <li class="listitem"><p>
1.334 nia 11211: partial (the default): the ELF sections are reordered so that internal data sections
1.322 leot 11212: precede the program's own data sections, and non-PLT GOT is read-only;
11213: </p></li>
11214: <li class="listitem"><p>
11215: full: in addition to partial RELRO, every relocation is performed immediately
1.333 nia 11216: when starting the program, allowing the entire GOT to be read-only. This
11217: can greatly slow down startup of large programs.
1.322 leot 11218: </p></li>
11219: </ul></div>
11220: <p>
11221: This is currently supported by GCC. Many software distributions now enable this
1.335 nia 11222: feature by default, at the "partial" level.
1.322 leot 11223: </p>
11224: <p>
11225: More details can be found here:
11226: </p>
11227: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
11228: <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>
11229: </p></li></ul></div>
1.75 rillig 11230: </div>
1.334 nia 11231: </div>
11232: <div class="sect2">
11233: <div class="titlepage"><div><div><h3 class="title">
11234: <a name="hardening.mechanisms.disabled"></a>B.1.2. Not enabled by default</h3></div></div></div>
11235: <div class="sect3">
11236: <div class="titlepage"><div><div><h4 class="title">
11237: <a name="hardening.mechanisms.disabled.repro"></a>B.1.2.1. PKGSRC_MKREPRO</h4></div></div></div>
11238: <p>
11239: With this option, pkgsrc will try to build packages reproducibly. This allows
11240: packages built from the same tree and with the same options, to produce
11241: identical results bit by bit. This option should be combined with ASLR and
11242: <code class="varname">PKGSRC_MKPIE</code> to avoid predictable address offsets for
11243: attackers attempting to exploit security vulnerabilities.
11244: </p>
11245: <p>
11246: More details can be found here:
11247: </p>
11248: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
11249: <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>
11250: </p></li></ul></div>
11251: <p>
11252: More work likely needs to be done before pkgsrc is fully reproducible.
11253: </p>
11254: </div>
1.322 leot 11255: <div class="sect3">
11256: <div class="titlepage"><div><div><h4 class="title">
1.334 nia 11257: <a name="hardening.mechanisms.disabled.stackcheck"></a>B.1.2.2. PKGSRC_USE_STACK_CHECK</h4></div></div></div>
1.322 leot 11258: <p>
11259: This uses <code class="literal">-fstack-check</code> with GCC for
11260: another stack protection mitigation.
11261: </p>
11262: <p>
11263: It asks the compiler to generate code verifying that it does not corrupt the
11264: stack. According to GCC's manual page, this is really only useful for
11265: multi-threaded programs.
11266: </p>
1.76 rillig 11267: </div>
11268: </div>
11269: </div>
1.148 asau 11270: <div class="sect1">
1.76 rillig 11271: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322 leot 11272: <a name="hardening.caveats"></a>B.2. Caveats</h2></div></div></div>
11273: <div class="sect2">
11274: <div class="titlepage"><div><div><h3 class="title">
11275: <a name="hardening.caveats.pie"></a>B.2.1. Problems with PKGSRC_MKPIE</h3></div></div></div>
11276: <div class="sect3">
11277: <div class="titlepage"><div><div><h4 class="title">
11278: <a name="hardening.caveats.pie.build"></a>B.2.1.1. Packages failing to build</h4></div></div></div>
11279: <p>
11280: A number of packages may fail to build with this option enabled. The
11281: failures are often related to the absence of the <code class="literal">-fPIC</code>
11282: compilation flag when building libraries or executables (or ideally
11283: <code class="literal">-fPIE</code> in the latter case). This flag is added to the
11284: <code class="varname">CFLAGS</code> already, but requires the package to
11285: actually support it.
11286: </p>
11287: <div class="sect4">
11288: <div class="titlepage"><div><div><h5 class="title">
11289: <a name="hardening.caveats.pie.build.fix"></a>B.2.1.1.1. How to fix</h5></div></div></div>
11290: <p>
11291: These instructions are meant as a reference only; they likely need to be adapted
11292: for many packages individually.
11293: </p>
11294: <p>
11295: For packages using <code class="filename">Makefiles</code>:
11296: </p>
11297: <pre class="programlisting">
11298: MAKE_FLAGS+= CFLAGS=${CFLAGS:Q}
11299: MAKE_FLAGS+= LDFLAGS=${LDFLAGS:Q}
11300: </pre>
11301: <p>
11302: For packages using <code class="filename">Imakefiles</code>:
11303: </p>
11304: <pre class="programlisting">
11305: MAKE_FLAGS+= CCOPTIONS=${CFLAGS:Q}
11306: MAKE_FLAGS+= LOCAL_LDFLAGS=${LDFLAGS:Q}
11307: </pre>
11308: </div>
11309: </div>
11310: <div class="sect3">
11311: <div class="titlepage"><div><div><h4 class="title">
11312: <a name="hardening.caveats.pie.crash"></a>B.2.1.2. Run-time crashes</h4></div></div></div>
11313: <p>
11314: Some programs may fail to run, or crash at random times once built as PIE. Two
11315: scenarios are essentially possible. This is nearly always due to a bug in
11316: the program being exposed due to ASLR.
11317: </p>
11318: </div>
11319: <div class="sect3">
11320: <div class="titlepage"><div><div><h4 class="title">
11321: <a name="hardening.caveats.pie.disable"></a>B.2.1.3. Disabling PKGSRC_MKPIE on a per-package basis</h4></div></div></div>
11322: <p>
11323: Ideally, packages should be fixed for compatibility with MKPIE.
11324: However, in some cases this is very difficult, due to complex build systems,
11325: packages using non-standard toolchains, or programming languages with odd
11326: bootstrapping mechanisms.
11327: </p>
11328: <p>
11329: To disable <code class="varname">PKGSRC_MKPIE</code> on a per-package basis, set
11330: <code class="varname">MKPIE_SUPPORTED= no</code> in the package's Makefile before
11331: <code class="filename">bsd.prefs.mk</code> is included.
11332: </p>
11333: </div>
11334: </div>
11335: <div class="sect2">
11336: <div class="titlepage"><div><div><h3 class="title">
11337: <a name="hardening.caveats.fortify"></a>B.2.2. Problems with PKGSRC_USE_FORTIFY</h3></div></div></div>
11338: <div class="sect3">
11339: <div class="titlepage"><div><div><h4 class="title">
11340: <a name="hardening.caveats.fortify.build"></a>B.2.2.1. Packages failing to build</h4></div></div></div>
11341: <p>
11342: This feature makes use of pre-processing directives to look for hardened,
11343: alternative implementations of essential library calls. Some programs may fail
11344: to build as a result; this usually happens for those trying too hard to be
11345: portable, or otherwise abusing definitions in the standard library.
11346: </p>
11347: </div>
11348: <div class="sect3">
11349: <div class="titlepage"><div><div><h4 class="title">
11350: <a name="hardening.caveats.fortify.crash"></a>B.2.2.2. Run-time crashes</h4></div></div></div>
11351: <p>
11352: This feature may cause some programs to crash, usually indicating an
11353: actual bug in the program. The fix will typically involve patching the
11354: original program's source code.
11355: </p>
11356: </div>
11357: <div class="sect3">
11358: <div class="titlepage"><div><div><h4 class="title">
11359: <a name="hardening.caveats.fortify.opt"></a>B.2.2.3. Optimization is required</h4></div></div></div>
11360: <p>
11361: At least in the case of GCC, FORTIFY will only be applied if optimization is
11362: applied while compiling. This means that the <code class="varname">CFLAGS</code> should
11363: also contain <code class="literal">-O</code>, <code class="literal">-O2</code> or another
11364: optimization level. This cannot easily be applied globally, as some packages
11365: may require specific optimization levels.
11366: </p>
11367: </div>
11368: <div class="sect3">
11369: <div class="titlepage"><div><div><h4 class="title">
11370: <a name="hardening.caveats.fortify.disable"></a>B.2.2.4. Disabling FORTIFY on a per-package basis</h4></div></div></div>
11371: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
11372: <h3 class="title">Note</h3>
11373: <p>FORTIFY should not be disabled to work around runtime crashes in
11374: the program! This is a very bad idea and will expose you to security
11375: vulnerabilities.
11376: </p>
11377: </div>
11378: <p>
11379: To disable FORTIFY on a per-package basis, set the following
11380: in the package's <code class="filename">Makefile</code>
11381: before <code class="filename">bsd.prefs.mk</code> is included:
11382: </p>
11383: <pre class="programlisting">
11384: FORTIFY_SUPPORTED= no
11385: </pre>
11386: </div>
11387: </div>
11388: <div class="sect2">
11389: <div class="titlepage"><div><div><h3 class="title">
11390: <a name="hardening.caveats.relro"></a>B.2.3. Problems with PKGSRC_USE_RELRO</h3></div></div></div>
11391: <div class="sect3">
11392: <div class="titlepage"><div><div><h4 class="title">
11393: <a name="hardening.caveats.relro.performance"></a>B.2.3.1. Performance impact</h4></div></div></div>
11394: <p>
11395: For better protection, full RELRO requires every symbol to be resolved when the
11396: program starts, rather than simply when required at run-time. This will have
11397: more impact on programs using a lot of symbols, or linked to libraries exposing
11398: a lot of symbols. Therefore, daemons or programs otherwise running in
11399: background are affected only when started. Programs loading plug-ins at
11400: run-time are affected when loading the plug-ins.
11401: </p>
11402: <p>
11403: The impact is not expected to be noticeable on modern hardware, except in some
11404: cases for big programs.
11405: </p>
11406: </div>
11407: <div class="sect3">
11408: <div class="titlepage"><div><div><h4 class="title">
11409: <a name="hardening.caveats.relro.crash"></a>B.2.3.2. Run-time crashes</h4></div></div></div>
11410: <p>
11411: Some programs handle plug-ins and dependencies in a way that conflicts with
11412: RELRO: for instance, with an initialization routine listing any other plug-in
11413: required. With full RELRO, the missing symbols are resolved before the
11414: initialization routine can run, and the dynamic loader will not be able to find
11415: them directly and abort as a result. Unfortunately, this is how Xorg loads its
11416: drivers. Partial RELRO can be applied instead in this case.
11417: </p>
11418: </div>
11419: <div class="sect3">
11420: <div class="titlepage"><div><div><h4 class="title">
11421: <a name="hardening.caveats.relro.disable"></a>B.2.3.3. Disabling RELRO on a per-package basis</h4></div></div></div>
11422: <p>
11423: To disable RELRO on a per-package basis, set the following
11424: in the package's <code class="filename">Makefile</code>
11425: before <code class="filename">bsd.prefs.mk</code> is included:
11426: </p>
11427: <pre class="programlisting">
11428: RELRO_SUPPORTED= no
11429: </pre>
1.324 nia 11430: <p>
11431: It is also possible to at most enable partial RELRO, by
11432: setting <code class="varname">RELRO_SUPPORTED</code> to <code class="literal">partial</code>.
11433: </p>
1.322 leot 11434: </div>
11435: </div>
11436: <div class="sect2">
11437: <div class="titlepage"><div><div><h3 class="title">
11438: <a name="hardening.caveats.ssp"></a>B.2.4. Problems with PKGSRC_USE_SSP</h3></div></div></div>
11439: <div class="sect3">
11440: <div class="titlepage"><div><div><h4 class="title">
11441: <a name="hardening.caveats.ssp.build"></a>B.2.4.1. Packages failing to build</h4></div></div></div>
11442: <p>
11443: The stack-smashing protection provided by this option does not work for some
11444: programs. The most common situation in which this happens is when the program
11445: allocates variables on the stack, with the size determined at run-time.
11446: </p>
11447: </div>
11448: <div class="sect3">
11449: <div class="titlepage"><div><div><h4 class="title">
11450: <a name="hardening.caveats.ssp.crash"></a>B.2.4.2. Run-time crashes</h4></div></div></div>
11451: <p>
11452: Again, this feature may cause some programs to crash via a
11453: <code class="varname">SIGABRT</code>, usually indicating an actual bug in the program.
11454: </p>
11455: <p>
11456: On NetBSD <code class="varname">LOG_CRIT</code> level syslog
11457: messages are sent and - by default -
11458: appended to <code class="filename">/var/log/messages</code>, e.g.:
11459: </p>
11460: <pre class="programlisting">
11461: Jan 6 15:42:51 hostname -: hostname program - - - buffer overflow detected; terminated
11462: </pre>
11463: <p>
11464: (where <code class="literal">hostname</code> is the hostname(1) and
11465: <code class="literal">program</code> is the basename(1) of the program crashed).
11466: </p>
11467: <p>
11468: Patching the original program is then required.
11469: </p>
11470: <p>
11471: Rebuilding the package via:
11472: </p>
11473: <pre class="programlisting">
11474: <strong class="userinput"><code>% env CFLAGS=-g INSTALL_UNSTRIPPED=yes make replace</code></strong>
11475: </pre>
11476: <p>
11477: and inspecting the backtrace of the coredump via the debugger
11478: should point out the problematic call by inspecting the frame
11479: calling the _chk() (SSP) function.
11480: </p>
11481: </div>
11482: <div class="sect3">
11483: <div class="titlepage"><div><div><h4 class="title">
11484: <a name="hardening.caveats.ssp.performance"></a>B.2.4.3. Performance impact</h4></div></div></div>
11485: <p>
11486: The compiler emits extra code when using this feature: a check for buffer
11487: overflows is performed when entering and exiting functions, requiring an extra
11488: variable on the stack. The level of protection can otherwise be adjusted to
11489: affect only those functions considered more sensitive by the compiler (with
11490: -fstack-protector instead of -fstack-protector-all).
11491: </p>
11492: <p>
11493: The impact is not expected to be noticeable on modern hardware. However,
11494: programs with a hard requirement to run at the fastest possible speed should
11495: avoid using this feature, or using libraries built with this feature.
11496: </p>
11497: </div>
11498: <div class="sect3">
11499: <div class="titlepage"><div><div><h4 class="title">
11500: <a name="hardening.caveats.ssp.disable"></a>B.2.4.4. Disabling SSP on a per-package basis</h4></div></div></div>
11501: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
11502: <h3 class="title">Note</h3>
11503: <p>SSP should not be disabled to work around runtime crashes in
11504: the program! This is a very bad idea and will expose you to security
11505: vulnerabilities.</p>
11506: </div>
11507: <p>
11508: To disable SSP on a per-package basis, set the following
11509: in the package's <code class="filename">Makefile</code>
11510: before <code class="filename">bsd.prefs.mk</code> is included:
11511: </p>
11512: <pre class="programlisting">
11513: SSP_SUPPORTED= no
11514: </pre>
11515: </div>
11516: </div>
11517: </div>
11518: <div class="sect1">
11519: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11520: <a name="hardening.audit"></a>B.3. Auditing the system</h2></div></div></div>
11521: <p>
11522: The illusion of security is worse than having no security at all. This section
11523: lists a number of ways to ensure the security features requested are actually
11524: effective.
11525: </p>
11526: <p>
11527: These instructions were obtained and tested on a system derived from NetBSD 7
11528: (amd64). YMMV.
11529: </p>
11530: <div class="sect2">
11531: <div class="titlepage"><div><div><h3 class="title">
11532: <a name="hardening.audit.pie"></a>B.3.1. Checking for PIE</h3></div></div></div>
11533: <p>
11534: The ELF executable type in use changes for binaries built as PIE; without:
11535: </p>
11536: <pre class="programlisting">
11537: <strong class="userinput"><code>$ file /path/to/bin/ary</code></strong>
11538: /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
11539: </pre>
11540: <p>as opposed to the following binary, built as PIE:</p>
11541: <pre class="programlisting">
11542: <strong class="userinput"><code>$ file /path/to/pie/bin/ary</code></strong>
11543: /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
11544: </pre>
11545: <p>
11546: The latter result is then what is expected.
11547: </p>
11548: </div>
11549: <div class="sect2">
11550: <div class="titlepage"><div><div><h3 class="title">
11551: <a name="hardening.audit.relropartial"></a>B.3.2. Checking for partial RELRO</h3></div></div></div>
11552: <p>
11553: The following command should list a section called RELRO:
11554: </p>
11555: <pre class="programlisting">
11556: <strong class="userinput"><code>$ objdump -p /path/to/bin/ary</code></strong>
11557:
11558: /path/to/bin/ary: file format elf64-x86-64
11559:
11560: Program Header:
11561: [...]
11562: RELRO off 0x0000000000000d78 vaddr 0x0000000000600d78 paddr 0x0000000000600d78 align 2**0
11563: </pre>
11564: <p>
11565: This check is now performed automatically if
11566: <code class="varname">PKG_DEVELOPER</code> is set and RELRO is enabled.
11567: </p>
11568: </div>
11569: <div class="sect2">
11570: <div class="titlepage"><div><div><h3 class="title">
11571: <a name="hardening.audit.relrofull"></a>B.3.3. Checking for full RELRO</h3></div></div></div>
11572: <p>
11573: The dynamic loader will apply RELRO immediately when detecting the presence of
11574: the <code class="varname">BIND_NOW</code> flag:
11575: </p>
11576: <pre class="programlisting">
11577: <strong class="userinput"><code>$ objdump -x /path/to/bin/ary</code></strong>
11578:
11579: /path/to/bin/ary: file format elf64-x86-64
11580:
11581: Dynamic Section:
11582: [...]
11583: BIND_NOW 0x0000000000000000
11584: </pre>
11585: <p>
11586: This has to be combined with partial RELRO (see above) to be fully efficient.
11587: </p>
11588: <p>
11589: This check is now performed automatically (where supported) if
11590: <code class="varname">PKG_DEVELOPER</code> is set.
11591: </p>
11592: </div>
11593: <div class="sect2">
11594: <div class="titlepage"><div><div><h3 class="title">
11595: <a name="hardening.audit.ssp"></a>B.3.4. Checking for SSP</h3></div></div></div>
1.323 nia 11596: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
11597: <h3 class="title">Note</h3>
11598: <p>
11599: Checking for SSP using this method only works where the operating system
11600: uses <code class="literal">libssp</code>. <code class="literal">libssp</code> is not used
11601: on recent NetBSD/FreeBSD/Linux versions.
11602: </p>
11603: </div>
1.322 leot 11604: <p>
11605: Building objects, binaries and libraries with SSP will affect the presence of
11606: additional symbols in the resulting file:
11607: </p>
11608: <pre class="programlisting">
11609: <strong class="userinput"><code>$ nm /path/to/bin/ary</code></strong>
11610: [...]
11611: U __stack_chk_fail
11612: 0000000000600ea0 B __stack_chk_guard
11613: </pre>
11614: <p>
11615: This is an indicator that the program was indeed built with support for SSP.
11616: </p>
11617: <p>
11618: This check is now performed automatically (where supported) if
11619: <code class="varname">PKG_DEVELOPER</code> is set and SSP is enabled.
11620: </p>
11621: </div>
11622: </div>
11623: </div>
11624: <div class="appendix">
11625: <div class="titlepage"><div><div><h1 class="title">
11626: <a name="logs"></a>Appendix C. Build logs</h1></div></div></div>
11627: <div class="toc">
11628: <p><b>Table of Contents</b></p>
11629: <dl class="toc">
11630: <dt><span class="sect1"><a href="#logs.building">C.1. Building figlet</a></span></dt>
11631: <dt><span class="sect1"><a href="#logs.package">C.2. Packaging figlet</a></span></dt>
11632: </dl>
11633: </div>
11634: <div class="sect1">
11635: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11636: <a name="logs.building"></a>C.1. Building figlet</h2></div></div></div>
11637: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make</code></strong>
11638: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11639: => figlet221.tar.gz doesn't seem to exist on this system.
11640: => Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
11641: => [172219 bytes]
11642: Connected to ftp.plig.net.
11643: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
11644: 331 Guest login ok, send your complete e-mail address as password.
11645: 230-You are user #5 of 500 simultaneous users allowed.
11646: 230-
11647: 230- ___ _ _ _
11648: 230- | _| |_ ___ ___| |_|___ ___ ___ ___
11649: 230- | _| _| . |_| . | | | . |_| . | _| . |
11650: 230- |_| |_| | _|_| _|_|_|_ |_|___|_| |_ |
11651: 230- |_| |_| |___| |___|
11652: 230-
11653: 230-** Welcome to ftp.plig.org **
11654: 230-
11655: 230-Please note that all transfers from this FTP site are logged. If you
11656: 230-do not like this, please disconnect now.
11657: 230-
11658: 230-This archive is available via
11659: 230-
11660: 230-HTTP: http://ftp.plig.org/
11661: 230-FTP: ftp://ftp.plig.org/ (max 500 connections)
11662: 230-RSYNC: rsync://ftp.plig.org/ (max 30 connections)
11663: 230-
11664: 230-Please email comments, bug reports and requests for packages to be
11665: 230-mirrored to ftp-admin@plig.org.
11666: 230-
11667: 230-
11668: 230 Logged in anonymously.
11669: Remote system type is UNIX.
11670: Using binary mode to transfer files.
11671: 200 Type okay.
11672: 250 "/pub" is new cwd.
11673: 250-"/pub/figlet" is new cwd.
11674: 250-
11675: 250-Welcome to the figlet archive at ftp.figlet.org
11676: 250-
11677: 250- ftp://ftp.figlet.org/pub/figlet/
11678: 250-
11679: 250-The official FIGlet web page is:
11680: 250- http://www.figlet.org/
11681: 250-
11682: 250-If you have questions, please mailto:info@figlet.org. If you want to
11683: 250-contribute a font or something else, you can email us.
11684: 250
11685: 250 "/pub/figlet/program" is new cwd.
11686: 250 "/pub/figlet/program/unix" is new cwd.
11687: local: figlet221.tar.gz remote: figlet221.tar.gz
11688: 502 Unimplemented command.
11689: 227 Entering Passive Mode (195,40,6,41,246,104)
11690: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
11691: 38% |************** | 65800 64.16 KB/s 00:01 ETA
11692: 226 Transfer completed.
11693: 172219 bytes received in 00:02 (75.99 KB/s)
11694: 221 Goodbye.
11695: => Checksum OK for figlet221.tar.gz.
11696: ===> Extracting for figlet-2.2.1nb2
11697: ===> Required installed package ccache-[0-9]*: ccache-2.3nb1 found
11698: ===> Patching for figlet-2.2.1nb2
11699: ===> Applying pkgsrc patches for figlet-2.2.1nb2
11700: ===> Overriding tools for figlet-2.2.1nb2
11701: ===> Creating toolchain wrappers for figlet-2.2.1nb2
11702: ===> Configuring for figlet-2.2.1nb2
11703: ===> Building for figlet-2.2.1nb2
11704: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\" -DDEFAULTFONTFILE=\"standard.flf\" figlet.c zipio.c crc.c inflate.c -o figlet
11705: chmod a+x figlet
11706: gcc -O2 -o chkfont chkfont.c
11707: => Unwrapping files-to-be-installed.
11708: <code class="prompt">#</code>
11709: <code class="prompt">#</code> <strong class="userinput"><code>make install</code></strong>
11710: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11711: ===> Installing for figlet-2.2.1nb2
11712: install -d -o root -g wheel -m 755 /usr/pkg/bin
11713: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
11714: mkdir -p /usr/pkg/share/figlet
11715: cp figlet /usr/pkg/bin
11716: cp chkfont /usr/pkg/bin
11717: chmod 555 figlist showfigfonts
11718: cp figlist /usr/pkg/bin
11719: cp showfigfonts /usr/pkg/bin
11720: cp fonts/*.flf /usr/pkg/share/figlet
11721: cp fonts/*.flc /usr/pkg/share/figlet
11722: cp figlet.6 /usr/pkg/man/man6
11723: ===> Registering installation for figlet-2.2.1nb2
11724: <code class="prompt">#</code></pre>
11725: </div>
11726: <div class="sect1">
11727: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11728: <a name="logs.package"></a>C.2. Packaging figlet</h2></div></div></div>
11729: <pre class="screen"><code class="prompt">#</code> <strong class="userinput"><code>make package</code></strong>
11730: ===> Checking for vulnerabilities in figlet-2.2.1nb2
11731: ===> Packaging figlet-2.2.1nb2
11732: ===> Building binary package for figlet-2.2.1nb2
11733: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
11734: Using SrcDir value of /usr/pkg
11735: Registering depends:.
11736: <code class="prompt">#</code></pre>
11737: </div>
11738: </div>
11739: <div class="appendix">
11740: <div class="titlepage"><div><div><h1 class="title">
11741: <a name="ftp-layout"></a>Appendix D. Directory layout of the pkgsrc FTP server</h1></div></div></div>
11742: <div class="toc">
11743: <p><b>Table of Contents</b></p>
11744: <dl class="toc">
11745: <dt><span class="sect1"><a href="#ftp-distfiles">D.1. <code class="filename">distfiles</code>: The distributed source files</a></span></dt>
11746: <dt><span class="sect1"><a href="#ftp-misc">D.2. <code class="filename">misc</code>: Miscellaneous things</a></span></dt>
11747: <dt><span class="sect1"><a href="#ftp-packages">D.3. <code class="filename">packages</code>: Binary packages</a></span></dt>
11748: <dt><span class="sect1"><a href="#ftp-reports">D.4. <code class="filename">reports</code>: Bulk build reports</a></span></dt>
11749: <dt><span class="sect1"><a href="#ftp-source">D.5. <code class="filename">current</code>,
11750: <code class="filename">stable</code>,
11751: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
11752: source packages</a></span></dt>
11753: </dl>
11754: </div>
11755: <p>As in other big projects, the directory layout of pkgsrc
11756: is quite complex for newbies. This chapter explains where you
11757: find things on the FTP server. The base directory on
11758: <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>.
11759: On other servers it may be different, but inside this directory,
11760: everything should look the same, no matter on which server you
11761: are. This directory contains some subdirectories, which are
11762: explained below.</p>
11763: <div class="sect1">
11764: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11765: <a name="ftp-distfiles"></a>D.1. <code class="filename">distfiles</code>: The distributed source files</h2></div></div></div>
11766: <p>The directory <code class="filename">distfiles</code> contains lots
11767: of archive files from all pkgsrc packages, which are mirrored
11768: here. The subdirectories are called after their package names
11769: and are used when the distributed files have names that don't
11770: explicitly contain a version number or are otherwise too generic
11771: (for example <code class="filename">release.tar.gz</code>).</p>
11772: </div>
11773: <div class="sect1">
11774: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11775: <a name="ftp-misc"></a>D.2. <code class="filename">misc</code>: Miscellaneous things</h2></div></div></div>
11776: <p>This directory contains things that individual pkgsrc
11777: developers find worth publishing.</p>
11778: </div>
11779: <div class="sect1">
11780: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11781: <a name="ftp-packages"></a>D.3. <code class="filename">packages</code>: Binary packages</h2></div></div></div>
11782: <p>This directory contains binary packages for the various
11783: platforms that are supported by pkgsrc.
11784: 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>
11785: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
11786: <li class="listitem"><p><code class="varname">OPSYS</code> is the name of the
11787: operating system for which the packages have been built. The
11788: name is taken from the output of the <span class="command"><strong>uname</strong></span>
11789: command, so it may differ from the one you are used to
11790: hear.</p></li>
11791: <li class="listitem"><p><code class="varname">ARCH</code> is the hardware
11792: architecture of the platform for which the packages have been
11793: built. It also includes the <code class="varname">ABI</code> (Application
11794: Binary Interface) for platforms that have several of
11795: them.</p></li>
11796: <li class="listitem"><p><code class="varname">OSVERSION</code> is the version of
11797: the operating system. For version numbers that change often (for
11798: example NetBSD-current), the often-changing part should be
11799: replaced with an <code class="literal">x</code>, for example
11800: <code class="literal">4.99.x</code>.</p></li>
11801: <li class="listitem"><p><code class="varname">TAG</code> is either
11802: <code class="literal">20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
11803: for a stable branch, or <code class="literal">head</code> for packages
11804: built from the HEAD branch. The latter should only be used when
11805: the packages are updated on a regular basis. Otherwise the date
11806: from checking out pkgsrc should be appended, for example
11807: <code class="literal">head_20071015</code>.</p></li>
11808: </ul></div>
11809: <p>The rationale for exactly this scheme is that the pkgsrc users looking for binary packages
11810: can quickly click through the directories on the
11811: server and find the best binary packages for their machines. Since they
11812: usually know the operating system and the hardware architecture, OPSYS
11813: and ARCH are placed first. After these choices, they can select the
11814: best combination of OSVERSION and TAG together, since it is usually the
11815: case that packages stay compatible between different version of the
11816: operating system.</p>
11817: <p>In each of these directories, there is a
11818: whole binary packages collection for a specific platform. It has a directory called
11819: <code class="filename">All</code> which contains all binary packages.
11820: Besides that, there are various category directories that
11821: contain symbolic links to the real binary packages.</p>
11822: </div>
11823: <div class="sect1">
11824: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
11825: <a name="ftp-reports"></a>D.4. <code class="filename">reports</code>: Bulk build reports</h2></div></div></div>
1.108 rillig 11826: <p>Here are the reports from bulk builds, for those who want
11827: to fix packages that didn't build on some of the platforms. The
1.322 leot 11828: structure of subdirectories should look like the one in <a class="xref" href="#ftp-packages" title="D.3. packages: Binary packages">Section D.3, “<code class="filename">packages</code>: Binary packages”</a>.</p>
1.108 rillig 11829: </div>
1.148 asau 11830: <div class="sect1">
1.108 rillig 11831: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322 leot 11832: <a name="ftp-source"></a>D.5. <code class="filename">current</code>,
1.261 leot 11833: <code class="filename">stable</code>,
1.126 jakllsch 11834: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>:
1.76 rillig 11835: source packages</h2></div></div></div>
1.128 wiz 11836: <p>These directories contain the <span class="quote">“<span class="quote">real</span>”</span> pkgsrc,
1.76 rillig 11837: that is the files that define how to create binary packages from
11838: source archives.</p>
1.262 leot 11839: <p>Each of the <code class="filename">current</code>,
11840: <code class="filename">stable</code> and
11841: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
11842: directories share the same structure. They each contain a
11843: <code class="filename">pkgsrc</code> directory and
11844: <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> file.</p>
1.76 rillig 11845: <p>The directory <code class="filename">pkgsrc</code> contains a
1.89 rillig 11846: snapshot of the CVS repository, which is updated regularly. The
1.262 leot 11847: file <code class="filename">pkgsrc.tar.{bz,gz,xz}</code> contains the same
11848: as the directory, ready to be downloaded as a whole.</p>
11849: <p>The <code class="filename">current</code> directory contains files
11850: related to the HEAD branch of the CVS repository.
11851: In this directory there is an additional file called
11852: <code class="filename">pkgsrc-readmes.tar.{bz,gz,xz}</code> that contains
11853: all pkgsrc <code class="filename">README</code>s with information about
11854: categories and packages.
11855: </p>
11856: <p>The <code class="filename">stable</code> directory is a symlink to
11857: the latest
11858: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
11859: </p>
11860: <p>The
11861: <code class="filename">pkgsrc-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>.
11862: directories contain files related to the
11863: <code class="filename">-20<em class="replaceable"><code>xx</code></em>Q<em class="replaceable"><code>y</code></em></code>
11864: stable branch of the CVS repository. In these directories there is
11865: an additional file called
11866: <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 11867: which contains the state of pkgsrc when it was branched.</p>
11868: </div>
1.75 rillig 11869: </div>
1.148 asau 11870: <div class="appendix">
11871: <div class="titlepage"><div><div><h1 class="title">
1.322 leot 11872: <a name="help-topics"></a>Appendix E. Help topics</h1></div></div></div>
1.267 rillig 11873: <p>
11874: The following list contains all help topics that are available
11875: when running <span class="command"><strong>bmake help topic=:index</strong></span>.
11876: </p>
1.269 leot 11877: <table border="0" summary="Simple list" class="simplelist">
11878: <tr>
11879: <td>#!</td>
11880: <td>-lintl</td>
11881: </tr>
11882: <tr>
1.320 wiz 11883: <td>32bit</td>
1.269 leot 11884: <td>64bit</td>
1.320 wiz 11885: </tr>
11886: <tr>
1.269 leot 11887: <td>ABI</td>
1.320 wiz 11888: <td>ACCEPTABLE_LICENSES</td>
1.269 leot 11889: </tr>
11890: <tr>
11891: <td>ACROREAD_FONTPATH</td>
1.320 wiz 11892: <td>ADDITIONAL</td>
1.269 leot 11893: </tr>
11894: <tr>
11895: <td>AFAIK</td>
1.320 wiz 11896: <td>AIX</td>
1.269 leot 11897: </tr>
11898: <tr>
11899: <td>ALLOW_VULNERABLE_PACKAGES</td>
1.320 wiz 11900: <td>ALL_ENV</td>
1.269 leot 11901: </tr>
11902: <tr>
1.355 ! rillig 11903: <td>ALSA_PC</td>
1.315 cirnatda 11904: <td>ALTERNATIVES_SRC</td>
1.355 ! rillig 11905: </tr>
! 11906: <tr>
1.353 dholland 11907: <td>AMANDA_TMP</td>
1.355 ! rillig 11908: <td>AMANDA_USER</td>
1.352 wiz 11909: </tr>
11910: <tr>
1.353 dholland 11911: <td>AMANDA_VAR</td>
1.355 ! rillig 11912: <td>APACHE_GROUP</td>
1.348 wiz 11913: </tr>
11914: <tr>
1.353 dholland 11915: <td>APACHE_MODULE_NAME</td>
1.355 ! rillig 11916: <td>APACHE_MODULE_SRC</td>
1.342 wiz 11917: </tr>
11918: <tr>
1.353 dholland 11919: <td>APACHE_MODULE_SRCDIR</td>
1.355 ! rillig 11920: <td>APACHE_PKG_PREFIX</td>
1.338 nia 11921: </tr>
11922: <tr>
1.353 dholland 11923: <td>APACHE_SUEXEC_CONFIGURE_ARGS</td>
1.355 ! rillig 11924: <td>APACHE_SUEXEC_DOCROOT</td>
1.332 rillig 11925: </tr>
11926: <tr>
1.353 dholland 11927: <td>APACHE_USER</td>
1.355 ! rillig 11928: <td>APPEND_ABI</td>
1.329 leot 11929: </tr>
11930: <tr>
1.353 dholland 11931: <td>APPEND_ELF</td>
1.355 ! rillig 11932: <td>ARLA_CACHE</td>
1.327 wiz 11933: </tr>
11934: <tr>
1.353 dholland 11935: <td>AUDIT_PACKAGES_FLAGS</td>
1.355 ! rillig 11936: <td>AUTOCONF_REQD</td>
1.311 leot 11937: </tr>
11938: <tr>
1.353 dholland 11939: <td>AUTOMAKE_OVERRIDE</td>
1.355 ! rillig 11940: <td>AUTOMAKE_REQD</td>
1.292 leot 11941: </tr>
11942: <tr>
1.353 dholland 11943: <td>AUTO_MKDIRS</td>
1.355 ! rillig 11944: <td>BDB185_DEFAULT</td>
1.274 rillig 11945: </tr>
11946: <tr>
1.353 dholland 11947: <td>BDBBASE</td>
1.355 ! rillig 11948: <td>BDB_ACCEPTED</td>
1.269 leot 11949: </tr>
11950: <tr>
1.353 dholland 11951: <td>BDB_DEFAULT</td>
1.355 ! rillig 11952: <td>BDB_LIBS</td>
1.269 leot 11953: </tr>
11954: <tr>
1.353 dholland 11955: <td>BDB_TYPE</td>
1.355 ! rillig 11956: <td>BINCIMAP_GROUP</td>
1.269 leot 11957: </tr>
11958: <tr>
1.353 dholland 11959: <td>BINCIMAP_USER</td>
1.355 ! rillig 11960: <td>BIND_DIR</td>
1.269 leot 11961: </tr>
11962: <tr>
1.353 dholland 11963: <td>BIND_GROUP</td>
1.355 ! rillig 11964: <td>BIND_USER</td>
1.269 leot 11965: </tr>
11966: <tr>
1.353 dholland 11967: <td>BINOWN</td>
1.355 ! rillig 11968: <td>BINPKG_SITES</td>
1.269 leot 11969: </tr>
11970: <tr>
1.353 dholland 11971: <td>BIN_INSTALL_FLAGS</td>
1.355 ! rillig 11972: <td>BISON_PKGDATADIR</td>
1.269 leot 11973: </tr>
11974: <tr>
1.353 dholland 11975: <td>BLAS</td>
1.355 ! rillig 11976: <td>BLAS_ACCEPTED</td>
1.269 leot 11977: </tr>
11978: <tr>
1.353 dholland 11979: <td>BLAS_C_INTERFACE</td>
1.355 ! rillig 11980: <td>BLAS_INCLUDES</td>
1.269 leot 11981: </tr>
11982: <tr>
1.353 dholland 11983: <td>BLAS_INDEX64</td>
1.355 ! rillig 11984: <td>BLAS_LIBS</td>
1.269 leot 11985: </tr>
11986: <tr>
1.353 dholland 11987: <td>BLAS_PC</td>
1.355 ! rillig 11988: <td>BLAS_TYPE</td>
1.269 leot 11989: </tr>
11990: <tr>
1.353 dholland 11991: <td>BOOTSTRAP_DEPENDS</td>
1.355 ! rillig 11992: <td>BROKEN</td>
1.312 gdt 11993: </tr>
11994: <tr>
1.353 dholland 11995: <td>BROKEN_EXCEPT_ON_PLATFORM</td>
1.355 ! rillig 11996: <td>BROKEN_ON_PLATFORM</td>
1.344 gutterid 11997: </tr>
11998: <tr>
1.353 dholland 11999: <td>BSDSRCDIR</td>
1.355 ! rillig 12000: <td>BSDXSRCDIR</td>
1.269 leot 12001: </tr>
12002: <tr>
1.353 dholland 12003: <td>BSD_MAKE_ENV</td>
1.355 ! rillig 12004: <td>BUILDLINK_AUTO_DIRS</td>
1.269 leot 12005: </tr>
12006: <tr>
1.353 dholland 12007: <td>BUILDLINK_AUTO_VARS</td>
1.355 ! rillig 12008: <td>BUILDLINK_CFLAGS</td>
1.303 bacon 12009: </tr>
12010: <tr>
1.353 dholland 12011: <td>BUILDLINK_CONTENTS_FILTER</td>
1.355 ! rillig 12012: <td>BUILDLINK_CPPFLAGS</td>
1.320 wiz 12013: </tr>
12014: <tr>
1.355 ! rillig 12015: <td>BUILDLINK_DEPMETHOD</td>
1.344 gutterid 12016: <td>BUILDLINK_FILES</td>
1.269 leot 12017: </tr>
12018: <tr>
1.331 gutterid 12019: <td>BUILDLINK_FILES_CMD</td>
1.344 gutterid 12020: <td>BUILDLINK_FNAME_TRANSFORM</td>
1.320 wiz 12021: </tr>
12022: <tr>
1.331 gutterid 12023: <td>BUILDLINK_LDFLAGS</td>
1.344 gutterid 12024: <td>BUILDLINK_LIBS</td>
1.269 leot 12025: </tr>
12026: <tr>
1.331 gutterid 12027: <td>BUILDLINK_OPSYS_SUPPORT_PTHREAD</td>
1.344 gutterid 12028: <td>BUILDLINK_PKGNAME</td>
1.269 leot 12029: </tr>
12030: <tr>
1.331 gutterid 12031: <td>BUILDLINK_PREFIX</td>
1.344 gutterid 12032: <td>BUILDLINK_RPATHDIRS</td>
1.269 leot 12033: </tr>
12034: <tr>
1.331 gutterid 12035: <td>BUILDLINK_TREE</td>
1.344 gutterid 12036: <td>BUILD_DEFS</td>
1.269 leot 12037: </tr>
12038: <tr>
1.331 gutterid 12039: <td>BUILD_DEFS_EFFECTS</td>
1.344 gutterid 12040: <td>BUILD_DEPENDS</td>
1.269 leot 12041: </tr>
12042: <tr>
1.331 gutterid 12043: <td>BUILD_DIRS</td>
1.344 gutterid 12044: <td>BUILD_ENV_SHELL</td>
1.269 leot 12045: </tr>
12046: <tr>
1.331 gutterid 12047: <td>BUILD_MAKE_CMD</td>
1.344 gutterid 12048: <td>BUILD_MAKE_FLAGS</td>
1.269 leot 12049: </tr>
12050: <tr>
1.331 gutterid 12051: <td>BUILD_TARGET</td>
1.344 gutterid 12052: <td>BUILTIN_FIND_FILES</td>
1.269 leot 12053: </tr>
12054: <tr>
1.331 gutterid 12055: <td>BUILTIN_FIND_FILES_VAR</td>
1.344 gutterid 12056: <td>BUILTIN_FIND_GREP</td>
1.269 leot 12057: </tr>
12058: <tr>
1.331 gutterid 12059: <td>BUILTIN_FIND_HEADERS</td>
1.344 gutterid 12060: <td>BUILTIN_FIND_HEADERS_VAR</td>
1.269 leot 12061: </tr>
12062: <tr>
1.331 gutterid 12063: <td>BUILTIN_FIND_PKGCONFIG</td>
1.344 gutterid 12064: <td>BUILTIN_FIND_PKGCONFIG_VAR</td>
1.269 leot 12065: </tr>
12066: <tr>
1.331 gutterid 12067: <td>BUILTIN_PKG</td>
1.344 gutterid 12068: <td>BUILTIN_TEST_CURSES_DEFINES</td>
1.309 gutterid 12069: </tr>
12070: <tr>
1.331 gutterid 12071: <td>BUILTIN_TEST_CURSES_FUNCS</td>
1.344 gutterid 12072: <td>BUILTIN_VERSION_SCRIPT</td>
1.269 leot 12073: </tr>
12074: <tr>
1.331 gutterid 12075: <td>BUILTIN_X11_TYPE</td>
1.344 gutterid 12076: <td>BUILTIN_X11_VERSION</td>
1.269 leot 12077: </tr>
12078: <tr>
1.331 gutterid 12079: <td>CACTI_GROUP</td>
1.344 gutterid 12080: <td>CACTI_USER</td>
1.269 leot 12081: </tr>
12082: <tr>
1.331 gutterid 12083: <td>CANNA_GROUP</td>
1.344 gutterid 12084: <td>CANNA_USER</td>
1.269 leot 12085: </tr>
12086: <tr>
1.331 gutterid 12087: <td>CAT</td>
1.344 gutterid 12088: <td>CBLAS_LIBS</td>
1.269 leot 12089: </tr>
12090: <tr>
1.344 gutterid 12091: <td>CBLAS_PC</td>
1.331 gutterid 12092: <td>CCACHE_BASE</td>
1.269 leot 12093: </tr>
12094: <tr>
1.303 bacon 12095: <td>CCACHE_DIR</td>
1.331 gutterid 12096: <td>CCACHE_LOGFILE</td>
1.269 leot 12097: </tr>
12098: <tr>
1.303 bacon 12099: <td>CC_VERSION</td>
1.331 gutterid 12100: <td>CC_VERSION_STRING</td>
1.269 leot 12101: </tr>
12102: <tr>
1.303 bacon 12103: <td>CDRECORD_CONF</td>
1.331 gutterid 12104: <td>CDROM_PKG_URL_DIR</td>
1.269 leot 12105: </tr>
12106: <tr>
1.303 bacon 12107: <td>CDROM_PKG_URL_HOST</td>
1.341 gutterid 12108: <td>CHANGES</td>
1.338 nia 12109: </tr>
12110: <tr>
1.355 ! rillig 12111: <td>CHECKOUT_DATE</td>
1.341 gutterid 12112: <td>CHECK_COMPILER</td>
1.355 ! rillig 12113: </tr>
! 12114: <tr>
1.353 dholland 12115: <td>CHECK_FAKEHOME</td>
1.355 ! rillig 12116: <td>CHECK_FILES</td>
1.352 wiz 12117: </tr>
12118: <tr>
1.353 dholland 12119: <td>CHECK_FILES_SKIP</td>
1.355 ! rillig 12120: <td>CHECK_FILES_STRICT</td>
1.348 wiz 12121: </tr>
12122: <tr>
1.353 dholland 12123: <td>CHECK_HEADERS</td>
1.355 ! rillig 12124: <td>CHECK_HEADERS_SKIP</td>
1.342 wiz 12125: </tr>
12126: <tr>
1.353 dholland 12127: <td>CHECK_INTERPRETER</td>
1.355 ! rillig 12128: <td>CHECK_INTERPRETER_SKIP</td>
1.332 rillig 12129: </tr>
12130: <tr>
1.353 dholland 12131: <td>CHECK_PERMS</td>
1.355 ! rillig 12132: <td>CHECK_PERMS_AUTOFIX</td>
1.329 leot 12133: </tr>
12134: <tr>
1.353 dholland 12135: <td>CHECK_PERMS_SKIP</td>
1.355 ! rillig 12136: <td>CHECK_PIE</td>
1.327 wiz 12137: </tr>
12138: <tr>
1.353 dholland 12139: <td>CHECK_PIE_SKIP</td>
1.355 ! rillig 12140: <td>CHECK_PIE_SUPPORTED</td>
1.320 wiz 12141: </tr>
12142: <tr>
1.353 dholland 12143: <td>CHECK_PORTABILITY</td>
1.355 ! rillig 12144: <td>CHECK_PORTABILITY_EXPERIMENTAL</td>
1.311 leot 12145: </tr>
12146: <tr>
1.353 dholland 12147: <td>CHECK_PORTABILITY_SKIP</td>
1.355 ! rillig 12148: <td>CHECK_RELRO</td>
1.292 leot 12149: </tr>
12150: <tr>
1.353 dholland 12151: <td>CHECK_RELRO_SKIP</td>
1.355 ! rillig 12152: <td>CHECK_RELRO_SUPPORTED</td>
1.274 rillig 12153: </tr>
12154: <tr>
1.353 dholland 12155: <td>CHECK_SHLIBS</td>
1.355 ! rillig 12156: <td>CHECK_SHLIBS_SKIP</td>
1.331 gutterid 12157: </tr>
12158: <tr>
1.353 dholland 12159: <td>CHECK_SHLIBS_SUPPORTED</td>
1.355 ! rillig 12160: <td>CHECK_SHLIBS_TOXIC</td>
1.269 leot 12161: </tr>
12162: <tr>
1.353 dholland 12163: <td>CHECK_SSP</td>
1.355 ! rillig 12164: <td>CHECK_SSP_SKIP</td>
1.269 leot 12165: </tr>
12166: <tr>
1.353 dholland 12167: <td>CHECK_SSP_SUPPORTED</td>
1.355 ! rillig 12168: <td>CHECK_STRIPPED</td>
1.269 leot 12169: </tr>
12170: <tr>
1.353 dholland 12171: <td>CHECK_STRIPPED_SKIP</td>
1.355 ! rillig 12172: <td>CHECK_WRKREF</td>
1.269 leot 12173: </tr>
12174: <tr>
1.353 dholland 12175: <td>CHECK_WRKREF_EXTRA_DIRS</td>
1.355 ! rillig 12176: <td>CHECK_WRKREF_SKIP</td>
1.269 leot 12177: </tr>
12178: <tr>
1.353 dholland 12179: <td>CLAMAV_DBDIR</td>
1.355 ! rillig 12180: <td>CLAMAV_GROUP</td>
1.269 leot 12181: </tr>
12182: <tr>
1.353 dholland 12183: <td>CLAMAV_USER</td>
1.355 ! rillig 12184: <td>CLANGBASE</td>
1.269 leot 12185: </tr>
12186: <tr>
1.353 dholland 12187: <td>CLEANDEPENDS</td>
1.355 ! rillig 12188: <td>CMAKE_DEPENDENCIES_REWRITE</td>
1.269 leot 12189: </tr>
12190: <tr>
1.353 dholland 12191: <td>CMAKE_INSTALL_NAME_DIR</td>
1.355 ! rillig 12192: <td>CMAKE_INSTALL_PREFIX</td>
1.269 leot 12193: </tr>
12194: <tr>
1.353 dholland 12195: <td>CMAKE_MODULE_PATH_OVERRIDE</td>
1.355 ! rillig 12196: <td>CMAKE_PKGSRC_BUILD_FLAGS</td>
1.269 leot 12197: </tr>
12198: <tr>
1.353 dholland 12199: <td>CMAKE_PREFIX_PATH</td>
1.355 ! rillig 12200: <td>CMAKE_USE_GNU_INSTALL_DIRS</td>
! 12201: </tr>
! 12202: <tr>
! 12203: <td>COMMON_LISP_DOCFILES</td>
! 12204: <td>COMMON_LISP_EXAMPLES</td>
! 12205: </tr>
! 12206: <tr>
! 12207: <td>COMMON_LISP_EXTRAFILES</td>
! 12208: <td>COMMON_LISP_PACKAGES</td>
1.269 leot 12209: </tr>
12210: <tr>
1.355 ! rillig 12211: <td>COMMON_LISP_SYSTEM</td>
1.305 bacon 12212: <td>COMPILER_RPATH_FLAG</td>
1.269 leot 12213: </tr>
12214: <tr>
1.341 gutterid 12215: <td>COMPILER_USE_SYMLINKS</td>
1.305 bacon 12216: <td>CONFIGURE_ARGS</td>
1.269 leot 12217: </tr>
12218: <tr>
1.341 gutterid 12219: <td>CONFIGURE_DIRS</td>
1.305 bacon 12220: <td>CONFIGURE_ENV</td>
1.269 leot 12221: </tr>
12222: <tr>
1.341 gutterid 12223: <td>CONFIGURE_ENV_SHELL</td>
1.305 bacon 12224: <td>CONFIGURE_HAS_INFODIR</td>
1.269 leot 12225: </tr>
12226: <tr>
1.341 gutterid 12227: <td>CONFIGURE_HAS_MANDIR</td>
1.305 bacon 12228: <td>CONFIGURE_SCRIPT</td>
1.269 leot 12229: </tr>
12230: <tr>
1.341 gutterid 12231: <td>CONFIG_SHELL</td>
1.305 bacon 12232: <td>CONFIG_SHELL_FLAGS</td>
1.269 leot 12233: </tr>
12234: <tr>
1.341 gutterid 12235: <td>CONF_FILES</td>
1.305 bacon 12236: <td>CONF_FILES_MODE</td>
1.269 leot 12237: </tr>
12238: <tr>
1.341 gutterid 12239: <td>CONF_FILES_PERMS</td>
1.305 bacon 12240: <td>CONSERVER_DEFAULTHOST</td>
1.269 leot 12241: </tr>
12242: <tr>
1.341 gutterid 12243: <td>CONSERVER_DEFAULTPORT</td>
1.305 bacon 12244: <td>CP</td>
1.269 leot 12245: </tr>
12246: <tr>
1.347 gutterid 12247: <td>CPE</td>
12248: <td>CPE_EDITION</td>
12249: </tr>
12250: <tr>
12251: <td>CPE_LANG</td>
12252: <td>CPE_OTHER</td>
12253: </tr>
12254: <tr>
12255: <td>CPE_PART</td>
12256: <td>CPE_PRODUCT</td>
12257: </tr>
12258: <tr>
12259: <td>CPE_SW_EDITION</td>
12260: <td>CPE_TARGET_HW</td>
12261: </tr>
12262: <tr>
12263: <td>CPE_TARGET_SW</td>
12264: <td>CPE_UPDATE</td>
12265: </tr>
12266: <tr>
12267: <td>CPE_URI</td>
12268: <td>CPE_VENDOR</td>
12269: </tr>
12270: <tr>
12271: <td>CPE_VERSION</td>
1.341 gutterid 12272: <td>CPP</td>
1.269 leot 12273: </tr>
12274: <tr>
1.347 gutterid 12275: <td>CPP_PRECOMP_FLAGS</td>
1.341 gutterid 12276: <td>CREATE_WRKDIR_SYMLINK</td>
1.269 leot 12277: </tr>
12278: <tr>
1.347 gutterid 12279: <td>CROSSBASE</td>
1.341 gutterid 12280: <td>CTFCONVERT</td>
1.269 leot 12281: </tr>
12282: <tr>
1.347 gutterid 12283: <td>CTF_FILES_SKIP</td>
1.341 gutterid 12284: <td>CTF_SUPPORTED</td>
1.269 leot 12285: </tr>
12286: <tr>
1.347 gutterid 12287: <td>CTYPE</td>
1.341 gutterid 12288: <td>CUPS_GROUP</td>
1.269 leot 12289: </tr>
12290: <tr>
1.347 gutterid 12291: <td>CUPS_SYSTEM_GROUPS</td>
1.341 gutterid 12292: <td>CUPS_USER</td>
1.292 leot 12293: </tr>
12294: <tr>
1.347 gutterid 12295: <td>CURSES_DEFAULT</td>
1.341 gutterid 12296: <td>CURSES_TYPE</td>
1.342 wiz 12297: </tr>
12298: <tr>
1.355 ! rillig 12299: <td>CVS_EXTRACTDIR</td>
! 12300: <td>CVS_MODULE</td>
! 12301: </tr>
! 12302: <tr>
! 12303: <td>CVS_PROJECT</td>
! 12304: <td>CVS_REPOSITORIES</td>
! 12305: </tr>
! 12306: <tr>
! 12307: <td>CVS_ROOT</td>
! 12308: <td>CVS_ROOT_GNU</td>
! 12309: </tr>
! 12310: <tr>
! 12311: <td>CVS_ROOT_NONGNU</td>
! 12312: <td>CVS_ROOT_SOURCEFORGE</td>
! 12313: </tr>
! 12314: <tr>
! 12315: <td>CVS_TAG</td>
1.347 gutterid 12316: <td>CXX</td>
1.352 wiz 12317: </tr>
12318: <tr>
1.355 ! rillig 12319: <td>CYRUS_GROUP</td>
1.352 wiz 12320: <td>CYRUS_IDLE</td>
1.348 wiz 12321: </tr>
12322: <tr>
1.355 ! rillig 12323: <td>CYRUS_USER</td>
1.352 wiz 12324: <td>DAEMONTOOLS_GROUP</td>
1.332 rillig 12325: </tr>
12326: <tr>
1.355 ! rillig 12327: <td>DAEMONTOOLS_LOG_USER</td>
1.352 wiz 12328: <td>DARWIN_NO_SYSTEM_LIBS</td>
1.329 leot 12329: </tr>
12330: <tr>
1.355 ! rillig 12331: <td>DARWIN_REQUIRES_FILTER</td>
1.352 wiz 12332: <td>DBUS_GROUP</td>
1.327 wiz 12333: </tr>
12334: <tr>
1.355 ! rillig 12335: <td>DBUS_USER</td>
1.352 wiz 12336: <td>DEFANG_GROUP</td>
1.320 wiz 12337: </tr>
12338: <tr>
1.355 ! rillig 12339: <td>DEFANG_USER</td>
1.352 wiz 12340: <td>DEFAULT_ACCEPTABLE_LICENSES</td>
1.311 leot 12341: </tr>
12342: <tr>
1.355 ! rillig 12343: <td>DEFAULT_DISTFILES</td>
1.352 wiz 12344: <td>DEFAULT_IRC_SERVER</td>
1.269 leot 12345: </tr>
12346: <tr>
1.355 ! rillig 12347: <td>DEFAULT_SERIAL_DEVICE</td>
1.352 wiz 12348: <td>DEF_UMASK</td>
1.269 leot 12349: </tr>
12350: <tr>
1.355 ! rillig 12351: <td>DEINSTALLDEPENDS</td>
1.352 wiz 12352: <td>DEINSTALL_SRC</td>
1.269 leot 12353: </tr>
12354: <tr>
1.355 ! rillig 12355: <td>DEINSTALL_TEMPLATES</td>
1.352 wiz 12356: <td>DELAYED_ERROR_MSG</td>
1.309 gutterid 12357: </tr>
12358: <tr>
1.355 ! rillig 12359: <td>DELAYED_WARNING_MSG</td>
1.352 wiz 12360: <td>DEPENDS</td>
1.269 leot 12361: </tr>
12362: <tr>
1.355 ! rillig 12363: <td>DEPENDS_TARGET</td>
1.352 wiz 12364: <td>DEPENDS_TYPE</td>
1.269 leot 12365: </tr>
12366: <tr>
1.355 ! rillig 12367: <td>DESTDIR</td>
1.352 wiz 12368: <td>DESTDIR_VARNAME</td>
1.269 leot 12369: </tr>
12370: <tr>
1.355 ! rillig 12371: <td>DIALER_GROUP</td>
1.352 wiz 12372: <td>DIGEST_REQD</td>
1.269 leot 12373: </tr>
12374: <tr>
1.355 ! rillig 12375: <td>DISTDIR</td>
1.352 wiz 12376: <td>DISTFILES</td>
1.269 leot 12377: </tr>
12378: <tr>
1.355 ! rillig 12379: <td>DISTINFO_FILE</td>
1.352 wiz 12380: <td>DISTNAME</td>
1.269 leot 12381: </tr>
12382: <tr>
1.355 ! rillig 12383: <td>DIST_PATH</td>
1.352 wiz 12384: <td>DIST_SUBDIR</td>
1.269 leot 12385: </tr>
12386: <tr>
1.355 ! rillig 12387: <td>DJBDNS_AXFR_USER</td>
1.352 wiz 12388: <td>DJBDNS_CACHE_USER</td>
1.269 leot 12389: </tr>
12390: <tr>
1.355 ! rillig 12391: <td>DJBDNS_DJBDNS_GROUP</td>
1.352 wiz 12392: <td>DJBDNS_LOG_USER</td>
1.269 leot 12393: </tr>
12394: <tr>
1.355 ! rillig 12395: <td>DJBDNS_RBL_USER</td>
1.352 wiz 12396: <td>DJBDNS_TINY_USER</td>
1.269 leot 12397: </tr>
12398: <tr>
1.355 ! rillig 12399: <td>DLOPEN_REQUIRE_PTHREADS</td>
1.352 wiz 12400: <td>DL_AUTO_VARS</td>
1.269 leot 12401: </tr>
12402: <tr>
1.355 ! rillig 12403: <td>DL_CFLAGS</td>
1.352 wiz 12404: <td>DL_LDFLAGS</td>
1.269 leot 12405: </tr>
12406: <tr>
1.355 ! rillig 12407: <td>DL_LIBS</td>
1.352 wiz 12408: <td>DNS</td>
1.269 leot 12409: </tr>
12410: <tr>
1.355 ! rillig 12411: <td>DOCOWN</td>
1.352 wiz 12412: <td>DOWNLOADED_DISTFILE</td>
1.269 leot 12413: </tr>
12414: <tr>
1.355 ! rillig 12415: <td>DQCACHE_GROUP</td>
1.352 wiz 12416: <td>DQCACHE_USER</td>
1.269 leot 12417: </tr>
12418: <tr>
1.355 ! rillig 12419: <td>DT_LAYOUT</td>
1.352 wiz 12420: <td>DYNAMIC_SITES_CMD</td>
1.269 leot 12421: </tr>
12422: <tr>
1.355 ! rillig 12423: <td>DYNAMIC_SITES_SCRIPT</td>
1.352 wiz 12424: <td>ECHO</td>
1.333 nia 12425: </tr>
12426: <tr>
1.355 ! rillig 12427: <td>ECHO_N</td>
1.352 wiz 12428: <td>ELK_GUI</td>
1.269 leot 12429: </tr>
12430: <tr>
1.355 ! rillig 12431: <td>EMACS_TYPE</td>
1.352 wiz 12432: <td>EMULDIR</td>
1.269 leot 12433: </tr>
12434: <tr>
1.355 ! rillig 12435: <td>EMULSUBDIR</td>
1.352 wiz 12436: <td>EMULSUBDIRSLASH</td>
1.269 leot 12437: </tr>
12438: <tr>
1.355 ! rillig 12439: <td>EMUL_ARCH</td>
1.352 wiz 12440: <td>EMUL_DISTRO</td>
1.269 leot 12441: </tr>
12442: <tr>
1.355 ! rillig 12443: <td>EMUL_EXEC_FMT</td>
1.352 wiz 12444: <td>EMUL_IS_NATIVE</td>
1.269 leot 12445: </tr>
12446: <tr>
1.355 ! rillig 12447: <td>EMUL_MODULES</td>
1.352 wiz 12448: <td>EMUL_OPSYS</td>
1.269 leot 12449: </tr>
12450: <tr>
1.355 ! rillig 12451: <td>EMUL_PKG_FMT</td>
1.352 wiz 12452: <td>EMUL_PLATFORM</td>
1.269 leot 12453: </tr>
12454: <tr>
1.355 ! rillig 12455: <td>EMUL_PLATFORMS</td>
1.352 wiz 12456: <td>EMUL_PREFER</td>
1.269 leot 12457: </tr>
12458: <tr>
1.355 ! rillig 12459: <td>EMUL_REQD</td>
1.352 wiz 12460: <td>EMUL_TYPE</td>
1.269 leot 12461: </tr>
12462: <tr>
1.355 ! rillig 12463: <td>ERROR_MSG</td>
1.352 wiz 12464: <td>EXIM_GROUP</td>
1.269 leot 12465: </tr>
12466: <tr>
1.355 ! rillig 12467: <td>EXIM_USER</td>
1.352 wiz 12468: <td>EXPORT_SYMBOLS_LDFLAGS</td>
1.269 leot 12469: </tr>
12470: <tr>
1.355 ! rillig 12471: <td>EXTRACTOR</td>
1.352 wiz 12472: <td>EXTRACT_CMD</td>
1.269 leot 12473: </tr>
12474: <tr>
1.355 ! rillig 12475: <td>EXTRACT_CMD_DEFAULT</td>
1.352 wiz 12476: <td>EXTRACT_DIR</td>
1.269 leot 12477: </tr>
12478: <tr>
1.355 ! rillig 12479: <td>EXTRACT_ELEMENTS</td>
1.352 wiz 12480: <td>EXTRACT_ENV</td>
1.338 nia 12481: </tr>
12482: <tr>
1.355 ! rillig 12483: <td>EXTRACT_ONLY</td>
1.352 wiz 12484: <td>EXTRACT_OPTS</td>
1.269 leot 12485: </tr>
12486: <tr>
1.355 ! rillig 12487: <td>EXTRACT_SUFX</td>
1.352 wiz 12488: <td>EXTRACT_USING</td>
1.269 leot 12489: </tr>
12490: <tr>
1.355 ! rillig 12491: <td>FAIL</td>
1.352 wiz 12492: <td>FAILOVER_FETCH</td>
1.269 leot 12493: </tr>
12494: <tr>
1.355 ! rillig 12495: <td>FAIL_MSG</td>
1.352 wiz 12496: <td>FAKE_NCURSES</td>
1.269 leot 12497: </tr>
12498: <tr>
1.355 ! rillig 12499: <td>FAM</td>
1.352 wiz 12500: <td>FAM_ACCEPTED</td>
1.269 leot 12501: </tr>
12502: <tr>
1.355 ! rillig 12503: <td>FAM_DEFAULT</td>
1.352 wiz 12504: <td>FAM_SERVER</td>
1.269 leot 12505: </tr>
12506: <tr>
1.355 ! rillig 12507: <td>FCPATH</td>
1.352 wiz 12508: <td>FEATURE_CPPFLAGS</td>
1.269 leot 12509: </tr>
12510: <tr>
1.355 ! rillig 12511: <td>FEATURE_LDFLAGS</td>
1.352 wiz 12512: <td>FEATURE_LIBS</td>
1.269 leot 12513: </tr>
12514: <tr>
1.355 ! rillig 12515: <td>FETCH_AFTER_ARGS</td>
1.352 wiz 12516: <td>FETCH_BEFORE_ARGS</td>
1.269 leot 12517: </tr>
12518: <tr>
1.355 ! rillig 12519: <td>FETCH_CMD</td>
1.352 wiz 12520: <td>FETCH_OUTPUT_ARGS</td>
1.292 leot 12521: </tr>
12522: <tr>
1.355 ! rillig 12523: <td>FETCH_PROXY</td>
1.352 wiz 12524: <td>FETCH_RESUME_ARGS</td>
1.355 ! rillig 12525: </tr>
! 12526: <tr>
1.353 dholland 12527: <td>FETCH_TIMEOUT</td>
1.355 ! rillig 12528: <td>FETCH_USE_IPV4_ONLY</td>
1.269 leot 12529: </tr>
12530: <tr>
1.353 dholland 12531: <td>FETCH_USING</td>
1.355 ! rillig 12532: <td>FILES_SUBST</td>
1.269 leot 12533: </tr>
12534: <tr>
1.353 dholland 12535: <td>FILES_SUBST_SED</td>
1.355 ! rillig 12536: <td>FIX_SYSTEM_HEADERS</td>
1.269 leot 12537: </tr>
12538: <tr>
1.355 ! rillig 12539: <td>FONTDIR</td>
1.341 gutterid 12540: <td>FONTS_DIRS</td>
1.292 leot 12541: </tr>
12542: <tr>
1.347 gutterid 12543: <td>FONTS_VERBOSE</td>
1.341 gutterid 12544: <td>FOO_HACKS_MK</td>
1.269 leot 12545: </tr>
12546: <tr>
1.355 ! rillig 12547: <td>FOSSIL_EXTRACTDIR</td>
! 12548: <td>FOSSIL_REPO</td>
! 12549: </tr>
! 12550: <tr>
! 12551: <td>FOSSIL_REPOSITORIES</td>
! 12552: <td>FOSSIL_VERSION</td>
! 12553: </tr>
! 12554: <tr>
1.347 gutterid 12555: <td>FOX_USE_XUNICODE</td>
1.341 gutterid 12556: <td>FREEWNN_GROUP</td>
1.269 leot 12557: </tr>
12558: <tr>
1.347 gutterid 12559: <td>FREEWNN_USER</td>
1.341 gutterid 12560: <td>FTP_PKG_URL_DIR</td>
1.269 leot 12561: </tr>
12562: <tr>
1.347 gutterid 12563: <td>FTP_PKG_URL_HOST</td>
1.341 gutterid 12564: <td>GAMEDATAMODE</td>
1.269 leot 12565: </tr>
12566: <tr>
1.347 gutterid 12567: <td>GAMEDATA_PERMS</td>
1.341 gutterid 12568: <td>GAMEDIRMODE</td>
1.269 leot 12569: </tr>
12570: <tr>
1.347 gutterid 12571: <td>GAMEDIR_PERMS</td>
1.341 gutterid 12572: <td>GAMEGRP</td>
1.269 leot 12573: </tr>
12574: <tr>
1.347 gutterid 12575: <td>GAMEMODE</td>
1.341 gutterid 12576: <td>GAMEOWN</td>
1.269 leot 12577: </tr>
12578: <tr>
1.347 gutterid 12579: <td>GAMES_GROUP</td>
1.341 gutterid 12580: <td>GAMES_USER</td>
1.269 leot 12581: </tr>
12582: <tr>
1.347 gutterid 12583: <td>GCC</td>
1.341 gutterid 12584: <td>GCCBASE</td>
1.269 leot 12585: </tr>
12586: <tr>
1.347 gutterid 12587: <td>GCC_REQD</td>
1.341 gutterid 12588: <td>GCC_VERSION_SUFFIX</td>
1.269 leot 12589: </tr>
12590: <tr>
1.347 gutterid 12591: <td>GEM_BUILD</td>
1.341 gutterid 12592: <td>GEM_CLEANBUILD</td>
1.269 leot 12593: </tr>
12594: <tr>
1.347 gutterid 12595: <td>GEM_CLEANBUILD_EXTENSIONS</td>
1.341 gutterid 12596: <td>GEM_DOCDIR</td>
1.292 leot 12597: </tr>
12598: <tr>
1.347 gutterid 12599: <td>GEM_EXTSDIR</td>
1.341 gutterid 12600: <td>GEM_HOME</td>
1.269 leot 12601: </tr>
12602: <tr>
1.347 gutterid 12603: <td>GEM_KEEPBUILD</td>
1.341 gutterid 12604: <td>GEM_LIBDIR</td>
1.269 leot 12605: </tr>
12606: <tr>
1.347 gutterid 12607: <td>GEM_NAME</td>
1.341 gutterid 12608: <td>GEM_PATH</td>
1.269 leot 12609: </tr>
12610: <tr>
1.347 gutterid 12611: <td>GEM_PLUGINSDIR</td>
1.341 gutterid 12612: <td>GEM_SPECFILE</td>
1.269 leot 12613: </tr>
12614: <tr>
1.347 gutterid 12615: <td>GENERATE_PLIST</td>
1.341 gutterid 12616: <td>GHC</td>
1.292 leot 12617: </tr>
12618: <tr>
1.347 gutterid 12619: <td>GHOSTSCRIPT_REQD</td>
1.341 gutterid 12620: <td>GITHUB_PROJECT</td>
1.311 leot 12621: </tr>
12622: <tr>
1.347 gutterid 12623: <td>GITHUB_RELEASE</td>
1.341 gutterid 12624: <td>GITHUB_SUBMODULES</td>
1.269 leot 12625: </tr>
12626: <tr>
1.347 gutterid 12627: <td>GITHUB_TAG</td>
1.341 gutterid 12628: <td>GITHUB_TYPE</td>
1.338 nia 12629: </tr>
12630: <tr>
1.347 gutterid 12631: <td>GITLAB_PROJECT</td>
1.341 gutterid 12632: <td>GITLAB_RELEASE</td>
1.338 nia 12633: </tr>
12634: <tr>
1.347 gutterid 12635: <td>GITLAB_SUBMODULES</td>
1.341 gutterid 12636: <td>GITLAB_TAG</td>
1.338 nia 12637: </tr>
12638: <tr>
1.347 gutterid 12639: <td>GITLAB_TYPE</td>
1.355 ! rillig 12640: <td>GIT_BRANCH</td>
! 12641: </tr>
! 12642: <tr>
! 12643: <td>GIT_ENV</td>
! 12644: <td>GIT_EXTRACTDIR</td>
! 12645: </tr>
! 12646: <tr>
! 12647: <td>GIT_REPO</td>
! 12648: <td>GIT_REPOSITORIES</td>
! 12649: </tr>
! 12650: <tr>
! 12651: <td>GIT_REVISION</td>
! 12652: <td>GIT_TAG</td>
! 12653: </tr>
! 12654: <tr>
1.353 dholland 12655: <td>GNU</td>
1.355 ! rillig 12656: <td>GNU_CONFIGURE</td>
1.348 wiz 12657: </tr>
12658: <tr>
1.353 dholland 12659: <td>GNU_CONFIGURE_INFODIR</td>
1.355 ! rillig 12660: <td>GNU_CONFIGURE_MANDIR</td>
1.269 leot 12661: </tr>
12662: <tr>
1.353 dholland 12663: <td>GNU_CONFIGURE_QUIET</td>
1.355 ! rillig 12664: <td>GNU_CONFIGURE_STRICT</td>
1.269 leot 12665: </tr>
12666: <tr>
1.353 dholland 12667: <td>GODEP_REDIRECTS</td>
1.355 ! rillig 12668: <td>GO_BUILD_PATTERN</td>
1.269 leot 12669: </tr>
12670: <tr>
1.353 dholland 12671: <td>GO_DEPS</td>
1.355 ! rillig 12672: <td>GO_DIST_BASE</td>
1.352 wiz 12673: </tr>
12674: <tr>
1.353 dholland 12675: <td>GO_EXTRA_MOD_DIRS</td>
1.355 ! rillig 12676: <td>GO_MODULE_FILES</td>
1.276 leot 12677: </tr>
12678: <tr>
1.353 dholland 12679: <td>GO_SRCPATH</td>
1.355 ! rillig 12680: <td>GROUP_SPECIFIC_PKGS</td>
1.269 leot 12681: </tr>
12682: <tr>
1.353 dholland 12683: <td>GRUB_NETWORK_CARDS</td>
1.355 ! rillig 12684: <td>GRUB_PRESET_COMMAND</td>
1.269 leot 12685: </tr>
12686: <tr>
1.353 dholland 12687: <td>GRUB_SCAN_ARGS</td>
1.355 ! rillig 12688: <td>GZIP</td>
1.269 leot 12689: </tr>
12690: <tr>
1.355 ! rillig 12691: <td>HASKELL_COMPILER</td>
1.348 wiz 12692: <td>HASKELL_ENABLE_DYNAMIC_EXECUTABLE</td>
1.332 rillig 12693: </tr>
12694: <tr>
1.347 gutterid 12695: <td>HASKELL_ENABLE_HADDOCK_DOCUMENTATION</td>
1.337 gutterid 12696: <td>HASKELL_ENABLE_LIBRARY_PROFILING</td>
1.341 gutterid 12697: </tr>
12698: <tr>
1.347 gutterid 12699: <td>HASKELL_ENABLE_SHARED_LIBRARY</td>
1.350 gutterid 12700: <td>HASKELL_ENABLE_TESTS</td>
1.335 nia 12701: </tr>
12702: <tr>
1.350 gutterid 12703: <td>HASKELL_OPTIMIZATION_LEVEL</td>
1.347 gutterid 12704: <td>HASKELL_PKG_NAME</td>
1.344 gutterid 12705: </tr>
12706: <tr>
1.350 gutterid 12707: <td>HASKELL_UNRESTRICT_DEPENDENCIES</td>
1.341 gutterid 12708: <td>HEADER_TEMPLATES</td>
1.329 leot 12709: </tr>
12710: <tr>
1.355 ! rillig 12711: <td>HG_REPO</td>
! 12712: <td>HG_REPOSITORIES</td>
! 12713: </tr>
! 12714: <tr>
! 12715: <td>HG_TAG</td>
1.347 gutterid 12716: <td>HOMEPAGE</td>
1.355 ! rillig 12717: </tr>
! 12718: <tr>
1.353 dholland 12719: <td>HOST_PKGTOOLS_ARGS</td>
1.355 ! rillig 12720: <td>HOST_SPECIFIC_PKGS</td>
1.348 wiz 12721: </tr>
12722: <tr>
1.353 dholland 12723: <td>HOWL_GROUP</td>
1.355 ! rillig 12724: <td>HOWL_USER</td>
1.342 wiz 12725: </tr>
12726: <tr>
1.353 dholland 12727: <td>ICCBASE</td>
1.355 ! rillig 12728: <td>ICECAST_CHROOTDIR</td>
1.338 nia 12729: </tr>
12730: <tr>
1.353 dholland 12731: <td>ICON_THEMES</td>
1.355 ! rillig 12732: <td>IDOBASE</td>
1.269 leot 12733: </tr>
12734: <tr>
1.353 dholland 12735: <td>IGNORE_CCACHE</td>
1.355 ! rillig 12736: <td>IGNORE_INFO_DIRS</td>
1.305 bacon 12737: </tr>
12738: <tr>
1.353 dholland 12739: <td>IGNORE_INTERACTIVE_FETCH</td>
1.355 ! rillig 12740: <td>IMAKE</td>
1.269 leot 12741: </tr>
12742: <tr>
1.353 dholland 12743: <td>IMAKEOPTS</td>
1.355 ! rillig 12744: <td>IMAKE_MAKE</td>
1.269 leot 12745: </tr>
12746: <tr>
1.353 dholland 12747: <td>IMAKE_MANINSTALL</td>
1.355 ! rillig 12748: <td>IMAP_UW_CCLIENT_MBOX_FMT</td>
1.269 leot 12749: </tr>
12750: <tr>
1.353 dholland 12751: <td>IMDICTDIR</td>
1.355 ! rillig 12752: <td>INCOMPAT_CURSES</td>
1.269 leot 12753: </tr>
12754: <tr>
1.353 dholland 12755: <td>INFO_DIR</td>
1.355 ! rillig 12756: <td>INFO_FILES</td>
1.269 leot 12757: </tr>
12758: <tr>
1.355 ! rillig 12759: <td>INFO_FILES_VERBOSE</td>
1.354 gutterid 12760: <td>INFO_MSG</td>
1.269 leot 12761: </tr>
12762: <tr>
1.350 gutterid 12763: <td>INIT_SYSTEM</td>
1.354 gutterid 12764: <td>INN_DATA_DIR</td>
1.269 leot 12765: </tr>
12766: <tr>
1.350 gutterid 12767: <td>INN_GROUP</td>
1.354 gutterid 12768: <td>INN_USER</td>
1.269 leot 12769: </tr>
12770: <tr>
1.350 gutterid 12771: <td>INSTALLATION_DIRS</td>
1.354 gutterid 12772: <td>INSTALLATION_DIRS_FROM_PLIST</td>
1.269 leot 12773: </tr>
12774: <tr>
1.350 gutterid 12775: <td>INSTALL_ENV</td>
1.354 gutterid 12776: <td>INSTALL_SH_OVERRIDE</td>
1.287 rillig 12777: </tr>
12778: <tr>
1.350 gutterid 12779: <td>INSTALL_SRC</td>
1.354 gutterid 12780: <td>INSTALL_TEMPLATES</td>
1.269 leot 12781: </tr>
12782: <tr>
1.350 gutterid 12783: <td>INSTALL_UNSTRIPPED</td>
1.354 gutterid 12784: <td>IRCD_HYBRID_IRC_GROUP</td>
1.269 leot 12785: </tr>
12786: <tr>
1.350 gutterid 12787: <td>IRCD_HYBRID_IRC_USER</td>
1.354 gutterid 12788: <td>IRCD_HYBRID_MAXCONN</td>
1.269 leot 12789: </tr>
12790: <tr>
1.350 gutterid 12791: <td>IRCD_HYBRID_NICLEN</td>
1.354 gutterid 12792: <td>IRCD_HYBRID_SYSLOG_EVENTS</td>
1.269 leot 12793: </tr>
12794: <tr>
1.350 gutterid 12795: <td>IRCD_HYBRID_SYSLOG_FACILITY</td>
1.354 gutterid 12796: <td>IRCD_HYBRID_TOPICLEN</td>
1.269 leot 12797: </tr>
12798: <tr>
1.350 gutterid 12799: <td>IRIX</td>
1.354 gutterid 12800: <td>IRRD_USE_PGP</td>
1.269 leot 12801: </tr>
12802: <tr>
1.350 gutterid 12803: <td>JABBERD_GROUP</td>
1.354 gutterid 12804: <td>JABBERD_LOGDIR</td>
1.269 leot 12805: </tr>
12806: <tr>
1.350 gutterid 12807: <td>JABBERD_PIDDIR</td>
1.354 gutterid 12808: <td>JABBERD_SPOOLDIR</td>
1.269 leot 12809: </tr>
12810: <tr>
1.347 gutterid 12811: <td>JABBERD_USER</td>
1.355 ! rillig 12812: <td>JAVA_APP_PATH</td>
! 12813: </tr>
! 12814: <tr>
! 12815: <td>JAVA_APP_TARGETS</td>
1.354 gutterid 12816: <td>JAVA_BINPREFIX</td>
1.269 leot 12817: </tr>
12818: <tr>
1.350 gutterid 12819: <td>JAVA_CLASSPATH</td>
1.354 gutterid 12820: <td>JAVA_HOME</td>
1.348 wiz 12821: </tr>
12822: <tr>
1.350 gutterid 12823: <td>JAVA_LD_LIBRARY_PATH</td>
1.354 gutterid 12824: <td>JAVA_NAME</td>
1.292 leot 12825: </tr>
12826: <tr>
1.350 gutterid 12827: <td>JAVA_UNLIMIT</td>
1.354 gutterid 12828: <td>JAVA_WRAPPERS</td>
1.342 wiz 12829: </tr>
12830: <tr>
1.350 gutterid 12831: <td>JPEG_ACCEPTED</td>
1.354 gutterid 12832: <td>JPEG_DEFAULT</td>
1.311 leot 12833: </tr>
12834: <tr>
1.350 gutterid 12835: <td>KERBEROS</td>
1.354 gutterid 12836: <td>KERMIT_SUID_UUCP</td>
1.269 leot 12837: </tr>
12838: <tr>
1.350 gutterid 12839: <td>KJS_USE_PCRE</td>
1.354 gutterid 12840: <td>KNEWS_DOMAIN_FILE</td>
1.332 rillig 12841: </tr>
12842: <tr>
1.347 gutterid 12843: <td>KNEWS_DOMAIN_NAME</td>
1.354 gutterid 12844: <td>KRB5_ACCEPTED</td>
1.269 leot 12845: </tr>
12846: <tr>
1.347 gutterid 12847: <td>KRB5_DEFAULT</td>
1.354 gutterid 12848: <td>LANGUAGES</td>
1.269 leot 12849: </tr>
12850: <tr>
1.347 gutterid 12851: <td>LAPACKE_LIBS</td>
1.354 gutterid 12852: <td>LAPACKE_PC</td>
1.269 leot 12853: </tr>
12854: <tr>
1.347 gutterid 12855: <td>LAPACK_LIBS</td>
1.354 gutterid 12856: <td>LAPACK_PC</td>
1.269 leot 12857: </tr>
12858: <tr>
1.347 gutterid 12859: <td>LATEX2HTML_ICONPATH</td>
1.354 gutterid 12860: <td>LDCONFIG_ADD_CMD</td>
1.292 leot 12861: </tr>
12862: <tr>
1.347 gutterid 12863: <td>LDCONFIG_REMOVE_CMD</td>
1.354 gutterid 12864: <td>LDD</td>
1.271 brook 12865: </tr>
12866: <tr>
1.347 gutterid 12867: <td>LEAFNODE_DATA_DIR</td>
1.354 gutterid 12868: <td>LEAFNODE_GROUP</td>
1.269 leot 12869: </tr>
12870: <tr>
1.347 gutterid 12871: <td>LEAFNODE_USER</td>
1.354 gutterid 12872: <td>LIBDVDCSS_HOMEPAGE</td>
1.269 leot 12873: </tr>
12874: <tr>
1.347 gutterid 12875: <td>LIBDVDCSS_MASTER_SITES</td>
1.354 gutterid 12876: <td>LIBRSVG_TYPE</td>
1.269 leot 12877: </tr>
12878: <tr>
1.347 gutterid 12879: <td>LIBTOOL</td>
1.354 gutterid 12880: <td>LIBTOOLIZE_PLIST</td>
1.269 leot 12881: </tr>
12882: <tr>
1.347 gutterid 12883: <td>LIBTOOL_M4_OVERRIDE</td>
1.354 gutterid 12884: <td>LIBUSB_TYPE</td>
1.320 wiz 12885: </tr>
12886: <tr>
1.347 gutterid 12887: <td>LICENSE</td>
1.354 gutterid 12888: <td>LINKER_RPATH_FLAG</td>
1.270 leot 12889: </tr>
12890: <tr>
1.347 gutterid 12891: <td>LINK_RPATH_FLAG</td>
1.355 ! rillig 12892: <td>LINUX_BASE_NODEPS</td>
! 12893: </tr>
! 12894: <tr>
! 12895: <td>LINUX_BASE_PREFERRED</td>
! 12896: <td>LINUX_BASE_REQUIRED</td>
! 12897: </tr>
! 12898: <tr>
1.354 gutterid 12899: <td>LINUX_LOCALES</td>
1.355 ! rillig 12900: <td>LOCALBASE</td>
1.269 leot 12901: </tr>
12902: <tr>
1.354 gutterid 12903: <td>LOCALBASE_LOCKTYPE</td>
1.355 ! rillig 12904: <td>LOCALPATCHES</td>
1.352 wiz 12905: </tr>
12906: <tr>
1.354 gutterid 12907: <td>LOVE_DATA</td>
1.355 ! rillig 12908: <td>LOVE_GAME</td>
1.338 nia 12909: </tr>
12910: <tr>
1.354 gutterid 12911: <td>LOVE_VERSION</td>
1.355 ! rillig 12912: <td>LP32PLATFORMS</td>
1.269 leot 12913: </tr>
12914: <tr>
1.354 gutterid 12915: <td>LP64PLATFORMS</td>
1.355 ! rillig 12916: <td>LUA_BUSTED_ARGS</td>
1.329 leot 12917: </tr>
12918: <tr>
1.354 gutterid 12919: <td>LUA_CDIR</td>
1.355 ! rillig 12920: <td>LUA_COMPILER</td>
1.269 leot 12921: </tr>
12922: <tr>
1.354 gutterid 12923: <td>LUA_DOCDIR</td>
1.355 ! rillig 12924: <td>LUA_EXAMPLESDIR</td>
1.269 leot 12925: </tr>
12926: <tr>
1.354 gutterid 12927: <td>LUA_INCDIR</td>
1.355 ! rillig 12928: <td>LUA_INTERPRETER</td>
1.269 leot 12929: </tr>
12930: <tr>
1.354 gutterid 12931: <td>LUA_LDIR</td>
1.355 ! rillig 12932: <td>LUA_LINKER_MAGIC</td>
1.336 nia 12933: </tr>
12934: <tr>
1.354 gutterid 12935: <td>LUA_PKGPREFIX</td>
1.355 ! rillig 12936: <td>LUA_SELF_CONFLICT</td>
1.333 nia 12937: </tr>
12938: <tr>
1.354 gutterid 12939: <td>LUA_USE_BUSTED</td>
1.355 ! rillig 12940: <td>LUA_VERSIONS_ACCEPTED</td>
1.333 nia 12941: </tr>
12942: <tr>
1.354 gutterid 12943: <td>LUA_VERSIONS_INCOMPATIBLE</td>
1.355 ! rillig 12944: <td>LUA_VERSION_DEFAULT</td>
1.333 nia 12945: </tr>
12946: <tr>
1.354 gutterid 12947: <td>LUA_VERSION_REQD</td>
1.355 ! rillig 12948: <td>Lua</td>
1.333 nia 12949: </tr>
12950: <tr>
1.354 gutterid 12951: <td>MACHINE_PLATFORM</td>
1.355 ! rillig 12952: <td>MAILAGENT_DOMAIN</td>
1.333 nia 12953: </tr>
12954: <tr>
1.354 gutterid 12955: <td>MAILAGENT_EMAIL</td>
1.355 ! rillig 12956: <td>MAILAGENT_FQDN</td>
1.333 nia 12957: </tr>
12958: <tr>
1.354 gutterid 12959: <td>MAILAGENT_ORGANIZATION</td>
1.355 ! rillig 12960: <td>MAJORDOMO_HOMEDIR</td>
1.333 nia 12961: </tr>
12962: <tr>
1.355 ! rillig 12963: <td>MAJOR_OS_VERSION</td>
1.354 gutterid 12964: <td>MAKEINFO_ARGS</td>
1.320 wiz 12965: </tr>
12966: <tr>
1.350 gutterid 12967: <td>MAKE_DIRS</td>
1.354 gutterid 12968: <td>MAKE_DIRS_PERMS</td>
1.348 wiz 12969: </tr>
12970: <tr>
1.350 gutterid 12971: <td>MAKE_ENV</td>
1.354 gutterid 12972: <td>MAKE_FILE</td>
1.342 wiz 12973: </tr>
12974: <tr>
1.350 gutterid 12975: <td>MAKE_FLAGS</td>
1.354 gutterid 12976: <td>MAKE_JOBS</td>
1.269 leot 12977: </tr>
12978: <tr>
1.350 gutterid 12979: <td>MAKE_JOBS_SAFE</td>
1.354 gutterid 12980: <td>MAKE_PROGRAM</td>
1.327 wiz 12981: </tr>
12982: <tr>
1.350 gutterid 12983: <td>MANCOMPRESSED_IF_MANZ</td>
1.354 gutterid 12984: <td>MANINSTALL</td>
1.269 leot 12985: </tr>
12986: <tr>
1.350 gutterid 12987: <td>MANZ</td>
1.354 gutterid 12988: <td>MASTER_SITES</td>
1.269 leot 12989: </tr>
12990: <tr>
1.350 gutterid 12991: <td>MASTER_SITE_BACKUP</td>
1.354 gutterid 12992: <td>MASTER_SITE_LOCAL</td>
1.269 leot 12993: </tr>
12994: <tr>
1.350 gutterid 12995: <td>MASTER_SITE_MOZILLA</td>
1.354 gutterid 12996: <td>MASTER_SITE_OVERRIDE</td>
1.303 bacon 12997: </tr>
12998: <tr>
1.350 gutterid 12999: <td>MASTER_SITE_PERL_CPAN</td>
1.354 gutterid 13000: <td>MASTER_SORT</td>
1.269 leot 13001: </tr>
13002: <tr>
1.350 gutterid 13003: <td>MASTER_SORT_RANDOM</td>
1.354 gutterid 13004: <td>MASTER_SORT_REGEX</td>
1.269 leot 13005: </tr>
13006: <tr>
1.350 gutterid 13007: <td>MECAB_CHARSET</td>
1.354 gutterid 13008: <td>MEDIATOMB_GROUP</td>
1.269 leot 13009: </tr>
13010: <tr>
1.350 gutterid 13011: <td>MEDIATOMB_USER</td>
1.354 gutterid 13012: <td>MIPSPROBASE</td>
1.269 leot 13013: </tr>
13014: <tr>
1.350 gutterid 13015: <td>MIREDO_GROUP</td>
1.354 gutterid 13016: <td>MIREDO_USER</td>
1.269 leot 13017: </tr>
13018: <tr>
1.350 gutterid 13019: <td>MISSING_FEATURES</td>
1.354 gutterid 13020: <td>MKDIR</td>
1.269 leot 13021: </tr>
13022: <tr>
1.350 gutterid 13023: <td>MKPIE_SUPPORTED</td>
1.354 gutterid 13024: <td>MLDONKEY_GROUP</td>
1.269 leot 13025: </tr>
13026: <tr>
1.350 gutterid 13027: <td>MLDONKEY_HOME</td>
1.354 gutterid 13028: <td>MLDONKEY_USER</td>
1.269 leot 13029: </tr>
13030: <tr>
1.350 gutterid 13031: <td>MONOTONE_GROUP</td>
1.354 gutterid 13032: <td>MONOTONE_USER</td>
1.269 leot 13033: </tr>
13034: <tr>
1.350 gutterid 13035: <td>MOTIFBASE</td>
1.354 gutterid 13036: <td>MOTIF_TYPE</td>
1.269 leot 13037: </tr>
13038: <tr>
1.350 gutterid 13039: <td>MOTIF_TYPE_DEFAULT</td>
1.354 gutterid 13040: <td>MPI_TYPE</td>
1.322 leot 13041: </tr>
13042: <tr>
1.350 gutterid 13043: <td>MSGFMT_STRIP_MSGCTXT</td>
1.354 gutterid 13044: <td>MSGFMT_STRIP_MSGID_PLURAL</td>
1.269 leot 13045: </tr>
13046: <tr>
1.347 gutterid 13047: <td>MTOOLS_ENABLE_FLOPPYD</td>
1.355 ! rillig 13048: <td>MUST</td>
! 13049: </tr>
! 13050: <tr>
1.354 gutterid 13051: <td>MV</td>
1.355 ! rillig 13052: <td>MYSQL_CHARSET</td>
1.269 leot 13053: </tr>
13054: <tr>
1.354 gutterid 13055: <td>MYSQL_DATADIR</td>
1.355 ! rillig 13056: <td>MYSQL_EXTRA_CHARSET</td>
1.352 wiz 13057: </tr>
13058: <tr>
1.354 gutterid 13059: <td>MYSQL_GROUP</td>
1.355 ! rillig 13060: <td>MYSQL_USER</td>
1.338 nia 13061: </tr>
13062: <tr>
1.354 gutterid 13063: <td>MYSQL_VERSION</td>
1.355 ! rillig 13064: <td>MYSQL_VERSIONS_ACCEPTED</td>
1.329 leot 13065: </tr>
13066: <tr>
1.354 gutterid 13067: <td>MYSQL_VERSIONS_ALL</td>
1.355 ! rillig 13068: <td>MYSQL_VERSION_DEFAULT</td>
1.269 leot 13069: </tr>
13070: <tr>
1.354 gutterid 13071: <td>NAGIOSCMD_GROUP</td>
1.355 ! rillig 13072: <td>NAGIOSDIR</td>
1.320 wiz 13073: </tr>
13074: <tr>
1.354 gutterid 13075: <td>NAGIOS_GROUP</td>
1.355 ! rillig 13076: <td>NAGIOS_USER</td>
1.269 leot 13077: </tr>
13078: <tr>
1.354 gutterid 13079: <td>NATIVE_APPEND_ABI</td>
1.355 ! rillig 13080: <td>NATIVE_APPEND_ELF</td>
1.269 leot 13081: </tr>
13082: <tr>
1.354 gutterid 13083: <td>NATIVE_EXEC_FMT</td>
1.355 ! rillig 13084: <td>NATIVE_MACHINE_PLATFORM</td>
1.269 leot 13085: </tr>
13086: <tr>
1.354 gutterid 13087: <td>NATIVE_OBJECT_FMT</td>
1.355 ! rillig 13088: <td>NBPAX_PROGRAM_PREFIX</td>
1.309 gutterid 13089: </tr>
13090: <tr>
1.354 gutterid 13091: <td>NETBSD_LOGIN_NAME</td>
1.355 ! rillig 13092: <td>NMH_EDITOR</td>
1.269 leot 13093: </tr>
13094: <tr>
1.354 gutterid 13095: <td>NMH_MTA</td>
1.355 ! rillig 13096: <td>NMH_PAGER</td>
1.269 leot 13097: </tr>
13098: <tr>
1.354 gutterid 13099: <td>NODE_VERSIONS_ACCEPTED</td>
1.355 ! rillig 13100: <td>NODE_VERSIONS_INCOMPATIBLE</td>
1.269 leot 13101: </tr>
13102: <tr>
1.354 gutterid 13103: <td>NODE_VERSION_DEFAULT</td>
1.355 ! rillig 13104: <td>NODE_VERSION_REQD</td>
1.269 leot 13105: </tr>
13106: <tr>
1.354 gutterid 13107: <td>NOLOGIN</td>
1.355 ! rillig 13108: <td>NOTE</td>
1.269 leot 13109: </tr>
13110: <tr>
1.354 gutterid 13111: <td>NOT_FOR_PLATFORM</td>
1.355 ! rillig 13112: <td>NOT_PAX_ASLR_SAFE</td>
1.269 leot 13113: </tr>
13114: <tr>
1.354 gutterid 13115: <td>NOT_PAX_MPROTECT_SAFE</td>
1.355 ! rillig 13116: <td>NO_BUILD</td>
1.344 gutterid 13117: </tr>
13118: <tr>
1.354 gutterid 13119: <td>NO_CHECKSUM</td>
1.355 ! rillig 13120: <td>NO_CONFIGURE</td>
1.333 nia 13121: </tr>
13122: <tr>
1.354 gutterid 13123: <td>NO_SKIP</td>
1.355 ! rillig 13124: <td>NS_PREFERRED</td>
1.333 nia 13125: </tr>
13126: <tr>
1.354 gutterid 13127: <td>NULLMAILER_GROUP</td>
1.355 ! rillig 13128: <td>NULLMAILER_USER</td>
1.293 rillig 13129: </tr>
13130: <tr>
1.354 gutterid 13131: <td>OBJHOSTNAME</td>
1.355 ! rillig 13132: <td>OBJMACHINE</td>
1.269 leot 13133: </tr>
13134: <tr>
1.354 gutterid 13135: <td>OCAML_FINDLIB_DIRS</td>
1.355 ! rillig 13136: <td>OCAML_FINDLIB_REGISTER</td>
1.269 leot 13137: </tr>
13138: <tr>
1.354 gutterid 13139: <td>OCAML_FINDLIB_REGISTER_VERBOSE</td>
1.355 ! rillig 13140: <td>OCAML_SITELIBDIR</td>
1.269 leot 13141: </tr>
13142: <tr>
1.354 gutterid 13143: <td>OMF</td>
1.355 ! rillig 13144: <td>ONLY_FOR_COMPILER</td>
1.269 leot 13145: </tr>
13146: <tr>
1.354 gutterid 13147: <td>ONLY_FOR_PLATFORM</td>
1.355 ! rillig 13148: <td>OPENSSH_CHROOT</td>
1.269 leot 13149: </tr>
13150: <tr>
1.354 gutterid 13151: <td>OPENSSH_GROUP</td>
1.355 ! rillig 13152: <td>OPENSSH_USER</td>
1.269 leot 13153: </tr>
13154: <tr>
1.354 gutterid 13155: <td>OPSYS</td>
1.355 ! rillig 13156: <td>OPSYS_EMULDIR</td>
1.269 leot 13157: </tr>
13158: <tr>
1.354 gutterid 13159: <td>OPSYS_VERSION</td>
1.355 ! rillig 13160: <td>OS</td>
1.269 leot 13161: </tr>
13162: <tr>
1.354 gutterid 13163: <td>OSS_TYPE</td>
1.355 ! rillig 13164: <td>OSX</td>
1.269 leot 13165: </tr>
13166: <tr>
1.354 gutterid 13167: <td>OSX_TOLERATE_SDK_SKEW</td>
1.355 ! rillig 13168: <td>OS_HAVE_ALSA</td>
1.269 leot 13169: </tr>
13170: <tr>
1.355 ! rillig 13171: <td>OS_HAVE_RCD</td>
1.353 dholland 13172: <td>OS_VARIANT</td>
1.355 ! rillig 13173: </tr>
! 13174: <tr>
1.354 gutterid 13175: <td>OS_VERSION</td>
1.355 ! rillig 13176: <td>OTF_FONTS_DIR</td>
1.352 wiz 13177: </tr>
13178: <tr>
1.354 gutterid 13179: <td>OVERRIDE_DIRDEPTH</td>
1.355 ! rillig 13180: <td>OVERRIDE_GEMSPEC</td>
1.269 leot 13181: </tr>
13182: <tr>
1.354 gutterid 13183: <td>OVERRIDE_GNU_CONFIG_SCRIPTS</td>
1.355 ! rillig 13184: <td>OVERRIDE_ROCKSPEC</td>
1.269 leot 13185: </tr>
13186: <tr>
1.344 gutterid 13187: <td>OWN_DIRS</td>
1.354 gutterid 13188: <td>OWN_DIRS_PERMS</td>
1.348 wiz 13189: </tr>
13190: <tr>
13191: <td>P4GROUP</td>
1.354 gutterid 13192: <td>P4PORT</td>
1.329 leot 13193: </tr>
13194: <tr>
1.348 wiz 13195: <td>P4ROOT</td>
1.354 gutterid 13196: <td>P4USER</td>
1.342 wiz 13197: </tr>
13198: <tr>
1.348 wiz 13199: <td>PACKAGES</td>
1.354 gutterid 13200: <td>PALMOS_DEFAULT_SDK</td>
1.320 wiz 13201: </tr>
13202: <tr>
1.348 wiz 13203: <td>PAMBASE</td>
1.354 gutterid 13204: <td>PAM_DEFAULT</td>
1.269 leot 13205: </tr>
13206: <tr>
1.348 wiz 13207: <td>PAPERSIZE</td>
1.354 gutterid 13208: <td>PASSIVE_FETCH</td>
1.269 leot 13209: </tr>
13210: <tr>
1.348 wiz 13211: <td>PATCHDIR</td>
1.354 gutterid 13212: <td>PATCHFILES</td>
1.269 leot 13213: </tr>
13214: <tr>
1.348 wiz 13215: <td>PATCH_ARGS</td>
1.354 gutterid 13216: <td>PATCH_DEBUG</td>
1.269 leot 13217: </tr>
13218: <tr>
1.348 wiz 13219: <td>PATCH_DIST_ARGS</td>
1.354 gutterid 13220: <td>PATCH_DIST_CAT</td>
1.269 leot 13221: </tr>
13222: <tr>
1.348 wiz 13223: <td>PATCH_DIST_STRIP</td>
1.354 gutterid 13224: <td>PATCH_FUZZ_FACTOR</td>
1.269 leot 13225: </tr>
13226: <tr>
1.348 wiz 13227: <td>PATCH_STRIP</td>
1.354 gutterid 13228: <td>PATH</td>
1.324 nia 13229: </tr>
13230: <tr>
1.348 wiz 13231: <td>PCCBASE</td>
1.355 ! rillig 13232: <td>PEAR</td>
! 13233: </tr>
! 13234: <tr>
! 13235: <td>PEAR_CHANNEL</td>
! 13236: <td>PEAR_CHANNEL_ALIAS</td>
! 13237: </tr>
! 13238: <tr>
! 13239: <td>PEAR_CHANNEL_VERSION</td>
1.354 gutterid 13240: <td>PEAR_CMD</td>
1.269 leot 13241: </tr>
13242: <tr>
1.344 gutterid 13243: <td>PEAR_LIB</td>
1.354 gutterid 13244: <td>PEAR_PACKAGE_XML</td>
1.342 wiz 13245: </tr>
13246: <tr>
1.344 gutterid 13247: <td>PERL5</td>
1.354 gutterid 13248: <td>PERL5_CONFIGURE</td>
1.269 leot 13249: </tr>
13250: <tr>
1.344 gutterid 13251: <td>PERL5_CONFIGURE_DIRS</td>
1.354 gutterid 13252: <td>PERL5_LDFLAGS</td>
1.332 rillig 13253: </tr>
13254: <tr>
1.344 gutterid 13255: <td>PERL5_LICENSE</td>
1.354 gutterid 13256: <td>PERL5_MODULE_TYPE</td>
1.320 wiz 13257: </tr>
13258: <tr>
1.344 gutterid 13259: <td>PERL5_PACKLIST</td>
1.354 gutterid 13260: <td>PERL5_PACKLIST_DIR</td>
1.292 leot 13261: </tr>
13262: <tr>
1.344 gutterid 13263: <td>PERL5_PERLBASE</td>
1.354 gutterid 13264: <td>PERL5_SITEBASE</td>
1.274 rillig 13265: </tr>
13266: <tr>
1.344 gutterid 13267: <td>PERL5_USE_PACKLIST</td>
1.354 gutterid 13268: <td>PERL5_VENDORBASE</td>
1.274 rillig 13269: </tr>
13270: <tr>
1.344 gutterid 13271: <td>PFCTL</td>
1.354 gutterid 13272: <td>PFVAR_H</td>
1.269 leot 13273: </tr>
13274: <tr>
1.344 gutterid 13275: <td>PF_VERSION</td>
1.354 gutterid 13276: <td>PGGROUP</td>
1.269 leot 13277: </tr>
13278: <tr>
1.344 gutterid 13279: <td>PGHOME</td>
1.354 gutterid 13280: <td>PGPKGSRCDIR</td>
1.269 leot 13281: </tr>
13282: <tr>
1.344 gutterid 13283: <td>PGSQL_TYPE</td>
1.354 gutterid 13284: <td>PGSQL_VERSION</td>
1.269 leot 13285: </tr>
13286: <tr>
1.344 gutterid 13287: <td>PGSQL_VERSIONS_ACCEPTED</td>
1.354 gutterid 13288: <td>PGSQL_VERSION_DEFAULT</td>
1.269 leot 13289: </tr>
13290: <tr>
1.344 gutterid 13291: <td>PGUSER</td>
1.354 gutterid 13292: <td>PG_LIB_EXT</td>
1.269 leot 13293: </tr>
13294: <tr>
1.344 gutterid 13295: <td>PHP</td>
1.354 gutterid 13296: <td>PHPCOMMON_MK</td>
1.269 leot 13297: </tr>
13298: <tr>
1.344 gutterid 13299: <td>PHPPKGSRCDIR</td>
1.354 gutterid 13300: <td>PHP_BASE_VERS</td>
1.269 leot 13301: </tr>
13302: <tr>
1.344 gutterid 13303: <td>PHP_CHECK_INSTALLED</td>
1.354 gutterid 13304: <td>PHP_EXTENSION_DIR</td>
1.269 leot 13305: </tr>
13306: <tr>
1.344 gutterid 13307: <td>PHP_INITIAL_TEENY</td>
1.354 gutterid 13308: <td>PHP_PKG_PREFIX</td>
1.269 leot 13309: </tr>
13310: <tr>
1.344 gutterid 13311: <td>PHP_VERSION</td>
1.354 gutterid 13312: <td>PHP_VERSIONS_ACCEPTED</td>
1.269 leot 13313: </tr>
13314: <tr>
1.344 gutterid 13315: <td>PHP_VERSIONS_INCOMPATIBLE</td>
1.354 gutterid 13316: <td>PHP_VERSION_DEFAULT</td>
1.269 leot 13317: </tr>
13318: <tr>
1.344 gutterid 13319: <td>PHP_VERSION_REQD</td>
1.354 gutterid 13320: <td>PILRC_USE_GTK</td>
1.269 leot 13321: </tr>
13322: <tr>
1.344 gutterid 13323: <td>PKGCONFIG_BASE</td>
1.354 gutterid 13324: <td>PKGCONFIG_FILE</td>
1.269 leot 13325: </tr>
13326: <tr>
1.344 gutterid 13327: <td>PKGCONFIG_OVERRIDE</td>
1.354 gutterid 13328: <td>PKGCONFIG_OVERRIDE_STAGE</td>
1.269 leot 13329: </tr>
13330: <tr>
1.344 gutterid 13331: <td>PKGDIR</td>
1.354 gutterid 13332: <td>PKGGNUDIR</td>
1.269 leot 13333: </tr>
13334: <tr>
1.344 gutterid 13335: <td>PKGINFODIR</td>
1.354 gutterid 13336: <td>PKGLOCALEDIR</td>
1.269 leot 13337: </tr>
13338: <tr>
1.344 gutterid 13339: <td>PKGMANDIR</td>
1.354 gutterid 13340: <td>PKGNAME</td>
1.269 leot 13341: </tr>
13342: <tr>
1.344 gutterid 13343: <td>PKGNAME_REQD</td>
1.354 gutterid 13344: <td>PKGPATH</td>
1.269 leot 13345: </tr>
13346: <tr>
1.344 gutterid 13347: <td>PKGREVISION</td>
1.354 gutterid 13348: <td>PKGSRC_BLAS_TYPES</td>
1.269 leot 13349: </tr>
13350: <tr>
1.344 gutterid 13351: <td>PKGSRC_CHANGES</td>
1.354 gutterid 13352: <td>PKGSRC_COMPILER</td>
1.269 leot 13353: </tr>
13354: <tr>
1.344 gutterid 13355: <td>PKGSRC_KEEP_BIN_PKGS</td>
1.354 gutterid 13356: <td>PKGSRC_LOCKTYPE</td>
1.269 leot 13357: </tr>
13358: <tr>
1.344 gutterid 13359: <td>PKGSRC_MAKE_ENV</td>
1.354 gutterid 13360: <td>PKGSRC_MESSAGE_RECIPIENTS</td>
1.269 leot 13361: </tr>
13362: <tr>
1.344 gutterid 13363: <td>PKGSRC_MKPIE</td>
1.354 gutterid 13364: <td>PKGSRC_MKREPRO</td>
1.269 leot 13365: </tr>
13366: <tr>
1.344 gutterid 13367: <td>PKGSRC_OVERRIDE_MKPIE</td>
1.354 gutterid 13368: <td>PKGSRC_RUN_TEST</td>
1.292 leot 13369: </tr>
13370: <tr>
1.344 gutterid 13371: <td>PKGSRC_SETENV</td>
1.354 gutterid 13372: <td>PKGSRC_SLEEPSECS</td>
1.269 leot 13373: </tr>
13374: <tr>
1.344 gutterid 13375: <td>PKGSRC_TODO</td>
1.354 gutterid 13376: <td>PKGSRC_USE_CTF</td>
1.274 rillig 13377: </tr>
13378: <tr>
1.344 gutterid 13379: <td>PKGSRC_USE_FORTIFY</td>
1.354 gutterid 13380: <td>PKGSRC_USE_MKTOOLS</td>
1.269 leot 13381: </tr>
13382: <tr>
1.344 gutterid 13383: <td>PKGSRC_USE_RELRO</td>
1.354 gutterid 13384: <td>PKGSRC_USE_SSP</td>
1.269 leot 13385: </tr>
13386: <tr>
1.344 gutterid 13387: <td>PKGSRC_USE_STACK_CHECK</td>
1.354 gutterid 13388: <td>PKGTASKS_DATAFILE</td>
1.269 leot 13389: </tr>
13390: <tr>
1.344 gutterid 13391: <td>PKGTOOLS_ARGS</td>
1.354 gutterid 13392: <td>PKGTOOLS_ENV</td>
1.269 leot 13393: </tr>
13394: <tr>
1.344 gutterid 13395: <td>PKG_ALTERNATIVES</td>
1.354 gutterid 13396: <td>PKG_APACHE</td>
1.269 leot 13397: </tr>
13398: <tr>
1.344 gutterid 13399: <td>PKG_APACHE_ACCEPTED</td>
1.354 gutterid 13400: <td>PKG_APACHE_DEFAULT</td>
1.269 leot 13401: </tr>
13402: <tr>
1.344 gutterid 13403: <td>PKG_BEST_EXISTS</td>
1.354 gutterid 13404: <td>PKG_BUILD_OPTIONS</td>
1.269 leot 13405: </tr>
13406: <tr>
1.344 gutterid 13407: <td>PKG_COMPRESSION</td>
1.354 gutterid 13408: <td>PKG_CONFIG</td>
1.269 leot 13409: </tr>
13410: <tr>
1.344 gutterid 13411: <td>PKG_CONFIG_PERMS</td>
1.354 gutterid 13412: <td>PKG_CREATE_USERGROUP</td>
1.269 leot 13413: </tr>
13414: <tr>
1.344 gutterid 13415: <td>PKG_DB_TMPDIR</td>
1.354 gutterid 13416: <td>PKG_DEBUG_LEVEL</td>
1.269 leot 13417: </tr>
13418: <tr>
1.344 gutterid 13419: <td>PKG_DEFAULT_OPTIONS</td>
1.354 gutterid 13420: <td>PKG_DESTDIR_SUPPORT</td>
1.269 leot 13421: </tr>
13422: <tr>
1.344 gutterid 13423: <td>PKG_DEVELOPER</td>
1.354 gutterid 13424: <td>PKG_DISABLED_OPTIONS</td>
1.269 leot 13425: </tr>
13426: <tr>
1.344 gutterid 13427: <td>PKG_FATAL_ERRORS</td>
1.354 gutterid 13428: <td>PKG_FC</td>
1.348 wiz 13429: </tr>
13430: <tr>
13431: <td>PKG_FILELIST_CMD</td>
1.354 gutterid 13432: <td>PKG_GECOS</td>
1.269 leot 13433: </tr>
13434: <tr>
1.348 wiz 13435: <td>PKG_GID</td>
1.354 gutterid 13436: <td>PKG_GROUPS</td>
1.269 leot 13437: </tr>
13438: <tr>
1.348 wiz 13439: <td>PKG_GROUPS_VARS</td>
1.354 gutterid 13440: <td>PKG_HOME</td>
1.269 leot 13441: </tr>
13442: <tr>
1.348 wiz 13443: <td>PKG_INIT_SCRIPTS</td>
1.354 gutterid 13444: <td>PKG_JAVA_HOME</td>
1.269 leot 13445: </tr>
13446: <tr>
1.348 wiz 13447: <td>PKG_JVM</td>
1.354 gutterid 13448: <td>PKG_JVMS_ACCEPTED</td>
1.269 leot 13449: </tr>
13450: <tr>
1.348 wiz 13451: <td>PKG_JVM_DEFAULT</td>
1.354 gutterid 13452: <td>PKG_LEGACY_OPTIONS</td>
1.269 leot 13453: </tr>
13454: <tr>
1.348 wiz 13455: <td>PKG_LIBTOOL</td>
1.354 gutterid 13456: <td>PKG_MKSYMLINKS</td>
1.269 leot 13457: </tr>
13458: <tr>
1.348 wiz 13459: <td>PKG_OPTIONS</td>
1.354 gutterid 13460: <td>PKG_OPTIONS_DEPRECATED_WARNINGS</td>
1.269 leot 13461: </tr>
13462: <tr>
1.348 wiz 13463: <td>PKG_OPTIONS_LEGACY_OPTS</td>
1.354 gutterid 13464: <td>PKG_OPTIONS_LEGACY_VARS</td>
1.269 leot 13465: </tr>
13466: <tr>
1.348 wiz 13467: <td>PKG_OPTIONS_NONEMPTY_SETS</td>
1.354 gutterid 13468: <td>PKG_OPTIONS_OPTIONAL_GROUPS</td>
1.341 gutterid 13469: </tr>
13470: <tr>
1.348 wiz 13471: <td>PKG_OPTIONS_REQUIRED_GROUPS</td>
1.354 gutterid 13472: <td>PKG_OPTIONS_VAR</td>
1.269 leot 13473: </tr>
13474: <tr>
1.348 wiz 13475: <td>PKG_PHP</td>
1.354 gutterid 13476: <td>PKG_PHP_MAJOR_VERS</td>
1.269 leot 13477: </tr>
13478: <tr>
1.348 wiz 13479: <td>PKG_PHP_VERSION</td>
1.354 gutterid 13480: <td>PKG_RCD_SCRIPTS</td>
1.269 leot 13481: </tr>
13482: <tr>
1.348 wiz 13483: <td>PKG_REFCOUNT_DBDIR</td>
1.354 gutterid 13484: <td>PKG_REGISTER_SHELLS</td>
1.269 leot 13485: </tr>
13486: <tr>
1.348 wiz 13487: <td>PKG_RESUME_TRANSFERS</td>
1.354 gutterid 13488: <td>PKG_SHELL</td>
1.269 leot 13489: </tr>
13490: <tr>
1.348 wiz 13491: <td>PKG_SUGGESTED_OPTIONS</td>
1.354 gutterid 13492: <td>PKG_SUPPORTED_OPTIONS</td>
1.269 leot 13493: </tr>
13494: <tr>
1.348 wiz 13495: <td>PKG_SYSCONFBASE</td>
1.354 gutterid 13496: <td>PKG_SYSCONFBASEDIR</td>
1.269 leot 13497: </tr>
13498: <tr>
1.348 wiz 13499: <td>PKG_SYSCONFDIR</td>
1.354 gutterid 13500: <td>PKG_SYSCONFDIR_PERMS</td>
1.269 leot 13501: </tr>
13502: <tr>
1.348 wiz 13503: <td>PKG_SYSCONFSUBDIR</td>
1.354 gutterid 13504: <td>PKG_SYSCONFVAR</td>
1.269 leot 13505: </tr>
13506: <tr>
1.348 wiz 13507: <td>PKG_TOOLS_BIN</td>
1.354 gutterid 13508: <td>PKG_UID</td>
1.269 leot 13509: </tr>
13510: <tr>
1.348 wiz 13511: <td>PKG_UPDATE_FONTS_DB</td>
1.354 gutterid 13512: <td>PKG_USERS</td>
1.269 leot 13513: </tr>
13514: <tr>
1.348 wiz 13515: <td>PKG_USERS_VARS</td>
1.354 gutterid 13516: <td>PKG_VERBOSE</td>
1.269 leot 13517: </tr>
13518: <tr>
1.348 wiz 13519: <td>PLEASE</td>
1.354 gutterid 13520: <td>PLIST</td>
1.269 leot 13521: </tr>
13522: <tr>
1.348 wiz 13523: <td>PLIST_AWK</td>
1.354 gutterid 13524: <td>PLIST_AWK_ENV</td>
1.269 leot 13525: </tr>
13526: <tr>
1.348 wiz 13527: <td>PLIST_SRC</td>
1.354 gutterid 13528: <td>PLIST_SUBST</td>
1.269 leot 13529: </tr>
13530: <tr>
1.348 wiz 13531: <td>PLIST_TYPE</td>
1.354 gutterid 13532: <td>PLIST_VARS</td>
1.269 leot 13533: </tr>
13534: <tr>
1.348 wiz 13535: <td>POPTOP_USE_MPPE</td>
1.354 gutterid 13536: <td>POSSIBLE_GFORTRAN_VERSION</td>
1.269 leot 13537: </tr>
13538: <tr>
1.348 wiz 13539: <td>POST_FETCH_HOOK</td>
1.354 gutterid 13540: <td>PREFER</td>
1.269 leot 13541: </tr>
13542: <tr>
1.348 wiz 13543: <td>PREFER_NATIVE</td>
1.354 gutterid 13544: <td>PREFER_NATIVE_PTHREADS</td>
1.269 leot 13545: </tr>
13546: <tr>
1.348 wiz 13547: <td>PREFER_PKGSRC</td>
1.354 gutterid 13548: <td>PREFIX</td>
1.269 leot 13549: </tr>
13550: <tr>
1.348 wiz 13551: <td>PREPEND_PATH</td>
1.354 gutterid 13552: <td>PRE_ROOT_CMD</td>
1.269 leot 13553: </tr>
13554: <tr>
1.348 wiz 13555: <td>PRIVILEGED_STAGES</td>
1.354 gutterid 13556: <td>PS</td>
1.269 leot 13557: </tr>
13558: <tr>
1.348 wiz 13559: <td>PTHREAD_AUTO_VARS</td>
1.354 gutterid 13560: <td>PTHREAD_CFLAGS</td>
1.269 leot 13561: </tr>
13562: <tr>
1.348 wiz 13563: <td>PTHREAD_LDFLAGS</td>
1.354 gutterid 13564: <td>PTHREAD_LIBS</td>
1.269 leot 13565: </tr>
13566: <tr>
1.348 wiz 13567: <td>PTHREAD_OPTS</td>
1.354 gutterid 13568: <td>PTHREAD_TYPE</td>
1.269 leot 13569: </tr>
13570: <tr>
1.348 wiz 13571: <td>PVM_SSH</td>
1.354 gutterid 13572: <td>PYPKGPREFIX</td>
1.269 leot 13573: </tr>
13574: <tr>
1.348 wiz 13575: <td>PYTHON_FOR_BUILD_ONLY</td>
1.354 gutterid 13576: <td>PYTHON_SELF_CONFLICT</td>
1.269 leot 13577: </tr>
13578: <tr>
1.351 gutterid 13579: <td>PYTHON_VERSION</td>
1.354 gutterid 13580: <td>PYTHON_VERSIONED_DEPENDENCIES</td>
1.269 leot 13581: </tr>
13582: <tr>
1.347 gutterid 13583: <td>PYTHON_VERSIONS_ACCEPTED</td>
1.354 gutterid 13584: <td>PYTHON_VERSIONS_INCOMPATIBLE</td>
1.269 leot 13585: </tr>
13586: <tr>
1.347 gutterid 13587: <td>PYTHON_VERSION_DEFAULT</td>
1.354 gutterid 13588: <td>PYTHON_VERSION_REQD</td>
1.269 leot 13589: </tr>
13590: <tr>
1.347 gutterid 13591: <td>PYVERSSUFFIX</td>
1.354 gutterid 13592: <td>QMAILDIR</td>
1.269 leot 13593: </tr>
13594: <tr>
1.347 gutterid 13595: <td>QMAIL_ALIAS_USER</td>
1.354 gutterid 13596: <td>QMAIL_DAEMON_USER</td>
1.269 leot 13597: </tr>
13598: <tr>
1.347 gutterid 13599: <td>QMAIL_LOG_USER</td>
1.354 gutterid 13600: <td>QMAIL_NOFILES_GROUP</td>
1.269 leot 13601: </tr>
13602: <tr>
1.347 gutterid 13603: <td>QMAIL_PASSWD_USER</td>
1.354 gutterid 13604: <td>QMAIL_QMAIL_GROUP</td>
1.269 leot 13605: </tr>
13606: <tr>
1.347 gutterid 13607: <td>QMAIL_QUEUE_DIR</td>
1.354 gutterid 13608: <td>QMAIL_QUEUE_EXTRA</td>
1.269 leot 13609: </tr>
13610: <tr>
1.347 gutterid 13611: <td>QMAIL_QUEUE_USER</td>
1.354 gutterid 13612: <td>QMAIL_REMOTE_USER</td>
1.269 leot 13613: </tr>
13614: <tr>
1.347 gutterid 13615: <td>QMAIL_ROOT_USER</td>
1.354 gutterid 13616: <td>QMAIL_SEND_USER</td>
1.269 leot 13617: </tr>
13618: <tr>
1.347 gutterid 13619: <td>QORE_LATEST_MODULE_API</td>
1.354 gutterid 13620: <td>QORE_MODULE_API</td>
1.269 leot 13621: </tr>
13622: <tr>
1.347 gutterid 13623: <td>QORE_MODULE_DIR</td>
1.354 gutterid 13624: <td>QORE_USER_MODULE_DIR</td>
1.269 leot 13625: </tr>
13626: <tr>
1.347 gutterid 13627: <td>QORE_VERSION</td>
1.354 gutterid 13628: <td>QPOPPER_FAC</td>
1.269 leot 13629: </tr>
13630: <tr>
1.347 gutterid 13631: <td>QPOPPER_SPOOL_DIR</td>
1.354 gutterid 13632: <td>QPOPPER_USER</td>
1.269 leot 13633: </tr>
13634: <tr>
1.347 gutterid 13635: <td>RAKE_NAME</td>
1.354 gutterid 13636: <td>RASMOL_DEPTH</td>
1.348 wiz 13637: </tr>
13638: <tr>
1.355 ! rillig 13639: <td>RCD_DIR</td>
! 13640: <td>RCD_ORDER</td>
! 13641: </tr>
! 13642: <tr>
1.347 gutterid 13643: <td>RCD_SCRIPTS</td>
1.354 gutterid 13644: <td>RCD_SCRIPTS_DIR</td>
1.333 nia 13645: </tr>
13646: <tr>
1.347 gutterid 13647: <td>RCD_SCRIPTS_EXAMPLEDIR</td>
1.354 gutterid 13648: <td>RCD_SCRIPTS_MODE</td>
1.342 wiz 13649: </tr>
13650: <tr>
1.347 gutterid 13651: <td>RCD_SCRIPTS_SHELL</td>
1.354 gutterid 13652: <td>RCD_SCRIPT_SRC</td>
1.269 leot 13653: </tr>
13654: <tr>
1.355 ! rillig 13655: <td>RCD_SUBR</td>
1.353 dholland 13656: <td>RDOC</td>
1.355 ! rillig 13657: </tr>
! 13658: <tr>
1.352 wiz 13659: <td>READLINE_DEFAULT</td>
1.355 ! rillig 13660: <td>READLINE_TYPE</td>
1.329 leot 13661: </tr>
13662: <tr>
1.352 wiz 13663: <td>REAL_ROOT_GROUP</td>
1.355 ! rillig 13664: <td>REAL_ROOT_USER</td>
1.320 wiz 13665: </tr>
13666: <tr>
1.352 wiz 13667: <td>RECURSIVE_MAKE</td>
1.355 ! rillig 13668: <td>RELAY_CTRL_DIR</td>
1.338 nia 13669: </tr>
13670: <tr>
1.352 wiz 13671: <td>RELRO_SUPPORTED</td>
1.355 ! rillig 13672: <td>REPLACE_AWK</td>
1.292 leot 13673: </tr>
13674: <tr>
1.352 wiz 13675: <td>REPLACE_BASH</td>
1.355 ! rillig 13676: <td>REPLACE_CSH</td>
1.329 leot 13677: </tr>
13678: <tr>
1.352 wiz 13679: <td>REPLACE_KSH</td>
1.355 ! rillig 13680: <td>REPLACE_LUA</td>
1.327 wiz 13681: </tr>
13682: <tr>
1.352 wiz 13683: <td>REPLACE_NODEJS</td>
1.355 ! rillig 13684: <td>REPLACE_OCTAVE</td>
1.269 leot 13685: </tr>
13686: <tr>
1.352 wiz 13687: <td>REPLACE_PERL</td>
1.355 ! rillig 13688: <td>REPLACE_PERL6</td>
1.320 wiz 13689: </tr>
13690: <tr>
1.352 wiz 13691: <td>REPLACE_PHP</td>
1.355 ! rillig 13692: <td>REPLACE_PYTHON</td>
1.311 leot 13693: </tr>
13694: <tr>
1.352 wiz 13695: <td>REPLACE_QORE</td>
1.355 ! rillig 13696: <td>REPLACE_R</td>
1.269 leot 13697: </tr>
13698: <tr>
1.352 wiz 13699: <td>REPLACE_RUBY</td>
1.355 ! rillig 13700: <td>REPLACE_RUBY_DIRS</td>
1.333 nia 13701: </tr>
13702: <tr>
1.352 wiz 13703: <td>REPLACE_RUBY_PAT</td>
1.355 ! rillig 13704: <td>REPLACE_SH</td>
1.269 leot 13705: </tr>
13706: <tr>
1.352 wiz 13707: <td>REPLACE_TEXLUA</td>
1.355 ! rillig 13708: <td>REPLACE_WISH</td>
1.331 gutterid 13709: </tr>
13710: <tr>
1.352 wiz 13711: <td>REQD_DIRS</td>
1.355 ! rillig 13712: <td>REQD_DIRS_PERMS</td>
1.269 leot 13713: </tr>
13714: <tr>
1.352 wiz 13715: <td>REQD_FILES</td>
1.355 ! rillig 13716: <td>REQD_FILES_MODE</td>
1.333 nia 13717: </tr>
13718: <tr>
1.352 wiz 13719: <td>REQD_FILES_PERMS</td>
1.355 ! rillig 13720: <td>RESOLV_AUTO_VARS</td>
1.269 leot 13721: </tr>
13722: <tr>
1.352 wiz 13723: <td>RESOLV_LDFLAGS</td>
1.355 ! rillig 13724: <td>RESOLV_LIBS</td>
1.269 leot 13725: </tr>
13726: <tr>
1.352 wiz 13727: <td>RM</td>
1.355 ! rillig 13728: <td>ROCKSPEC_NAME</td>
1.352 wiz 13729: </tr>
13730: <tr>
1.355 ! rillig 13731: <td>ROCKSPEC_SPECFILE</td>
1.347 gutterid 13732: <td>ROOT_CMD</td>
1.355 ! rillig 13733: </tr>
! 13734: <tr>
1.352 wiz 13735: <td>ROOT_GROUP</td>
1.355 ! rillig 13736: <td>ROOT_USER</td>
1.269 leot 13737: </tr>
13738: <tr>
1.352 wiz 13739: <td>RPCGEN</td>
1.355 ! rillig 13740: <td>RPM</td>
1.269 leot 13741: </tr>
13742: <tr>
1.352 wiz 13743: <td>RPM2PKG_PLIST</td>
1.355 ! rillig 13744: <td>RPM2PKG_PREFIX</td>
1.320 wiz 13745: </tr>
13746: <tr>
1.352 wiz 13747: <td>RPM2PKG_STAGE</td>
1.355 ! rillig 13748: <td>RPM2PKG_STRIP</td>
1.332 rillig 13749: </tr>
13750: <tr>
1.352 wiz 13751: <td>RPM2PKG_SUBPREFIX</td>
1.355 ! rillig 13752: <td>RPMFILES</td>
1.329 leot 13753: </tr>
13754: <tr>
1.352 wiz 13755: <td>RPMIGNOREPATH</td>
1.355 ! rillig 13756: <td>RPM_DB_PREFIX</td>
1.327 wiz 13757: </tr>
13758: <tr>
1.352 wiz 13759: <td>RSSH_CVS_PATH</td>
1.355 ! rillig 13760: <td>RSSH_RDIST_PATH</td>
1.269 leot 13761: </tr>
13762: <tr>
1.352 wiz 13763: <td>RSSH_RSYNC_PATH</td>
1.355 ! rillig 13764: <td>RSSH_SCP_PATH</td>
1.311 leot 13765: </tr>
13766: <tr>
1.352 wiz 13767: <td>RSSH_SFTP_SERVER_PATH</td>
1.355 ! rillig 13768: <td>RUBY</td>
1.269 leot 13769: </tr>
13770: <tr>
1.352 wiz 13771: <td>RUBYGEM</td>
1.355 ! rillig 13772: <td>RUBYGEM_MANPAGES</td>
1.269 leot 13773: </tr>
13774: <tr>
1.352 wiz 13775: <td>RUBYGEM_NAME</td>
1.355 ! rillig 13776: <td>RUBYGEM_OPTIONS</td>
1.269 leot 13777: </tr>
13778: <tr>
1.352 wiz 13779: <td>RUBYGEM_USE_MANPAGES</td>
1.355 ! rillig 13780: <td>RUBYGEM_VERBOSE</td>
1.346 jnemeth 13781: </tr>
13782: <tr>
1.352 wiz 13783: <td>RUBY_ABI_VERSION</td>
1.355 ! rillig 13784: <td>RUBY_ARCH</td>
1.269 leot 13785: </tr>
13786: <tr>
1.352 wiz 13787: <td>RUBY_ARCHINC</td>
1.355 ! rillig 13788: <td>RUBY_ARCHLIB</td>
1.269 leot 13789: </tr>
13790: <tr>
1.352 wiz 13791: <td>RUBY_BASE</td>
1.355 ! rillig 13792: <td>RUBY_BASERIDIR</td>
1.269 leot 13793: </tr>
13794: <tr>
1.352 wiz 13795: <td>RUBY_BUILD_DOCUMENT</td>
1.355 ! rillig 13796: <td>RUBY_DLEXT</td>
1.269 leot 13797: </tr>
13798: <tr>
1.352 wiz 13799: <td>RUBY_DOC</td>
1.355 ! rillig 13800: <td>RUBY_DYNAMIC_DIRS</td>
1.269 leot 13801: </tr>
13802: <tr>
1.352 wiz 13803: <td>RUBY_EG</td>
1.355 ! rillig 13804: <td>RUBY_ENCODING_ARG</td>
1.269 leot 13805: </tr>
13806: <tr>
1.352 wiz 13807: <td>RUBY_EXTCONF</td>
1.355 ! rillig 13808: <td>RUBY_EXTCONF_CHECK</td>
1.269 leot 13809: </tr>
13810: <tr>
1.352 wiz 13811: <td>RUBY_EXTCONF_DEBUG</td>
1.355 ! rillig 13812: <td>RUBY_EXTCONF_MAKEFILE</td>
1.269 leot 13813: </tr>
13814: <tr>
1.352 wiz 13815: <td>RUBY_GEM_ARCH</td>
1.355 ! rillig 13816: <td>RUBY_GEM_BASE</td>
1.269 leot 13817: </tr>
13818: <tr>
1.352 wiz 13819: <td>RUBY_INC</td>
1.355 ! rillig 13820: <td>RUBY_LIB</td>
1.269 leot 13821: </tr>
13822: <tr>
1.352 wiz 13823: <td>RUBY_LIB_BASE</td>
1.355 ! rillig 13824: <td>RUBY_NAME</td>
1.269 leot 13825: </tr>
13826: <tr>
1.352 wiz 13827: <td>RUBY_NOVERSION</td>
1.355 ! rillig 13828: <td>RUBY_PKGPREFIX</td>
1.269 leot 13829: </tr>
13830: <tr>
1.352 wiz 13831: <td>RUBY_RAILS</td>
1.355 ! rillig 13832: <td>RUBY_RAILS52_VERSION</td>
1.338 nia 13833: </tr>
13834: <tr>
1.352 wiz 13835: <td>RUBY_RAILS60_VERSION</td>
1.355 ! rillig 13836: <td>RUBY_RAILS61_VERSION</td>
1.269 leot 13837: </tr>
13838: <tr>
1.352 wiz 13839: <td>RUBY_RAILS70_VERSION</td>
1.355 ! rillig 13840: <td>RUBY_RAILS_ACCEPTED</td>
1.269 leot 13841: </tr>
13842: <tr>
1.352 wiz 13843: <td>RUBY_RAILS_DEFAULT</td>
1.355 ! rillig 13844: <td>RUBY_RAILS_REQD</td>
1.269 leot 13845: </tr>
13846: <tr>
1.352 wiz 13847: <td>RUBY_RAILS_STRICT_DEP</td>
1.355 ! rillig 13848: <td>RUBY_RIDIR</td>
1.269 leot 13849: </tr>
13850: <tr>
1.352 wiz 13851: <td>RUBY_SETUP</td>
1.355 ! rillig 13852: <td>RUBY_SHLIB</td>
1.269 leot 13853: </tr>
13854: <tr>
1.352 wiz 13855: <td>RUBY_SHLIBALIAS</td>
1.355 ! rillig 13856: <td>RUBY_SHLIBVER</td>
1.269 leot 13857: </tr>
13858: <tr>
1.352 wiz 13859: <td>RUBY_SIMPLE_INSTALL</td>
1.355 ! rillig 13860: <td>RUBY_SITEARCHLIB</td>
1.269 leot 13861: </tr>
13862: <tr>
1.352 wiz 13863: <td>RUBY_SITELIB</td>
1.355 ! rillig 13864: <td>RUBY_SITELIB_BASE</td>
1.269 leot 13865: </tr>
13866: <tr>
1.352 wiz 13867: <td>RUBY_SITERIDIR</td>
1.355 ! rillig 13868: <td>RUBY_SLEXT</td>
1.312 gdt 13869: </tr>
13870: <tr>
1.352 wiz 13871: <td>RUBY_SRCDIR</td>
1.355 ! rillig 13872: <td>RUBY_STATICLIB</td>
1.289 leot 13873: </tr>
13874: <tr>
1.352 wiz 13875: <td>RUBY_SUFFIX</td>
1.355 ! rillig 13876: <td>RUBY_SYSRIDIR</td>
1.269 leot 13877: </tr>
13878: <tr>
1.352 wiz 13879: <td>RUBY_USE_PTHREAD</td>
1.355 ! rillig 13880: <td>RUBY_VENDORARCHLIB</td>
1.269 leot 13881: </tr>
13882: <tr>
1.352 wiz 13883: <td>RUBY_VENDORLIB</td>
1.355 ! rillig 13884: <td>RUBY_VENDORLIB_BASE</td>
1.269 leot 13885: </tr>
13886: <tr>
1.352 wiz 13887: <td>RUBY_VER</td>
1.355 ! rillig 13888: <td>RUBY_VERSION</td>
1.269 leot 13889: </tr>
13890: <tr>
1.352 wiz 13891: <td>RUBY_VERSIONS_ACCEPTED</td>
1.355 ! rillig 13892: <td>RUBY_VERSIONS_INCOMPATIBLE</td>
1.269 leot 13893: </tr>
13894: <tr>
1.352 wiz 13895: <td>RUBY_VERSION_DEFAULT</td>
1.355 ! rillig 13896: <td>RUBY_VERSION_REQD</td>
1.269 leot 13897: </tr>
13898: <tr>
1.352 wiz 13899: <td>RUBY_VER_DIR</td>
1.355 ! rillig 13900: <td>RUN</td>
1.269 leot 13901: </tr>
13902: <tr>
1.352 wiz 13903: <td>RUN_LDCONFIG</td>
1.355 ! rillig 13904: <td>RUST_TYPE</td>
1.269 leot 13905: </tr>
13906: <tr>
1.352 wiz 13907: <td>SCO</td>
1.355 ! rillig 13908: <td>SCREWS_GROUP</td>
1.269 leot 13909: </tr>
13910: <tr>
1.352 wiz 13911: <td>SCREWS_USER</td>
1.355 ! rillig 13912: <td>SCRIPTS_ENV</td>
1.269 leot 13913: </tr>
13914: <tr>
1.352 wiz 13915: <td>SCROLLKEEPER_DATADIR</td>
1.355 ! rillig 13916: <td>SCROLLKEEPER_REBUILDDB</td>
1.269 leot 13917: </tr>
13918: <tr>
1.352 wiz 13919: <td>SCROLLKEEPER_UPDATEDB</td>
1.355 ! rillig 13920: <td>SDIST_PAWD</td>
1.269 leot 13921: </tr>
13922: <tr>
1.352 wiz 13923: <td>SDL12_TYPE</td>
1.355 ! rillig 13924: <td>SERIAL_DEVICES</td>
1.269 leot 13925: </tr>
13926: <tr>
1.352 wiz 13927: <td>SETGIDGAME</td>
1.355 ! rillig 13928: <td>SETGID_GAMES_PERMS</td>
1.269 leot 13929: </tr>
13930: <tr>
1.352 wiz 13931: <td>SETUID_ROOT_PERMS</td>
1.355 ! rillig 13932: <td>SH</td>
1.269 leot 13933: </tr>
13934: <tr>
1.352 wiz 13935: <td>SHLIB</td>
1.355 ! rillig 13936: <td>SHORTNAME</td>
1.348 wiz 13937: </tr>
13938: <tr>
1.347 gutterid 13939: <td>SIGN_PACKAGES</td>
1.353 dholland 13940: <td>SILC_CLIENT_WITH_PERL</td>
1.269 leot 13941: </tr>
13942: <tr>
1.347 gutterid 13943: <td>SITE_SPECIFIC_PKGS</td>
1.353 dholland 13944: <td>SKIP_DEPENDS</td>
1.342 wiz 13945: </tr>
13946: <tr>
1.347 gutterid 13947: <td>SMF_INSTANCES</td>
1.353 dholland 13948: <td>SMF_MANIFEST</td>
1.269 leot 13949: </tr>
13950: <tr>
1.347 gutterid 13951: <td>SMF_METHODS</td>
1.353 dholland 13952: <td>SMF_METHOD_SHELL</td>
1.269 leot 13953: </tr>
13954: <tr>
1.347 gutterid 13955: <td>SMF_METHOD_SRC</td>
1.353 dholland 13956: <td>SMF_NAME</td>
1.292 leot 13957: </tr>
13958: <tr>
1.347 gutterid 13959: <td>SMF_PREFIX</td>
1.353 dholland 13960: <td>SMF_SRCDIR</td>
1.269 leot 13961: </tr>
13962: <tr>
1.347 gutterid 13963: <td>SNIPROXY_GROUP</td>
1.353 dholland 13964: <td>SNIPROXY_USER</td>
1.332 rillig 13965: </tr>
13966: <tr>
1.347 gutterid 13967: <td>SOURCE_BUFFSIZE</td>
1.353 dholland 13968: <td>SPECIAL_PERMS</td>
1.269 leot 13969: </tr>
13970: <tr>
1.347 gutterid 13971: <td>SPECIFIC_PKGS</td>
1.353 dholland 13972: <td>SSH_SUID</td>
1.274 rillig 13973: </tr>
13974: <tr>
1.347 gutterid 13975: <td>SSP_SUPPORTED</td>
1.353 dholland 13976: <td>SSYNC_PAWD</td>
1.269 leot 13977: </tr>
13978: <tr>
1.347 gutterid 13979: <td>STEP_MSG</td>
1.353 dholland 13980: <td>STRIP</td>
1.269 leot 13981: </tr>
13982: <tr>
1.347 gutterid 13983: <td>STRIP_DBG</td>
1.353 dholland 13984: <td>STRIP_DEBUG</td>
1.269 leot 13985: </tr>
13986: <tr>
1.347 gutterid 13987: <td>STRIP_DEBUG_SUPPORTED</td>
1.353 dholland 13988: <td>STRIP_FILES_SKIP</td>
1.269 leot 13989: </tr>
13990: <tr>
1.347 gutterid 13991: <td>SU</td>
1.353 dholland 13992: <td>SUBDIR</td>
1.269 leot 13993: </tr>
13994: <tr>
1.347 gutterid 13995: <td>SUBST</td>
1.353 dholland 13996: <td>SUBST_CLASSES</td>
1.269 leot 13997: </tr>
13998: <tr>
1.347 gutterid 13999: <td>SUBST_FILES</td>
1.353 dholland 14000: <td>SUBST_FILTER_CMD</td>
1.269 leot 14001: </tr>
14002: <tr>
1.347 gutterid 14003: <td>SUBST_MESSAGE</td>
1.353 dholland 14004: <td>SUBST_NOOP_OK</td>
1.269 leot 14005: </tr>
14006: <tr>
1.347 gutterid 14007: <td>SUBST_SED</td>
1.353 dholland 14008: <td>SUBST_SHOW_DIFF</td>
1.269 leot 14009: </tr>
14010: <tr>
1.347 gutterid 14011: <td>SUBST_SKIP_TEXT_CHECK</td>
1.353 dholland 14012: <td>SUBST_STAGE</td>
1.269 leot 14013: </tr>
14014: <tr>
1.347 gutterid 14015: <td>SUBST_VARS</td>
1.353 dholland 14016: <td>SUNWSPROBASE</td>
1.269 leot 14017: </tr>
14018: <tr>
1.347 gutterid 14019: <td>SUSE_PREFER</td>
1.351 gutterid 14020: <td>SU_CMD</td>
1.352 wiz 14021: </tr>
14022: <tr>
1.355 ! rillig 14023: <td>SVN_EXTRACTDIR</td>
! 14024: <td>SVN_REPO</td>
! 14025: </tr>
! 14026: <tr>
! 14027: <td>SVN_REPOSITORIES</td>
! 14028: <td>SVN_REVISION</td>
! 14029: </tr>
! 14030: <tr>
1.347 gutterid 14031: <td>SYSCONFBASE</td>
1.353 dholland 14032: <td>TARGET_ARCH</td>
1.269 leot 14033: </tr>
14034: <tr>
1.347 gutterid 14035: <td>TBL</td>
1.353 dholland 14036: <td>TERMCAP_TYPE</td>
1.342 wiz 14037: </tr>
14038: <tr>
1.347 gutterid 14039: <td>TERMINFO_DEFAULT</td>
1.353 dholland 14040: <td>TERMINFO_TYPE</td>
1.269 leot 14041: </tr>
14042: <tr>
1.347 gutterid 14043: <td>TEST</td>
1.353 dholland 14044: <td>TEST_DEPENDS</td>
1.332 rillig 14045: </tr>
14046: <tr>
1.347 gutterid 14047: <td>TEST_DIRS</td>
1.353 dholland 14048: <td>TEST_ENV</td>
1.327 wiz 14049: </tr>
14050: <tr>
1.347 gutterid 14051: <td>TEST_ENV_SHELL</td>
1.353 dholland 14052: <td>TEST_MAKE_CMD</td>
1.332 rillig 14053: </tr>
14054: <tr>
1.347 gutterid 14055: <td>TEST_MAKE_FLAGS</td>
1.353 dholland 14056: <td>TEST_TARGET</td>
1.320 wiz 14057: </tr>
14058: <tr>
1.347 gutterid 14059: <td>TEXLIVE_IGNORE_PATTERNS</td>
1.353 dholland 14060: <td>TEXLIVE_REV</td>
1.303 bacon 14061: </tr>
14062: <tr>
1.347 gutterid 14063: <td>TEXLIVE_UNVERSIONED</td>
1.353 dholland 14064: <td>TEXMFSITE</td>
1.274 rillig 14065: </tr>
14066: <tr>
1.347 gutterid 14067: <td>TEX_FORMATS</td>
1.353 dholland 14068: <td>TEX_HYPHEN_DAT</td>
1.269 leot 14069: </tr>
14070: <tr>
1.347 gutterid 14071: <td>TEX_HYPHEN_DEF</td>
1.353 dholland 14072: <td>TEX_TEXMF_DIRS</td>
1.269 leot 14073: </tr>
14074: <tr>
1.347 gutterid 14075: <td>THTTPD_LOG_FACILITY</td>
1.353 dholland 14076: <td>TINYDYN_USER</td>
1.269 leot 14077: </tr>
14078: <tr>
1.347 gutterid 14079: <td>TLSWRAPPER_CHROOT</td>
1.353 dholland 14080: <td>TO</td>
1.269 leot 14081: </tr>
14082: <tr>
1.347 gutterid 14083: <td>TOOLS_ALIASES</td>
1.353 dholland 14084: <td>TOOLS_ALWAYS_WRAP</td>
1.269 leot 14085: </tr>
14086: <tr>
1.347 gutterid 14087: <td>TOOLS_ARGS</td>
1.353 dholland 14088: <td>TOOLS_BROKEN</td>
1.269 leot 14089: </tr>
14090: <tr>
1.347 gutterid 14091: <td>TOOLS_CMD</td>
1.353 dholland 14092: <td>TOOLS_CMDLINE_SED</td>
1.269 leot 14093: </tr>
14094: <tr>
1.347 gutterid 14095: <td>TOOLS_CREATE</td>
1.353 dholland 14096: <td>TOOLS_CROSS_DESTDIR</td>
1.269 leot 14097: </tr>
14098: <tr>
1.347 gutterid 14099: <td>TOOLS_DIR</td>
1.353 dholland 14100: <td>TOOLS_FAIL</td>
1.269 leot 14101: </tr>
14102: <tr>
1.347 gutterid 14103: <td>TOOLS_GNU_MISSING</td>
1.353 dholland 14104: <td>TOOLS_LDCONFIG</td>
1.269 leot 14105: </tr>
14106: <tr>
1.347 gutterid 14107: <td>TOOLS_NOOP</td>
1.353 dholland 14108: <td>TOOLS_PATH</td>
1.269 leot 14109: </tr>
14110: <tr>
1.347 gutterid 14111: <td>TOOLS_SCRIPT</td>
1.353 dholland 14112: <td>TOOLS_USE_CROSS_COMPILE</td>
1.269 leot 14113: </tr>
14114: <tr>
1.347 gutterid 14115: <td>TOOL_DEPENDS</td>
1.355 ! rillig 14116: <td>TTF_FONTDIR</td>
! 14117: </tr>
! 14118: <tr>
1.351 gutterid 14119: <td>TTF_FONTS_DIR</td>
1.355 ! rillig 14120: <td>TYPE</td>
1.352 wiz 14121: </tr>
14122: <tr>
14123: <td>UAC_REQD_EXECS</td>
1.355 ! rillig 14124: <td>UCSPI_SSL_GROUP</td>
1.269 leot 14125: </tr>
14126: <tr>
1.352 wiz 14127: <td>UCSPI_SSL_USER</td>
1.355 ! rillig 14128: <td>UNLIMIT_RESOURCES</td>
1.338 nia 14129: </tr>
14130: <tr>
1.352 wiz 14131: <td>UNPRIVILEGED</td>
1.355 ! rillig 14132: <td>UNPRIVILEGED_GROUP</td>
1.269 leot 14133: </tr>
14134: <tr>
1.352 wiz 14135: <td>UNPRIVILEGED_GROUPS</td>
1.355 ! rillig 14136: <td>UNPRIVILEGED_USER</td>
1.327 wiz 14137: </tr>
14138: <tr>
1.352 wiz 14139: <td>UNWRAP_FILES</td>
1.355 ! rillig 14140: <td>UNWRAP_PATTERNS</td>
1.269 leot 14141: </tr>
14142: <tr>
1.352 wiz 14143: <td>UPDATE_GEMSPEC</td>
1.355 ! rillig 14144: <td>UPDATE_TARGET</td>
1.269 leot 14145: </tr>
14146: <tr>
1.352 wiz 14147: <td>URI</td>
1.355 ! rillig 14148: <td>USERGROUP_PHASE</td>
1.269 leot 14149: </tr>
14150: <tr>
1.352 wiz 14151: <td>USERPPP_GROUP</td>
1.355 ! rillig 14152: <td>USER_SPECIFIC_PKGS</td>
1.269 leot 14153: </tr>
14154: <tr>
1.352 wiz 14155: <td>USE_ABI_DEPENDS</td>
1.355 ! rillig 14156: <td>USE_APR</td>
1.269 leot 14157: </tr>
14158: <tr>
1.352 wiz 14159: <td>USE_BSD_MAKEFILE</td>
1.355 ! rillig 14160: <td>USE_BUILTIN</td>
1.269 leot 14161: </tr>
14162: <tr>
1.352 wiz 14163: <td>USE_CROSS_COMPILE</td>
1.355 ! rillig 14164: <td>USE_CURSES</td>
1.269 leot 14165: </tr>
14166: <tr>
1.352 wiz 14167: <td>USE_CWRAPPERS</td>
1.355 ! rillig 14168: <td>USE_DB185</td>
1.269 leot 14169: </tr>
14170: <tr>
1.352 wiz 14171: <td>USE_FEATURES</td>
1.355 ! rillig 14172: <td>USE_GAMESGROUP</td>
1.269 leot 14173: </tr>
14174: <tr>
1.352 wiz 14175: <td>USE_GCC_RUNTIME</td>
1.355 ! rillig 14176: <td>USE_IMAKE</td>
1.320 wiz 14177: </tr>
14178: <tr>
1.352 wiz 14179: <td>USE_JAVA</td>
1.355 ! rillig 14180: <td>USE_JAVA2</td>
1.269 leot 14181: </tr>
14182: <tr>
1.352 wiz 14183: <td>USE_LANGUAGES</td>
1.355 ! rillig 14184: <td>USE_LIBTOOL</td>
1.269 leot 14185: </tr>
14186: <tr>
1.352 wiz 14187: <td>USE_NATIVE_GCC</td>
1.355 ! rillig 14188: <td>USE_NETBSD_REPO</td>
1.269 leot 14189: </tr>
14190: <tr>
1.352 wiz 14191: <td>USE_PKGSRC_GCC</td>
1.355 ! rillig 14192: <td>USE_PKGSRC_GCC_RUNTIME</td>
1.269 leot 14193: </tr>
14194: <tr>
1.352 wiz 14195: <td>USE_PKGTASKS</td>
1.355 ! rillig 14196: <td>USE_PKG_ADMIN_DIGEST</td>
1.269 leot 14197: </tr>
14198: <tr>
1.352 wiz 14199: <td>USE_RUBY_EXTCONF</td>
1.355 ! rillig 14200: <td>USE_RUBY_INSTALL</td>
1.269 leot 14201: </tr>
14202: <tr>
1.352 wiz 14203: <td>USE_RUBY_SETUP</td>
1.355 ! rillig 14204: <td>USE_RUBY_SETUP_PKG</td>
1.269 leot 14205: </tr>
14206: <tr>
1.352 wiz 14207: <td>USE_TOOLS</td>
1.355 ! rillig 14208: <td>UUCP_GROUP</td>
1.269 leot 14209: </tr>
14210: <tr>
1.352 wiz 14211: <td>UUCP_USER</td>
1.355 ! rillig 14212: <td>VARBASE</td>
1.269 leot 14213: </tr>
14214: <tr>
1.352 wiz 14215: <td>VARNAME</td>
1.355 ! rillig 14216: <td>VIM_EXTRA_OPTS</td>
1.269 leot 14217: </tr>
14218: <tr>
1.352 wiz 14219: <td>WARNING_MSG</td>
1.355 ! rillig 14220: <td>WCALC_CGIDIR</td>
1.269 leot 14221: </tr>
14222: <tr>
1.352 wiz 14223: <td>WCALC_CGIPATH</td>
1.355 ! rillig 14224: <td>WCALC_HTMLDIR</td>
1.269 leot 14225: </tr>
14226: <tr>
1.352 wiz 14227: <td>WCALC_HTMLPATH</td>
1.355 ! rillig 14228: <td>WDM_MANAGERS</td>
1.269 leot 14229: </tr>
14230: <tr>
1.352 wiz 14231: <td>WRAPPER_CC</td>
1.355 ! rillig 14232: <td>WRAPPER_REORDER_CMDS</td>
1.269 leot 14233: </tr>
14234: <tr>
1.352 wiz 14235: <td>WRKDIR</td>
1.355 ! rillig 14236: <td>WRKDIR_BASENAME</td>
1.269 leot 14237: </tr>
14238: <tr>
1.352 wiz 14239: <td>WRKDIR_LOCKTYPE</td>
1.355 ! rillig 14240: <td>WRKLOG</td>
1.269 leot 14241: </tr>
14242: <tr>
1.352 wiz 14243: <td>WRKOBJDIR</td>
1.355 ! rillig 14244: <td>WRKSRC</td>
1.269 leot 14245: </tr>
14246: <tr>
1.352 wiz 14247: <td>X10_PORT</td>
1.355 ! rillig 14248: <td>X11</td>
1.269 leot 14249: </tr>
14250: <tr>
1.352 wiz 14251: <td>X11BASE</td>
1.355 ! rillig 14252: <td>X11_PKGSRCDIR</td>
1.269 leot 14253: </tr>
14254: <tr>
1.352 wiz 14255: <td>X11_TYPE</td>
1.355 ! rillig 14256: <td>X509_CERTIFICATE</td>
1.303 bacon 14257: </tr>
14258: <tr>
1.352 wiz 14259: <td>X509_KEY</td>
1.355 ! rillig 14260: <td>XAW_TYPE</td>
1.269 leot 14261: </tr>
14262: <tr>
1.352 wiz 14263: <td>XLOCK_DEFAULT_MODE</td>
1.355 ! rillig 14264: <td>XMKMF</td>
1.269 leot 14265: </tr>
14266: <tr>
1.352 wiz 14267: <td>XMKMF_FLAGS</td>
1.355 ! rillig 14268: <td>XXX</td>
1.269 leot 14269: </tr>
14270: <tr>
1.355 ! rillig 14271: <td>XXXX</td>
1.353 dholland 14272: <td>YES</td>
1.348 wiz 14273: </tr>
14274: <tr>
1.347 gutterid 14275: <td>ZSH_STATIC</td>
1.353 dholland 14276: <td>__stdc__</td>
1.269 leot 14277: </tr>
14278: <tr>
1.347 gutterid 14279: <td>_vargroups</td>
1.353 dholland 14280: <td>accept</td>
1.342 wiz 14281: </tr>
14282: <tr>
1.347 gutterid 14283: <td>acquire-localbase-lock</td>
1.353 dholland 14284: <td>acquire-lock</td>
1.269 leot 14285: </tr>
14286: <tr>
1.347 gutterid 14287: <td>add</td>
1.353 dholland 14288: <td>added</td>
1.274 rillig 14289: </tr>
14290: <tr>
1.347 gutterid 14291: <td>administrator</td>
1.353 dholland 14292: <td>alloca</td>
1.332 rillig 14293: </tr>
14294: <tr>
1.347 gutterid 14295: <td>alternatives</td>
1.353 dholland 14296: <td>aslr</td>
1.269 leot 14297: </tr>
14298: <tr>
1.347 gutterid 14299: <td>asprintf</td>
1.353 dholland 14300: <td>atlas</td>
1.316 cirnatda 14301: </tr>
14302: <tr>
1.347 gutterid 14303: <td>autoconf</td>
1.353 dholland 14304: <td>automake</td>
1.289 leot 14305: </tr>
14306: <tr>
1.347 gutterid 14307: <td>autoreconf</td>
1.353 dholland 14308: <td>awk</td>
1.269 leot 14309: </tr>
14310: <tr>
1.347 gutterid 14311: <td>bash</td>
1.353 dholland 14312: <td>big-endian</td>
1.269 leot 14313: </tr>
14314: <tr>
1.347 gutterid 14315: <td>bin-install</td>
1.353 dholland 14316: <td>bind</td>
1.289 leot 14317: </tr>
14318: <tr>
1.347 gutterid 14319: <td>binpkg-list</td>
1.353 dholland 14320: <td>blas</td>
1.269 leot 14321: </tr>
14322: <tr>
1.347 gutterid 14323: <td>bootstrap-depends</td>
1.353 dholland 14324: <td>broken</td>
1.269 leot 14325: </tr>
14326: <tr>
1.347 gutterid 14327: <td>broken_on_platform</td>
1.353 dholland 14328: <td>bsd</td>
1.269 leot 14329: </tr>
14330: <tr>
1.347 gutterid 14331: <td>bsd.prog.mk</td>
1.353 dholland 14332: <td>build</td>
1.271 brook 14333: </tr>
14334: <tr>
1.347 gutterid 14335: <td>build-env</td>
1.353 dholland 14336: <td>buildlink-directories</td>
1.269 leot 14337: </tr>
14338: <tr>
1.347 gutterid 14339: <td>buildlink-oss-soundcard-h</td>
1.353 dholland 14340: <td>c</td>
1.292 leot 14341: </tr>
14342: <tr>
1.347 gutterid 14343: <td>c++</td>
1.353 dholland 14344: <td>ccache</td>
1.274 rillig 14345: </tr>
14346: <tr>
1.347 gutterid 14347: <td>cce</td>
1.353 dholland 14348: <td>cdefs</td>
1.269 leot 14349: </tr>
14350: <tr>
1.347 gutterid 14351: <td>ceil</td>
1.353 dholland 14352: <td>changes</td>
1.289 leot 14353: </tr>
14354: <tr>
1.347 gutterid 14355: <td>changes-entry</td>
1.353 dholland 14356: <td>changes-entry-noupdate</td>
1.269 leot 14357: </tr>
14358: <tr>
1.347 gutterid 14359: <td>check</td>
1.353 dholland 14360: <td>check-clean</td>
1.269 leot 14361: </tr>
14362: <tr>
1.347 gutterid 14363: <td>check-files</td>
1.353 dholland 14364: <td>check-files-clean</td>
1.269 leot 14365: </tr>
14366: <tr>
1.347 gutterid 14367: <td>check-vulnerable</td>
1.353 dholland 14368: <td>checksum</td>
1.269 leot 14369: </tr>
14370: <tr>
1.347 gutterid 14371: <td>checksum-phase</td>
1.353 dholland 14372: <td>clean</td>
1.289 leot 14373: </tr>
14374: <tr>
1.347 gutterid 14375: <td>clean-depends</td>
1.353 dholland 14376: <td>cleandir</td>
1.269 leot 14377: </tr>
14378: <tr>
1.347 gutterid 14379: <td>commit</td>
1.353 dholland 14380: <td>commit-changes-entry</td>
1.269 leot 14381: </tr>
14382: <tr>
1.347 gutterid 14383: <td>compact</td>
1.353 dholland 14384: <td>compiler</td>
1.269 leot 14385: </tr>
14386: <tr>
1.347 gutterid 14387: <td>conf</td>
1.353 dholland 14388: <td>config.guess</td>
1.269 leot 14389: </tr>
14390: <tr>
1.347 gutterid 14391: <td>config.sub</td>
1.353 dholland 14392: <td>configuration</td>
1.269 leot 14393: </tr>
14394: <tr>
1.347 gutterid 14395: <td>configure</td>
1.353 dholland 14396: <td>configure-env</td>
1.269 leot 14397: </tr>
14398: <tr>
1.347 gutterid 14399: <td>configure-help</td>
1.353 dholland 14400: <td>configure_args</td>
1.269 leot 14401: </tr>
14402: <tr>
1.347 gutterid 14403: <td>connect</td>
1.353 dholland 14404: <td>cos</td>
1.269 leot 14405: </tr>
14406: <tr>
1.347 gutterid 14407: <td>cpe</td>
1.353 dholland 14408: <td>cputime</td>
1.269 leot 14409: </tr>
14410: <tr>
1.344 gutterid 14411: <td>create-usergroup</td>
1.353 dholland 14412: <td>csh</td>
1.269 leot 14413: </tr>
14414: <tr>
1.344 gutterid 14415: <td>ctf</td>
1.355 ! rillig 14416: <td>cvs</td>
! 14417: </tr>
! 14418: <tr>
1.351 gutterid 14419: <td>debug</td>
1.355 ! rillig 14420: <td>declaration</td>
1.352 wiz 14421: </tr>
14422: <tr>
14423: <td>declare</td>
1.355 ! rillig 14424: <td>defined</td>
1.338 nia 14425: </tr>
14426: <tr>
1.352 wiz 14427: <td>depend</td>
1.355 ! rillig 14428: <td>dependencies</td>
1.289 leot 14429: </tr>
14430: <tr>
1.352 wiz 14431: <td>depends</td>
1.355 ! rillig 14432: <td>depends-checksum</td>
1.329 leot 14433: </tr>
14434: <tr>
1.352 wiz 14435: <td>depends-fetch</td>
1.355 ! rillig 14436: <td>deps</td>
1.320 wiz 14437: </tr>
14438: <tr>
1.352 wiz 14439: <td>describe</td>
1.355 ! rillig 14440: <td>destdir</td>
1.269 leot 14441: </tr>
14442: <tr>
1.352 wiz 14443: <td>disable</td>
1.355 ! rillig 14444: <td>distclean</td>
1.311 leot 14445: </tr>
14446: <tr>
1.352 wiz 14447: <td>distinfo</td>
1.355 ! rillig 14448: <td>dl</td>
1.269 leot 14449: </tr>
14450: <tr>
1.352 wiz 14451: <td>dlopen</td>
1.355 ! rillig 14452: <td>do-buildlink</td>
1.269 leot 14453: </tr>
14454: <tr>
1.352 wiz 14455: <td>do-clean</td>
1.355 ! rillig 14456: <td>do-configure</td>
1.269 leot 14457: </tr>
14458: <tr>
1.352 wiz 14459: <td>do-configure-post-hook</td>
1.355 ! rillig 14460: <td>do-extract</td>
1.269 leot 14461: </tr>
14462: <tr>
1.352 wiz 14463: <td>do-fetch</td>
1.355 ! rillig 14464: <td>do-install</td>
1.269 leot 14465: </tr>
14466: <tr>
1.352 wiz 14467: <td>emul</td>
1.355 ! rillig 14468: <td>emul-distinfo</td>
1.277 rillig 14469: </tr>
14470: <tr>
1.352 wiz 14471: <td>emul-fetch</td>
1.355 ! rillig 14472: <td>emulation</td>
1.269 leot 14473: </tr>
14474: <tr>
1.352 wiz 14475: <td>emulator</td>
1.355 ! rillig 14476: <td>enable</td>
1.332 rillig 14477: </tr>
14478: <tr>
1.352 wiz 14479: <td>endian</td>
1.355 ! rillig 14480: <td>endif</td>
1.348 wiz 14481: </tr>
14482: <tr>
1.344 gutterid 14483: <td>enomem</td>
1.353 dholland 14484: <td>ensurepip</td>
1.269 leot 14485: </tr>
14486: <tr>
1.344 gutterid 14487: <td>err</td>
1.353 dholland 14488: <td>errx</td>
1.342 wiz 14489: </tr>
14490: <tr>
1.344 gutterid 14491: <td>etc</td>
1.353 dholland 14492: <td>exp</td>
1.329 leot 14493: </tr>
14494: <tr>
1.344 gutterid 14495: <td>extract-rpm</td>
1.353 dholland 14496: <td>fabs</td>
1.269 leot 14497: </tr>
14498: <tr>
1.344 gutterid 14499: <td>feature</td>
1.353 dholland 14500: <td>features</td>
1.320 wiz 14501: </tr>
14502: <tr>
1.344 gutterid 14503: <td>fetch</td>
1.353 dholland 14504: <td>fetch-list</td>
1.311 leot 14505: </tr>
14506: <tr>
1.344 gutterid 14507: <td>follows</td>
1.353 dholland 14508: <td>forbids</td>
1.269 leot 14509: </tr>
14510: <tr>
1.344 gutterid 14511: <td>form</td>
1.353 dholland 14512: <td>format</td>
1.269 leot 14513: </tr>
14514: <tr>
1.344 gutterid 14515: <td>fortify</td>
1.351 gutterid 14516: <td>fortify_source</td>
1.352 wiz 14517: </tr>
14518: <tr>
1.355 ! rillig 14519: <td>fossil</td>
1.344 gutterid 14520: <td>friend</td>
1.355 ! rillig 14521: </tr>
! 14522: <tr>
1.352 wiz 14523: <td>fts</td>
1.355 ! rillig 14524: <td>fts_close</td>
1.332 rillig 14525: </tr>
14526: <tr>
1.352 wiz 14527: <td>fts_open</td>
1.355 ! rillig 14528: <td>fts_read</td>
1.338 nia 14529: </tr>
14530: <tr>
1.352 wiz 14531: <td>fts_set</td>
1.355 ! rillig 14532: <td>gcc</td>
1.269 leot 14533: </tr>
14534: <tr>
1.352 wiz 14535: <td>gethostbyaddr</td>
1.355 ! rillig 14536: <td>gethostbyname</td>
1.269 leot 14537: </tr>
14538: <tr>
1.352 wiz 14539: <td>gethostbyname2</td>
1.355 ! rillig 14540: <td>getopt_long</td>
1.269 leot 14541: </tr>
14542: <tr>
1.352 wiz 14543: <td>getprogname</td>
1.355 ! rillig 14544: <td>getservbyname</td>
1.269 leot 14545: </tr>
14546: <tr>
1.352 wiz 14547: <td>getservbyport</td>
1.355 ! rillig 14548: <td>getservent</td>
1.289 leot 14549: </tr>
14550: <tr>
1.352 wiz 14551: <td>gettext</td>
1.355 ! rillig 14552: <td>git</td>
1.348 wiz 14553: </tr>
14554: <tr>
1.344 gutterid 14555: <td>github</td>
1.353 dholland 14556: <td>gitlab</td>
1.289 leot 14557: </tr>
14558: <tr>
1.344 gutterid 14559: <td>glob</td>
1.353 dholland 14560: <td>gnu</td>
1.342 wiz 14561: </tr>
14562: <tr>
1.344 gutterid 14563: <td>gnu_configure_strict</td>
1.353 dholland 14564: <td>go</td>
1.338 nia 14565: </tr>
14566: <tr>
1.344 gutterid 14567: <td>go-deps</td>
1.355 ! rillig 14568: <td>go-modules</td>
! 14569: </tr>
! 14570: <tr>
! 14571: <td>go-modules.mk</td>
1.353 dholland 14572: <td>golang</td>
1.332 rillig 14573: </tr>
14574: <tr>
1.344 gutterid 14575: <td>guess-license</td>
1.353 dholland 14576: <td>hashbang</td>
1.269 leot 14577: </tr>
14578: <tr>
1.344 gutterid 14579: <td>heimdal</td>
1.351 gutterid 14580: <td>help</td>
1.352 wiz 14581: </tr>
14582: <tr>
1.355 ! rillig 14583: <td>hg</td>
1.344 gutterid 14584: <td>imake</td>
1.355 ! rillig 14585: </tr>
! 14586: <tr>
1.352 wiz 14587: <td>increment</td>
1.355 ! rillig 14588: <td>indirect</td>
1.269 leot 14589: </tr>
14590: <tr>
1.352 wiz 14591: <td>inet_aton</td>
1.355 ! rillig 14592: <td>interp</td>
1.329 leot 14593: </tr>
14594: <tr>
1.352 wiz 14595: <td>interpreter</td>
1.355 ! rillig 14596: <td>intl</td>
1.269 leot 14597: </tr>
14598: <tr>
1.352 wiz 14599: <td>ip4</td>
1.355 ! rillig 14600: <td>ip6</td>
1.320 wiz 14601: </tr>
14602: <tr>
1.352 wiz 14603: <td>ipv4</td>
1.355 ! rillig 14604: <td>ipv6</td>
1.311 leot 14605: </tr>
14606: <tr>
1.352 wiz 14607: <td>iso</td>
1.355 ! rillig 14608: <td>kerberos</td>
1.269 leot 14609: </tr>
14610: <tr>
1.352 wiz 14611: <td>krb</td>
1.355 ! rillig 14612: <td>krb5</td>
1.269 leot 14613: </tr>
14614: <tr>
1.352 wiz 14615: <td>ksh</td>
1.355 ! rillig 14616: <td>lapack</td>
1.269 leot 14617: </tr>
14618: <tr>
1.352 wiz 14619: <td>latex</td>
1.355 ! rillig 14620: <td>libintl_bindtextdomain</td>
1.269 leot 14621: </tr>
14622: <tr>
1.352 wiz 14623: <td>libintl_gettext</td>
1.355 ! rillig 14624: <td>libintl_textdomain</td>
1.303 bacon 14625: </tr>
14626: <tr>
1.352 wiz 14627: <td>libnbcompat</td>
1.355 ! rillig 14628: <td>libs</td>
1.303 bacon 14629: </tr>
14630: <tr>
1.352 wiz 14631: <td>libtool</td>
1.355 ! rillig 14632: <td>licence</td>
1.269 leot 14633: </tr>
14634: <tr>
1.352 wiz 14635: <td>license</td>
1.355 ! rillig 14636: <td>lintl</td>
1.292 leot 14637: </tr>
14638: <tr>
1.352 wiz 14639: <td>little-endian</td>
1.355 ! rillig 14640: <td>lock</td>
1.269 leot 14641: </tr>
14642: <tr>
1.352 wiz 14643: <td>locking</td>
1.355 ! rillig 14644: <td>lua</td>
1.289 leot 14645: </tr>
14646: <tr>
1.352 wiz 14647: <td>lvalue</td>
1.355 ! rillig 14648: <td>make</td>
1.274 rillig 14649: </tr>
14650: <tr>
1.352 wiz 14651: <td>makesum</td>
1.355 ! rillig 14652: <td>memory</td>
1.271 brook 14653: </tr>
14654: <tr>
1.355 ! rillig 14655: <td>mercurial</td>
1.353 dholland 14656: <td>meta</td>
1.348 wiz 14657: </tr>
14658: <tr>
1.344 gutterid 14659: <td>meta-package</td>
1.353 dholland 14660: <td>meta_package</td>
1.342 wiz 14661: </tr>
14662: <tr>
1.344 gutterid 14663: <td>mit-krb5</td>
1.353 dholland 14664: <td>mk.conf</td>
1.269 leot 14665: </tr>
14666: <tr>
1.344 gutterid 14667: <td>mkl</td>
1.353 dholland 14668: <td>mount</td>
1.269 leot 14669: </tr>
14670: <tr>
1.344 gutterid 14671: <td>move</td>
1.353 dholland 14672: <td>moved</td>
1.292 leot 14673: </tr>
14674: <tr>
1.344 gutterid 14675: <td>mprotect</td>
1.353 dholland 14676: <td>mremap</td>
1.274 rillig 14677: </tr>
14678: <tr>
1.344 gutterid 14679: <td>nb</td>
1.353 dholland 14680: <td>nbcompat</td>
1.341 gutterid 14681: </tr>
14682: <tr>
1.344 gutterid 14683: <td>netlib</td>
1.353 dholland 14684: <td>node</td>
1.269 leot 14685: </tr>
14686: <tr>
1.344 gutterid 14687: <td>node.js</td>
1.353 dholland 14688: <td>nodejs</td>
1.269 leot 14689: </tr>
14690: <tr>
1.344 gutterid 14691: <td>obstack</td>
1.353 dholland 14692: <td>obstack_ptr_grow</td>
1.333 nia 14693: </tr>
14694: <tr>
1.344 gutterid 14695: <td>occurs</td>
1.353 dholland 14696: <td>only</td>
1.333 nia 14697: </tr>
14698: <tr>
1.344 gutterid 14699: <td>openblas</td>
1.353 dholland 14700: <td>options</td>
1.320 wiz 14701: </tr>
14702: <tr>
1.344 gutterid 14703: <td>options.mk</td>
1.353 dholland 14704: <td>order</td>
1.269 leot 14705: </tr>
14706: <tr>
1.344 gutterid 14707: <td>override</td>
1.353 dholland 14708: <td>override-intltool</td>
1.269 leot 14709: </tr>
14710: <tr>
1.344 gutterid 14711: <td>override-message-intltool</td>
1.353 dholland 14712: <td>package</td>
1.269 leot 14713: </tr>
14714: <tr>
1.344 gutterid 14715: <td>parallel</td>
1.353 dholland 14716: <td>path</td>
1.271 brook 14717: </tr>
14718: <tr>
1.344 gutterid 14719: <td>pax</td>
1.353 dholland 14720: <td>paxctl</td>
1.269 leot 14721: </tr>
14722: <tr>
1.344 gutterid 14723: <td>pbulk-index</td>
1.353 dholland 14724: <td>pc</td>
1.269 leot 14725: </tr>
14726: <tr>
1.344 gutterid 14727: <td>perl</td>
1.353 dholland 14728: <td>perl5</td>
1.269 leot 14729: </tr>
14730: <tr>
1.344 gutterid 14731: <td>perms</td>
1.353 dholland 14732: <td>php</td>
1.269 leot 14733: </tr>
14734: <tr>
1.344 gutterid 14735: <td>pkg-build-options</td>
1.353 dholland 14736: <td>pkg-config</td>
1.269 leot 14737: </tr>
14738: <tr>
1.344 gutterid 14739: <td>pkg_build_options</td>
1.353 dholland 14740: <td>platform</td>
1.269 leot 14741: </tr>
14742: <tr>
1.344 gutterid 14743: <td>plist</td>
1.353 dholland 14744: <td>post-extract</td>
1.269 leot 14745: </tr>
14746: <tr>
1.344 gutterid 14747: <td>post-fetch</td>
1.353 dholland 14748: <td>post-wrapper</td>
1.269 leot 14749: </tr>
14750: <tr>
1.344 gutterid 14751: <td>pre-build-checks-hook</td>
1.353 dholland 14752: <td>pre-configure-checks-hook</td>
1.269 leot 14753: </tr>
14754: <tr>
1.348 wiz 14755: <td>pre-extract</td>
1.353 dholland 14756: <td>pre-fetch</td>
1.269 leot 14757: </tr>
14758: <tr>
1.348 wiz 14759: <td>print-go-deps</td>
1.353 dholland 14760: <td>print-plist</td>
1.269 leot 14761: </tr>
14762: <tr>
1.348 wiz 14763: <td>print-summary-data</td>
1.353 dholland 14764: <td>privileged-install-hook</td>
1.289 leot 14765: </tr>
14766: <tr>
1.348 wiz 14767: <td>pypi</td>
1.353 dholland 14768: <td>python</td>
1.269 leot 14769: </tr>
14770: <tr>
1.348 wiz 14771: <td>r</td>
1.353 dholland 14772: <td>readme-all</td>
1.269 leot 14773: </tr>
14774: <tr>
1.348 wiz 14775: <td>recursive</td>
1.353 dholland 14776: <td>recv</td>
1.269 leot 14777: </tr>
14778: <tr>
1.348 wiz 14779: <td>recvfrom</td>
1.353 dholland 14780: <td>regcomp</td>
1.269 leot 14781: </tr>
14782: <tr>
1.348 wiz 14783: <td>release-localbase-lock</td>
1.353 dholland 14784: <td>release-lock</td>
1.269 leot 14785: </tr>
14786: <tr>
1.348 wiz 14787: <td>relro</td>
1.353 dholland 14788: <td>remove</td>
1.289 leot 14789: </tr>
14790: <tr>
1.348 wiz 14791: <td>removed</td>
1.353 dholland 14792: <td>rename</td>
1.289 leot 14793: </tr>
14794: <tr>
1.348 wiz 14795: <td>renamed</td>
1.353 dholland 14796: <td>reorder</td>
1.269 leot 14797: </tr>
14798: <tr>
1.348 wiz 14799: <td>replace</td>
1.353 dholland 14800: <td>replace_interpreter</td>
1.341 gutterid 14801: </tr>
14802: <tr>
1.348 wiz 14803: <td>reproducible</td>
1.353 dholland 14804: <td>resolv</td>
1.341 gutterid 14805: </tr>
14806: <tr>
1.348 wiz 14807: <td>root</td>
1.353 dholland 14808: <td>ruby</td>
1.269 leot 14809: </tr>
14810: <tr>
1.348 wiz 14811: <td>send</td>
1.353 dholland 14812: <td>sendfile</td>
1.269 leot 14813: </tr>
14814: <tr>
1.348 wiz 14815: <td>sendto</td>
1.353 dholland 14816: <td>setenv</td>
1.269 leot 14817: </tr>
14818: <tr>
1.348 wiz 14819: <td>setgid</td>
1.353 dholland 14820: <td>setprogname</td>
1.289 leot 14821: </tr>
14822: <tr>
1.348 wiz 14823: <td>setuid</td>
1.353 dholland 14824: <td>sh</td>
1.269 leot 14825: </tr>
14826: <tr>
1.348 wiz 14827: <td>shebang</td>
1.353 dholland 14828: <td>show</td>
1.269 leot 14829: </tr>
14830: <tr>
1.348 wiz 14831: <td>show-all</td>
1.353 dholland 14832: <td>show-build-defs</td>
1.269 leot 14833: </tr>
14834: <tr>
1.348 wiz 14835: <td>show-depends</td>
1.353 dholland 14836: <td>show-depends-dirs</td>
1.269 leot 14837: </tr>
14838: <tr>
1.348 wiz 14839: <td>show-depends-pkgpaths</td>
1.353 dholland 14840: <td>show-depends-recursive</td>
1.296 rillig 14841: </tr>
14842: <tr>
1.348 wiz 14843: <td>show-deps</td>
1.353 dholland 14844: <td>show-distfiles</td>
1.269 leot 14845: </tr>
14846: <tr>
1.348 wiz 14847: <td>show-downlevel</td>
1.353 dholland 14848: <td>show-subdir-var</td>
1.337 gutterid 14849: </tr>
14850: <tr>
1.348 wiz 14851: <td>show-tools</td>
1.353 dholland 14852: <td>show-var</td>
1.338 nia 14853: </tr>
14854: <tr>
1.348 wiz 14855: <td>show-vars</td>
1.353 dholland 14856: <td>snprintf</td>
1.269 leot 14857: </tr>
14858: <tr>
1.348 wiz 14859: <td>socket</td>
1.353 dholland 14860: <td>ssp</td>
1.269 leot 14861: </tr>
14862: <tr>
1.348 wiz 14863: <td>st_mode</td>
1.353 dholland 14864: <td>stage-install</td>
1.269 leot 14865: </tr>
14866: <tr>
1.348 wiz 14867: <td>strcasestr</td>
1.353 dholland 14868: <td>strict</td>
1.269 leot 14869: </tr>
14870: <tr>
1.348 wiz 14871: <td>strip</td>
1.353 dholland 14872: <td>strndup</td>
1.289 leot 14873: </tr>
14874: <tr>
1.348 wiz 14875: <td>strnlen</td>
1.353 dholland 14876: <td>strsep</td>
1.269 leot 14877: </tr>
14878: <tr>
1.348 wiz 14879: <td>subst</td>
1.351 gutterid 14880: <td>substitutions</td>
1.352 wiz 14881: </tr>
14882: <tr>
1.355 ! rillig 14883: <td>subversion</td>
1.341 gutterid 14884: <td>sun</td>
1.355 ! rillig 14885: </tr>
! 14886: <tr>
1.352 wiz 14887: <td>sunpro</td>
1.355 ! rillig 14888: <td>sunwspro</td>
1.329 leot 14889: </tr>
14890: <tr>
1.355 ! rillig 14891: <td>svn</td>
1.353 dholland 14892: <td>symlink</td>
1.327 wiz 14893: </tr>
14894: <tr>
1.343 gutterid 14895: <td>test</td>
1.353 dholland 14896: <td>test-env</td>
1.342 wiz 14897: </tr>
14898: <tr>
1.343 gutterid 14899: <td>tex</td>
1.353 dholland 14900: <td>texlive</td>
1.338 nia 14901: </tr>
14902: <tr>
1.343 gutterid 14903: <td>tmp</td>
1.353 dholland 14904: <td>todo</td>
1.269 leot 14905: </tr>
14906: <tr>
1.343 gutterid 14907: <td>tool</td>
1.353 dholland 14908: <td>tools</td>
1.269 leot 14909: </tr>
14910: <tr>
1.343 gutterid 14911: <td>tools-libtool-m4-override</td>
1.353 dholland 14912: <td>transitive</td>
1.269 leot 14913: </tr>
14914: <tr>
1.343 gutterid 14915: <td>type</td>
1.353 dholland 14916: <td>ulimit</td>
1.269 leot 14917: </tr>
14918: <tr>
1.343 gutterid 14919: <td>undefined</td>
1.353 dholland 14920: <td>undo-replace</td>
1.269 leot 14921: </tr>
14922: <tr>
1.343 gutterid 14923: <td>unlimit</td>
1.353 dholland 14924: <td>unprivileged</td>
1.269 leot 14925: </tr>
14926: <tr>
1.343 gutterid 14927: <td>unprivileged-install-hook</td>
1.353 dholland 14928: <td>unstripped</td>
1.269 leot 14929: </tr>
14930: <tr>
1.343 gutterid 14931: <td>update</td>
1.353 dholland 14932: <td>updated</td>
1.269 leot 14933: </tr>
14934: <tr>
1.343 gutterid 14935: <td>upload</td>
1.353 dholland 14936: <td>upload-distfiles</td>
1.269 leot 14937: </tr>
14938: <tr>
1.343 gutterid 14939: <td>use_tools</td>
1.353 dholland 14940: <td>user</td>
1.269 leot 14941: </tr>
14942: <tr>
1.343 gutterid 14943: <td>utimes</td>
1.353 dholland 14944: <td>vasprintf</td>
1.269 leot 14945: </tr>
14946: <tr>
1.343 gutterid 14947: <td>verbose</td>
1.353 dholland 14948: <td>vsnprintf</td>
1.269 leot 14949: </tr>
14950: <tr>
1.343 gutterid 14951: <td>warn</td>
1.353 dholland 14952: <td>warning</td>
1.269 leot 14953: </tr>
14954: <tr>
1.343 gutterid 14955: <td>warnings</td>
1.353 dholland 14956: <td>warnx</td>
1.269 leot 14957: </tr>
14958: <tr>
1.343 gutterid 14959: <td>wattr_off</td>
1.353 dholland 14960: <td>wattr_on</td>
1.269 leot 14961: </tr>
14962: <tr>
1.343 gutterid 14963: <td>work</td>
1.353 dholland 14964: <td>wrapper</td>
1.269 leot 14965: </tr>
14966: <tr>
1.289 leot 14967: <td>wrkdir</td>
1.353 dholland 14968: <td> </td>
1.269 leot 14969: </tr>
14970: </table>
1.267 rillig 14971: </div>
14972: <div class="appendix">
14973: <div class="titlepage"><div><div><h1 class="title">
1.322 leot 14974: <a name="editing"></a>Appendix F. Editing guidelines for the pkgsrc guide</h1></div></div></div>
1.75 rillig 14975: <div class="toc">
14976: <p><b>Table of Contents</b></p>
1.210 leot 14977: <dl class="toc">
1.322 leot 14978: <dt><span class="sect1"><a href="#targets">F.1. Make targets</a></span></dt>
14979: <dt><span class="sect1"><a href="#procedure">F.2. Procedure</a></span></dt>
1.75 rillig 14980: </dl>
14981: </div>
1.79 rillig 14982: <p>This section contains information on editing the pkgsrc
14983: guide itself.</p>
1.148 asau 14984: <div class="sect1">
1.75 rillig 14985: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322 leot 14986: <a name="targets"></a>F.1. Make targets</h2></div></div></div>
1.79 rillig 14987: <p>The pkgsrc guide's source code is stored in
14988: <code class="filename">pkgsrc/doc/guide/files</code>, and several files
14989: are created from it:</p>
1.148 asau 14990: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.128 wiz 14991: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.txt</code></p></li>
14992: <li class="listitem"><p><code class="filename">pkgsrc/doc/pkgsrc.html</code></p></li>
1.289 leot 14993: <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>
14994: <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 14995: The PDF version of the pkgsrc guide.</p></li>
1.289 leot 14996: <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 14997: PostScript version of the pkgsrc guide.</p></li>
1.75 rillig 14998: </ul></div>
14999: </div>
1.148 asau 15000: <div class="sect1">
1.75 rillig 15001: <div class="titlepage"><div><div><h2 class="title" style="clear: both">
1.322 leot 15002: <a name="procedure"></a>F.2. Procedure</h2></div></div></div>
1.79 rillig 15003: <p>The procedure to edit the pkgsrc guide is:</p>
1.128 wiz 15004: <div class="procedure"><ol class="procedure" type="1">
1.304 bacon 15005: <li class="step"><p>Make sure you have checked out the htdocs repository
15006: into a sibling directory of your pkgsrc directory. You will need
15007: the ability to commit from both pkgsrc and htdocs.</p></li>
1.148 asau 15008: <li class="step"><p>Make sure you have the packages needed to
1.83 wiz 15009: regenerate the pkgsrc guide (and other XML-based NetBSD
1.151 obache 15010: documentation) installed. These are automatically installed when
1.322 leot 15011: 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 15012: <li class="step"><p>Run <span class="command"><strong>cd doc/guide</strong></span> to get to the
1.79 rillig 15013: right directory. All further steps will take place
15014: here.</p></li>
1.148 asau 15015: <li class="step"><p>Edit the XML file(s) in
1.79 rillig 15016: <code class="filename">files/</code>.</p></li>
1.148 asau 15017: <li class="step"><p>Run <span class="command"><strong>bmake</strong></span> to check the pkgsrc
1.79 rillig 15018: guide for valid XML and to build the final output files. If you
15019: get any errors at this stage, you can just edit the files, as
15020: there are only symbolic links in the working directory, pointing
15021: to the files in <code class="filename">files/</code>.</p></li>
1.148 asau 15022: <li class="step"><p><span class="command"><strong>(cd files && cvs
1.79 rillig 15023: commit)</strong></span></p></li>
1.148 asau 15024: <li class="step"><p>Run <span class="command"><strong>bmake clean && bmake</strong></span> to
1.79 rillig 15025: regenerate the output files with the proper RCS
15026: Ids.</p></li>
1.148 asau 15027: <li class="step">
1.110 hubertf 15028: <p>Run <span class="command"><strong>bmake regen</strong></span> to install and
1.91 rillig 15029: commit the files in both <code class="filename">pkgsrc/doc</code> and
15030: <code class="filename">htdocs</code>.</p>
1.148 asau 15031: <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
1.91 rillig 15032: <h3 class="title">Note</h3>
15033: <p>If you have added, removed or renamed some chapters,
1.110 hubertf 15034: you need to synchronize them using <span class="command"><strong>cvs add</strong></span> or
15035: <span class="command"><strong>cvs delete</strong></span> in the htdocs
1.91 rillig 15036: directory.</p>
15037: </div>
15038: </li>
1.79 rillig 15039: </ol></div>
1.75 rillig 15040: </div>
15041: </div>
15042: </div></body>
1.1 grant 15043: </html>
CVSweb <webmaster@jp.NetBSD.org>